|
|
1.1 root 1: /*
1.1.1.6 root 2: Hatari - configuration.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
1.1 root 6:
7: Configuration File
8:
1.1.1.6 root 9: The configuration file is now stored in an ASCII format to allow the user
10: to edit the file manually.
1.1 root 11: */
1.1.1.13! root 12: const char Configuration_rcsid[] = "Hatari $Id: configuration.c,v 1.103 2008/11/25 20:51:34 thothy Exp $";
1.1.1.10 root 13:
14: #include <SDL_keysym.h>
1.1 root 15:
16: #include "main.h"
17: #include "configuration.h"
1.1.1.9 root 18: #include "cfgopts.h"
1.1.1.8 root 19: #include "audio.h"
1.1.1.5 root 20: #include "file.h"
1.1.1.9 root 21: #include "log.h"
22: #include "m68000.h"
1.1.1.12 root 23: #include "memorySnapShot.h"
24: #include "paths.h"
1.1.1.9 root 25: #include "screen.h"
26: #include "vdi.h"
27: #include "video.h"
1.1.1.6 root 28:
29:
30: CNF_PARAMS ConfigureParams; /* List of configuration for the emulator */
1.1.1.7 root 31: char sConfigFileName[FILENAME_MAX]; /* Stores the name of the configuration file */
1.1.1.6 root 32:
33:
1.1.1.9 root 34: /* Used to load/save logging options */
35: static const struct Config_Tag configs_Log[] =
36: {
37: { "sLogFileName", String_Tag, ConfigureParams.Log.sLogFileName },
1.1.1.13! root 38: { "sTraceFileName", String_Tag, ConfigureParams.Log.sTraceFileName },
1.1.1.9 root 39: { "nTextLogLevel", Int_Tag, &ConfigureParams.Log.nTextLogLevel },
40: { "nAlertDlgLogLevel", Int_Tag, &ConfigureParams.Log.nAlertDlgLogLevel },
1.1.1.12 root 41: { "bConfirmQuit", Bool_Tag, &ConfigureParams.Log.bConfirmQuit },
1.1.1.9 root 42: { NULL , Error_Tag, NULL }
43: };
44:
45:
1.1.1.6 root 46: /* Used to load/save screen options */
1.1.1.9 root 47: static const struct Config_Tag configs_Screen[] =
1.1.1.6 root 48: {
1.1.1.13! root 49: { "nMonitorType", Int_Tag, &ConfigureParams.Screen.nMonitorType },
! 50: { "nFrameSkips", Int_Tag, &ConfigureParams.Screen.nFrameSkips },
1.1.1.9 root 51: { "bFullScreen", Bool_Tag, &ConfigureParams.Screen.bFullScreen },
52: { "bAllowOverscan", Bool_Tag, &ConfigureParams.Screen.bAllowOverscan },
1.1.1.12 root 53: { "nSpec512Threshold", Int_Tag, &ConfigureParams.Screen.nSpec512Threshold },
54: { "nForceBpp", Int_Tag, &ConfigureParams.Screen.nForceBpp },
55: { "bZoomLowRes", Bool_Tag, &ConfigureParams.Screen.bZoomLowRes },
1.1.1.9 root 56: { "bUseExtVdiResolutions", Bool_Tag, &ConfigureParams.Screen.bUseExtVdiResolutions },
1.1.1.12 root 57: { "nVdiWidth", Int_Tag, &ConfigureParams.Screen.nVdiWidth },
58: { "nVdiHeight", Int_Tag, &ConfigureParams.Screen.nVdiHeight },
1.1.1.9 root 59: { "nVdiColors", Int_Tag, &ConfigureParams.Screen.nVdiColors },
1.1.1.13! root 60: { "bShowStatusbar", Bool_Tag, &ConfigureParams.Screen.bShowStatusbar },
! 61: { "bShowDriveLed", Bool_Tag, &ConfigureParams.Screen.bShowDriveLed },
1.1.1.9 root 62: { "bCaptureChange", Bool_Tag, &ConfigureParams.Screen.bCaptureChange },
1.1.1.13! root 63: { "nWindowBorderPixelsTop", Int_Tag, &ConfigureParams.Screen.nWindowBorderPixelsTop },
1.1.1.12 root 64: { "nWindowBorderPixelsLeft", Int_Tag, &ConfigureParams.Screen.nWindowBorderPixelsLeft },
65: { "nWindowBorderPixelsRight", Int_Tag, &ConfigureParams.Screen.nWindowBorderPixelsRight },
66: { "nWindowBorderPixelsBottom", Int_Tag, &ConfigureParams.Screen.nWindowBorderPixelsBottom },
1.1.1.13! root 67: { "nFullScreenBorderPixelsTop", Int_Tag, &ConfigureParams.Screen.nFullScreenBorderPixelsTop },
1.1.1.12 root 68: { "nFullScreenBorderPixelsLeft", Int_Tag, &ConfigureParams.Screen.nFullScreenBorderPixelsLeft },
69: { "nFullScreenBorderPixelsRight", Int_Tag, &ConfigureParams.Screen.nFullScreenBorderPixelsRight },
70: { "nFullScreenBorderPixelsBottom", Int_Tag, &ConfigureParams.Screen.nFullScreenBorderPixelsBottom },
1.1.1.9 root 71: { NULL , Error_Tag, NULL }
1.1.1.6 root 72: };
73:
1.1.1.10 root 74: /* Used to load/save joystick 0 options */
1.1.1.9 root 75: static const struct Config_Tag configs_Joystick0[] =
1.1.1.6 root 76: {
1.1.1.10 root 77: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nJoystickMode },
1.1.1.9 root 78: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[0].bEnableAutoFire },
1.1.1.10 root 79: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nJoyId },
80: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeUp },
81: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeDown },
82: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeLeft },
83: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeRight },
84: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeFire },
1.1.1.9 root 85: { NULL , Error_Tag, NULL }
1.1.1.6 root 86: };
1.1.1.10 root 87:
88: /* Used to load/save joystick 1 options */
1.1.1.9 root 89: static const struct Config_Tag configs_Joystick1[] =
1.1.1.6 root 90: {
1.1.1.10 root 91: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nJoystickMode },
1.1.1.9 root 92: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[1].bEnableAutoFire },
1.1.1.10 root 93: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nJoyId },
94: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeUp },
95: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeDown },
96: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeLeft },
97: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeRight },
98: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeFire },
99: { NULL , Error_Tag, NULL }
100: };
101:
102: /* Used to load/save joystick 2 options */
103: static const struct Config_Tag configs_Joystick2[] =
104: {
105: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nJoystickMode },
106: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[2].bEnableAutoFire },
107: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nJoyId },
108: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeUp },
109: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeDown },
110: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeLeft },
111: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeRight },
112: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeFire },
113: { NULL , Error_Tag, NULL }
114: };
115:
116: /* Used to load/save joystick 3 options */
117: static const struct Config_Tag configs_Joystick3[] =
118: {
119: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nJoystickMode },
120: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[3].bEnableAutoFire },
121: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nJoyId },
122: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeUp },
123: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeDown },
124: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeLeft },
125: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeRight },
126: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeFire },
127: { NULL , Error_Tag, NULL }
128: };
129:
130: /* Used to load/save joystick 4 options */
131: static const struct Config_Tag configs_Joystick4[] =
132: {
133: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nJoystickMode },
134: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[4].bEnableAutoFire },
135: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nJoyId },
136: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeUp },
137: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeDown },
138: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeLeft },
139: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeRight },
140: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeFire },
141: { NULL , Error_Tag, NULL }
142: };
143:
144: /* Used to load/save joystick 5 options */
145: static const struct Config_Tag configs_Joystick5[] =
146: {
147: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nJoystickMode },
148: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[5].bEnableAutoFire },
149: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nJoyId },
150: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeUp },
151: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeDown },
152: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeLeft },
153: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeRight },
154: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeFire },
1.1.1.9 root 155: { NULL , Error_Tag, NULL }
1.1.1.6 root 156: };
1.1.1.5 root 157:
1.1.1.6 root 158: /* Used to load/save keyboard options */
1.1.1.9 root 159: static const struct Config_Tag configs_Keyboard[] =
1.1.1.6 root 160: {
1.1.1.9 root 161: { "bDisableKeyRepeat", Bool_Tag, &ConfigureParams.Keyboard.bDisableKeyRepeat },
162: { "nKeymapType", Int_Tag, &ConfigureParams.Keyboard.nKeymapType },
163: { "szMappingFileName", String_Tag, ConfigureParams.Keyboard.szMappingFileName },
164: { NULL , Error_Tag, NULL }
1.1.1.6 root 165: };
1.1 root 166:
1.1.1.11 root 167: /* Used to load/save shortcut key bindings with modifiers options */
168: static const struct Config_Tag configs_ShortCutWithMod[] =
169: {
170: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] },
171: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] },
172: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEMODE] },
173: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] },
174: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] },
175: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] },
176: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] },
177: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] },
1.1.1.13! root 178: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] },
1.1.1.11 root 179: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] },
180: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] },
181: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] },
1.1.1.13! root 182: { "keyDebug", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_PAUSE] },
1.1.1.11 root 183: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] },
1.1.1.12 root 184: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] },
185: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] },
1.1.1.13! root 186: { "keyInsertDiskA",Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_INSERTDISKA] },
1.1.1.11 root 187: { NULL , Error_Tag, NULL }
188: };
189:
190: /* Used to load/save shortcut key bindings without modifiers options */
191: static const struct Config_Tag configs_ShortCutWithoutMod[] =
192: {
193: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] },
194: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] },
195: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_MOUSEMODE] },
196: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_COLDRESET] },
197: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_WARMRESET] },
198: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SCREENSHOT] },
199: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_BOSSKEY] },
200: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_CURSOREMU] },
1.1.1.13! root 201: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FASTFORWARD] },
1.1.1.11 root 202: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECANIM] },
203: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECSOUND] },
204: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SOUND] },
1.1.1.13! root 205: { "keyDebug", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_PAUSE] },
1.1.1.11 root 206: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_QUIT] },
1.1.1.12 root 207: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_LOADMEM] },
208: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SAVEMEM] },
1.1.1.13! root 209: { "keyInsertDiskA",Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_INSERTDISKA] },
1.1.1.11 root 210: { NULL , Error_Tag, NULL }
211: };
212:
213:
1.1.1.6 root 214: /* Used to load/save sound options */
1.1.1.9 root 215: static const struct Config_Tag configs_Sound[] =
1.1.1.6 root 216: {
1.1.1.9 root 217: { "bEnableSound", Bool_Tag, &ConfigureParams.Sound.bEnableSound },
218: { "nPlaybackQuality", Int_Tag, &ConfigureParams.Sound.nPlaybackQuality },
219: { "szYMCaptureFileName", String_Tag, ConfigureParams.Sound.szYMCaptureFileName },
220: { NULL , Error_Tag, NULL }
1.1.1.6 root 221: };
222:
223: /* Used to load/save memory options */
1.1.1.9 root 224: static const struct Config_Tag configs_Memory[] =
1.1.1.6 root 225: {
1.1.1.9 root 226: { "nMemorySize", Int_Tag, &ConfigureParams.Memory.nMemorySize },
1.1.1.12 root 227: { "bAutoSave", Bool_Tag, &ConfigureParams.Memory.bAutoSave },
1.1.1.9 root 228: { "szMemoryCaptureFileName", String_Tag, ConfigureParams.Memory.szMemoryCaptureFileName },
1.1.1.12 root 229: { "szAutoSaveFileName", String_Tag, ConfigureParams.Memory.szAutoSaveFileName },
1.1.1.9 root 230: { NULL , Error_Tag, NULL }
1.1.1.6 root 231: };
232:
233:
234: /* Used to load/save floppy options */
1.1.1.9 root 235: static const struct Config_Tag configs_Floppy[] =
1.1.1.6 root 236: {
1.1.1.10 root 237: { "bAutoInsertDiskB", Bool_Tag, &ConfigureParams.DiskImage.bAutoInsertDiskB },
238: { "nWriteProtection", Int_Tag, &ConfigureParams.DiskImage.nWriteProtection },
1.1.1.13! root 239: { "szDiskAZipPath", String_Tag, ConfigureParams.DiskImage.szDiskZipPath[0] },
! 240: { "szDiskAFileName", String_Tag, ConfigureParams.DiskImage.szDiskFileName[0] },
! 241: { "szDiskBZipPath", String_Tag, ConfigureParams.DiskImage.szDiskZipPath[1] },
! 242: { "szDiskBFileName", String_Tag, ConfigureParams.DiskImage.szDiskFileName[1] },
1.1.1.10 root 243: { "szDiskImageDirectory", String_Tag, ConfigureParams.DiskImage.szDiskImageDirectory },
244: { NULL , Error_Tag, NULL }
245: };
246:
1.1.1.6 root 247: /* Used to load/save HD options */
1.1.1.10 root 248: static const struct Config_Tag configs_HardDisk[] =
1.1.1.6 root 249: {
1.1.1.10 root 250: { "bBootFromHardDisk", Bool_Tag, &ConfigureParams.HardDisk.bBootFromHardDisk },
251: { "bUseHardDiskDirectory", Bool_Tag, &ConfigureParams.HardDisk.bUseHardDiskDirectories },
252: { "szHardDiskDirectory", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C] },
253: /*{ "szHardDiskDirD", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_D] },*/
254: /*{ "szHardDiskDirE", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_E] },*/
255: /*{ "szHardDiskDirF", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_F] },*/
256: { "bUseHardDiskImage", Bool_Tag, &ConfigureParams.HardDisk.bUseHardDiskImage },
257: { "szHardDiskImage", String_Tag, ConfigureParams.HardDisk.szHardDiskImage },
258: { NULL , Error_Tag, NULL }
259: };
260:
1.1.1.8 root 261: /* Used to load/save ROM options */
1.1.1.9 root 262: static const struct Config_Tag configs_Rom[] =
1.1.1.6 root 263: {
1.1.1.9 root 264: { "szTosImageFileName", String_Tag, ConfigureParams.Rom.szTosImageFileName },
265: { "szCartridgeImageFileName", String_Tag, ConfigureParams.Rom.szCartridgeImageFileName },
266: { NULL , Error_Tag, NULL }
1.1.1.6 root 267: };
268:
269: /* Used to load/save RS232 options */
1.1.1.9 root 270: static const struct Config_Tag configs_Rs232[] =
1.1.1.6 root 271: {
1.1.1.9 root 272: { "bEnableRS232", Bool_Tag, &ConfigureParams.RS232.bEnableRS232 },
273: { "szOutFileName", String_Tag, ConfigureParams.RS232.szOutFileName },
274: { "szInFileName", String_Tag, ConfigureParams.RS232.szInFileName },
275: { NULL , Error_Tag, NULL }
1.1.1.6 root 276: };
277:
278: /* Used to load/save printer options */
1.1.1.9 root 279: static const struct Config_Tag configs_Printer[] =
1.1.1.6 root 280: {
1.1.1.9 root 281: { "bEnablePrinting", Bool_Tag, &ConfigureParams.Printer.bEnablePrinting },
282: { "bPrintToFile", Bool_Tag, &ConfigureParams.Printer.bPrintToFile },
283: { "szPrintToFileName", String_Tag, ConfigureParams.Printer.szPrintToFileName },
284: { NULL , Error_Tag, NULL }
1.1.1.6 root 285: };
286:
1.1.1.7 root 287: /* Used to load/save MIDI options */
1.1.1.9 root 288: static const struct Config_Tag configs_Midi[] =
1.1.1.7 root 289: {
1.1.1.9 root 290: { "bEnableMidi", Bool_Tag, &ConfigureParams.Midi.bEnableMidi },
291: { "szMidiOutFileName", String_Tag, ConfigureParams.Midi.szMidiOutFileName },
292: { NULL , Error_Tag, NULL }
1.1.1.7 root 293: };
294:
1.1.1.6 root 295: /* Used to load/save system options */
1.1.1.9 root 296: static const struct Config_Tag configs_System[] =
1.1.1.6 root 297: {
1.1.1.9 root 298: { "nCpuLevel", Int_Tag, &ConfigureParams.System.nCpuLevel },
299: { "nCpuFreq", Int_Tag, &ConfigureParams.System.nCpuFreq },
300: { "bCompatibleCpu", Bool_Tag, &ConfigureParams.System.bCompatibleCpu },
301: { "nMachineType", Int_Tag, &ConfigureParams.System.nMachineType },
302: { "bBlitter", Bool_Tag, &ConfigureParams.System.bBlitter },
1.1.1.12 root 303: { "nDSPType", Int_Tag, &ConfigureParams.System.nDSPType },
1.1.1.9 root 304: { "bRealTimeClock", Bool_Tag, &ConfigureParams.System.bRealTimeClock },
305: { "bPatchTimerD", Bool_Tag, &ConfigureParams.System.bPatchTimerD },
306: { "bSlowFDC", Bool_Tag, &ConfigureParams.System.bSlowFDC },
1.1.1.13! root 307: { "bFastForward", Bool_Tag, &ConfigureParams.System.bFastForward },
1.1.1.9 root 308: { NULL , Error_Tag, NULL }
1.1.1.6 root 309: };
1.1 root 310:
311:
312: /*-----------------------------------------------------------------------*/
1.1.1.12 root 313: /**
314: * Set default configuration values.
315: */
1.1.1.2 root 316: void Configuration_SetDefault(void)
317: {
1.1.1.9 root 318: int i;
1.1.1.12 root 319: const char *psHomeDir;
320: const char *psWorkingDir;
321:
322: psHomeDir = Paths_GetHatariHome();
323: psWorkingDir = Paths_GetWorkingDir();
1.1.1.4 root 324:
1.1.1.9 root 325: /* Clear parameters */
326: memset(&ConfigureParams, 0, sizeof(CNF_PARAMS));
327:
328: /* Set defaults for logging */
329: strcpy(ConfigureParams.Log.sLogFileName, "stderr");
1.1.1.13! root 330: strcpy(ConfigureParams.Log.sTraceFileName, "stderr");
! 331: ConfigureParams.Log.nTextLogLevel = LOG_TODO;
! 332: ConfigureParams.Log.nAlertDlgLogLevel = LOG_ERROR;
1.1.1.12 root 333: ConfigureParams.Log.bConfirmQuit = TRUE;
1.1.1.9 root 334:
1.1.1.10 root 335: /* Set defaults for floppy disk images */
336: ConfigureParams.DiskImage.bAutoInsertDiskB = TRUE;
337: ConfigureParams.DiskImage.nWriteProtection = WRITEPROT_OFF;
1.1.1.13! root 338: for (i = 0; i < 2; i++)
! 339: {
! 340: ConfigureParams.DiskImage.szDiskZipPath[i][0] = '\0';
! 341: ConfigureParams.DiskImage.szDiskFileName[i][0] = '\0';
! 342: }
1.1.1.12 root 343: strcpy(ConfigureParams.DiskImage.szDiskImageDirectory, psWorkingDir);
1.1.1.10 root 344: File_AddSlashToEndFileName(ConfigureParams.DiskImage.szDiskImageDirectory);
345:
346: /* Set defaults for hard disks */
347: ConfigureParams.HardDisk.bBootFromHardDisk = FALSE;
348: ConfigureParams.HardDisk.nHardDiskDir = DRIVE_C;
349: ConfigureParams.HardDisk.bUseHardDiskDirectories = FALSE;
1.1.1.13! root 350: for (i = 0; i < MAX_HARDDRIVES; i++)
1.1.1.9 root 351: {
1.1.1.12 root 352: strcpy(ConfigureParams.HardDisk.szHardDiskDirectories[i], psWorkingDir);
1.1.1.10 root 353: File_CleanFileName(ConfigureParams.HardDisk.szHardDiskDirectories[i]);
1.1.1.9 root 354: }
1.1.1.10 root 355: ConfigureParams.HardDisk.bUseHardDiskImage = FALSE;
1.1.1.12 root 356: strcpy(ConfigureParams.HardDisk.szHardDiskImage, psWorkingDir);
357: ConfigureParams.HardDisk.bUseIdeHardDiskImage = FALSE;
358: strcpy(ConfigureParams.HardDisk.szIdeHardDiskImage, psWorkingDir);
1.1.1.9 root 359:
360: /* Set defaults for Joysticks */
1.1.1.11 root 361: for (i = 0; i < JOYSTICK_COUNT; i++)
1.1.1.9 root 362: {
1.1.1.10 root 363: ConfigureParams.Joysticks.Joy[i].nJoystickMode = JOYSTICK_DISABLED;
1.1.1.9 root 364: ConfigureParams.Joysticks.Joy[i].bEnableAutoFire = FALSE;
1.1.1.10 root 365: ConfigureParams.Joysticks.Joy[i].nJoyId = i;
366: ConfigureParams.Joysticks.Joy[i].nKeyCodeUp = SDLK_UP;
367: ConfigureParams.Joysticks.Joy[i].nKeyCodeDown = SDLK_DOWN;
368: ConfigureParams.Joysticks.Joy[i].nKeyCodeLeft = SDLK_LEFT;
369: ConfigureParams.Joysticks.Joy[i].nKeyCodeRight = SDLK_RIGHT;
370: ConfigureParams.Joysticks.Joy[i].nKeyCodeFire = SDLK_RCTRL;
1.1.1.9 root 371: }
1.1.1.10 root 372: ConfigureParams.Joysticks.Joy[1].nJoyId = 0; /* ST Joystick #1 is default joystick */
373: ConfigureParams.Joysticks.Joy[0].nJoyId = 1;
1.1.1.13! root 374: ConfigureParams.Joysticks.Joy[1].nJoystickMode = JOYSTICK_REALSTICK;
1.1.1.9 root 375:
376: /* Set defaults for Keyboard */
1.1.1.13! root 377: ConfigureParams.Keyboard.bDisableKeyRepeat = FALSE;
1.1.1.9 root 378: ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
379: strcpy(ConfigureParams.Keyboard.szMappingFileName, "");
1.1.1.11 root 380:
1.1.1.12 root 381: /* Set defaults for Shortcuts */
382: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] = SDLK_F12;
383: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] = SDLK_F11;
1.1.1.13! root 384: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_PAUSE] = SDLK_PAUSE;
1.1.1.11 root 385:
1.1.1.12 root 386: ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] = SDLK_o;
387: ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] = SDLK_f;
388: ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEMODE] = SDLK_m;
389: ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] = SDLK_c;
390: ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] = SDLK_r;
391: ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] = SDLK_g;
392: ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] = SDLK_i;
393: ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] = SDLK_j;
1.1.1.13! root 394: ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] = SDLK_x;
1.1.1.12 root 395: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] = SDLK_a;
396: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] = SDLK_y;
397: ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] = SDLK_s;
398: ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] = SDLK_q;
399: ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] = SDLK_l;
400: ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] = SDLK_k;
1.1.1.13! root 401: ConfigureParams.Shortcut.withModifier[SHORTCUT_INSERTDISKA] = SDLK_d;
! 402:
1.1.1.9 root 403: /* Set defaults for Memory */
1.1.1.10 root 404: ConfigureParams.Memory.nMemorySize = 1; /* 1 MiB */
1.1.1.12 root 405: ConfigureParams.Memory.bAutoSave = FALSE;
406: sprintf(ConfigureParams.Memory.szMemoryCaptureFileName, "%s%chatari.sav",
407: psHomeDir, PATHSEP);
408: sprintf(ConfigureParams.Memory.szAutoSaveFileName, "%s%cauto.sav",
409: psHomeDir, PATHSEP);
1.1.1.9 root 410:
411: /* Set defaults for Printer */
412: ConfigureParams.Printer.bEnablePrinting = FALSE;
413: ConfigureParams.Printer.bPrintToFile = TRUE;
1.1.1.12 root 414: sprintf(ConfigureParams.Printer.szPrintToFileName, "%s%chatari.prn",
415: psHomeDir, PATHSEP);
1.1.1.9 root 416:
417: /* Set defaults for RS232 */
418: ConfigureParams.RS232.bEnableRS232 = FALSE;
419: strcpy(ConfigureParams.RS232.szOutFileName, "/dev/modem");
420: strcpy(ConfigureParams.RS232.szInFileName, "/dev/modem");
421:
422: /* Set defaults for MIDI */
423: ConfigureParams.Midi.bEnableMidi = FALSE;
424: strcpy(ConfigureParams.Midi.szMidiOutFileName, "/dev/midi00");
425:
426: /* Set defaults for Screen */
427: ConfigureParams.Screen.bFullScreen = FALSE;
1.1.1.13! root 428: ConfigureParams.Screen.nFrameSkips = AUTO_FRAMESKIP_LIMIT;
1.1.1.9 root 429: ConfigureParams.Screen.bAllowOverscan = TRUE;
1.1.1.12 root 430: ConfigureParams.Screen.nSpec512Threshold = 16;
431: ConfigureParams.Screen.nForceBpp = 0;
432: ConfigureParams.Screen.bZoomLowRes = FALSE;
1.1.1.13! root 433: ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_RGB;
1.1.1.9 root 434: ConfigureParams.Screen.bUseExtVdiResolutions = FALSE;
1.1.1.12 root 435: ConfigureParams.Screen.nVdiWidth = 640;
436: ConfigureParams.Screen.nVdiHeight = 480;
437: ConfigureParams.Screen.nVdiColors = GEMCOLOR_16;
1.1.1.13! root 438: ConfigureParams.Screen.bShowStatusbar = TRUE;
! 439: ConfigureParams.Screen.bShowDriveLed = TRUE;
1.1.1.9 root 440: ConfigureParams.Screen.bCaptureChange = FALSE;
1.1.1.13! root 441: ConfigureParams.Screen.nWindowBorderPixelsTop = OVERSCAN_TOP;
1.1.1.12 root 442: ConfigureParams.Screen.nWindowBorderPixelsLeft = 48;
443: ConfigureParams.Screen.nWindowBorderPixelsRight = 48;
1.1.1.13! root 444: ConfigureParams.Screen.nWindowBorderPixelsBottom = MAX_OVERSCAN_BOTTOM-2;
! 445: ConfigureParams.Screen.nFullScreenBorderPixelsTop = OVERSCAN_TOP;
1.1.1.12 root 446: ConfigureParams.Screen.nFullScreenBorderPixelsLeft = 32;
447: ConfigureParams.Screen.nFullScreenBorderPixelsRight = 32;
1.1.1.13! root 448: ConfigureParams.Screen.nFullScreenBorderPixelsBottom = MAX_OVERSCAN_BOTTOM-2;
1.1.1.9 root 449:
450: /* Set defaults for Sound */
451: ConfigureParams.Sound.bEnableSound = TRUE;
1.1.1.12 root 452: ConfigureParams.Sound.nPlaybackQuality = PLAYBACK_HIGH;
453: sprintf(ConfigureParams.Sound.szYMCaptureFileName, "%s%chatari.wav",
454: psWorkingDir, PATHSEP);
1.1.1.9 root 455:
456: /* Set defaults for Rom */
1.1.1.12 root 457: sprintf(ConfigureParams.Rom.szTosImageFileName, "%s%ctos.img",
458: Paths_GetDataDir(), PATHSEP);
1.1.1.9 root 459: strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
460:
461: /* Set defaults for System */
462: ConfigureParams.System.nCpuLevel = 0;
463: ConfigureParams.System.nCpuFreq = 8;
1.1.1.12 root 464: ConfigureParams.System.bCompatibleCpu = TRUE;
1.1.1.9 root 465: /*ConfigureParams.System.bAddressSpace24 = TRUE;*/
466: ConfigureParams.System.nMachineType = MACHINE_ST;
467: ConfigureParams.System.bBlitter = FALSE;
1.1.1.12 root 468: ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
1.1.1.9 root 469: ConfigureParams.System.bPatchTimerD = TRUE;
470: ConfigureParams.System.bRealTimeClock = TRUE;
1.1.1.13! root 471: ConfigureParams.System.bFastForward = FALSE;
1.1.1.9 root 472: ConfigureParams.System.bSlowFDC = FALSE;
473:
474: /* Initialize the configuration file name */
1.1.1.12 root 475: if (strlen(psHomeDir) < sizeof(sConfigFileName)-13)
476: sprintf(sConfigFileName, "%s%chatari.cfg", psHomeDir, PATHSEP);
1.1.1.9 root 477: else
478: strcpy(sConfigFileName, "hatari.cfg");
1.1.1.12 root 479:
480: #if defined(__AMIGAOS4__)
481: /* Fix default path names on Amiga OS */
482: sprintf(ConfigureParams.Rom.szTosImageFileName, "%stos.img", Paths_GetDataDir());
483: #endif
1.1.1.2 root 484: }
485:
486:
487: /*-----------------------------------------------------------------------*/
1.1.1.12 root 488: /**
489: * Copy details from configuration structure into global variables for system,
490: * clean file names, etc... Called from main.c and dialog.c files.
491: */
1.1.1.13! root 492: void Configuration_Apply(bool bReset)
1.1.1.8 root 493: {
1.1.1.9 root 494: if (bReset)
495: {
1.1.1.12 root 496: /* Set resolution change */
1.1.1.9 root 497: bUseVDIRes = ConfigureParams.Screen.bUseExtVdiResolutions;
1.1.1.13! root 498: bUseHighRes = ((!bUseVDIRes) && ConfigureParams.Screen.nMonitorType == MONITOR_TYPE_MONO)
1.1.1.12 root 499: || (bUseVDIRes && ConfigureParams.Screen.nVdiColors == GEMCOLOR_2);
500: if (bUseHighRes)
501: {
502: STRes = ST_HIGH_RES;
503: }
504: if (bUseVDIRes)
505: {
506: VDI_SetResolution(ConfigureParams.Screen.nVdiColors,
507: ConfigureParams.Screen.nVdiWidth,
508: ConfigureParams.Screen.nVdiHeight);
509: }
1.1.1.9 root 510: }
1.1.1.13! root 511: if (ConfigureParams.Screen.nFrameSkips < AUTO_FRAMESKIP_LIMIT)
! 512: {
! 513: nFrameSkips = ConfigureParams.Screen.nFrameSkips;
! 514: }
1.1.1.9 root 515: /* Set playback frequency */
516: if (ConfigureParams.Sound.bEnableSound)
1.1.1.13! root 517: {
1.1.1.9 root 518: Audio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackQuality);
1.1.1.13! root 519: }
1.1.1.9 root 520: /* CPU settings */
521: if (ConfigureParams.System.nCpuFreq < 12)
522: {
523: ConfigureParams.System.nCpuFreq = 8;
524: nCpuFreqShift = 0;
525: }
526: else if (ConfigureParams.System.nCpuFreq > 26)
527: {
528: ConfigureParams.System.nCpuFreq = 32;
529: nCpuFreqShift = 2;
530: }
531: else
532: {
533: ConfigureParams.System.nCpuFreq = 16;
534: nCpuFreqShift = 1;
535: }
1.1.1.12 root 536: /* Change UAE cpu_level and cpu_compatible accordingly */
537: M68000_CheckCpuLevel();
1.1.1.9 root 538:
539: /* Clean file and directory names */
540: File_MakeAbsoluteName(ConfigureParams.Rom.szTosImageFileName);
1.1.1.11 root 541: if (strlen(ConfigureParams.Rom.szCartridgeImageFileName) > 0)
542: File_MakeAbsoluteName(ConfigureParams.Rom.szCartridgeImageFileName);
1.1.1.10 root 543: File_MakeAbsoluteName(ConfigureParams.HardDisk.szHardDiskImage);
544: File_CleanFileName(ConfigureParams.HardDisk.szHardDiskDirectories[0]);
545: File_MakeAbsoluteName(ConfigureParams.HardDisk.szHardDiskDirectories[0]);
1.1.1.12 root 546: File_MakeAbsoluteName(ConfigureParams.Memory.szMemoryCaptureFileName);
547: File_MakeAbsoluteName(ConfigureParams.Sound.szYMCaptureFileName);
548: if (strlen(ConfigureParams.Keyboard.szMappingFileName) > 0)
549: File_MakeAbsoluteName(ConfigureParams.Keyboard.szMappingFileName);
1.1.1.9 root 550: File_MakeAbsoluteName(ConfigureParams.RS232.szOutFileName);
551: File_MakeAbsoluteName(ConfigureParams.RS232.szInFileName);
1.1.1.12 root 552:
553: /* make path names absolute, but handle special file names */
554: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sLogFileName);
1.1.1.13! root 555: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sTraceFileName);
1.1.1.12 root 556: File_MakeAbsoluteSpecialName(ConfigureParams.Midi.szMidiOutFileName);
557: File_MakeAbsoluteSpecialName(ConfigureParams.Printer.szPrintToFileName);
1.1.1.8 root 558: }
559:
560:
561: /*-----------------------------------------------------------------------*/
1.1.1.12 root 562: /**
563: * Load a settings section from the configuration file.
564: */
1.1.1.9 root 565: static int Configuration_LoadSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1 root 566: {
1.1.1.9 root 567: int ret;
1.1 root 568:
1.1.1.9 root 569: ret = input_config(pFilename, configs, pSection);
1.1 root 570:
1.1.1.9 root 571: if (ret < 0)
572: fprintf(stderr, "Can not load configuration file %s (section %s).\n",
573: sConfigFileName, pSection);
1.1 root 574:
1.1.1.9 root 575: return ret;
1.1 root 576: }
577:
578:
579: /*-----------------------------------------------------------------------*/
1.1.1.12 root 580: /**
581: * Load program setting from configuration file. If psFileName is NULL, use
582: * the default (i.e. the users) configuration file.
583: */
1.1.1.9 root 584: void Configuration_Load(const char *psFileName)
1.1 root 585: {
1.1.1.9 root 586: if (psFileName == NULL)
587: psFileName = sConfigFileName;
588:
589: if (!File_Exists(psFileName))
590: {
591: fprintf(stderr, "Configuration file %s not found.\n", psFileName);
592: return;
593: }
594:
595: Configuration_LoadSection(psFileName, configs_Log, "[Log]");
596: Configuration_LoadSection(psFileName, configs_Screen, "[Screen]");
597: Configuration_LoadSection(psFileName, configs_Joystick0, "[Joystick0]");
598: Configuration_LoadSection(psFileName, configs_Joystick1, "[Joystick1]");
1.1.1.10 root 599: Configuration_LoadSection(psFileName, configs_Joystick2, "[Joystick2]");
600: Configuration_LoadSection(psFileName, configs_Joystick3, "[Joystick3]");
601: Configuration_LoadSection(psFileName, configs_Joystick4, "[Joystick4]");
602: Configuration_LoadSection(psFileName, configs_Joystick5, "[Joystick5]");
1.1.1.9 root 603: Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]");
1.1.1.11 root 604: Configuration_LoadSection(psFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
605: Configuration_LoadSection(psFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.9 root 606: Configuration_LoadSection(psFileName, configs_Sound, "[Sound]");
607: Configuration_LoadSection(psFileName, configs_Memory, "[Memory]");
608: Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]");
1.1.1.10 root 609: Configuration_LoadSection(psFileName, configs_HardDisk, "[HardDisk]");
1.1.1.9 root 610: Configuration_LoadSection(psFileName, configs_Rom, "[ROM]");
611: Configuration_LoadSection(psFileName, configs_Rs232, "[RS232]");
612: Configuration_LoadSection(psFileName, configs_Printer, "[Printer]");
613: Configuration_LoadSection(psFileName, configs_Midi, "[Midi]");
614: Configuration_LoadSection(psFileName, configs_System, "[System]");
1.1 root 615: }
616:
617:
618: /*-----------------------------------------------------------------------*/
1.1.1.12 root 619: /**
620: * Save a settings section to configuration file
621: */
1.1.1.9 root 622: static int Configuration_SaveSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1 root 623: {
1.1.1.9 root 624: int ret;
1.1 root 625:
1.1.1.9 root 626: ret = update_config(pFilename, configs, pSection);
1.1 root 627:
1.1.1.9 root 628: if (ret < 0)
629: fprintf(stderr, "Error while updating section %s\n", pSection);
1.1 root 630:
1.1.1.9 root 631: return ret;
1.1 root 632: }
633:
634:
635: /*-----------------------------------------------------------------------*/
1.1.1.12 root 636: /**
637: * Save program setting to configuration file
638: */
1.1.1.6 root 639: void Configuration_Save(void)
1.1 root 640: {
1.1.1.9 root 641: if (Configuration_SaveSection(sConfigFileName, configs_Log, "[Log]") < 0)
642: {
1.1.1.13! root 643: Log_AlertDlg(LOG_ERROR, "Error saving config file.");
1.1.1.9 root 644: return;
645: }
646: Configuration_SaveSection(sConfigFileName, configs_Screen, "[Screen]");
647: Configuration_SaveSection(sConfigFileName, configs_Joystick0, "[Joystick0]");
648: Configuration_SaveSection(sConfigFileName, configs_Joystick1, "[Joystick1]");
1.1.1.10 root 649: Configuration_SaveSection(sConfigFileName, configs_Joystick2, "[Joystick2]");
650: Configuration_SaveSection(sConfigFileName, configs_Joystick3, "[Joystick3]");
651: Configuration_SaveSection(sConfigFileName, configs_Joystick4, "[Joystick4]");
652: Configuration_SaveSection(sConfigFileName, configs_Joystick5, "[Joystick5]");
1.1.1.9 root 653: Configuration_SaveSection(sConfigFileName, configs_Keyboard, "[Keyboard]");
1.1.1.11 root 654: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
655: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.9 root 656: Configuration_SaveSection(sConfigFileName, configs_Sound, "[Sound]");
657: Configuration_SaveSection(sConfigFileName, configs_Memory, "[Memory]");
658: Configuration_SaveSection(sConfigFileName, configs_Floppy, "[Floppy]");
1.1.1.10 root 659: Configuration_SaveSection(sConfigFileName, configs_HardDisk, "[HardDisk]");
1.1.1.9 root 660: Configuration_SaveSection(sConfigFileName, configs_Rom, "[ROM]");
661: Configuration_SaveSection(sConfigFileName, configs_Rs232, "[RS232]");
662: Configuration_SaveSection(sConfigFileName, configs_Printer, "[Printer]");
663: Configuration_SaveSection(sConfigFileName, configs_Midi, "[Midi]");
664: Configuration_SaveSection(sConfigFileName, configs_System, "[System]");
1.1 root 665: }
1.1.1.6 root 666:
1.1.1.12 root 667:
668: /*-----------------------------------------------------------------------*/
669: /**
670: * Save/restore snapshot of configuration variables
671: * ('MemorySnapShot_Store' handles type)
672: */
1.1.1.13! root 673: void Configuration_MemorySnapShot_Capture(bool bSave)
1.1.1.12 root 674: {
675: MemorySnapShot_Store(ConfigureParams.Rom.szTosImageFileName, sizeof(ConfigureParams.Rom.szTosImageFileName));
676: MemorySnapShot_Store(ConfigureParams.Rom.szCartridgeImageFileName, sizeof(ConfigureParams.Rom.szCartridgeImageFileName));
677:
678: MemorySnapShot_Store(&ConfigureParams.Memory.nMemorySize, sizeof(ConfigureParams.Memory.nMemorySize));
679:
680: MemorySnapShot_Store(&ConfigureParams.HardDisk.bUseHardDiskDirectories, sizeof(ConfigureParams.HardDisk.bUseHardDiskDirectories));
681: MemorySnapShot_Store(ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C], sizeof(ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C]));
682: MemorySnapShot_Store(&ConfigureParams.HardDisk.bUseHardDiskImage, sizeof(ConfigureParams.HardDisk.bUseHardDiskImage));
683: MemorySnapShot_Store(ConfigureParams.HardDisk.szHardDiskImage, sizeof(ConfigureParams.HardDisk.szHardDiskImage));
684:
1.1.1.13! root 685: MemorySnapShot_Store(&ConfigureParams.Screen.nMonitorType, sizeof(ConfigureParams.Screen.nMonitorType));
1.1.1.12 root 686: MemorySnapShot_Store(&ConfigureParams.Screen.bUseExtVdiResolutions, sizeof(ConfigureParams.Screen.bUseExtVdiResolutions));
687: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiWidth, sizeof(ConfigureParams.Screen.nVdiWidth));
688: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiHeight, sizeof(ConfigureParams.Screen.nVdiHeight));
689: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiColors, sizeof(ConfigureParams.Screen.nVdiColors));
690:
691: MemorySnapShot_Store(&ConfigureParams.System.nCpuLevel, sizeof(ConfigureParams.System.nCpuLevel));
692: MemorySnapShot_Store(&ConfigureParams.System.nCpuFreq, sizeof(ConfigureParams.System.nCpuFreq));
693: MemorySnapShot_Store(&ConfigureParams.System.bCompatibleCpu, sizeof(ConfigureParams.System.bCompatibleCpu));
694: MemorySnapShot_Store(&ConfigureParams.System.nMachineType, sizeof(ConfigureParams.System.nMachineType));
695: MemorySnapShot_Store(&ConfigureParams.System.bBlitter, sizeof(ConfigureParams.System.bBlitter));
696: MemorySnapShot_Store(&ConfigureParams.System.nDSPType, sizeof(ConfigureParams.System.nDSPType));
697: MemorySnapShot_Store(&ConfigureParams.System.bRealTimeClock, sizeof(ConfigureParams.System.bRealTimeClock));
698: MemorySnapShot_Store(&ConfigureParams.System.bPatchTimerD, sizeof(ConfigureParams.System.bPatchTimerD));
699: MemorySnapShot_Store(&ConfigureParams.System.bSlowFDC, sizeof(ConfigureParams.System.bSlowFDC));
700:
701: if (!bSave)
702: Configuration_Apply(TRUE);
703: }
704:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.