-
Notifications
You must be signed in to change notification settings - Fork 2
/
MDX_Hash_Test.lpr
164 lines (142 loc) · 4.09 KB
/
MDX_Hash_Test.lpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{
*****************************************************************************
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
Author: Boban Spasic
Program description:
This program can get some info from Yamaha DX7 SysEx files. The info is more about the integrity/corruption of the files.
Second aspect of the program is to repair some of the common corrupted files found on the internet.
Third aspect (not yet implemented) will be the conversion from VMEM to VCED and vice-versa.
ToDo:
- conversion VMEM <> VCED
- duplicate finder along a collection of files
}
program MDX_Hash_Test;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes,
SysUtils,
CustApp,
untUtils,
untDXUtils,
untDXObjInterface;
type
{ TMDX_Hash_Test }
TMDX_Hash_Test = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TMDX_Hash_Test }
procedure TMDX_Hash_Test.DoRun;
var
ErrorMsg: string;
fVCED: string;
fVMEM: string;
fNr: string;
iNr: integer;
begin
// quick check parameters
ErrorMsg := CheckOptions('hc:m:n:', 'help vced: vmem: nr:');
if ErrorMsg <> '' then
begin
WriteHelp;
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
if (ParamCount = 0) or HasOption('h', 'help') then
begin
WriteHelp;
Terminate;
Exit;
end;
fVCED := '';
fVMEM := '';
fNr := '';
if HasOption('c', 'vced') then
begin
fVCED := GetOptionValue('c', 'vced');
WriteLn ('Call -c with the value *' + fVCED +'*');
end;
if HasOption('m', 'vmem') then
begin
fVMEM := GetOptionValue('m', 'vmem');
WriteLn ('Call -m with the value *' + fVMEM +'*');
end;
if HasOption('n', 'nr') then
begin
fNr := GetOptionValue('n', 'nr');
WriteLn ('Call -n with the value *' + fNr +'*');
end;
if (HasOption('c', 'vced')) and (fVCED <> '') then
begin
if FileExists(fVCED) then
Test_VCEDHash(fVCED)
else
WriteLn('File ' + fVCED + ' could not be found');
end;
if (HasOption('m', 'vmem')) and (fVMEM <> '') and (fNr <> '') then
begin
iNr := StrToIntDef(fNr, -1);
if iNr <> -1 then
begin
if (iNr > 0) and (iNr < 33) then
begin
if FileExists(fVMEM) then
Test_VMEMHash(fVMEM, iNr)
else
WriteLn('File ' + fVMEM + ' could not be found');
end
else
WriteLn('-n parameter is outside the 1 - 32 range');
end
else
WriteLn('-n parameter is missing');
end;
Terminate;
end;
constructor TMDX_Hash_Test.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
destructor TMDX_Hash_Test.Destroy;
begin
inherited Destroy;
end;
procedure TMDX_Hash_Test.WriteHelp;
begin
writeln('');
writeln('');
writeln('MDX_Hash_Test - test program for the generated hash summs');
writeln('Author: Boban Spasic');
writeln('https://github.com/BobanSpasic/MDX_Tool');
writeln('');
writeln('Usage: ', ExtractFileName(ExeName), ' -parameters');
writeln(' Parameters (short and long form):');
writeln(' -h --help This help message');
writeln(' -c --vced The single voice for test');
writeln(' -m --vmem The bank for test');
writeln(' -n --nr The voice number inside the bank');
writeLn('');
writeln(' Example usage:');
writeln(' MDX_Hash_Test -i -f my_dx_file.syx');
writeLn('');
writeLn('');
end;
var
Application: TMDX_Hash_Test;
begin
Application := TMDX_Hash_Test.Create(nil);
Application.Title := 'MDX_Hash_Test';
Application.Run;
Application.Free;
end.