Debian Codegraph @

src/pt2_config.c

raw symbols SCIP
1 // for finding memory leaks in debug mode with Visual Studio cxx . . $ `<file>/src/pt2_config.c`/
2 #if defined _DEBUG && defined _MSC_VER
3 #include <crtdbg.h>
4 #endif
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <stdint.h>
9 #include <stdbool.h>
10 #include <string.h>
11 #include <ctype.h>
12 #ifndef _WIN32
13 #include <unistd.h>
14 #include <limits.h>
15 #endif
16 #include "pt2_helpers.h"cxx . . $ `<file>/src/pt2_helpers.h`/
17 #include "pt2_config.h"cxx . . $ `<file>/src/pt2_config.h`/
18 #include "pt2_tables.h"cxx . . $ `<file>/src/pt2_tables.h`/
19 #include "pt2_sampler.h"cxx . . $ `<file>/src/pt2_sampler.h`/
20 #include "pt2_diskop.h"cxx . . $ `<file>/src/pt2_diskop.h`/ // changePathToDesktop(), changePathToHome()
21 #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/ // MAX_UPSCALE_FACTOR
22
23 #ifndef _WIN32
24 static char oldCwdcxx . . $ oldCwd.[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
25 #endif
26
27 config_tcxx . . $ config_t# configcxx . . $ config.; // globalized
28
29 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadProTrackerDotInicxx . . $ loadProTrackerDotIni(dc9e5a301483124c).(FILEcxx . . $ FILE# *f);
30 static FILEcxx . . $ FILE# *openPTDotConfigcxx . . $ openPTDotConfig(3637adb0f06093ef).(void);
31 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadPTDotConfigcxx . . $ loadPTDotConfig(dc9e5a301483124c).(FILEcxx . . $ FILE# *f);
32 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadColorsDotInicxx . . $ loadColorsDotIni(c9857a73d68e59ba).(void);
33
34 void loadConfigcxx . . $ loadConfig(49f6e7a06ebc5aa8).(void)
35 {
36 #ifndef _WIN32
37 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! colorsDotIniFound;
38 #endif
39 FILEcxx . . $ FILE# *f;
40
41 // set default config values first
42 configcxx . . $ config..noDownsampleOnSmpLoadcxx . . $ config_t#noDownsampleOnSmpLoad. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
43 configcxx . . $ config..enableE8xEffectcxx . . $ config_t#enableE8xEffect. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
44 configcxx . . $ config..fullScreenStretchcxx . . $ config_t#fullScreenStretch. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
45 configcxx . . $ config..pattDotscxx . . $ config_t#pattDots. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
46 configcxx . . $ config..waveformCenterLinecxx . . $ config_t#waveformCenterLine. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
47 configcxx . . $ config..amigaModelcxx . . $ config_t#amigaModel. = MODEL_A1200cxx . . $ MODEL_A1200.;
48 configcxx . . $ config..soundFrequencycxx . . $ config_t#soundFrequency. = 48000;
49 configcxx . . $ config..rememberPlayModecxx . . $ config_t#rememberPlayMode. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
50 configcxx . . $ config..stereoSeparationcxx . . $ config_t#stereoSeparation. = 20;
51 configcxx . . $ config..autoFitVideoScalecxx . . $ config_t#autoFitVideoScale. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
52 configcxx . . $ config..videoScaleFactorcxx . . $ config_t#videoScaleFactor. = 0; // will be set later if autoFitVideoScale is set
53 configcxx . . $ config..realVuMeterscxx . . $ config_t#realVuMeters. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
54 configcxx . . $ config..modDotcxx . . $ config_t#modDot. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
55 configcxx . . $ config..accidentalcxx . . $ config_t#accidental. = 0; // sharp
56 configcxx . . $ config..quantizeValuecxx . . $ config_t#quantizeValue. = 1;
57 configcxx . . $ config..transDelcxx . . $ config_t#transDel. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
58 configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
59 configcxx . . $ config..compoModecxx . . $ config_t#compoMode. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
60 configcxx . . $ config..soundBufferSizecxx . . $ config_t#soundBufferSize. = 1024;
61 configcxx . . $ config..autoCloseDiskOpcxx . . $ config_t#autoCloseDiskOp. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
62 configcxx . . $ config..vsyncOffcxx . . $ config_t#vsyncOff. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
63 configcxx . . $ config..hwMousecxx . . $ config_t#hwMouse. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
64 configcxx . . $ config..startInFullscreencxx . . $ config_t#startInFullscreen. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
65 configcxx . . $ config..pixelFiltercxx . . $ config_t#pixelFilter. = PIXELFILTER_NEARESTcxx . . $ PIXELFILTER_NEAREST.;
66 configcxx . . $ config..integerScalingcxx . . $ config_t#integerScaling. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
67 configcxx . . $ config..audioInputFrequencycxx . . $ config_t#audioInputFrequency. = 44100;
68 configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq. = 44100;
69 configcxx . . $ config..keepEditModeAfterStepPlaycxx . . $ config_t#keepEditModeAfterStepPlay. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
70 configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. = 65534;
71 configcxx . . $ config..restrictedPattEditClickcxx . . $ config_t#restrictedPattEditClick. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
72
73 #ifndef _WIN32
74 getcwdcxx . . $ getcwd(dff97f9eb74e1544).(oldCwdcxx . . $ oldCwd., PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!);
75 #endif
76
77 // load protracker.ini
78 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! proTrackerDotIniFound = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
79
80 #ifdef _WIN32
81 f = fopen("protracker.ini", "r");
82 if (f != NULL)
83 proTrackerDotIniFound = true;
84 #else
85 // check in program executable directory (first priority)
86 f = fopencxx . . $ fopen(82ec0787cd37e0a3).("protracker.ini", "r");
87 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
88 proTrackerDotIniFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
89
90 // check in ~/.config/protracker/
91 if (!proTrackerDotIniFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".config/protracker") == 0)
92 {
93 f = fopencxx . . $ fopen(82ec0787cd37e0a3).("protracker.ini", "r");
94 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
95 proTrackerDotIniFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
96 }
97
98 // check in ~/.protracker/
99 if (!proTrackerDotIniFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".protracker") == 0)
100 {
101 f = fopencxx . . $ fopen(82ec0787cd37e0a3).("protracker.ini", "r");
102 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
103 proTrackerDotIniFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
104 }
105
106 chdircxx . . $ chdir(5c4306d8553b3696).(oldCwdcxx . . $ oldCwd.);
107 #endif
108
109 if (proTrackerDotIniFound)
110 loadProTrackerDotInicxx . . $ loadProTrackerDotIni(dc9e5a301483124c).(f);
111
112 editorcxx . . $ editor..oldTempocxx . . $ editor_t#oldTempo. = editorcxx . . $ editor..initialTempocxx . . $ editor_t#initialTempo.;
113
114 // load PT.Config (if available)
115 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ptDotConfigFound = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
116
117 #ifdef _WIN32
118 f = openPTDotConfig();
119 if (f != NULL)
120 ptDotConfigFound = true;
121 #else
122 // check in program executable directory (first priority)
123 f = openPTDotConfigcxx . . $ openPTDotConfig(3637adb0f06093ef).();
124 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
125 ptDotConfigFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
126
127 // check in ~/.config/protracker/
128 if (!ptDotConfigFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".config/protracker") == 0)
129 {
130 f = openPTDotConfigcxx . . $ openPTDotConfig(3637adb0f06093ef).();
131 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
132 ptDotConfigFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
133 }
134
135 // check in ~/.protracker/
136 if (!ptDotConfigFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".protracker") == 0)
137 {
138 f = openPTDotConfigcxx . . $ openPTDotConfig(3637adb0f06093ef).();
139 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
140 ptDotConfigFound = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
141 }
142
143 chdircxx . . $ chdir(5c4306d8553b3696).(oldCwdcxx . . $ oldCwd.);
144 #endif
145
146 if (ptDotConfigFound)
147 loadPTDotConfigcxx . . $ loadPTDotConfig(dc9e5a301483124c).(f);
148
149 if (proTrackerDotIniFound || ptDotConfigFound)
150 editorcxx . . $ editor..configFoundcxx . . $ editor_t#configFound. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
151
152 // load colors.ini (if available)
153 #ifdef _WIN32
154 loadColorsDotIni();
155 #else
156 // check in program executable directory (first priority)
157 colorsDotIniFound = loadColorsDotInicxx . . $ loadColorsDotIni(c9857a73d68e59ba).();
158
159 // check in ~/.config/protracker/
160 if (!colorsDotIniFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".config/protracker") == 0)
161 colorsDotIniFound = loadColorsDotInicxx . . $ loadColorsDotIni(c9857a73d68e59ba).();
162
163 // check in ~/.protracker/
164 if (!colorsDotIniFound && changePathToHomecxx . . $ changePathToHome(c9857a73d68e59ba).() && chdircxx . . $ chdir(5c4306d8553b3696).(".protracker") == 0)
165 loadColorsDotInicxx . . $ loadColorsDotIni(c9857a73d68e59ba).();
166
167 chdircxx . . $ chdir(5c4306d8553b3696).(oldCwdcxx . . $ oldCwd.);
168 #endif
169
170 // make 'sample data mark' palette-invert table now
171 createSampleMarkTablecxx . . $ createSampleMarkTable(49f6e7a06ebc5aa8).();
172 }
173
174 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadProTrackerDotInicxx . . $ loadProTrackerDotIni(dc9e5a301483124c).(FILEcxx . . $ FILE# *f)
175 {
176 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!);
177 uint32_tcxx . . $ uint32_t# configFileSize = ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f);
178 rewindcxx . . $ rewind(8d4262d45fc644ab).(f);
179
180 char *configBuffer = (char *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(configFileSize + 1);
181 if (configBuffer == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
182 {
183 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
184 showErrorMsgBoxcxx . . $ showErrorMsgBox(326aeb464d16410c).("Couldn't parse protracker.ini: Out of memory!");
185 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
186 }
187
188 freadcxx . . $ fread(738fc8ac1d711e58).(configBuffer, 1, configFileSize, f);
189 configBuffer[configFileSize] = '\0';
190 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
191
192 char *configLine = strtokcxx . . $ strtok(b7b3a83273496486).(configBuffer, "\n");
193 while (configLine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
194 {
195 uint32_tcxx . . $ uint32_t# lineLen = (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(configLine);
196
197 // remove CR in CRLF linefeed (if present)
198 if (lineLen > 1)
199 {
200 if (configLine[lineLen-1] == '\r')
201 {
202 configLine[lineLen-1] = '\0';
203 lineLen--;
204 }
205 }
206
207 // COMMENT OR CATEGORY
208 if (*configLine == ';' || *configLine == '[')
209 {
210 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
211 continue;
212 }
213
214 // RESTRICTED_PATT_EDIT_CLICK
215 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "RESTRICTED_PATT_EDIT_CLICK=", 27))
216 {
217 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[27], "TRUE", 4))
218 configcxx . . $ config..restrictedPattEditClickcxx . . $ config_t#restrictedPattEditClick. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
219 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[27], "FALSE", 5))
220 configcxx . . $ config..restrictedPattEditClickcxx . . $ config_t#restrictedPattEditClick. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
221 }
222
223 // STEPPLAY_KEEP_EDITMODE
224 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "STEPPLAY_KEEP_EDITMODE=", 23))
225 {
226 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[23], "TRUE", 4))
227 configcxx . . $ config..keepEditModeAfterStepPlaycxx . . $ config_t#keepEditModeAfterStepPlay. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
228 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[23], "FALSE", 5))
229 configcxx . . $ config..keepEditModeAfterStepPlaycxx . . $ config_t#keepEditModeAfterStepPlay. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
230 }
231
232 // 64K_LIMIT
233 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "64K_LIMIT=", 10))
234 {
235 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "TRUE", 4))
236 configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. = 65534;
237 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "FALSE", 5))
238 configcxx . . $ config..maxSampleLengthcxx . . $ config_t#maxSampleLength. = 131070;
239 }
240
241 // NO_DWNSMP_ON_SMP_LOAD (no dialog for 2x downsample after >22kHz sample load)
242 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "NO_DWNSMP_ON_SMP_LOAD=", 22))
243 {
244 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[22], "TRUE", 4)) configcxx . . $ config..noDownsampleOnSmpLoadcxx . . $ config_t#noDownsampleOnSmpLoad. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
245 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[22], "FALSE", 5)) configcxx . . $ config..noDownsampleOnSmpLoadcxx . . $ config_t#noDownsampleOnSmpLoad. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
246 }
247
248 // ENABLE_E8X (Karplus-Strong command)
249 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "ENABLE_E8X=", 11))
250 {
251 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "TRUE", 4)) configcxx . . $ config..enableE8xEffectcxx . . $ config_t#enableE8xEffect. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
252 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "FALSE", 5)) configcxx . . $ config..enableE8xEffectcxx . . $ config_t#enableE8xEffect. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
253 }
254
255 // HWMOUSE
256 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "HWMOUSE=", 8))
257 {
258 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[8], "TRUE", 4)) configcxx . . $ config..hwMousecxx . . $ config_t#hwMouse. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
259 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[8], "FALSE", 5)) configcxx . . $ config..hwMousecxx . . $ config_t#hwMouse. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
260 }
261
262 // VSYNCOFF
263 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "VSYNCOFF=", 9))
264 {
265 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "TRUE", 4)) configcxx . . $ config..vsyncOffcxx . . $ config_t#vsyncOff. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
266 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "FALSE", 5)) configcxx . . $ config..vsyncOffcxx . . $ config_t#vsyncOff. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
267 }
268
269 // INTEGERSCALING
270 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "INTEGERSCALING=", 15))
271 {
272 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[15], "TRUE", 4)) configcxx . . $ config..integerScalingcxx . . $ config_t#integerScaling. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
273 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[15], "FALSE", 5)) configcxx . . $ config..integerScalingcxx . . $ config_t#integerScaling. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
274 }
275
276 // FULLSCREENSTRETCH
277 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "FULLSCREENSTRETCH=", 18))
278 {
279 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[18], "TRUE", 4)) configcxx . . $ config..fullScreenStretchcxx . . $ config_t#fullScreenStretch. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
280 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[18], "FALSE", 5)) configcxx . . $ config..fullScreenStretchcxx . . $ config_t#fullScreenStretch. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
281 }
282
283 // HIDEDISKOPDATES
284 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "HIDEDISKOPDATES=", 16))
285 {
286 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[16], "TRUE", 4)) configcxx . . $ config..hideDiskOpDatescxx . . $ config_t#hideDiskOpDates. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
287 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[16], "FALSE", 5)) configcxx . . $ config..hideDiskOpDatescxx . . $ config_t#hideDiskOpDates. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
288 }
289
290 // AUTOCLOSEDISKOP
291 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "AUTOCLOSEDISKOP=", 16))
292 {
293 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[16], "TRUE", 4)) configcxx . . $ config..autoCloseDiskOpcxx . . $ config_t#autoCloseDiskOp. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
294 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[16], "FALSE", 5)) configcxx . . $ config..autoCloseDiskOpcxx . . $ config_t#autoCloseDiskOp. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
295 }
296
297 // FULLSCREEN
298 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "FULLSCREEN=", 11))
299 {
300 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "TRUE", 4)) configcxx . . $ config..startInFullscreencxx . . $ config_t#startInFullscreen. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
301 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "FALSE", 5)) configcxx . . $ config..startInFullscreencxx . . $ config_t#startInFullscreen. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
302 }
303
304 // PIXELFILTER
305 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "PIXELFILTER=", 12))
306 {
307 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[12], "NEAREST", 7)) configcxx . . $ config..pixelFiltercxx . . $ config_t#pixelFilter. = PIXELFILTER_NEARESTcxx . . $ PIXELFILTER_NEAREST.;
308 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[12], "LINEAR", 6)) configcxx . . $ config..pixelFiltercxx . . $ config_t#pixelFilter. = PIXELFILTER_LINEARcxx . . $ PIXELFILTER_LINEAR.;
309 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[12], "BEST", 4)) configcxx . . $ config..pixelFiltercxx . . $ config_t#pixelFilter. = PIXELFILTER_BESTcxx . . $ PIXELFILTER_BEST.;
310 }
311
312 // COMPOMODE
313 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "COMPOMODE=", 10))
314 {
315 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "TRUE", 4)) configcxx . . $ config..compoModecxx . . $ config_t#compoMode. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
316 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "FALSE", 5)) configcxx . . $ config..compoModecxx . . $ config_t#compoMode. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
317 }
318
319 // PATTDOTS
320 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "PATTDOTS=", 9))
321 {
322 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "TRUE", 4)) configcxx . . $ config..pattDotscxx . . $ config_t#pattDots. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
323 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "FALSE", 5)) configcxx . . $ config..pattDotscxx . . $ config_t#pattDots. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
324 }
325
326 // BLANKZERO
327 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "BLANKZERO=", 10))
328 {
329 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "TRUE", 4)) configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
330 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[10], "FALSE", 5)) configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
331 }
332
333 // REALVUMETERS
334 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "REALVUMETERS=", 13))
335 {
336 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[13], "TRUE", 4)) configcxx . . $ config..realVuMeterscxx . . $ config_t#realVuMeters. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
337 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[13], "FALSE", 5)) configcxx . . $ config..realVuMeterscxx . . $ config_t#realVuMeters. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
338 }
339
340 // ACCIDENTAL
341 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "ACCIDENTAL=", 11))
342 {
343 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "SHARP", 4)) configcxx . . $ config..accidentalcxx . . $ config_t#accidental. = 0;
344 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "FLAT", 5)) configcxx . . $ config..accidentalcxx . . $ config_t#accidental. = 1;
345 }
346
347 // QUANTIZE
348 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "QUANTIZE=", 9))
349 {
350 if (configLine[9] != '\0')
351 {
352 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[9]);
353 configcxx . . $ config..quantizeValuecxx . . $ config_t#quantizeValue. = (int16_tcxx . . $ int16_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, 0, 63));
354 }
355 }
356
357 // TRANSDEL
358 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "TRANSDEL=", 9))
359 {
360 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "TRUE", 4)) configcxx . . $ config..transDelcxx . . $ config_t#transDel. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
361 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[9], "FALSE", 5)) configcxx . . $ config..transDelcxx . . $ config_t#transDel. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
362 }
363
364 // DOTTEDCENTER
365 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "DOTTEDCENTER=", 13))
366 {
367 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[13], "TRUE", 4)) configcxx . . $ config..waveformCenterLinecxx . . $ config_t#waveformCenterLine. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
368 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[13], "FALSE", 5)) configcxx . . $ config..waveformCenterLinecxx . . $ config_t#waveformCenterLine. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
369 }
370
371 // MODDOT
372 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "MODDOT=", 7))
373 {
374 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[7], "TRUE", 4)) configcxx . . $ config..modDotcxx . . $ config_t#modDot. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
375 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[7], "FALSE", 5)) configcxx . . $ config..modDotcxx . . $ config_t#modDot. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
376 }
377
378 // VIDEOSCALE
379 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "VIDEOSCALE=", 11))
380 {
381 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[11], "AUTO", 4))
382 {
383 configcxx . . $ config..autoFitVideoScalecxx . . $ config_t#autoFitVideoScale. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
384 configcxx . . $ config..videoScaleFactorcxx . . $ config_t#videoScaleFactor. = 0; // will be set later
385 }
386 else if (lineLen >= 13 && touppercxx . . $ `<external>/17904084882347303253/ctype.h:221:11`!(configLine[12]) == 'X' && isdigitcxx . . $ `<external>/17904084882347303253/ctype.h:192:10`!(configLine[11]))
387 {
388 configcxx . . $ config..autoFitVideoScalecxx . . $ config_t#autoFitVideoScale. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
389 configcxx . . $ config..videoScaleFactorcxx . . $ config_t#videoScaleFactor. = (int8_tcxx . . $ int8_t#)(configLine[11] - '0');
390 configcxx . . $ config..videoScaleFactorcxx . . $ config_t#videoScaleFactor. = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(config.videoScaleFactor, 1, MAX_UPSCALE_FACTORcxx . . $ `src/pt2_visuals.h:8:9`!);
391 }
392 }
393
394 // REMEMBERPLAYMODE
395 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "REMEMBERPLAYMODE=", 17))
396 {
397 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[17], "TRUE", 4)) configcxx . . $ config..rememberPlayModecxx . . $ config_t#rememberPlayMode. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
398 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[17], "FALSE", 5)) configcxx . . $ config..rememberPlayModecxx . . $ config_t#rememberPlayMode. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
399 }
400
401 // DEFAULTDIR
402 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "DEFAULTDIR=", 11))
403 {
404 if (lineLen > 11)
405 {
406 uint32_tcxx . . $ uint32_t# i = 11;
407 while (configLine[i] == ' ') i++; // remove spaces before string (if present)
408 while (configLine[lineLen-1] == ' ') lineLen--; // remove spaces after string (if present)
409
410 lineLen -= i;
411 if (lineLen > 0)
412 strncpycxx . . $ strncpy(255158a415b673b0).(configcxx . . $ config..defModulesDircxx . . $ config_t#defModulesDir., &configLine[i], (lineLen > PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) ? PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! : lineLen);
413 }
414 }
415
416 // DEFAULTSMPDIR
417 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "DEFAULTSMPDIR=", 14))
418 {
419 if (lineLen > 14)
420 {
421 uint32_tcxx . . $ uint32_t# i = 14;
422 while (configLine[i] == ' ') i++; // remove spaces before string (if present)
423 while (configLine[lineLen-1] == ' ') lineLen--; // remove spaces after string (if present)
424
425 lineLen -= i;
426 if (lineLen > 0)
427 strncpycxx . . $ strncpy(255158a415b673b0).(configcxx . . $ config..defSamplesDircxx . . $ config_t#defSamplesDir., &configLine[i], (lineLen > PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) ? PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! : lineLen);
428 }
429 }
430
431 // FILTERMODEL
432 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "FILTERMODEL=", 12))
433 {
434 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[12], "A500", 4)) configcxx . . $ config..amigaModelcxx . . $ config_t#amigaModel. = MODEL_A500cxx . . $ MODEL_A500.;
435 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[12], "A1200", 5)) configcxx . . $ config..amigaModelcxx . . $ config_t#amigaModel. = MODEL_A1200cxx . . $ MODEL_A1200.;
436 }
437
438 // A500LOWPASSFILTER (deprecated, same as A4000LOWPASSFILTER)
439 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "A500LOWPASSFILTER=", 18))
440 {
441 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[18], "TRUE", 4)) configcxx . . $ config..amigaModelcxx . . $ config_t#amigaModel. = MODEL_A500cxx . . $ MODEL_A500.;
442 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(&configLine[18], "FALSE", 5)) configcxx . . $ config..amigaModelcxx . . $ config_t#amigaModel. = MODEL_A1200cxx . . $ MODEL_A1200.;
443 }
444
445 // SAMPLINGFREQ
446 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "SAMPLINGFREQ=", 13))
447 {
448 if (configLine[10] != '\0')
449 {
450 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[13]);
451 configcxx . . $ config..audioInputFrequencycxx . . $ config_t#audioInputFrequency. = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, 44100, 192000);
452 }
453 }
454
455 // MOD2WAVFREQUENCY
456 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "MOD2WAVFREQUENCY=", 17))
457 {
458 if (configLine[17] != '\0')
459 {
460 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[17]);
461 configcxx . . $ config..mod2WavOutputFreqcxx . . $ config_t#mod2WavOutputFreq. = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, MIN_AUDIO_FREQUENCYcxx . . $ `src/pt2_header.h:44:9`!, MAX_AUDIO_FREQUENCYcxx . . $ `src/pt2_header.h:45:9`!);
462 }
463 }
464
465 // FREQUENCY
466 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "FREQUENCY=", 10))
467 {
468 if (configLine[10] != '\0')
469 {
470 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[10]);
471 configcxx . . $ config..soundFrequencycxx . . $ config_t#soundFrequency. = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, MIN_AUDIO_FREQUENCYcxx . . $ `src/pt2_header.h:44:9`!, MAX_AUDIO_FREQUENCYcxx . . $ `src/pt2_header.h:45:9`!);
472 }
473 }
474
475 // BUFFERSIZE
476 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "BUFFERSIZE=", 11))
477 {
478 if (configLine[11] != '\0')
479 {
480 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[11]);
481 configcxx . . $ config..soundBufferSizecxx . . $ config_t#soundBufferSize. = CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, 128, 8192);
482 }
483 }
484
485 // STEREOSEPARATION
486 else if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!(configLine, "STEREOSEPARATION=", 17))
487 {
488 if (configLine[17] != '\0')
489 {
490 const int32_tcxx . . $ int32_t# num = atoicxx . . $ atoi(5c4306d8553b3696).(&configLine[17]);
491 configcxx . . $ config..stereoSeparationcxx . . $ config_t#stereoSeparation. = (int8_tcxx . . $ int8_t#)(CLAMPcxx . . $ `src/pt2_helpers.h:36:9`!(num, 0, 100));
492 }
493 }
494
495 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
496 }
497
498 freecxx . . $ free(5d22bdacc48458e8).(configBuffer);
499 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
500 }
501
502 static FILEcxx . . $ FILE# *openPTDotConfigcxx . . $ openPTDotConfig(3637adb0f06093ef).(void)
503 {
504 FILEcxx . . $ FILE# *f = fopencxx . . $ fopen(82ec0787cd37e0a3).("PT.Config", "rb"); // PT didn't read PT.Config with no number, but let's support it
505 if (f == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
506 {
507 // try regular PT config filenames (PT.Config-xx)
508 char tmpFilename[16];
509 int32_tcxx . . $ int32_t# i;
510
511 for (i = 0; i < 100; i++)
512 {
513 sprintfcxx . . $ sprintf(26c8642d26409d6d).(tmpFilename, "PT.Config-%02d", i);
514
515 f = fopencxx . . $ fopen(82ec0787cd37e0a3).(tmpFilename, "rb");
516 if (f != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
517 break;
518 }
519
520 if (i == 100)
521 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
522 }
523
524 return f;
525 }
526
527 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadPTDotConfigcxx . . $ loadPTDotConfig(dc9e5a301483124c).(FILEcxx . . $ FILE# *f)
528 {
529 char cfgString[24];
530 uint8_tcxx . . $ uint8_t# tmp8;
531 uint16_tcxx . . $ uint16_t# tmp16;
532
533 // get filesize
534 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!);
535 uint32_tcxx . . $ uint32_t# configFileSize = ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f);
536 if (configFileSize != 1024)
537 {
538 // not a valid PT.Config file
539 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
540 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
541 }
542 rewindcxx . . $ rewind(8d4262d45fc644ab).(f);
543
544 // check if file is a PT.Config file
545 freadcxx . . $ fread(738fc8ac1d711e58).(cfgString, 1, 24, f);
546
547 /* force version string to 2.3 so that we'll accept all versions.
548 ** AFAIK we're only loading values that were present since 1.0,
549 ** so it should be safe. */
550 cfgString[2] = '2';
551 cfgString[4] = '3';
552
553 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(cfgString, "PT2.3 Configuration File", 24) != 0)
554 {
555 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
556 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
557 }
558
559 // Palette
560 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 154, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
561 for (int32_tcxx . . $ int32_t# i = 0; i < 8; i++)
562 {
563 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp16, 2, 1, f); // stored as Big-Endian
564 tmp16 = SWAP16cxx . . $ `src/pt2_helpers.h:6:9`!(tmp16);
565 videocxx . . $ video..palettecxx . . $ video_t#palette.[i] = RGB12_to_RGB24cxx . . $ `src/pt2_helpers.h:47:9`!(tmp16);
566 }
567
568 // Transpose Delete (delete out of range notes on transposing)
569 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 174, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
570 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
571 configcxx . . $ config..transDelcxx . . $ config_t#transDel. = tmp8 ? truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! : falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
572 configcxx . . $ config..transDelcxx . . $ config_t#transDel. = configcxx . . $ config..transDelcxx . . $ config_t#transDel.;
573
574 // Note style (sharps/flats)
575 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 200, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
576 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
577 configcxx . . $ config..accidentalcxx . . $ config_t#accidental. = tmp8 ? 1 : 0;
578 configcxx . . $ config..accidentalcxx . . $ config_t#accidental. = configcxx . . $ config..accidentalcxx . . $ config_t#accidental.;
579
580 // Multi Mode Next
581 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 462, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
582 freadcxx . . $ fread(738fc8ac1d711e58).(&editorcxx . . $ editor..multiModeNextcxx . . $ editor_t#multiModeNext.[0], 1, 1, f);
583 freadcxx . . $ fread(738fc8ac1d711e58).(&editorcxx . . $ editor..multiModeNextcxx . . $ editor_t#multiModeNext.[1], 1, 1, f);
584 freadcxx . . $ fread(738fc8ac1d711e58).(&editorcxx . . $ editor..multiModeNextcxx . . $ editor_t#multiModeNext.[2], 1, 1, f);
585 freadcxx . . $ fread(738fc8ac1d711e58).(&editorcxx . . $ editor..multiModeNextcxx . . $ editor_t#multiModeNext.[3], 1, 1, f);
586
587 // Effect Macros
588 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 466, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
589 for (int32_tcxx . . $ int32_t# i = 0; i < 10; i++)
590 {
591 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp16, 2, 1, f); // stored as Big-Endian
592 tmp16 = SWAP16cxx . . $ `src/pt2_helpers.h:6:9`!(tmp16);
593 editorcxx . . $ editor..effectMacroscxx . . $ editor_t#effectMacros.[i] = tmp16;
594 }
595
596 // Timing Mode (CIA/VBLANK)
597 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 487, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
598 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
599 editorcxx . . $ editor..timingModecxx . . $ editor_t#timingMode. = tmp8 ? TEMPO_MODE_CIAcxx . . $ TEMPO_MODE_CIA. : TEMPO_MODE_VBLANKcxx . . $ TEMPO_MODE_VBLANK.;
600
601 // Blank Zeroes
602 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 490, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
603 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
604 configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag. = tmp8 ? truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! : falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
605 configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag. = configcxx . . $ config..blankZeroFlagcxx . . $ config_t#blankZeroFlag.;
606
607 // Initial Tempo (don't load if timing is set to VBLANK)
608 if (editorcxx . . $ editor..timingModecxx . . $ editor_t#timingMode. == TEMPO_MODE_CIAcxx . . $ TEMPO_MODE_CIA.)
609 {
610 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 497, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
611 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
612 if (tmp8 < 32) tmp8 = 32;
613 editorcxx . . $ editor..initialTempocxx . . $ editor_t#initialTempo. = tmp8;
614 editorcxx . . $ editor..oldTempocxx . . $ editor_t#oldTempo. = tmp8;
615 }
616
617 // Tuning Tone Note
618 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 501, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
619 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
620 if (tmp8 > 35) tmp8 = 35;
621 editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote. = tmp8;
622
623 if (editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote. > 35)
624 editorcxx . . $ editor..tuningNotecxx . . $ editor_t#tuningNote. = 35;
625
626 // Tuning Tone Volume
627 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 503, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
628 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
629 if (tmp8 > 64) tmp8 = 64;
630 editorcxx . . $ editor..tuningVolcxx . . $ editor_t#tuningVol. = tmp8;
631
632 // Initial Speed
633 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 545, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
634 freadcxx . . $ fread(738fc8ac1d711e58).(&tmp8, 1, 1, f);
635 if (editorcxx . . $ editor..timingModecxx . . $ editor_t#timingMode. == TEMPO_MODE_VBLANKcxx . . $ TEMPO_MODE_VBLANK.)
636 {
637 editorcxx . . $ editor..initialSpeedcxx . . $ editor_t#initialSpeed. = tmp8;
638 }
639 else
640 {
641 if (tmp8 > 0x20) tmp8 = 0x20;
642 editorcxx . . $ editor..initialSpeedcxx . . $ editor_t#initialSpeed. = tmp8;
643 }
644
645 // VU-Meter Colors
646 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 546, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
647 for (int32_tcxx . . $ int32_t# i = 0; i < 48; i++)
648 {
649 freadcxx . . $ fread(738fc8ac1d711e58).(&vuMeterColorscxx . . $ vuMeterColors.[i], 2, 1, f); // stored as Big-Endian
650 vuMeterColorscxx . . $ vuMeterColors.[i] = SWAP16cxx . . $ `src/pt2_helpers.h:6:9`!(vuMeterColors[i]);
651 }
652
653 // Spectrum Analyzer Colors
654 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 642, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!);
655 for (int32_tcxx . . $ int32_t# i = 0; i < 36; i++)
656 {
657 freadcxx . . $ fread(738fc8ac1d711e58).(&analyzerColorscxx . . $ analyzerColors.[i], 2, 1, f); // stored as Big-Endian
658 analyzerColorscxx . . $ analyzerColors.[i] = SWAP16cxx . . $ `src/pt2_helpers.h:6:9`!(analyzerColors[i]);
659 }
660
661 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
662 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
663 }
664
665 static uint8_tcxx . . $ uint8_t# hex2intcxx . . $ hex2int(37bf0c9286c484e9).(char ch)
666 {
667 ch = (char)touppercxx . . $ `<external>/17904084882347303253/ctype.h:221:11`!(ch);
668
669 if (ch >= 'A' && ch <= 'F')
670 return 10 + (ch - 'A');
671 else if (ch >= '0' && ch <= '9')
672 return ch - '0';
673
674 return 0; // not a hex
675 }
676
677 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! loadColorsDotInicxx . . $ loadColorsDotIni(c9857a73d68e59ba).(void)
678 {
679 FILEcxx . . $ FILE# *f = fopencxx . . $ fopen(82ec0787cd37e0a3).("colors.ini", "r");
680 if (f == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
681 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
682
683 // get filesize
684 fseekcxx . . $ fseek(543fae30d249f6b1).(f, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!);
685 uint32_tcxx . . $ uint32_t# fileSize = ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f);
686 rewindcxx . . $ rewind(8d4262d45fc644ab).(f);
687
688 char *configBuffer = (char *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(fileSize + 1);
689 if (configBuffer == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
690 {
691 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
692 showErrorMsgBoxcxx . . $ showErrorMsgBox(326aeb464d16410c).("Couldn't parse colors.ini: Out of memory!");
693 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
694 }
695
696 freadcxx . . $ fread(738fc8ac1d711e58).(configBuffer, 1, fileSize, f);
697 configBuffer[fileSize] = '\0';
698 fclosecxx . . $ fclose(89bc1efcdac0ca22).(f);
699
700 // do parsing
701 char *configLine = strtokcxx . . $ strtok(b7b3a83273496486).(configBuffer, "\n");
702 while (configLine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
703 {
704 uint32_tcxx . . $ uint32_t# lineLen = (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(configLine);
705
706 // read palette
707 if (lineLen >= (sizeof ("[Palette]")-1))
708 {
709 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!("[Palette]", configLine, sizeof ("[Palette]")-1))
710 {
711 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
712
713 uint32_tcxx . . $ uint32_t# line = 0;
714 while (configLine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && line < 8)
715 {
716 uint16_tcxx . . $ uint16_t# color = (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[0]) << 8) | (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[1]) << 4) | hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[2]);
717 color &= 0xFFF;
718 videocxx . . $ video..palettecxx . . $ video_t#palette.[line] = RGB12_to_RGB24cxx . . $ `src/pt2_helpers.h:47:9`!(color);
719
720 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
721 line++;
722 }
723 }
724
725 if (configLine == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
726 break;
727
728 lineLen = (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(configLine);
729 }
730
731 // read VU-meter colors
732 if (lineLen >= sizeof ("[VU-meter]")-1)
733 {
734 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!("[VU-meter]", configLine, sizeof ("[VU-meter]")-1))
735 {
736 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
737
738 uint32_tcxx . . $ uint32_t# line = 0;
739 while (configLine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && line < 48)
740 {
741 uint16_tcxx . . $ uint16_t# color = (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[0]) << 8) | (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[1]) << 4) | hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[2]);
742 vuMeterColorscxx . . $ vuMeterColors.[line] = color & 0xFFF;
743
744 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
745 line++;
746 }
747 }
748
749 if (configLine == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
750 break;
751
752 lineLen = (uint32_tcxx . . $ uint32_t#)strlencxx . . $ strlen(751346f8406fd082).(configLine);
753 }
754
755 // read spectrum analyzer colors
756 if (lineLen >= sizeof ("[SpectrumAnalyzer]")-1)
757 {
758 if (!_strnicmpcxx . . $ `src/pt2_header.h:35:9`!("[SpectrumAnalyzer]", configLine, sizeof ("[SpectrumAnalyzer]")-1))
759 {
760 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
761
762 uint32_tcxx . . $ uint32_t# line = 0;
763 while (configLine != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && line < 36)
764 {
765 uint16_tcxx . . $ uint16_t# color = (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[0]) << 8) | (hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[1]) << 4) | hex2intcxx . . $ hex2int(37bf0c9286c484e9).(configLine[2]);
766 analyzerColorscxx . . $ analyzerColors.[line] = color & 0xFFF;
767
768 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
769 line++;
770 }
771 }
772
773 if (configLine == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
774 break;
775 }
776
777 configLine = strtokcxx . . $ strtok(b7b3a83273496486).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "\n");
778 }
779
780 freecxx . . $ free(5d22bdacc48458e8).(configBuffer);
781 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
782 }