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 |
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], ""); |
67 |
|
SpritesOn = true; |
68 |
|
SpriteCollisions = true; |
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 |
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")) |
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 = "); |
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 |