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