1 |
|
/* |
2 |
|
* Prefs.cpp - Global preferences |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
4 |
> |
* Frodo Copyright (C) Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
43 |
|
BadLineCycles = 23; |
44 |
|
CIACycles = 63; |
45 |
|
FloppyCycles = 64; |
46 |
< |
SkipFrames = 2; |
46 |
> |
SkipFrames = 1; |
47 |
|
LatencyMin = 80; |
48 |
|
LatencyMax = 120; |
49 |
|
LatencyAvg = 280; |
50 |
|
ScalingNumerator = 2; |
51 |
|
ScalingDenominator = 2; |
52 |
|
|
53 |
– |
for (int i=0; i<4; i++) |
54 |
– |
DriveType[i] = DRVTYPE_DIR; |
55 |
– |
|
53 |
|
strcpy(DrivePath[0], "64prgs"); |
54 |
|
strcpy(DrivePath[1], ""); |
55 |
|
strcpy(DrivePath[2], ""); |
58 |
|
strcpy(ViewPort, "Default"); |
59 |
|
strcpy(DisplayMode, "Default"); |
60 |
|
|
61 |
< |
SIDType = SIDTYPE_NONE; |
61 |
> |
SIDType = SIDTYPE_DIGITAL; |
62 |
|
REUSize = REU_NONE; |
63 |
|
DisplayType = DISPTYPE_WINDOW; |
64 |
+ |
Joystick1Port = 0; |
65 |
+ |
Joystick2Port = 0; |
66 |
|
|
67 |
|
SpritesOn = true; |
68 |
|
SpriteCollisions = true; |
70 |
– |
Joystick1On = false; |
71 |
– |
Joystick2On = false; |
69 |
|
JoystickSwap = false; |
70 |
< |
LimitSpeed = false; |
70 |
> |
LimitSpeed = true; |
71 |
|
FastReset = false; |
72 |
|
CIAIRQHack = false; |
73 |
|
MapSlash = true; |
103 |
|
&& LatencyAvg == rhs.LatencyAvg |
104 |
|
&& ScalingNumerator == rhs.ScalingNumerator |
105 |
|
&& ScalingDenominator == rhs.ScalingNumerator |
109 |
– |
&& DriveType[0] == rhs.DriveType[0] |
110 |
– |
&& DriveType[1] == rhs.DriveType[1] |
111 |
– |
&& DriveType[2] == rhs.DriveType[2] |
112 |
– |
&& DriveType[3] == rhs.DriveType[3] |
106 |
|
&& strcmp(DrivePath[0], rhs.DrivePath[0]) == 0 |
107 |
|
&& strcmp(DrivePath[1], rhs.DrivePath[1]) == 0 |
108 |
|
&& strcmp(DrivePath[2], rhs.DrivePath[2]) == 0 |
114 |
|
&& DisplayType == rhs.DisplayType |
115 |
|
&& SpritesOn == rhs.SpritesOn |
116 |
|
&& SpriteCollisions == rhs.SpriteCollisions |
117 |
< |
&& Joystick1On == rhs.Joystick1On |
118 |
< |
&& Joystick2On == rhs.Joystick2On |
117 |
> |
&& Joystick1Port == rhs.Joystick1Port |
118 |
> |
&& Joystick2Port == rhs.Joystick2Port |
119 |
|
&& JoystickSwap == rhs.JoystickSwap |
120 |
|
&& LimitSpeed == rhs.LimitSpeed |
121 |
|
&& FastReset == rhs.FastReset |
158 |
|
|
159 |
|
if (DisplayType < DISPTYPE_WINDOW || DisplayType > DISPTYPE_SCREEN) |
160 |
|
DisplayType = DISPTYPE_WINDOW; |
168 |
– |
|
169 |
– |
for (int i=0; i<4; i++) |
170 |
– |
if (DriveType[i] < DRVTYPE_DIR || DriveType[i] > DRVTYPE_T64) |
171 |
– |
DriveType[i] = DRVTYPE_DIR; |
161 |
|
} |
162 |
|
|
163 |
|
|
165 |
|
* Load preferences from file |
166 |
|
*/ |
167 |
|
|
168 |
< |
void Prefs::Load(char *filename) |
168 |
> |
void Prefs::Load(const char *filename) |
169 |
|
{ |
170 |
|
FILE *file; |
171 |
|
char line[256], keyword[256], value[256]; |
193 |
|
ScalingNumerator = atoi(value); |
194 |
|
else if (!strcmp(keyword, "ScalingDenominator")) |
195 |
|
ScalingDenominator = atoi(value); |
207 |
– |
else if (!strcmp(keyword, "DriveType8")) |
208 |
– |
if (!strcmp(value, "DIR")) |
209 |
– |
DriveType[0] = DRVTYPE_DIR; |
210 |
– |
else if (!strcmp(value, "D64")) |
211 |
– |
DriveType[0] = DRVTYPE_D64; |
212 |
– |
else |
213 |
– |
DriveType[0] = DRVTYPE_T64; |
214 |
– |
else if (!strcmp(keyword, "DriveType9")) |
215 |
– |
if (!strcmp(value, "DIR")) |
216 |
– |
DriveType[1] = DRVTYPE_DIR; |
217 |
– |
else if (!strcmp(value, "D64")) |
218 |
– |
DriveType[1] = DRVTYPE_D64; |
219 |
– |
else |
220 |
– |
DriveType[1] = DRVTYPE_T64; |
221 |
– |
else if (!strcmp(keyword, "DriveType10")) |
222 |
– |
if (!strcmp(value, "DIR")) |
223 |
– |
DriveType[2] = DRVTYPE_DIR; |
224 |
– |
else if (!strcmp(value, "D64")) |
225 |
– |
DriveType[2] = DRVTYPE_D64; |
226 |
– |
else |
227 |
– |
DriveType[2] = DRVTYPE_T64; |
228 |
– |
else if (!strcmp(keyword, "DriveType11")) |
229 |
– |
if (!strcmp(value, "DIR")) |
230 |
– |
DriveType[3] = DRVTYPE_DIR; |
231 |
– |
else if (!strcmp(value, "D64")) |
232 |
– |
DriveType[3] = DRVTYPE_D64; |
233 |
– |
else |
234 |
– |
DriveType[3] = DRVTYPE_T64; |
196 |
|
else if (!strcmp(keyword, "DrivePath8")) |
197 |
|
strcpy(DrivePath[0], value); |
198 |
|
else if (!strcmp(keyword, "DrivePath9")) |
223 |
|
REUSize = REU_NONE; |
224 |
|
} else if (!strcmp(keyword, "DisplayType")) |
225 |
|
DisplayType = strcmp(value, "SCREEN") ? DISPTYPE_WINDOW : DISPTYPE_SCREEN; |
226 |
+ |
else if (!strcmp(keyword, "Joystick1Port")) |
227 |
+ |
Joystick1Port = atoi(value); |
228 |
+ |
else if (!strcmp(keyword, "Joystick2Port")) |
229 |
+ |
Joystick2Port = atoi(value); |
230 |
|
else if (!strcmp(keyword, "SpritesOn")) |
231 |
|
SpritesOn = !strcmp(value, "TRUE"); |
232 |
|
else if (!strcmp(keyword, "SpriteCollisions")) |
233 |
|
SpriteCollisions = !strcmp(value, "TRUE"); |
269 |
– |
else if (!strcmp(keyword, "Joystick1On")) |
270 |
– |
Joystick1On = !strcmp(value, "TRUE"); |
271 |
– |
else if (!strcmp(keyword, "Joystick2On")) |
272 |
– |
Joystick2On = !strcmp(value, "TRUE"); |
234 |
|
else if (!strcmp(keyword, "JoystickSwap")) |
235 |
|
JoystickSwap = !strcmp(value, "TRUE"); |
236 |
|
else if (!strcmp(keyword, "LimitSpeed")) |
279 |
|
* true: success, false: error |
280 |
|
*/ |
281 |
|
|
282 |
< |
bool Prefs::Save(char *filename) |
282 |
> |
bool Prefs::Save(const char *filename) |
283 |
|
{ |
284 |
|
FILE *file; |
285 |
|
|
295 |
|
fprintf(file, "LatencyAvg = %d\n", LatencyAvg); |
296 |
|
fprintf(file, "ScalingNumerator = %d\n", ScalingNumerator); |
297 |
|
fprintf(file, "ScalingDenominator = %d\n", ScalingDenominator); |
298 |
< |
for (int i=0; i<4; i++) { |
338 |
< |
fprintf(file, "DriveType%d = ", i+8); |
339 |
< |
switch (DriveType[i]) { |
340 |
< |
case DRVTYPE_DIR: |
341 |
< |
fprintf(file, "DIR\n"); |
342 |
< |
break; |
343 |
< |
case DRVTYPE_D64: |
344 |
< |
fprintf(file, "D64\n"); |
345 |
< |
break; |
346 |
< |
case DRVTYPE_T64: |
347 |
< |
fprintf(file, "T64\n"); |
348 |
< |
break; |
349 |
< |
} |
298 |
> |
for (int i=0; i<4; i++) |
299 |
|
fprintf(file, "DrivePath%d = %s\n", i+8, DrivePath[i]); |
351 |
– |
} |
300 |
|
fprintf(file, "ViewPort = %s\n", ViewPort); |
301 |
|
fprintf(file, "DisplayMode = %s\n", DisplayMode); |
302 |
|
fprintf(file, "SIDType = "); |
327 |
|
break; |
328 |
|
}; |
329 |
|
fprintf(file, "DisplayType = %s\n", DisplayType == DISPTYPE_WINDOW ? "WINDOW" : "SCREEN"); |
330 |
+ |
fprintf(file, "Joystick1Port = %d\n", Joystick1Port); |
331 |
+ |
fprintf(file, "Joystick2Port = %d\n", Joystick2Port); |
332 |
|
fprintf(file, "SpritesOn = %s\n", SpritesOn ? "TRUE" : "FALSE"); |
333 |
|
fprintf(file, "SpriteCollisions = %s\n", SpriteCollisions ? "TRUE" : "FALSE"); |
384 |
– |
fprintf(file, "Joystick1On = %s\n", Joystick1On ? "TRUE" : "FALSE"); |
385 |
– |
fprintf(file, "Joystick2On = %s\n", Joystick2On ? "TRUE" : "FALSE"); |
334 |
|
fprintf(file, "JoystickSwap = %s\n", JoystickSwap ? "TRUE" : "FALSE"); |
335 |
|
fprintf(file, "LimitSpeed = %s\n", LimitSpeed ? "TRUE" : "FALSE"); |
336 |
|
fprintf(file, "FastReset = %s\n", FastReset ? "TRUE" : "FALSE"); |
367 |
|
#ifdef WIN32 |
368 |
|
#include "Prefs_WIN32.h" |
369 |
|
#endif |
370 |
+ |
|
371 |
+ |
#ifdef __unix |
372 |
+ |
#ifdef HAVE_GLADE |
373 |
+ |
#include "Prefs_glade.h" |
374 |
+ |
#else |
375 |
+ |
#include "Prefs_x.h" |
376 |
+ |
#endif |
377 |
+ |
#endif |