|
|
1.1 root 1: /*
1.1.1.6 root 2: Hatari - configuration.c
3:
1.1.1.20 root 4: This file is distributed under the GNU General Public License, version 2
5: or at 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:
1.1.1.21! root 14: #include <SDL_keyboard.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.17 root 20: #include "sound.h"
1.1.1.5 root 21: #include "file.h"
1.1.1.9 root 22: #include "log.h"
23: #include "m68000.h"
1.1.1.12 root 24: #include "memorySnapShot.h"
25: #include "paths.h"
1.1.1.9 root 26: #include "screen.h"
27: #include "vdi.h"
28: #include "video.h"
1.1.1.17 root 29: #include "avi_record.h"
30: #include "clocks_timings.h"
1.1.1.20 root 31: #include "68kDisass.h"
1.1.1.21! root 32: #include "fdc.h"
1.1.1.6 root 33:
34:
35: CNF_PARAMS ConfigureParams; /* List of configuration for the emulator */
1.1.1.7 root 36: char sConfigFileName[FILENAME_MAX]; /* Stores the name of the configuration file */
1.1.1.6 root 37:
38:
1.1.1.9 root 39: /* Used to load/save logging options */
40: static const struct Config_Tag configs_Log[] =
41: {
42: { "sLogFileName", String_Tag, ConfigureParams.Log.sLogFileName },
1.1.1.13 root 43: { "sTraceFileName", String_Tag, ConfigureParams.Log.sTraceFileName },
1.1.1.21! root 44: { "nExceptionDebugMask", Int_Tag, &ConfigureParams.Log.nExceptionDebugMask },
1.1.1.9 root 45: { "nTextLogLevel", Int_Tag, &ConfigureParams.Log.nTextLogLevel },
46: { "nAlertDlgLogLevel", Int_Tag, &ConfigureParams.Log.nAlertDlgLogLevel },
1.1.1.12 root 47: { "bConfirmQuit", Bool_Tag, &ConfigureParams.Log.bConfirmQuit },
1.1.1.20 root 48: { "bNatFeats", Bool_Tag, &ConfigureParams.Log.bNatFeats },
49: { "bConsoleWindow", Bool_Tag, &ConfigureParams.Log.bConsoleWindow },
1.1.1.9 root 50: { NULL , Error_Tag, NULL }
51: };
52:
1.1.1.16 root 53: /* Used to load/save debugger options */
54: static const struct Config_Tag configs_Debugger[] =
55: {
56: { "nNumberBase", Int_Tag, &ConfigureParams.Debugger.nNumberBase },
57: { "nDisasmLines", Int_Tag, &ConfigureParams.Debugger.nDisasmLines },
58: { "nMemdumpLines", Int_Tag, &ConfigureParams.Debugger.nMemdumpLines },
1.1.1.20 root 59: { "nDisasmOptions", Int_Tag, &ConfigureParams.Debugger.nDisasmOptions },
60: { "bDisasmUAE", Bool_Tag, &ConfigureParams.Debugger.bDisasmUAE },
1.1.1.16 root 61: { NULL , Error_Tag, NULL }
62: };
1.1.1.9 root 63:
1.1.1.6 root 64: /* Used to load/save screen options */
1.1.1.9 root 65: static const struct Config_Tag configs_Screen[] =
1.1.1.6 root 66: {
1.1.1.13 root 67: { "nMonitorType", Int_Tag, &ConfigureParams.Screen.nMonitorType },
68: { "nFrameSkips", Int_Tag, &ConfigureParams.Screen.nFrameSkips },
1.1.1.9 root 69: { "bFullScreen", Bool_Tag, &ConfigureParams.Screen.bFullScreen },
1.1.1.17 root 70: { "bKeepResolution", Bool_Tag, &ConfigureParams.Screen.bKeepResolution },
1.1.1.18 root 71: { "bKeepResolutionST", Bool_Tag, &ConfigureParams.Screen.bKeepResolutionST },
1.1.1.9 root 72: { "bAllowOverscan", Bool_Tag, &ConfigureParams.Screen.bAllowOverscan },
1.1.1.12 root 73: { "nSpec512Threshold", Int_Tag, &ConfigureParams.Screen.nSpec512Threshold },
74: { "nForceBpp", Int_Tag, &ConfigureParams.Screen.nForceBpp },
1.1.1.16 root 75: { "bAspectCorrect", Bool_Tag, &ConfigureParams.Screen.bAspectCorrect },
1.1.1.9 root 76: { "bUseExtVdiResolutions", Bool_Tag, &ConfigureParams.Screen.bUseExtVdiResolutions },
1.1.1.12 root 77: { "nVdiWidth", Int_Tag, &ConfigureParams.Screen.nVdiWidth },
78: { "nVdiHeight", Int_Tag, &ConfigureParams.Screen.nVdiHeight },
1.1.1.9 root 79: { "nVdiColors", Int_Tag, &ConfigureParams.Screen.nVdiColors },
1.1.1.13 root 80: { "bShowStatusbar", Bool_Tag, &ConfigureParams.Screen.bShowStatusbar },
81: { "bShowDriveLed", Bool_Tag, &ConfigureParams.Screen.bShowDriveLed },
1.1.1.17 root 82: { "bCrop", Bool_Tag, &ConfigureParams.Screen.bCrop },
1.1.1.18 root 83: { "bForceMax", Bool_Tag, &ConfigureParams.Screen.bForceMax },
1.1.1.16 root 84: { "nMaxWidth", Int_Tag, &ConfigureParams.Screen.nMaxWidth },
85: { "nMaxHeight", Int_Tag, &ConfigureParams.Screen.nMaxHeight },
1.1.1.9 root 86: { NULL , Error_Tag, NULL }
1.1.1.6 root 87: };
88:
1.1.1.10 root 89: /* Used to load/save joystick 0 options */
1.1.1.9 root 90: static const struct Config_Tag configs_Joystick0[] =
1.1.1.6 root 91: {
1.1.1.10 root 92: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nJoystickMode },
1.1.1.9 root 93: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[0].bEnableAutoFire },
1.1.1.15 root 94: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[0].bEnableJumpOnFire2 },
1.1.1.10 root 95: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nJoyId },
96: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeUp },
97: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeDown },
98: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeLeft },
99: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeRight },
100: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[0].nKeyCodeFire },
1.1.1.9 root 101: { NULL , Error_Tag, NULL }
1.1.1.6 root 102: };
1.1.1.10 root 103:
104: /* Used to load/save joystick 1 options */
1.1.1.9 root 105: static const struct Config_Tag configs_Joystick1[] =
1.1.1.6 root 106: {
1.1.1.10 root 107: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nJoystickMode },
1.1.1.9 root 108: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[1].bEnableAutoFire },
1.1.1.15 root 109: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[1].bEnableJumpOnFire2 },
1.1.1.10 root 110: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nJoyId },
111: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeUp },
112: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeDown },
113: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeLeft },
114: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeRight },
115: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[1].nKeyCodeFire },
116: { NULL , Error_Tag, NULL }
117: };
118:
119: /* Used to load/save joystick 2 options */
120: static const struct Config_Tag configs_Joystick2[] =
121: {
122: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nJoystickMode },
123: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[2].bEnableAutoFire },
1.1.1.15 root 124: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[2].bEnableJumpOnFire2 },
1.1.1.10 root 125: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nJoyId },
126: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeUp },
127: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeDown },
128: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeLeft },
129: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeRight },
130: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[2].nKeyCodeFire },
131: { NULL , Error_Tag, NULL }
132: };
133:
134: /* Used to load/save joystick 3 options */
135: static const struct Config_Tag configs_Joystick3[] =
136: {
137: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nJoystickMode },
138: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[3].bEnableAutoFire },
1.1.1.15 root 139: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[3].bEnableJumpOnFire2 },
1.1.1.10 root 140: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nJoyId },
141: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeUp },
142: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeDown },
143: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeLeft },
144: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeRight },
145: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[3].nKeyCodeFire },
146: { NULL , Error_Tag, NULL }
147: };
148:
149: /* Used to load/save joystick 4 options */
150: static const struct Config_Tag configs_Joystick4[] =
151: {
152: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nJoystickMode },
153: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[4].bEnableAutoFire },
1.1.1.15 root 154: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[4].bEnableJumpOnFire2 },
1.1.1.10 root 155: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nJoyId },
156: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeUp },
157: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeDown },
158: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeLeft },
159: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeRight },
160: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[4].nKeyCodeFire },
161: { NULL , Error_Tag, NULL }
162: };
163:
164: /* Used to load/save joystick 5 options */
165: static const struct Config_Tag configs_Joystick5[] =
166: {
167: { "nJoystickMode", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nJoystickMode },
168: { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[5].bEnableAutoFire },
1.1.1.15 root 169: { "bEnableJumpOnFire2", Bool_Tag, &ConfigureParams.Joysticks.Joy[5].bEnableJumpOnFire2 },
1.1.1.10 root 170: { "nJoyId", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nJoyId },
171: { "nKeyCodeUp", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeUp },
172: { "nKeyCodeDown", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeDown },
173: { "nKeyCodeLeft", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeLeft },
174: { "nKeyCodeRight", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeRight },
175: { "nKeyCodeFire", Int_Tag, &ConfigureParams.Joysticks.Joy[5].nKeyCodeFire },
1.1.1.9 root 176: { NULL , Error_Tag, NULL }
1.1.1.6 root 177: };
1.1.1.5 root 178:
1.1.1.6 root 179: /* Used to load/save keyboard options */
1.1.1.9 root 180: static const struct Config_Tag configs_Keyboard[] =
1.1.1.6 root 181: {
1.1.1.9 root 182: { "bDisableKeyRepeat", Bool_Tag, &ConfigureParams.Keyboard.bDisableKeyRepeat },
183: { "nKeymapType", Int_Tag, &ConfigureParams.Keyboard.nKeymapType },
184: { "szMappingFileName", String_Tag, ConfigureParams.Keyboard.szMappingFileName },
185: { NULL , Error_Tag, NULL }
1.1.1.6 root 186: };
1.1 root 187:
1.1.1.11 root 188: /* Used to load/save shortcut key bindings with modifiers options */
189: static const struct Config_Tag configs_ShortCutWithMod[] =
190: {
191: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] },
192: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] },
1.1.1.16 root 193: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] },
1.1.1.11 root 194: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] },
195: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] },
196: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] },
197: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] },
198: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] },
1.1.1.13 root 199: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] },
1.1.1.11 root 200: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] },
201: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] },
202: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] },
1.1.1.15 root 203: { "keyPause", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_PAUSE] },
204: { "keyDebugger", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_DEBUG] },
1.1.1.11 root 205: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] },
1.1.1.12 root 206: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] },
207: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] },
1.1.1.13 root 208: { "keyInsertDiskA",Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_INSERTDISKA] },
1.1.1.11 root 209: { NULL , Error_Tag, NULL }
210: };
211:
212: /* Used to load/save shortcut key bindings without modifiers options */
213: static const struct Config_Tag configs_ShortCutWithoutMod[] =
214: {
215: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] },
216: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] },
1.1.1.16 root 217: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_MOUSEGRAB] },
1.1.1.11 root 218: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_COLDRESET] },
219: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_WARMRESET] },
220: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SCREENSHOT] },
221: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_BOSSKEY] },
222: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_CURSOREMU] },
1.1.1.13 root 223: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FASTFORWARD] },
1.1.1.11 root 224: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECANIM] },
225: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECSOUND] },
226: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SOUND] },
1.1.1.15 root 227: { "keyPause", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_PAUSE] },
228: { "keyDebugger", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_DEBUG] },
1.1.1.11 root 229: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_QUIT] },
1.1.1.12 root 230: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_LOADMEM] },
231: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SAVEMEM] },
1.1.1.13 root 232: { "keyInsertDiskA",Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_INSERTDISKA] },
1.1.1.11 root 233: { NULL , Error_Tag, NULL }
234: };
235:
236:
1.1.1.6 root 237: /* Used to load/save sound options */
1.1.1.9 root 238: static const struct Config_Tag configs_Sound[] =
1.1.1.6 root 239: {
1.1.1.17 root 240: { "bEnableMicrophone", Bool_Tag, &ConfigureParams.Sound.bEnableMicrophone },
1.1.1.9 root 241: { "bEnableSound", Bool_Tag, &ConfigureParams.Sound.bEnableSound },
1.1.1.19 root 242: { "bEnableSoundSync", Bool_Tag, &ConfigureParams.Sound.bEnableSoundSync },
1.1.1.15 root 243: { "nPlaybackFreq", Int_Tag, &ConfigureParams.Sound.nPlaybackFreq },
1.1.1.16 root 244: { "nSdlAudioBufferSize", Int_Tag, &ConfigureParams.Sound.SdlAudioBufferSize },
1.1.1.17 root 245: { "szYMCaptureFileName", String_Tag, ConfigureParams.Sound.szYMCaptureFileName },
246: { "YmVolumeMixing", Int_Tag, &ConfigureParams.Sound.YmVolumeMixing },
1.1.1.9 root 247: { NULL , Error_Tag, NULL }
1.1.1.6 root 248: };
249:
250: /* Used to load/save memory options */
1.1.1.9 root 251: static const struct Config_Tag configs_Memory[] =
1.1.1.6 root 252: {
1.1.1.9 root 253: { "nMemorySize", Int_Tag, &ConfigureParams.Memory.nMemorySize },
1.1.1.12 root 254: { "bAutoSave", Bool_Tag, &ConfigureParams.Memory.bAutoSave },
1.1.1.9 root 255: { "szMemoryCaptureFileName", String_Tag, ConfigureParams.Memory.szMemoryCaptureFileName },
1.1.1.12 root 256: { "szAutoSaveFileName", String_Tag, ConfigureParams.Memory.szAutoSaveFileName },
1.1.1.9 root 257: { NULL , Error_Tag, NULL }
1.1.1.6 root 258: };
259:
260:
261: /* Used to load/save floppy options */
1.1.1.9 root 262: static const struct Config_Tag configs_Floppy[] =
1.1.1.6 root 263: {
1.1.1.10 root 264: { "bAutoInsertDiskB", Bool_Tag, &ConfigureParams.DiskImage.bAutoInsertDiskB },
1.1.1.18 root 265: { "FastFloppy", Bool_Tag, &ConfigureParams.DiskImage.FastFloppy },
1.1.1.21! root 266: { "EnableDriveA", Bool_Tag, &ConfigureParams.DiskImage.EnableDriveA },
! 267: { "DriveA_NumberOfHeads", Int_Tag, &ConfigureParams.DiskImage.DriveA_NumberOfHeads },
! 268: { "EnableDriveB", Bool_Tag, &ConfigureParams.DiskImage.EnableDriveB },
! 269: { "DriveB_NumberOfHeads", Int_Tag, &ConfigureParams.DiskImage.DriveB_NumberOfHeads },
1.1.1.10 root 270: { "nWriteProtection", Int_Tag, &ConfigureParams.DiskImage.nWriteProtection },
1.1.1.13 root 271: { "szDiskAZipPath", String_Tag, ConfigureParams.DiskImage.szDiskZipPath[0] },
272: { "szDiskAFileName", String_Tag, ConfigureParams.DiskImage.szDiskFileName[0] },
273: { "szDiskBZipPath", String_Tag, ConfigureParams.DiskImage.szDiskZipPath[1] },
274: { "szDiskBFileName", String_Tag, ConfigureParams.DiskImage.szDiskFileName[1] },
1.1.1.10 root 275: { "szDiskImageDirectory", String_Tag, ConfigureParams.DiskImage.szDiskImageDirectory },
276: { NULL , Error_Tag, NULL }
277: };
278:
1.1.1.6 root 279: /* Used to load/save HD options */
1.1.1.10 root 280: static const struct Config_Tag configs_HardDisk[] =
1.1.1.6 root 281: {
1.1.1.10 root 282: { "bBootFromHardDisk", Bool_Tag, &ConfigureParams.HardDisk.bBootFromHardDisk },
283: { "bUseHardDiskDirectory", Bool_Tag, &ConfigureParams.HardDisk.bUseHardDiskDirectories },
284: { "szHardDiskDirectory", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C] },
1.1.1.20 root 285: { "nGemdosCase", Int_Tag, &ConfigureParams.HardDisk.nGemdosCase },
1.1.1.16 root 286: { "nWriteProtection", Int_Tag, &ConfigureParams.HardDisk.nWriteProtection },
1.1.1.21! root 287: { "bUseHardDiskImage", Bool_Tag, &ConfigureParams.Acsi[0].bUseDevice },
! 288: { "szHardDiskImage", String_Tag, ConfigureParams.Acsi[0].sDeviceFile },
1.1.1.16 root 289: { "bUseIdeMasterHardDiskImage", Bool_Tag, &ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage },
290: { "bUseIdeSlaveHardDiskImage", Bool_Tag, &ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage },
291: { "szIdeMasterHardDiskImage", String_Tag, ConfigureParams.HardDisk.szIdeMasterHardDiskImage },
292: { "szIdeSlaveHardDiskImage", String_Tag, ConfigureParams.HardDisk.szIdeSlaveHardDiskImage },
1.1.1.10 root 293: { NULL , Error_Tag, NULL }
294: };
295:
1.1.1.21! root 296: /* Used to load/save ACSI options */
! 297: static const struct Config_Tag configs_Acsi[] =
! 298: {
! 299: // { "bUseDevice0", Bool_Tag, &ConfigureParams.Acsi[0].bUseDevice },
! 300: // { "sDeviceFile0", String_Tag, ConfigureParams.Acsi[0].sDeviceFile },
! 301: { "bUseDevice1", Bool_Tag, &ConfigureParams.Acsi[1].bUseDevice },
! 302: { "sDeviceFile1", String_Tag, ConfigureParams.Acsi[1].sDeviceFile },
! 303: { "bUseDevice2", Bool_Tag, &ConfigureParams.Acsi[2].bUseDevice },
! 304: { "sDeviceFile2", String_Tag, ConfigureParams.Acsi[2].sDeviceFile },
! 305: { "bUseDevice3", Bool_Tag, &ConfigureParams.Acsi[3].bUseDevice },
! 306: { "sDeviceFile3", String_Tag, ConfigureParams.Acsi[3].sDeviceFile },
! 307: { "bUseDevice4", Bool_Tag, &ConfigureParams.Acsi[4].bUseDevice },
! 308: { "sDeviceFile4", String_Tag, ConfigureParams.Acsi[4].sDeviceFile },
! 309: { "bUseDevice5", Bool_Tag, &ConfigureParams.Acsi[5].bUseDevice },
! 310: { "sDeviceFile5", String_Tag, ConfigureParams.Acsi[5].sDeviceFile },
! 311: { "bUseDevice6", Bool_Tag, &ConfigureParams.Acsi[6].bUseDevice },
! 312: { "sDeviceFile6", String_Tag, ConfigureParams.Acsi[6].sDeviceFile },
! 313: { "bUseDevice7", Bool_Tag, &ConfigureParams.Acsi[7].bUseDevice },
! 314: { "sDeviceFile7", String_Tag, ConfigureParams.Acsi[7].sDeviceFile },
! 315: { NULL , Error_Tag, NULL }
! 316: };
! 317:
1.1.1.8 root 318: /* Used to load/save ROM options */
1.1.1.9 root 319: static const struct Config_Tag configs_Rom[] =
1.1.1.6 root 320: {
1.1.1.9 root 321: { "szTosImageFileName", String_Tag, ConfigureParams.Rom.szTosImageFileName },
1.1.1.18 root 322: { "bPatchTos", Bool_Tag, &ConfigureParams.Rom.bPatchTos },
1.1.1.9 root 323: { "szCartridgeImageFileName", String_Tag, ConfigureParams.Rom.szCartridgeImageFileName },
324: { NULL , Error_Tag, NULL }
1.1.1.6 root 325: };
326:
327: /* Used to load/save RS232 options */
1.1.1.9 root 328: static const struct Config_Tag configs_Rs232[] =
1.1.1.6 root 329: {
1.1.1.9 root 330: { "bEnableRS232", Bool_Tag, &ConfigureParams.RS232.bEnableRS232 },
331: { "szOutFileName", String_Tag, ConfigureParams.RS232.szOutFileName },
332: { "szInFileName", String_Tag, ConfigureParams.RS232.szInFileName },
333: { NULL , Error_Tag, NULL }
1.1.1.6 root 334: };
335:
336: /* Used to load/save printer options */
1.1.1.9 root 337: static const struct Config_Tag configs_Printer[] =
1.1.1.6 root 338: {
1.1.1.9 root 339: { "bEnablePrinting", Bool_Tag, &ConfigureParams.Printer.bEnablePrinting },
340: { "szPrintToFileName", String_Tag, ConfigureParams.Printer.szPrintToFileName },
341: { NULL , Error_Tag, NULL }
1.1.1.6 root 342: };
343:
1.1.1.7 root 344: /* Used to load/save MIDI options */
1.1.1.9 root 345: static const struct Config_Tag configs_Midi[] =
1.1.1.7 root 346: {
1.1.1.9 root 347: { "bEnableMidi", Bool_Tag, &ConfigureParams.Midi.bEnableMidi },
1.1.1.14 root 348: { "sMidiInFileName", String_Tag, ConfigureParams.Midi.sMidiInFileName },
349: { "sMidiOutFileName", String_Tag, ConfigureParams.Midi.sMidiOutFileName },
1.1.1.9 root 350: { NULL , Error_Tag, NULL }
1.1.1.7 root 351: };
352:
1.1.1.6 root 353: /* Used to load/save system options */
1.1.1.9 root 354: static const struct Config_Tag configs_System[] =
1.1.1.6 root 355: {
1.1.1.9 root 356: { "nCpuLevel", Int_Tag, &ConfigureParams.System.nCpuLevel },
357: { "nCpuFreq", Int_Tag, &ConfigureParams.System.nCpuFreq },
358: { "bCompatibleCpu", Bool_Tag, &ConfigureParams.System.bCompatibleCpu },
359: { "nMachineType", Int_Tag, &ConfigureParams.System.nMachineType },
360: { "bBlitter", Bool_Tag, &ConfigureParams.System.bBlitter },
1.1.1.12 root 361: { "nDSPType", Int_Tag, &ConfigureParams.System.nDSPType },
1.1.1.9 root 362: { "bRealTimeClock", Bool_Tag, &ConfigureParams.System.bRealTimeClock },
363: { "bPatchTimerD", Bool_Tag, &ConfigureParams.System.bPatchTimerD },
1.1.1.18 root 364: { "bFastBoot", Bool_Tag, &ConfigureParams.System.bFastBoot },
1.1.1.13 root 365: { "bFastForward", Bool_Tag, &ConfigureParams.System.bFastForward },
1.1.1.17 root 366:
367: #if ENABLE_WINUAE_CPU
368: { "bAddressSpace24", Bool_Tag, &ConfigureParams.System.bAddressSpace24 },
369: { "bCycleExactCpu", Bool_Tag, &ConfigureParams.System.bCycleExactCpu },
370: { "n_FPUType", Int_Tag, &ConfigureParams.System.n_FPUType },
371: { "bCompatibleFPU", Bool_Tag, &ConfigureParams.System.bCompatibleFPU },
372: { "bMMU", Bool_Tag, &ConfigureParams.System.bMMU },
373: #endif
374: { NULL , Error_Tag, NULL }
375: };
376:
377: /* Used to load/save video options */
378: static const struct Config_Tag configs_Video[] =
379: {
380: { "AviRecordVcodec", Int_Tag, &ConfigureParams.Video.AviRecordVcodec },
381: { "AviRecordFps", Int_Tag, &ConfigureParams.Video.AviRecordFps },
382: { "AviRecordFile", String_Tag, ConfigureParams.Video.AviRecordFile },
1.1.1.9 root 383: { NULL , Error_Tag, NULL }
1.1.1.6 root 384: };
1.1 root 385:
386:
387: /*-----------------------------------------------------------------------*/
1.1.1.12 root 388: /**
389: * Set default configuration values.
390: */
1.1.1.2 root 391: void Configuration_SetDefault(void)
392: {
1.1.1.9 root 393: int i;
1.1.1.12 root 394: const char *psHomeDir;
395: const char *psWorkingDir;
396:
397: psHomeDir = Paths_GetHatariHome();
398: psWorkingDir = Paths_GetWorkingDir();
1.1.1.4 root 399:
1.1.1.9 root 400: /* Clear parameters */
401: memset(&ConfigureParams, 0, sizeof(CNF_PARAMS));
402:
1.1.1.16 root 403: /* Set defaults for logging and tracing */
1.1.1.9 root 404: strcpy(ConfigureParams.Log.sLogFileName, "stderr");
1.1.1.13 root 405: strcpy(ConfigureParams.Log.sTraceFileName, "stderr");
1.1.1.21! root 406: ConfigureParams.Log.nExceptionDebugMask = DEFAULT_EXCEPTIONS;
1.1.1.13 root 407: ConfigureParams.Log.nTextLogLevel = LOG_TODO;
408: ConfigureParams.Log.nAlertDlgLogLevel = LOG_ERROR;
1.1.1.15 root 409: ConfigureParams.Log.bConfirmQuit = true;
1.1.1.20 root 410: ConfigureParams.Log.bNatFeats = false;
411: ConfigureParams.Log.bConsoleWindow = false;
1.1.1.9 root 412:
1.1.1.16 root 413: /* Set defaults for debugger */
414: ConfigureParams.Debugger.nNumberBase = 10;
415: ConfigureParams.Debugger.nDisasmLines = 8;
416: ConfigureParams.Debugger.nMemdumpLines = 8;
1.1.1.20 root 417: /* external one has nicer output, but isn't as complete as UAE one */
418: ConfigureParams.Debugger.bDisasmUAE = false;
419: ConfigureParams.Debugger.nDisasmOptions = Disasm_GetOptions();
1.1.1.16 root 420:
1.1.1.10 root 421: /* Set defaults for floppy disk images */
1.1.1.15 root 422: ConfigureParams.DiskImage.bAutoInsertDiskB = true;
1.1.1.18 root 423: ConfigureParams.DiskImage.FastFloppy = false;
1.1.1.10 root 424: ConfigureParams.DiskImage.nWriteProtection = WRITEPROT_OFF;
1.1.1.21! root 425:
! 426: ConfigureParams.DiskImage.EnableDriveA = true;
! 427: FDC_Drive_Set_Enable ( 0 , ConfigureParams.DiskImage.EnableDriveA );
! 428: ConfigureParams.DiskImage.DriveA_NumberOfHeads = 2;
! 429: FDC_Drive_Set_NumberOfHeads ( 0 , ConfigureParams.DiskImage.DriveA_NumberOfHeads );
! 430:
! 431: ConfigureParams.DiskImage.EnableDriveB = true;
! 432: FDC_Drive_Set_Enable ( 1 , ConfigureParams.DiskImage.EnableDriveB );
! 433: ConfigureParams.DiskImage.DriveB_NumberOfHeads = 2;
! 434: FDC_Drive_Set_NumberOfHeads ( 1 , ConfigureParams.DiskImage.DriveB_NumberOfHeads );
! 435:
! 436: for (i = 0; i < MAX_FLOPPYDRIVES; i++)
1.1.1.13 root 437: {
438: ConfigureParams.DiskImage.szDiskZipPath[i][0] = '\0';
439: ConfigureParams.DiskImage.szDiskFileName[i][0] = '\0';
440: }
1.1.1.12 root 441: strcpy(ConfigureParams.DiskImage.szDiskImageDirectory, psWorkingDir);
1.1.1.10 root 442: File_AddSlashToEndFileName(ConfigureParams.DiskImage.szDiskImageDirectory);
443:
444: /* Set defaults for hard disks */
1.1.1.15 root 445: ConfigureParams.HardDisk.bBootFromHardDisk = false;
1.1.1.20 root 446: ConfigureParams.HardDisk.nGemdosCase = GEMDOS_NOP;
1.1.1.16 root 447: ConfigureParams.HardDisk.nWriteProtection = WRITEPROT_OFF;
1.1.1.10 root 448: ConfigureParams.HardDisk.nHardDiskDir = DRIVE_C;
1.1.1.15 root 449: ConfigureParams.HardDisk.bUseHardDiskDirectories = false;
1.1.1.13 root 450: for (i = 0; i < MAX_HARDDRIVES; i++)
1.1.1.9 root 451: {
1.1.1.12 root 452: strcpy(ConfigureParams.HardDisk.szHardDiskDirectories[i], psWorkingDir);
1.1.1.10 root 453: File_CleanFileName(ConfigureParams.HardDisk.szHardDiskDirectories[i]);
1.1.1.9 root 454: }
1.1.1.16 root 455: ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage = false;
456: strcpy(ConfigureParams.HardDisk.szIdeMasterHardDiskImage, psWorkingDir);
457: ConfigureParams.HardDisk.bUseIdeSlaveHardDiskImage = false;
458: strcpy(ConfigureParams.HardDisk.szIdeSlaveHardDiskImage, psWorkingDir);
1.1.1.9 root 459:
1.1.1.21! root 460: /* ACSI */
! 461: for (i = 0; i < MAX_ACSI_DEVS; i++)
! 462: {
! 463: ConfigureParams.Acsi[i].bUseDevice = false;
! 464: strcpy(ConfigureParams.Acsi[i].sDeviceFile, psWorkingDir);
! 465: }
! 466:
1.1.1.9 root 467: /* Set defaults for Joysticks */
1.1.1.11 root 468: for (i = 0; i < JOYSTICK_COUNT; i++)
1.1.1.9 root 469: {
1.1.1.10 root 470: ConfigureParams.Joysticks.Joy[i].nJoystickMode = JOYSTICK_DISABLED;
1.1.1.15 root 471: ConfigureParams.Joysticks.Joy[i].bEnableAutoFire = false;
472: ConfigureParams.Joysticks.Joy[i].bEnableJumpOnFire2 = false;
1.1.1.10 root 473: ConfigureParams.Joysticks.Joy[i].nJoyId = i;
474: ConfigureParams.Joysticks.Joy[i].nKeyCodeUp = SDLK_UP;
475: ConfigureParams.Joysticks.Joy[i].nKeyCodeDown = SDLK_DOWN;
476: ConfigureParams.Joysticks.Joy[i].nKeyCodeLeft = SDLK_LEFT;
477: ConfigureParams.Joysticks.Joy[i].nKeyCodeRight = SDLK_RIGHT;
478: ConfigureParams.Joysticks.Joy[i].nKeyCodeFire = SDLK_RCTRL;
1.1.1.9 root 479: }
1.1.1.10 root 480: ConfigureParams.Joysticks.Joy[1].nJoyId = 0; /* ST Joystick #1 is default joystick */
481: ConfigureParams.Joysticks.Joy[0].nJoyId = 1;
1.1.1.13 root 482: ConfigureParams.Joysticks.Joy[1].nJoystickMode = JOYSTICK_REALSTICK;
1.1.1.9 root 483:
484: /* Set defaults for Keyboard */
1.1.1.15 root 485: ConfigureParams.Keyboard.bDisableKeyRepeat = false;
1.1.1.9 root 486: ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
487: strcpy(ConfigureParams.Keyboard.szMappingFileName, "");
1.1.1.11 root 488:
1.1.1.12 root 489: /* Set defaults for Shortcuts */
490: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] = SDLK_F12;
491: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] = SDLK_F11;
1.1.1.13 root 492: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_PAUSE] = SDLK_PAUSE;
1.1.1.11 root 493:
1.1.1.15 root 494: ConfigureParams.Shortcut.withModifier[SHORTCUT_DEBUG] = SDLK_PAUSE;
1.1.1.12 root 495: ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] = SDLK_o;
496: ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] = SDLK_f;
1.1.1.16 root 497: ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] = SDLK_m;
1.1.1.12 root 498: ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] = SDLK_c;
499: ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] = SDLK_r;
500: ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] = SDLK_g;
501: ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] = SDLK_i;
502: ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] = SDLK_j;
1.1.1.13 root 503: ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] = SDLK_x;
1.1.1.12 root 504: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] = SDLK_a;
505: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] = SDLK_y;
506: ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] = SDLK_s;
507: ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] = SDLK_q;
508: ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] = SDLK_l;
509: ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] = SDLK_k;
1.1.1.13 root 510: ConfigureParams.Shortcut.withModifier[SHORTCUT_INSERTDISKA] = SDLK_d;
511:
1.1.1.9 root 512: /* Set defaults for Memory */
1.1.1.10 root 513: ConfigureParams.Memory.nMemorySize = 1; /* 1 MiB */
1.1.1.15 root 514: ConfigureParams.Memory.bAutoSave = false;
1.1.1.12 root 515: sprintf(ConfigureParams.Memory.szMemoryCaptureFileName, "%s%chatari.sav",
516: psHomeDir, PATHSEP);
517: sprintf(ConfigureParams.Memory.szAutoSaveFileName, "%s%cauto.sav",
518: psHomeDir, PATHSEP);
1.1.1.9 root 519:
520: /* Set defaults for Printer */
1.1.1.15 root 521: ConfigureParams.Printer.bEnablePrinting = false;
1.1.1.12 root 522: sprintf(ConfigureParams.Printer.szPrintToFileName, "%s%chatari.prn",
523: psHomeDir, PATHSEP);
1.1.1.9 root 524:
525: /* Set defaults for RS232 */
1.1.1.15 root 526: ConfigureParams.RS232.bEnableRS232 = false;
1.1.1.9 root 527: strcpy(ConfigureParams.RS232.szOutFileName, "/dev/modem");
528: strcpy(ConfigureParams.RS232.szInFileName, "/dev/modem");
529:
530: /* Set defaults for MIDI */
1.1.1.15 root 531: ConfigureParams.Midi.bEnableMidi = false;
1.1.1.14 root 532: strcpy(ConfigureParams.Midi.sMidiInFileName, "/dev/snd/midiC1D0");
533: strcpy(ConfigureParams.Midi.sMidiOutFileName, "/dev/snd/midiC1D0");
1.1.1.9 root 534:
535: /* Set defaults for Screen */
1.1.1.15 root 536: ConfigureParams.Screen.bFullScreen = false;
1.1.1.17 root 537: ConfigureParams.Screen.bKeepResolution = true;
1.1.1.18 root 538: ConfigureParams.Screen.bKeepResolutionST = false;
1.1.1.13 root 539: ConfigureParams.Screen.nFrameSkips = AUTO_FRAMESKIP_LIMIT;
1.1.1.15 root 540: ConfigureParams.Screen.bAllowOverscan = true;
1.1.1.21! root 541: ConfigureParams.Screen.nSpec512Threshold = 1;
1.1.1.12 root 542: ConfigureParams.Screen.nForceBpp = 0;
1.1.1.16 root 543: ConfigureParams.Screen.bAspectCorrect = true;
1.1.1.13 root 544: ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_RGB;
1.1.1.15 root 545: ConfigureParams.Screen.bUseExtVdiResolutions = false;
1.1.1.12 root 546: ConfigureParams.Screen.nVdiWidth = 640;
547: ConfigureParams.Screen.nVdiHeight = 480;
548: ConfigureParams.Screen.nVdiColors = GEMCOLOR_16;
1.1.1.15 root 549: ConfigureParams.Screen.bShowStatusbar = true;
550: ConfigureParams.Screen.bShowDriveLed = true;
1.1.1.17 root 551: ConfigureParams.Screen.bCrop = false;
1.1.1.19 root 552: /* gives zoomed Falcon/TT windows about same size as ST/STE windows */
553: ConfigureParams.Screen.nMaxWidth = 2*(48+320+48);
554: ConfigureParams.Screen.nMaxHeight = 2*NUM_VISIBLE_LINES+24;
1.1.1.18 root 555: ConfigureParams.Screen.bForceMax = false;
1.1.1.9 root 556:
557: /* Set defaults for Sound */
1.1.1.17 root 558: ConfigureParams.Sound.bEnableMicrophone = true;
1.1.1.15 root 559: ConfigureParams.Sound.bEnableSound = true;
1.1.1.19 root 560: ConfigureParams.Sound.bEnableSoundSync = false;
1.1.1.15 root 561: ConfigureParams.Sound.nPlaybackFreq = 44100;
1.1.1.12 root 562: sprintf(ConfigureParams.Sound.szYMCaptureFileName, "%s%chatari.wav",
563: psWorkingDir, PATHSEP);
1.1.1.16 root 564: ConfigureParams.Sound.SdlAudioBufferSize = 0;
1.1.1.17 root 565: ConfigureParams.Sound.YmVolumeMixing = YM_TABLE_MIXING;
1.1.1.9 root 566:
567: /* Set defaults for Rom */
1.1.1.12 root 568: sprintf(ConfigureParams.Rom.szTosImageFileName, "%s%ctos.img",
569: Paths_GetDataDir(), PATHSEP);
1.1.1.18 root 570: ConfigureParams.Rom.bPatchTos = true;
1.1.1.9 root 571: strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
572:
573: /* Set defaults for System */
1.1.1.19 root 574: #if ENABLE_WINUAE_CPU
575: /* Default to Falcon with WinUAE CPU core... */
576: ConfigureParams.System.nMachineType = MACHINE_FALCON;
577: ConfigureParams.System.nCpuLevel = 3;
578: ConfigureParams.System.nCpuFreq = 16;
579: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
580: ConfigureParams.System.bAddressSpace24 = true;
581: ConfigureParams.System.n_FPUType = FPU_NONE;
582: ConfigureParams.System.bCompatibleFPU = true;
583: ConfigureParams.System.bMMU = false;
584: ConfigureParams.System.bCycleExactCpu = true;
585: #else
586: /* ...and to ST with old UAE CPU core */
1.1.1.9 root 587: ConfigureParams.System.nMachineType = MACHINE_ST;
1.1.1.19 root 588: ConfigureParams.System.nCpuLevel = 0;
589: ConfigureParams.System.nCpuFreq = 8;
1.1.1.12 root 590: ConfigureParams.System.nDSPType = DSP_TYPE_NONE;
1.1.1.19 root 591: #endif
592: ConfigureParams.System.bCompatibleCpu = true;
593: ConfigureParams.System.bBlitter = false;
1.1.1.15 root 594: ConfigureParams.System.bPatchTimerD = true;
1.1.1.18 root 595: ConfigureParams.System.bFastBoot = true;
1.1.1.21! root 596: ConfigureParams.System.bRealTimeClock = false;
1.1.1.15 root 597: ConfigureParams.System.bFastForward = false;
1.1.1.17 root 598:
599: /* Set defaults for Video */
600: #if HAVE_LIBPNG
601: ConfigureParams.Video.AviRecordVcodec = AVI_RECORD_VIDEO_CODEC_PNG;
602: #else
603: ConfigureParams.Video.AviRecordVcodec = AVI_RECORD_VIDEO_CODEC_BMP;
604: #endif
605: ConfigureParams.Video.AviRecordFps = 0; /* automatic FPS */
606: sprintf(ConfigureParams.Video.AviRecordFile, "%s%chatari.avi", psWorkingDir, PATHSEP);
1.1.1.9 root 607:
608: /* Initialize the configuration file name */
1.1.1.12 root 609: if (strlen(psHomeDir) < sizeof(sConfigFileName)-13)
610: sprintf(sConfigFileName, "%s%chatari.cfg", psHomeDir, PATHSEP);
1.1.1.9 root 611: else
612: strcpy(sConfigFileName, "hatari.cfg");
1.1.1.12 root 613:
614: #if defined(__AMIGAOS4__)
615: /* Fix default path names on Amiga OS */
616: sprintf(ConfigureParams.Rom.szTosImageFileName, "%stos.img", Paths_GetDataDir());
617: #endif
1.1.1.2 root 618: }
619:
620:
621: /*-----------------------------------------------------------------------*/
1.1.1.12 root 622: /**
623: * Copy details from configuration structure into global variables for system,
624: * clean file names, etc... Called from main.c and dialog.c files.
625: */
1.1.1.13 root 626: void Configuration_Apply(bool bReset)
1.1.1.8 root 627: {
1.1.1.21! root 628: int i;
! 629:
1.1.1.9 root 630: if (bReset)
631: {
1.1.1.12 root 632: /* Set resolution change */
1.1.1.9 root 633: bUseVDIRes = ConfigureParams.Screen.bUseExtVdiResolutions;
1.1.1.13 root 634: bUseHighRes = ((!bUseVDIRes) && ConfigureParams.Screen.nMonitorType == MONITOR_TYPE_MONO)
1.1.1.12 root 635: || (bUseVDIRes && ConfigureParams.Screen.nVdiColors == GEMCOLOR_2);
636: if (bUseHighRes)
637: {
638: STRes = ST_HIGH_RES;
639: }
640: if (bUseVDIRes)
641: {
642: VDI_SetResolution(ConfigureParams.Screen.nVdiColors,
643: ConfigureParams.Screen.nVdiWidth,
644: ConfigureParams.Screen.nVdiHeight);
1.1.1.17 root 645: bVdiAesIntercept = true;
1.1.1.12 root 646: }
1.1.1.9 root 647: }
1.1.1.13 root 648: if (ConfigureParams.Screen.nFrameSkips < AUTO_FRAMESKIP_LIMIT)
649: {
650: nFrameSkips = ConfigureParams.Screen.nFrameSkips;
651: }
1.1.1.15 root 652:
1.1.1.17 root 653: /* Init clocks for this machine */
654: ClocksTimings_InitMachine ( ConfigureParams.System.nMachineType );
655:
1.1.1.16 root 656: /* Sound settings */
657: /* SDL sound buffer in ms */
658: SdlAudioBufferSize = ConfigureParams.Sound.SdlAudioBufferSize;
659: if ( SdlAudioBufferSize == 0 ) /* use default setting for SDL */
660: ;
661: else if ( SdlAudioBufferSize < 10 ) /* min of 10 ms */
662: SdlAudioBufferSize = 10;
663: else if ( SdlAudioBufferSize > 100 ) /* max of 100 ms */
664: SdlAudioBufferSize = 100;
665:
1.1.1.9 root 666: /* Set playback frequency */
1.1.1.15 root 667: Audio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackFreq);
668:
1.1.1.17 root 669: /* YM Mixing */
670: if ( ( ConfigureParams.Sound.YmVolumeMixing != YM_LINEAR_MIXING )
1.1.1.18 root 671: && ( ConfigureParams.Sound.YmVolumeMixing != YM_TABLE_MIXING )
672: && ( ConfigureParams.Sound.YmVolumeMixing != YM_MODEL_MIXING ) )
1.1.1.17 root 673: ConfigureParams.Sound.YmVolumeMixing = YM_TABLE_MIXING;
674:
675: YmVolumeMixing = ConfigureParams.Sound.YmVolumeMixing;
676: Sound_SetYmVolumeMixing();
677:
678: /* Check/constrain CPU settings and change corresponding
679: * UAE cpu_level & cpu_compatible variables
680: */
681: M68000_CheckCpuSettings();
1.1.1.9 root 682:
683: /* Clean file and directory names */
684: File_MakeAbsoluteName(ConfigureParams.Rom.szTosImageFileName);
1.1.1.11 root 685: if (strlen(ConfigureParams.Rom.szCartridgeImageFileName) > 0)
686: File_MakeAbsoluteName(ConfigureParams.Rom.szCartridgeImageFileName);
1.1.1.10 root 687: File_CleanFileName(ConfigureParams.HardDisk.szHardDiskDirectories[0]);
688: File_MakeAbsoluteName(ConfigureParams.HardDisk.szHardDiskDirectories[0]);
1.1.1.12 root 689: File_MakeAbsoluteName(ConfigureParams.Memory.szMemoryCaptureFileName);
690: File_MakeAbsoluteName(ConfigureParams.Sound.szYMCaptureFileName);
691: if (strlen(ConfigureParams.Keyboard.szMappingFileName) > 0)
692: File_MakeAbsoluteName(ConfigureParams.Keyboard.szMappingFileName);
1.1.1.17 root 693: File_MakeAbsoluteName(ConfigureParams.Video.AviRecordFile);
1.1.1.21! root 694: for (i = 0; i < MAX_ACSI_DEVS; i++)
! 695: {
! 696: File_MakeAbsoluteName(ConfigureParams.Acsi[i].sDeviceFile);
! 697: }
! 698:
1.1.1.12 root 699: /* make path names absolute, but handle special file names */
700: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sLogFileName);
1.1.1.13 root 701: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sTraceFileName);
1.1.1.14 root 702: File_MakeAbsoluteSpecialName(ConfigureParams.RS232.szInFileName);
703: File_MakeAbsoluteSpecialName(ConfigureParams.RS232.szOutFileName);
704: File_MakeAbsoluteSpecialName(ConfigureParams.Midi.sMidiInFileName);
705: File_MakeAbsoluteSpecialName(ConfigureParams.Midi.sMidiOutFileName);
1.1.1.12 root 706: File_MakeAbsoluteSpecialName(ConfigureParams.Printer.szPrintToFileName);
1.1.1.21! root 707:
! 708: /* Enable/disable floppy drives */
! 709: FDC_Drive_Set_Enable ( 0 , ConfigureParams.DiskImage.EnableDriveA );
! 710: FDC_Drive_Set_Enable ( 1 , ConfigureParams.DiskImage.EnableDriveB );
! 711: FDC_Drive_Set_NumberOfHeads ( 0 , ConfigureParams.DiskImage.DriveA_NumberOfHeads );
! 712: FDC_Drive_Set_NumberOfHeads ( 1 , ConfigureParams.DiskImage.DriveB_NumberOfHeads );
1.1.1.8 root 713: }
714:
715:
716: /*-----------------------------------------------------------------------*/
1.1.1.12 root 717: /**
718: * Load a settings section from the configuration file.
719: */
1.1.1.9 root 720: static int Configuration_LoadSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1 root 721: {
1.1.1.9 root 722: int ret;
1.1 root 723:
1.1.1.9 root 724: ret = input_config(pFilename, configs, pSection);
1.1 root 725:
1.1.1.9 root 726: if (ret < 0)
727: fprintf(stderr, "Can not load configuration file %s (section %s).\n",
1.1.1.16 root 728: pFilename, pSection);
1.1 root 729:
1.1.1.9 root 730: return ret;
1.1 root 731: }
732:
733:
734: /*-----------------------------------------------------------------------*/
1.1.1.12 root 735: /**
736: * Load program setting from configuration file. If psFileName is NULL, use
1.1.1.16 root 737: * the configuration file given in configuration / last selected by user.
1.1.1.12 root 738: */
1.1.1.9 root 739: void Configuration_Load(const char *psFileName)
1.1 root 740: {
1.1.1.9 root 741: if (psFileName == NULL)
742: psFileName = sConfigFileName;
743:
744: if (!File_Exists(psFileName))
745: {
1.1.1.17 root 746: Log_Printf(LOG_DEBUG, "Configuration file %s not found.\n", psFileName);
1.1.1.9 root 747: return;
748: }
749:
750: Configuration_LoadSection(psFileName, configs_Log, "[Log]");
1.1.1.16 root 751: Configuration_LoadSection(psFileName, configs_Debugger, "[Debugger]");
1.1.1.9 root 752: Configuration_LoadSection(psFileName, configs_Screen, "[Screen]");
753: Configuration_LoadSection(psFileName, configs_Joystick0, "[Joystick0]");
754: Configuration_LoadSection(psFileName, configs_Joystick1, "[Joystick1]");
1.1.1.10 root 755: Configuration_LoadSection(psFileName, configs_Joystick2, "[Joystick2]");
756: Configuration_LoadSection(psFileName, configs_Joystick3, "[Joystick3]");
757: Configuration_LoadSection(psFileName, configs_Joystick4, "[Joystick4]");
758: Configuration_LoadSection(psFileName, configs_Joystick5, "[Joystick5]");
1.1.1.9 root 759: Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]");
1.1.1.11 root 760: Configuration_LoadSection(psFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
761: Configuration_LoadSection(psFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.9 root 762: Configuration_LoadSection(psFileName, configs_Sound, "[Sound]");
763: Configuration_LoadSection(psFileName, configs_Memory, "[Memory]");
764: Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]");
1.1.1.10 root 765: Configuration_LoadSection(psFileName, configs_HardDisk, "[HardDisk]");
1.1.1.21! root 766: Configuration_LoadSection(psFileName, configs_Acsi, "[ACSI]");
1.1.1.9 root 767: Configuration_LoadSection(psFileName, configs_Rom, "[ROM]");
768: Configuration_LoadSection(psFileName, configs_Rs232, "[RS232]");
769: Configuration_LoadSection(psFileName, configs_Printer, "[Printer]");
770: Configuration_LoadSection(psFileName, configs_Midi, "[Midi]");
771: Configuration_LoadSection(psFileName, configs_System, "[System]");
1.1.1.17 root 772: Configuration_LoadSection(psFileName, configs_Video, "[Video]");
1.1 root 773: }
774:
775:
776: /*-----------------------------------------------------------------------*/
1.1.1.12 root 777: /**
778: * Save a settings section to configuration file
779: */
1.1.1.9 root 780: static int Configuration_SaveSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1 root 781: {
1.1.1.9 root 782: int ret;
1.1 root 783:
1.1.1.9 root 784: ret = update_config(pFilename, configs, pSection);
1.1 root 785:
1.1.1.9 root 786: if (ret < 0)
1.1.1.16 root 787: fprintf(stderr, "Error while updating section %s in %s\n", pSection, pFilename);
1.1 root 788:
1.1.1.9 root 789: return ret;
1.1 root 790: }
791:
792:
793: /*-----------------------------------------------------------------------*/
1.1.1.12 root 794: /**
795: * Save program setting to configuration file
796: */
1.1.1.6 root 797: void Configuration_Save(void)
1.1 root 798: {
1.1.1.9 root 799: if (Configuration_SaveSection(sConfigFileName, configs_Log, "[Log]") < 0)
800: {
1.1.1.13 root 801: Log_AlertDlg(LOG_ERROR, "Error saving config file.");
1.1.1.9 root 802: return;
803: }
1.1.1.16 root 804: Configuration_SaveSection(sConfigFileName, configs_Debugger, "[Debugger]");
1.1.1.9 root 805: Configuration_SaveSection(sConfigFileName, configs_Screen, "[Screen]");
806: Configuration_SaveSection(sConfigFileName, configs_Joystick0, "[Joystick0]");
807: Configuration_SaveSection(sConfigFileName, configs_Joystick1, "[Joystick1]");
1.1.1.10 root 808: Configuration_SaveSection(sConfigFileName, configs_Joystick2, "[Joystick2]");
809: Configuration_SaveSection(sConfigFileName, configs_Joystick3, "[Joystick3]");
810: Configuration_SaveSection(sConfigFileName, configs_Joystick4, "[Joystick4]");
811: Configuration_SaveSection(sConfigFileName, configs_Joystick5, "[Joystick5]");
1.1.1.9 root 812: Configuration_SaveSection(sConfigFileName, configs_Keyboard, "[Keyboard]");
1.1.1.11 root 813: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
814: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.9 root 815: Configuration_SaveSection(sConfigFileName, configs_Sound, "[Sound]");
816: Configuration_SaveSection(sConfigFileName, configs_Memory, "[Memory]");
817: Configuration_SaveSection(sConfigFileName, configs_Floppy, "[Floppy]");
1.1.1.10 root 818: Configuration_SaveSection(sConfigFileName, configs_HardDisk, "[HardDisk]");
1.1.1.21! root 819: /*Configuration_SaveSection(sConfigFileName, configs_Acsi, "[ACSI]");*/
1.1.1.9 root 820: Configuration_SaveSection(sConfigFileName, configs_Rom, "[ROM]");
821: Configuration_SaveSection(sConfigFileName, configs_Rs232, "[RS232]");
822: Configuration_SaveSection(sConfigFileName, configs_Printer, "[Printer]");
823: Configuration_SaveSection(sConfigFileName, configs_Midi, "[Midi]");
824: Configuration_SaveSection(sConfigFileName, configs_System, "[System]");
1.1.1.17 root 825: Configuration_SaveSection(sConfigFileName, configs_Video, "[Video]");
1.1 root 826: }
1.1.1.6 root 827:
1.1.1.12 root 828:
829: /*-----------------------------------------------------------------------*/
830: /**
831: * Save/restore snapshot of configuration variables
832: * ('MemorySnapShot_Store' handles type)
833: */
1.1.1.13 root 834: void Configuration_MemorySnapShot_Capture(bool bSave)
1.1.1.12 root 835: {
1.1.1.21! root 836: int i;
! 837:
1.1.1.12 root 838: MemorySnapShot_Store(ConfigureParams.Rom.szTosImageFileName, sizeof(ConfigureParams.Rom.szTosImageFileName));
839: MemorySnapShot_Store(ConfigureParams.Rom.szCartridgeImageFileName, sizeof(ConfigureParams.Rom.szCartridgeImageFileName));
840:
841: MemorySnapShot_Store(&ConfigureParams.Memory.nMemorySize, sizeof(ConfigureParams.Memory.nMemorySize));
842:
1.1.1.18 root 843: MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskFileName[0], sizeof(ConfigureParams.DiskImage.szDiskFileName[0]));
844: MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskZipPath[0], sizeof(ConfigureParams.DiskImage.szDiskZipPath[0]));
1.1.1.21! root 845: MemorySnapShot_Store(&ConfigureParams.DiskImage.EnableDriveA, sizeof(ConfigureParams.DiskImage.EnableDriveA));
! 846: MemorySnapShot_Store(&ConfigureParams.DiskImage.DriveA_NumberOfHeads, sizeof(ConfigureParams.DiskImage.DriveA_NumberOfHeads));
1.1.1.18 root 847: MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskFileName[1], sizeof(ConfigureParams.DiskImage.szDiskFileName[1]));
848: MemorySnapShot_Store(&ConfigureParams.DiskImage.szDiskZipPath[1], sizeof(ConfigureParams.DiskImage.szDiskZipPath[1]));
1.1.1.21! root 849: MemorySnapShot_Store(&ConfigureParams.DiskImage.EnableDriveB, sizeof(ConfigureParams.DiskImage.EnableDriveB));
! 850: MemorySnapShot_Store(&ConfigureParams.DiskImage.DriveB_NumberOfHeads, sizeof(ConfigureParams.DiskImage.DriveB_NumberOfHeads));
1.1.1.18 root 851:
1.1.1.12 root 852: MemorySnapShot_Store(&ConfigureParams.HardDisk.bUseHardDiskDirectories, sizeof(ConfigureParams.HardDisk.bUseHardDiskDirectories));
853: MemorySnapShot_Store(ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C], sizeof(ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C]));
1.1.1.21! root 854: for (i = 0; i < MAX_ACSI_DEVS; i++)
! 855: {
! 856: MemorySnapShot_Store(&ConfigureParams.Acsi[i].bUseDevice, sizeof(ConfigureParams.Acsi[i].bUseDevice));
! 857: MemorySnapShot_Store(ConfigureParams.Acsi[i].sDeviceFile, sizeof(ConfigureParams.Acsi[i].sDeviceFile));
! 858: }
1.1.1.12 root 859:
1.1.1.13 root 860: MemorySnapShot_Store(&ConfigureParams.Screen.nMonitorType, sizeof(ConfigureParams.Screen.nMonitorType));
1.1.1.12 root 861: MemorySnapShot_Store(&ConfigureParams.Screen.bUseExtVdiResolutions, sizeof(ConfigureParams.Screen.bUseExtVdiResolutions));
862: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiWidth, sizeof(ConfigureParams.Screen.nVdiWidth));
863: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiHeight, sizeof(ConfigureParams.Screen.nVdiHeight));
864: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiColors, sizeof(ConfigureParams.Screen.nVdiColors));
865:
866: MemorySnapShot_Store(&ConfigureParams.System.nCpuLevel, sizeof(ConfigureParams.System.nCpuLevel));
867: MemorySnapShot_Store(&ConfigureParams.System.nCpuFreq, sizeof(ConfigureParams.System.nCpuFreq));
868: MemorySnapShot_Store(&ConfigureParams.System.bCompatibleCpu, sizeof(ConfigureParams.System.bCompatibleCpu));
869: MemorySnapShot_Store(&ConfigureParams.System.nMachineType, sizeof(ConfigureParams.System.nMachineType));
870: MemorySnapShot_Store(&ConfigureParams.System.bBlitter, sizeof(ConfigureParams.System.bBlitter));
871: MemorySnapShot_Store(&ConfigureParams.System.nDSPType, sizeof(ConfigureParams.System.nDSPType));
872: MemorySnapShot_Store(&ConfigureParams.System.bRealTimeClock, sizeof(ConfigureParams.System.bRealTimeClock));
873: MemorySnapShot_Store(&ConfigureParams.System.bPatchTimerD, sizeof(ConfigureParams.System.bPatchTimerD));
1.1.1.17 root 874:
875: #if ENABLE_WINUAE_CPU
876: MemorySnapShot_Store(&ConfigureParams.System.bAddressSpace24, sizeof(ConfigureParams.System.bAddressSpace24));
877: MemorySnapShot_Store(&ConfigureParams.System.bCycleExactCpu, sizeof(ConfigureParams.System.bCycleExactCpu));
878: MemorySnapShot_Store(&ConfigureParams.System.n_FPUType, sizeof(ConfigureParams.System.n_FPUType));
879: MemorySnapShot_Store(&ConfigureParams.System.bCompatibleFPU, sizeof(ConfigureParams.System.bCompatibleFPU));
880: MemorySnapShot_Store(&ConfigureParams.System.bMMU, sizeof(ConfigureParams.System.bMMU));
881: #endif
882:
1.1.1.18 root 883: MemorySnapShot_Store(&ConfigureParams.DiskImage.FastFloppy, sizeof(ConfigureParams.DiskImage.FastFloppy));
1.1.1.12 root 884:
885: if (!bSave)
1.1.1.15 root 886: Configuration_Apply(true);
1.1.1.12 root 887: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.