-
Notifications
You must be signed in to change notification settings - Fork 4
/
freg.inc
186 lines (175 loc) · 4.08 KB
/
freg.inc
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
var regkey:HKEY;
procedure OpenReg();
begin
RegCreateKeyEx(HKEY_CURRENT_USER,
PChar('SoftWare\ax_midi_player'),
0,nil,0,KEY_ALL_ACCESS,nil,regkey,nil);
end;
procedure CloseReg();
begin
RegCloseKey(regkey);
end;
procedure GetKeySW(kname:ansistring;var s:unicodestring);
var regtype:longword=REG_SZ;
var ca:array[0..$100*2-1]of byte;
var size:longword=$100*2;
begin
if RegQueryValueExW(regkey,PWChar(unicodestring(kname)),nil,@regtype,@ca,@size)=ERROR_SUCCESS then
s:=copy(UnicodeString(pwchar(@ca)),0,length(unicodestring(pwchar(@ca))));
end;
procedure GetKeyS(kname:ansistring;var s:ansistring);
var regtype:longword=REG_SZ;
var ca:array[0..$100-1]of byte;
var size:longword=$100;
begin
if RegQueryValueEx(regkey,PChar(kname),nil,@regtype,@ca,@size)=ERROR_SUCCESS then
s:=PChar(@ca);
end;
procedure GetKeyI(kname:ansistring;var i:longword);
var regtype:longword=REG_DWORD;
var ca:array[0..3] of byte;
var size:longword=4;
begin
if RegQueryValueEx(regkey,PChar(kname),nil,@regtype,@ca,@size)=ERROR_SUCCESS then
i:=ca[3] shl 24 or ca[2] shl 16 or ca[1] shl 8 or ca[0]
end;
procedure SetKeySW(kname:ansistring;s:unicodestring);
begin
RegSetValueExW(regkey,PWChar(UnicodeString(kname)),0,REG_SZ,PWChar(s),length(s)*2);
end;
procedure SetKeyS(kname:ansistring;s:ansistring);
begin
RegSetValueEx(regkey,PChar(kname),0,REG_SZ,PChar(s),length(PChar(s)));
end;
procedure SetKeyI(kname:ansistring;i:longword);
begin
RegSetValueEx(regkey,PChar(kname),0,REG_DWORD,@i,sizeof(DWORD));
end;
var midipos:longword;
var voli:longword;
var spd1:longword;
var kchord0:longword;
var kkey0:longword;
var fnames:unicodestring;
var midiouti:longword;
var msgbufb0:longword;
var msgbufb1:longword;
var autofresh:longword;
var mult:longword;
var kbdcb:longword;
var kchb:longword;
var kchb2:longword;
var kmessure:longword;
var loop:longword;
var fbi:longword;
var tempdir:ansistring;
var msgbufn0:longword;
var msgvol0:longword;
var maxkbdc:longword;
var framerate:longword;
var helpb:longword;
var chancolor:ansistring;
{$ifdef video}
var vname:ansistring;
var vrate:longword;
var vquality:longword;
{$endif}
procedure ResetReg();
begin
midipos:=0;
voli:=14;
spd1:=100;
kchord0:=0;
kkey0:=128;
fnames:='midiplayer by ax_pokl';
midiouti:=0;
msgbufb0:=1;
msgbufb1:=1;
autofresh:=1;
mult:=100;
kbdcb:=0;
kchb:=0;
kchb2:=0;
kmessure:=0;
loop:=1;
fbi:=0;
msgbufn0:=128;
msgvol0:=3;
maxkbdc:=$40;
framerate:=120;
helpb:=0;
chancolor:='85,170,255,42,127,212,21,63,106,148,191,233,10,31,52,74,95,116,137,159,180,201,222,244';
{$ifdef video}
vname:='midiplayer.mp4';
vrate:=30;
vquality:=16;
{$endif}
end;
procedure SaveReg();
begin
OpenReg();
SetKeyI('midipos',midipos);
SetKeyI('voli',voli);
SetKeyI('spd1',spd1);
SetKeyI('kchord0',kchord0);
SetKeyI('kkey0',kkey0);
SetKeySW('fnames',fnames);
SetKeyI('midiouti',midiouti);
SetKeyI('msgbufb0',msgbufb0);
SetKeyI('msgbufb1',msgbufb1);
SetKeyI('autofresh',autofresh);
SetKeyI('mult',mult);
SetKeyI('kbdcb',kbdcb);
SetKeyI('kchb',kchb);
SetKeyI('kchb2',kchb2);
SetKeyI('kmessure',kmessure);
SetKeyI('loop',loop);
SetKeyI('fbi',fbi);
SetKeyS('tempdir',tempdir);
SetKeyI('msgbufn0',msgbufn0);
SetKeyI('msgvol0',msgvol0);
SetKeyI('maxkbdc',maxkbdc);
SetKeyI('framerate',framerate);
SetKeyI('helpb',helpb);
SetKeyS('chancolor',chancolor);
{$ifdef video}
SetKeyS('vname',vname);
SetKeyI('vrate',vrate);
SetKeyI('vquality',vquality);
{$endif}
CloseReg();
end;
procedure LoadReg();
begin
OpenReg();
GetKeyI('midipos',midipos);
GetKeyI('voli',voli);
GetKeyI('spd1',spd1);
GetKeyI('kchord0',kchord0);
GetKeyI('kkey0',kkey0);
GetKeySW('fnames',fnames);
GetKeyI('midiouti',midiouti);
GetKeyI('msgbufb0',msgbufb0);
GetKeyI('msgbufb1',msgbufb1);
GetKeyI('autofresh',autofresh);
GetKeyI('kbdcb',kbdcb);
GetKeyI('kchb',kchb);
GetKeyI('kchb2',kchb2);
GetKeyI('mult',mult);
GetKeyI('kmessure',kmessure);
GetKeyI('loop',loop);
GetKeyI('fbi',fbi);
GetKeyS('tempdir',tempdir);
GetKeyI('msgbufn0',msgbufn0);
GetKeyI('msgvol0',msgvol0);
GetKeyI('maxkbdc',maxkbdc);
GetKeyI('framerate',framerate);
GetKeyI('helpb',helpb);
GetKeyS('chancolor',chancolor);
{$ifdef video}
GetKeyS('vname',vname);
GetKeyI('vrate',vrate);
GetKeyI('vquality',vquality);
{$endif}
CloseReg();
end;