|
|
1.1 root 1: /*
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.
6:
7: Configuration File
8:
9: The configuration file is now stored in an ASCII format to allow the user
10: to edit the file manually.
11: */
12: const char Configuration_fileid[] = "Hatari configuration.c : " __DATE__ " " __TIME__;
13:
1.1.1.4 ! root 14: #include <SDL_keyboard.h>
1.1 root 15:
16: #include "main.h"
17: #include "configuration.h"
18: #include "cfgopts.h"
19: #include "file.h"
20: #include "log.h"
21: #include "m68000.h"
22: #include "memorySnapShot.h"
23: #include "paths.h"
24: #include "screen.h"
25: #include "video.h"
1.1.1.2 root 26: #include "avi_record.h"
27: #include "clocks_timings.h"
1.1 root 28:
29:
30: CNF_PARAMS ConfigureParams; /* List of configuration for the emulator */
31: char sConfigFileName[FILENAME_MAX]; /* Stores the name of the configuration file */
32:
33:
34: /* Used to load/save logging options */
35: static const struct Config_Tag configs_Log[] =
36: {
37: { "sLogFileName", String_Tag, ConfigureParams.Log.sLogFileName },
38: { "sTraceFileName", String_Tag, ConfigureParams.Log.sTraceFileName },
39: { "nTextLogLevel", Int_Tag, &ConfigureParams.Log.nTextLogLevel },
40: { "nAlertDlgLogLevel", Int_Tag, &ConfigureParams.Log.nAlertDlgLogLevel },
41: { "bConfirmQuit", Bool_Tag, &ConfigureParams.Log.bConfirmQuit },
42: { NULL , Error_Tag, NULL }
43: };
44:
1.1.1.3 root 45: /* Used to load/save configuration dialog options */
46: static const struct Config_Tag configs_ConfigDialog[] =
47: {
48: { "bShowConfigDialogAtStartup", Bool_Tag, &ConfigureParams.ConfigDialog.bShowConfigDialogAtStartup },
49: { NULL , Error_Tag, NULL }
50: };
51:
1.1 root 52: /* Used to load/save debugger options */
53: static const struct Config_Tag configs_Debugger[] =
54: {
55: { "nNumberBase", Int_Tag, &ConfigureParams.Debugger.nNumberBase },
56: { "nDisasmLines", Int_Tag, &ConfigureParams.Debugger.nDisasmLines },
57: { "nMemdumpLines", Int_Tag, &ConfigureParams.Debugger.nMemdumpLines },
58: { NULL , Error_Tag, NULL }
59: };
60:
61: /* Used to load/save screen options */
62: static const struct Config_Tag configs_Screen[] =
63: {
64: { "nMonitorType", Int_Tag, &ConfigureParams.Screen.nMonitorType },
1.1.1.2 root 65: // { "nFrameSkips", Int_Tag, &ConfigureParams.Screen.nFrameSkips },
1.1 root 66: { "bFullScreen", Bool_Tag, &ConfigureParams.Screen.bFullScreen },
1.1.1.2 root 67: { "bKeepResolution", Bool_Tag, &ConfigureParams.Screen.bKeepResolution },
1.1 root 68: { "bAllowOverscan", Bool_Tag, &ConfigureParams.Screen.bAllowOverscan },
69: { "nSpec512Threshold", Int_Tag, &ConfigureParams.Screen.nSpec512Threshold },
70: { "nForceBpp", Int_Tag, &ConfigureParams.Screen.nForceBpp },
71: { "bAspectCorrect", Bool_Tag, &ConfigureParams.Screen.bAspectCorrect },
72: { "bUseExtVdiResolutions", Bool_Tag, &ConfigureParams.Screen.bUseExtVdiResolutions },
73: { "nVdiWidth", Int_Tag, &ConfigureParams.Screen.nVdiWidth },
74: { "nVdiHeight", Int_Tag, &ConfigureParams.Screen.nVdiHeight },
75: { "nVdiColors", Int_Tag, &ConfigureParams.Screen.nVdiColors },
76: { "bShowStatusbar", Bool_Tag, &ConfigureParams.Screen.bShowStatusbar },
77: { "bShowDriveLed", Bool_Tag, &ConfigureParams.Screen.bShowDriveLed },
1.1.1.2 root 78: { "bCrop", Bool_Tag, &ConfigureParams.Screen.bCrop },
1.1 root 79: { "nMaxWidth", Int_Tag, &ConfigureParams.Screen.nMaxWidth },
80: { "nMaxHeight", Int_Tag, &ConfigureParams.Screen.nMaxHeight },
81: { NULL , Error_Tag, NULL }
82: };
83:
84: /* Used to load/save keyboard options */
85: static const struct Config_Tag configs_Keyboard[] =
86: {
87: { "bDisableKeyRepeat", Bool_Tag, &ConfigureParams.Keyboard.bDisableKeyRepeat },
1.1.1.4 ! root 88: { "bSwapCmdAlt", Bool_Tag, &ConfigureParams.Keyboard.bSwapCmdAlt },
1.1 root 89: { "nKeymapType", Int_Tag, &ConfigureParams.Keyboard.nKeymapType },
90: { "szMappingFileName", String_Tag, ConfigureParams.Keyboard.szMappingFileName },
91: { NULL , Error_Tag, NULL }
92: };
93:
1.1.1.4 ! root 94: /* Used to load/save mouse options */
! 95: static const struct Config_Tag configs_Mouse[] =
! 96: {
! 97: { "bEnableAutoGrab", Bool_Tag, &ConfigureParams.Mouse.bEnableAutoGrab },
! 98: { "fLinSpeedNormal", Float_Tag, &ConfigureParams.Mouse.fLinSpeedNormal },
! 99: { "fLinSpeedLocked", Float_Tag, &ConfigureParams.Mouse.fLinSpeedLocked },
! 100: { "fExpSpeedNormal", Float_Tag, &ConfigureParams.Mouse.fExpSpeedNormal },
! 101: { "fExpSpeedLocked", Float_Tag, &ConfigureParams.Mouse.fExpSpeedLocked },
! 102: { NULL , Error_Tag, NULL }
! 103: };
! 104:
1.1 root 105: /* Used to load/save shortcut key bindings with modifiers options */
106: static const struct Config_Tag configs_ShortCutWithMod[] =
107: {
108: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] },
109: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] },
110: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] },
111: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] },
112: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] },
113: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] },
114: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] },
115: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] },
116: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] },
117: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] },
118: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] },
119: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] },
120: { "keyPause", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_PAUSE] },
121: { "keyDebugger", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_DEBUG] },
122: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] },
123: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] },
124: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] },
1.1.1.4 ! root 125: { "keyDimension", Int_Tag, &ConfigureParams.Shortcut.withModifier[SHORTCUT_DIMENSION] },
1.1 root 126: { NULL , Error_Tag, NULL }
127: };
128:
129: /* Used to load/save shortcut key bindings without modifiers options */
130: static const struct Config_Tag configs_ShortCutWithoutMod[] =
131: {
132: { "keyOptions", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] },
133: { "keyFullScreen", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] },
134: { "keyMouseMode", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_MOUSEGRAB] },
135: { "keyColdReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_COLDRESET] },
136: { "keyWarmReset", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_WARMRESET] },
137: { "keyScreenShot", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SCREENSHOT] },
138: { "keyBossKey", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_BOSSKEY] },
139: { "keyCursorEmu", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_CURSOREMU] },
140: { "keyFastForward",Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FASTFORWARD] },
141: { "keyRecAnim", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECANIM] },
142: { "keyRecSound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_RECSOUND] },
143: { "keySound", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SOUND] },
144: { "keyPause", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_PAUSE] },
145: { "keyDebugger", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_DEBUG] },
146: { "keyQuit", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_QUIT] },
147: { "keyLoadMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_LOADMEM] },
148: { "keySaveMem", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_SAVEMEM] },
1.1.1.4 ! root 149: { "keyDimension", Int_Tag, &ConfigureParams.Shortcut.withoutModifier[SHORTCUT_DIMENSION] },
1.1 root 150: { NULL , Error_Tag, NULL }
151: };
152:
153:
154: /* Used to load/save sound options */
155: static const struct Config_Tag configs_Sound[] =
156: {
1.1.1.2 root 157: { "bEnableMicrophone", Bool_Tag, &ConfigureParams.Sound.bEnableMicrophone },
158: { "bEnableSound", Bool_Tag, &ConfigureParams.Sound.bEnableSound },
1.1 root 159: { NULL , Error_Tag, NULL }
160: };
161:
162: /* Used to load/save memory options */
163: static const struct Config_Tag configs_Memory[] =
164: {
1.1.1.3 root 165: { "nMemoryBankSize0", Int_Tag, &ConfigureParams.Memory.nMemoryBankSize[0] },
166: { "nMemoryBankSize1", Int_Tag, &ConfigureParams.Memory.nMemoryBankSize[1] },
167: { "nMemoryBankSize2", Int_Tag, &ConfigureParams.Memory.nMemoryBankSize[2] },
168: { "nMemoryBankSize3", Int_Tag, &ConfigureParams.Memory.nMemoryBankSize[3] },
169: { "nMemorySpeed", Int_Tag, &ConfigureParams.Memory.nMemorySpeed },
1.1 root 170: { "bAutoSave", Bool_Tag, &ConfigureParams.Memory.bAutoSave },
171: { "szMemoryCaptureFileName", String_Tag, ConfigureParams.Memory.szMemoryCaptureFileName },
172: { "szAutoSaveFileName", String_Tag, ConfigureParams.Memory.szAutoSaveFileName },
173: { NULL , Error_Tag, NULL }
174: };
175:
1.1.1.3 root 176: /* Used to load/save boot options */
177: static const struct Config_Tag configs_Boot[] =
1.1 root 178: {
1.1.1.3 root 179: { "nBootDevice", Int_Tag, &ConfigureParams.Boot.nBootDevice },
180: { "bEnableDRAMTest", Bool_Tag, &ConfigureParams.Boot.bEnableDRAMTest },
181: { "bEnablePot", Bool_Tag, &ConfigureParams.Boot.bEnablePot },
182: { "bEnableSoundTest", Bool_Tag, &ConfigureParams.Boot.bEnableSoundTest },
183: { "bEnableSCSITest", Bool_Tag, &ConfigureParams.Boot.bEnableSCSITest },
184: { "bLoopPot", Bool_Tag, &ConfigureParams.Boot.bLoopPot },
185: { "bVerbose", Bool_Tag, &ConfigureParams.Boot.bVerbose },
186: { "bExtendedPot", Bool_Tag, &ConfigureParams.Boot.bExtendedPot },
187: { NULL , Error_Tag, NULL }
188: };
189:
190: /* Used to load/save SCSI options */
191: static const struct Config_Tag configs_SCSI[] =
192: {
193: { "szImageName0", String_Tag, ConfigureParams.SCSI.target[0].szImageName },
1.1.1.4 ! root 194: { "nDeviceType0", Int_Tag, &ConfigureParams.SCSI.target[0].nDeviceType },
! 195: { "bDiskInserted0", Bool_Tag, &ConfigureParams.SCSI.target[0].bDiskInserted },
! 196: { "bWriteProtected0", Bool_Tag, &ConfigureParams.SCSI.target[0].bWriteProtected },
1.1.1.3 root 197:
198: { "szImageName1", String_Tag, ConfigureParams.SCSI.target[1].szImageName },
1.1.1.4 ! root 199: { "nDeviceType1", Int_Tag, &ConfigureParams.SCSI.target[1].nDeviceType },
! 200: { "bDiskInserted1", Bool_Tag, &ConfigureParams.SCSI.target[1].bDiskInserted },
! 201: { "bWriteProtected1", Bool_Tag, &ConfigureParams.SCSI.target[1].bWriteProtected },
1.1.1.3 root 202:
203: { "szImageName2", String_Tag, ConfigureParams.SCSI.target[2].szImageName },
1.1.1.4 ! root 204: { "nDeviceType2", Int_Tag, &ConfigureParams.SCSI.target[2].nDeviceType },
! 205: { "bDiskInserted2", Bool_Tag, &ConfigureParams.SCSI.target[2].bDiskInserted },
! 206: { "bWriteProtected2", Bool_Tag, &ConfigureParams.SCSI.target[2].bWriteProtected },
1.1.1.3 root 207:
208: { "szImageName3", String_Tag, ConfigureParams.SCSI.target[3].szImageName },
1.1.1.4 ! root 209: { "nDeviceType3", Int_Tag, &ConfigureParams.SCSI.target[3].nDeviceType },
! 210: { "bDiskInserted3", Bool_Tag, &ConfigureParams.SCSI.target[3].bDiskInserted },
! 211: { "bWriteProtected3", Bool_Tag, &ConfigureParams.SCSI.target[3].bWriteProtected },
1.1.1.3 root 212:
213: { "szImageName4", String_Tag, ConfigureParams.SCSI.target[4].szImageName },
1.1.1.4 ! root 214: { "nDeviceType4", Int_Tag, &ConfigureParams.SCSI.target[4].nDeviceType },
! 215: { "bDiskInserted4", Bool_Tag, &ConfigureParams.SCSI.target[4].bDiskInserted },
! 216: { "bWriteProtected4", Bool_Tag, &ConfigureParams.SCSI.target[4].bWriteProtected },
1.1.1.3 root 217:
218: { "szImageName5", String_Tag, ConfigureParams.SCSI.target[5].szImageName },
1.1.1.4 ! root 219: { "nDeviceType5", Int_Tag, &ConfigureParams.SCSI.target[5].nDeviceType },
! 220: { "bDiskInserted5", Bool_Tag, &ConfigureParams.SCSI.target[5].bDiskInserted },
! 221: { "bWriteProtected5", Bool_Tag, &ConfigureParams.SCSI.target[5].bWriteProtected },
1.1.1.3 root 222:
223: { "szImageName6", String_Tag, ConfigureParams.SCSI.target[6].szImageName },
1.1.1.4 ! root 224: { "nDeviceType6", Int_Tag, &ConfigureParams.SCSI.target[6].nDeviceType },
! 225: { "bDiskInserted6", Bool_Tag, &ConfigureParams.SCSI.target[6].bDiskInserted },
! 226: { "bWriteProtected6", Bool_Tag, &ConfigureParams.SCSI.target[6].bWriteProtected },
! 227:
! 228: { NULL , Error_Tag, NULL }
! 229: };
! 230:
! 231: /* Used to load/save MO options */
! 232: static const struct Config_Tag configs_MO[] =
! 233: {
! 234: { "szImageName0", String_Tag, ConfigureParams.MO.drive[0].szImageName },
! 235: { "bDriveConnected0", Bool_Tag, &ConfigureParams.MO.drive[0].bDriveConnected },
! 236: { "bDiskInserted0", Bool_Tag, &ConfigureParams.MO.drive[0].bDiskInserted },
! 237: { "bWriteProtected0", Bool_Tag, &ConfigureParams.MO.drive[0].bWriteProtected },
! 238:
! 239: { "szImageName1", String_Tag, ConfigureParams.MO.drive[1].szImageName },
! 240: { "bDriveConnected1", Bool_Tag, &ConfigureParams.MO.drive[1].bDriveConnected },
! 241: { "bDiskInserted1", Bool_Tag, &ConfigureParams.MO.drive[1].bDiskInserted },
! 242: { "bWriteProtected1", Bool_Tag, &ConfigureParams.MO.drive[1].bWriteProtected },
1.1.1.3 root 243:
1.1 root 244: { NULL , Error_Tag, NULL }
245: };
246:
1.1.1.4 ! root 247: /* Used to load/save floppy options */
! 248: static const struct Config_Tag configs_Floppy[] =
! 249: {
! 250: { "szImageName0", String_Tag, ConfigureParams.Floppy.drive[0].szImageName },
! 251: { "bDriveConnected0", Bool_Tag, &ConfigureParams.Floppy.drive[0].bDriveConnected },
! 252: { "bDiskInserted0", Bool_Tag, &ConfigureParams.Floppy.drive[0].bDiskInserted },
! 253: { "bWriteProtected0", Bool_Tag, &ConfigureParams.Floppy.drive[0].bWriteProtected },
! 254:
! 255: { "szImageName1", String_Tag, ConfigureParams.Floppy.drive[1].szImageName },
! 256: { "bDriveConnected1", Bool_Tag, &ConfigureParams.Floppy.drive[1].bDriveConnected },
! 257: { "bDiskInserted1", Bool_Tag, &ConfigureParams.Floppy.drive[1].bDiskInserted },
! 258: { "bWriteProtected1", Bool_Tag, &ConfigureParams.Floppy.drive[1].bWriteProtected },
! 259:
! 260: { NULL , Error_Tag, NULL }
! 261: };
! 262:
! 263: /* Used to load/save Ethernet options */
! 264: static const struct Config_Tag configs_Ethernet[] =
! 265: {
! 266: { "bEthernetConnected", Bool_Tag, &ConfigureParams.Ethernet.bEthernetConnected },
! 267:
! 268: { NULL , Error_Tag, NULL }
! 269: };
! 270:
1.1 root 271: /* Used to load/save ROM options */
272: static const struct Config_Tag configs_Rom[] =
273: {
1.1.1.3 root 274: { "szRom030FileName", String_Tag, ConfigureParams.Rom.szRom030FileName },
275: { "szRom040FileName", String_Tag, ConfigureParams.Rom.szRom040FileName },
276: { "szRomTurboFileName", String_Tag, ConfigureParams.Rom.szRomTurboFileName },
1.1 root 277: { NULL , Error_Tag, NULL }
278: };
279:
280: /* Used to load/save RS232 options */
281: static const struct Config_Tag configs_Rs232[] =
282: {
283: { "bEnableRS232", Bool_Tag, &ConfigureParams.RS232.bEnableRS232 },
284: { "szOutFileName", String_Tag, ConfigureParams.RS232.szOutFileName },
285: { "szInFileName", String_Tag, ConfigureParams.RS232.szInFileName },
286: { NULL , Error_Tag, NULL }
287: };
288:
289: /* Used to load/save printer options */
290: static const struct Config_Tag configs_Printer[] =
291: {
1.1.1.4 ! root 292: { "bPrinterConnected", Bool_Tag, &ConfigureParams.Printer.bPrinterConnected },
! 293: { "nPaperSize", Int_Tag, &ConfigureParams.Printer.nPaperSize },
1.1 root 294: { "szPrintToFileName", String_Tag, ConfigureParams.Printer.szPrintToFileName },
295: { NULL , Error_Tag, NULL }
296: };
297:
298: /* Used to load/save MIDI options */
299: static const struct Config_Tag configs_Midi[] =
300: {
301: { "bEnableMidi", Bool_Tag, &ConfigureParams.Midi.bEnableMidi },
302: { "sMidiInFileName", String_Tag, ConfigureParams.Midi.sMidiInFileName },
303: { "sMidiOutFileName", String_Tag, ConfigureParams.Midi.sMidiOutFileName },
304: { NULL , Error_Tag, NULL }
305: };
306:
307: /* Used to load/save system options */
308: static const struct Config_Tag configs_System[] =
309: {
1.1.1.3 root 310: { "nMachineType", Int_Tag, &ConfigureParams.System.nMachineType },
311: { "bColor", Bool_Tag, &ConfigureParams.System.bColor },
312: { "bTurbo", Bool_Tag, &ConfigureParams.System.bTurbo },
1.1.1.4 ! root 313: { "bNBIC", Bool_Tag, &ConfigureParams.System.bNBIC },
1.1.1.3 root 314: { "nSCSI", Bool_Tag, &ConfigureParams.System.nSCSI },
315: { "nRTC", Bool_Tag, &ConfigureParams.System.nRTC },
316:
1.1 root 317: { "nCpuLevel", Int_Tag, &ConfigureParams.System.nCpuLevel },
318: { "nCpuFreq", Int_Tag, &ConfigureParams.System.nCpuFreq },
319: { "bCompatibleCpu", Bool_Tag, &ConfigureParams.System.bCompatibleCpu },
320: { "bBlitter", Bool_Tag, &ConfigureParams.System.bBlitter },
321: { "nDSPType", Int_Tag, &ConfigureParams.System.nDSPType },
1.1.1.4 ! root 322: { "bDSPMemoryExpansion", Bool_Tag, &ConfigureParams.System.bDSPMemoryExpansion },
1.1 root 323: { "bRealTimeClock", Bool_Tag, &ConfigureParams.System.bRealTimeClock },
324: { "bPatchTimerD", Bool_Tag, &ConfigureParams.System.bPatchTimerD },
325: { "bFastForward", Bool_Tag, &ConfigureParams.System.bFastForward },
1.1.1.2 root 326:
327: { "bAddressSpace24", Bool_Tag, &ConfigureParams.System.bAddressSpace24 },
328: { "bCycleExactCpu", Bool_Tag, &ConfigureParams.System.bCycleExactCpu },
329: { "n_FPUType", Int_Tag, &ConfigureParams.System.n_FPUType },
330: { "bCompatibleFPU", Bool_Tag, &ConfigureParams.System.bCompatibleFPU },
331: { "bMMU", Bool_Tag, &ConfigureParams.System.bMMU },
332: { NULL , Error_Tag, NULL }
1.1.1.4 ! root 333: };
! 334:
! 335: /* Used to load/save nextdimension options */
! 336: static const struct Config_Tag configs_Dimension[] =
! 337: {
! 338: { "bEnabled", Bool_Tag, &ConfigureParams.Dimension.bEnabled },
! 339: { "nMemoryBankSize0", Int_Tag, &ConfigureParams.Dimension.nMemoryBankSize[0] },
! 340: { "nMemoryBankSize1", Int_Tag, &ConfigureParams.Dimension.nMemoryBankSize[1] },
! 341: { "nMemoryBankSize2", Int_Tag, &ConfigureParams.Dimension.nMemoryBankSize[2] },
! 342: { "nMemoryBankSize3", Int_Tag, &ConfigureParams.Dimension.nMemoryBankSize[3] },
! 343: { "szRomFileName", String_Tag, ConfigureParams.Dimension.szRomFileName },
! 344: { NULL , Error_Tag, NULL }
! 345: };
1.1.1.2 root 346:
347: /* Used to load/save video options */
348: static const struct Config_Tag configs_Video[] =
349: {
350: { "AviRecordVcodec", Int_Tag, &ConfigureParams.Video.AviRecordVcodec },
351: { "AviRecordFps", Int_Tag, &ConfigureParams.Video.AviRecordFps },
352: { "AviRecordFile", String_Tag, ConfigureParams.Video.AviRecordFile },
1.1 root 353: { NULL , Error_Tag, NULL }
354: };
355:
356:
357: /*-----------------------------------------------------------------------*/
358: /**
359: * Set default configuration values.
360: */
361: void Configuration_SetDefault(void)
362: {
363: int i;
364: const char *psHomeDir;
365: const char *psWorkingDir;
366:
367: psHomeDir = Paths_GetHatariHome();
368: psWorkingDir = Paths_GetWorkingDir();
369:
370: /* Clear parameters */
371: memset(&ConfigureParams, 0, sizeof(CNF_PARAMS));
372:
1.1.1.3 root 373:
1.1 root 374: /* Set defaults for logging and tracing */
375: strcpy(ConfigureParams.Log.sLogFileName, "stderr");
376: strcpy(ConfigureParams.Log.sTraceFileName, "stderr");
377: ConfigureParams.Log.nTextLogLevel = LOG_TODO;
378: ConfigureParams.Log.nAlertDlgLogLevel = LOG_ERROR;
379: ConfigureParams.Log.bConfirmQuit = true;
1.1.1.3 root 380:
381: /* Set defaults for config dialog */
382: ConfigureParams.ConfigDialog.bShowConfigDialogAtStartup = true;
1.1 root 383:
384: /* Set defaults for debugger */
385: ConfigureParams.Debugger.nNumberBase = 10;
386: ConfigureParams.Debugger.nDisasmLines = 8;
387: ConfigureParams.Debugger.nMemdumpLines = 8;
388:
1.1.1.3 root 389: /* Set defaults for Boot options */
390: ConfigureParams.Boot.nBootDevice = BOOT_ROM;
391: ConfigureParams.Boot.bEnableDRAMTest = false;
392: ConfigureParams.Boot.bEnablePot = true;
393: ConfigureParams.Boot.bEnableSoundTest = true;
394: ConfigureParams.Boot.bEnableSCSITest = true;
395: ConfigureParams.Boot.bLoopPot = false;
396: ConfigureParams.Boot.bVerbose = true;
397: ConfigureParams.Boot.bExtendedPot = false;
398:
399: /* Set defaults for SCSI disks */
1.1.1.4 ! root 400: for (i = 0; i < ESP_MAX_DEVS; i++) {
! 401: strcpy(ConfigureParams.SCSI.target[i].szImageName, psWorkingDir);
! 402: ConfigureParams.SCSI.target[i].nDeviceType = DEVTYPE_NONE;
! 403: ConfigureParams.SCSI.target[i].bDiskInserted = false;
! 404: ConfigureParams.SCSI.target[i].bWriteProtected = false;
1.1.1.3 root 405: }
406:
1.1.1.4 ! root 407: /* Set defaults for MO drives */
! 408: for (i = 0; i < MO_MAX_DRIVES; i++) {
! 409: strcpy(ConfigureParams.MO.drive[i].szImageName, psWorkingDir);
! 410: ConfigureParams.MO.drive[i].bDriveConnected = false;
! 411: ConfigureParams.MO.drive[i].bDiskInserted = false;
! 412: ConfigureParams.MO.drive[i].bWriteProtected = false;
! 413: }
! 414:
! 415: /* Set defaults for floppy drives */
! 416: for (i = 0; i < FLP_MAX_DRIVES; i++) {
! 417: strcpy(ConfigureParams.Floppy.drive[i].szImageName, psWorkingDir);
! 418: ConfigureParams.Floppy.drive[i].bDriveConnected = false;
! 419: ConfigureParams.Floppy.drive[i].bDiskInserted = false;
! 420: ConfigureParams.Floppy.drive[i].bWriteProtected = false;
! 421: }
! 422:
! 423: /* Set defaults for Ethernet */
! 424: ConfigureParams.Ethernet.bEthernetConnected = false;
! 425:
1.1 root 426: /* Set defaults for Keyboard */
427: ConfigureParams.Keyboard.bDisableKeyRepeat = false;
1.1.1.4 ! root 428: ConfigureParams.Keyboard.bSwapCmdAlt = false;
! 429: ConfigureParams.Keyboard.nKeymapType = KEYMAP_SCANCODE;
1.1 root 430: strcpy(ConfigureParams.Keyboard.szMappingFileName, "");
1.1.1.4 ! root 431:
! 432: /* Set defaults for Mouse */
! 433: ConfigureParams.Mouse.fLinSpeedNormal = 1.0;
! 434: ConfigureParams.Mouse.fLinSpeedLocked = 1.0;
! 435: ConfigureParams.Mouse.fExpSpeedNormal = 1.0;
! 436: ConfigureParams.Mouse.fExpSpeedLocked = 1.0;
! 437: ConfigureParams.Mouse.bEnableAutoGrab = true;
! 438:
1.1 root 439: /* Set defaults for Shortcuts */
440: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_OPTIONS] = SDLK_F12;
441: ConfigureParams.Shortcut.withoutModifier[SHORTCUT_FULLSCREEN] = SDLK_F11;
1.1.1.2 root 442:
443: ConfigureParams.Shortcut.withModifier[SHORTCUT_PAUSE] = SDLK_p;
444: ConfigureParams.Shortcut.withModifier[SHORTCUT_DEBUG] = SDLK_d;
445:
1.1 root 446: ConfigureParams.Shortcut.withModifier[SHORTCUT_OPTIONS] = SDLK_o;
447: ConfigureParams.Shortcut.withModifier[SHORTCUT_FULLSCREEN] = SDLK_f;
448: ConfigureParams.Shortcut.withModifier[SHORTCUT_MOUSEGRAB] = SDLK_m;
449: ConfigureParams.Shortcut.withModifier[SHORTCUT_COLDRESET] = SDLK_c;
450: ConfigureParams.Shortcut.withModifier[SHORTCUT_WARMRESET] = SDLK_r;
451: ConfigureParams.Shortcut.withModifier[SHORTCUT_SCREENSHOT] = SDLK_g;
452: ConfigureParams.Shortcut.withModifier[SHORTCUT_BOSSKEY] = SDLK_i;
453: ConfigureParams.Shortcut.withModifier[SHORTCUT_CURSOREMU] = SDLK_j;
454: ConfigureParams.Shortcut.withModifier[SHORTCUT_FASTFORWARD] = SDLK_x;
455: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECANIM] = SDLK_a;
456: ConfigureParams.Shortcut.withModifier[SHORTCUT_RECSOUND] = SDLK_y;
457: ConfigureParams.Shortcut.withModifier[SHORTCUT_SOUND] = SDLK_s;
458: ConfigureParams.Shortcut.withModifier[SHORTCUT_QUIT] = SDLK_q;
459: ConfigureParams.Shortcut.withModifier[SHORTCUT_LOADMEM] = SDLK_l;
460: ConfigureParams.Shortcut.withModifier[SHORTCUT_SAVEMEM] = SDLK_k;
1.1.1.4 ! root 461: ConfigureParams.Shortcut.withModifier[SHORTCUT_DIMENSION] = SDLK_n;
1.1 root 462:
463: /* Set defaults for Memory */
1.1.1.3 root 464: memset(ConfigureParams.Memory.nMemoryBankSize, 16,
465: sizeof(ConfigureParams.Memory.nMemoryBankSize)); /* 64 MiB */
466: ConfigureParams.Memory.nMemorySpeed = MEMORY_100NS;
1.1 root 467: ConfigureParams.Memory.bAutoSave = false;
468: sprintf(ConfigureParams.Memory.szMemoryCaptureFileName, "%s%chatari.sav",
469: psHomeDir, PATHSEP);
470: sprintf(ConfigureParams.Memory.szAutoSaveFileName, "%s%cauto.sav",
471: psHomeDir, PATHSEP);
472:
473: /* Set defaults for Printer */
1.1.1.4 ! root 474: ConfigureParams.Printer.bPrinterConnected = false;
! 475: ConfigureParams.Printer.nPaperSize = PAPER_A4;
! 476: sprintf(ConfigureParams.Printer.szPrintToFileName, "%s%c",
1.1 root 477: psHomeDir, PATHSEP);
478:
479: /* Set defaults for RS232 */
480: ConfigureParams.RS232.bEnableRS232 = false;
481: strcpy(ConfigureParams.RS232.szOutFileName, "/dev/modem");
482: strcpy(ConfigureParams.RS232.szInFileName, "/dev/modem");
483:
484: /* Set defaults for MIDI */
485: ConfigureParams.Midi.bEnableMidi = false;
486: strcpy(ConfigureParams.Midi.sMidiInFileName, "/dev/snd/midiC1D0");
487: strcpy(ConfigureParams.Midi.sMidiOutFileName, "/dev/snd/midiC1D0");
488:
489: /* Set defaults for Screen */
490: ConfigureParams.Screen.bFullScreen = false;
1.1.1.2 root 491: ConfigureParams.Screen.bKeepResolution = true;
492: // ConfigureParams.Screen.nFrameSkips = AUTO_FRAMESKIP_LIMIT;
1.1 root 493: ConfigureParams.Screen.bAllowOverscan = true;
494: ConfigureParams.Screen.nSpec512Threshold = 16;
495: ConfigureParams.Screen.nForceBpp = 0;
496: ConfigureParams.Screen.bAspectCorrect = true;
1.1.1.4 ! root 497: ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_CPU;
1.1 root 498: ConfigureParams.Screen.bUseExtVdiResolutions = false;
499: ConfigureParams.Screen.bShowStatusbar = true;
500: ConfigureParams.Screen.bShowDriveLed = true;
1.1.1.2 root 501: ConfigureParams.Screen.bCrop = false;
1.1 root 502: /* target 800x600 screen with statusbar out of screen */
1.1.1.2 root 503: ConfigureParams.Screen.nMaxWidth = 0;
504: ConfigureParams.Screen.nMaxHeight = 0;
1.1 root 505:
506: /* Set defaults for Sound */
1.1.1.2 root 507: ConfigureParams.Sound.bEnableMicrophone = true;
1.1 root 508: ConfigureParams.Sound.bEnableSound = true;
509:
510: /* Set defaults for Rom */
1.1.1.3 root 511: sprintf(ConfigureParams.Rom.szRom030FileName, "%s%cRev_1.0_v41.BIN",
512: Paths_GetWorkingDir(), PATHSEP);
513: sprintf(ConfigureParams.Rom.szRom040FileName, "%s%cRev_2.5_v66.BIN",
514: Paths_GetWorkingDir(), PATHSEP);
515: sprintf(ConfigureParams.Rom.szRomTurboFileName, "%s%cRev_3.3_v74.BIN",
516: Paths_GetWorkingDir(), PATHSEP);
517:
1.1 root 518:
519: /* Set defaults for System */
1.1.1.3 root 520: ConfigureParams.System.nMachineType = NEXT_CUBE030;
521: ConfigureParams.System.bColor = false;
522: ConfigureParams.System.bTurbo = false;
1.1.1.4 ! root 523: ConfigureParams.System.bNBIC = true;
1.1.1.3 root 524: ConfigureParams.System.nSCSI = NCR53C90;
525: ConfigureParams.System.nRTC = MC68HC68T1;
526:
527: ConfigureParams.System.nCpuLevel = 3;
528: ConfigureParams.System.nCpuFreq = 25;
1.1 root 529: ConfigureParams.System.bCompatibleCpu = true;
530: ConfigureParams.System.bBlitter = false;
1.1.1.4 ! root 531: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
! 532: ConfigureParams.System.bDSPMemoryExpansion = false;
1.1 root 533: ConfigureParams.System.bPatchTimerD = true;
534: ConfigureParams.System.bRealTimeClock = true;
535: ConfigureParams.System.bFastForward = false;
1.1.1.2 root 536:
537: ConfigureParams.System.bAddressSpace24 = false;
538: ConfigureParams.System.bCycleExactCpu = false;
1.1.1.3 root 539: ConfigureParams.System.n_FPUType = FPU_68882;
1.1.1.2 root 540: ConfigureParams.System.bCompatibleFPU = true;
541: ConfigureParams.System.bMMU = true;
1.1.1.4 ! root 542:
! 543: /* Set defaults for Dimension */
! 544: ConfigureParams.Dimension.bEnabled = false;
! 545: ConfigureParams.Dimension.nMemoryBankSize[0] = 4;
! 546: ConfigureParams.Dimension.nMemoryBankSize[1] = 4;
! 547: ConfigureParams.Dimension.nMemoryBankSize[2] = 4;
! 548: ConfigureParams.Dimension.nMemoryBankSize[3] = 4;
! 549: sprintf(ConfigureParams.Dimension.szRomFileName, "%s%cdimension_eeprom.bin",
! 550: Paths_GetWorkingDir(), PATHSEP);
1.1.1.2 root 551:
552: /* Set defaults for Video */
553: #if HAVE_LIBPNG
554: ConfigureParams.Video.AviRecordVcodec = AVI_RECORD_VIDEO_CODEC_PNG;
555: #else
556: ConfigureParams.Video.AviRecordVcodec = AVI_RECORD_VIDEO_CODEC_BMP;
557: #endif
558: ConfigureParams.Video.AviRecordFps = 0; /* automatic FPS */
559: sprintf(ConfigureParams.Video.AviRecordFile, "%s%chatari.avi", psWorkingDir, PATHSEP);
560:
1.1 root 561:
562: /* Initialize the configuration file name */
563: if (strlen(psHomeDir) < sizeof(sConfigFileName)-13)
1.1.1.2 root 564: sprintf(sConfigFileName, "%s%cprevious.cfg", psHomeDir, PATHSEP);
1.1 root 565: else
1.1.1.2 root 566: strcpy(sConfigFileName, "previous.cfg");
1.1 root 567:
568: #if defined(__AMIGAOS4__)
569: /* Fix default path names on Amiga OS */
1.1.1.3 root 570: sprintf(ConfigureParams.Rom.szRom030FileName, "%sRev_1.0_v41.BIN", Paths_GetWorkingDir());
571: sprintf(ConfigureParams.Rom.szRom040FileName, "%sRev_2.5_v66.BIN", Paths_GetWorkingDir());
572: sprintf(ConfigureParams.Rom.szRom040FileName, "%sRev_3.3_v74.BIN", Paths_GetWorkingDir());
1.1 root 573: #endif
574: }
575:
576:
577: /*-----------------------------------------------------------------------*/
578: /**
1.1.1.4 ! root 579: * Helper function for Configuration_Apply, check mouse speed settings
! 580: * to be in the valid range between minimum and maximum value.
! 581: */
! 582: void Configuration_CheckFloatMinMax(float *val, float min, float max)
! 583: {
! 584: if (*val<min)
! 585: *val=min;
! 586: if (*val>max)
! 587: *val=max;
! 588: }
! 589:
! 590:
! 591: /*-----------------------------------------------------------------------*/
! 592: /**
1.1 root 593: * Copy details from configuration structure into global variables for system,
594: * clean file names, etc... Called from main.c and dialog.c files.
595: */
596: void Configuration_Apply(bool bReset)
597: {
598: if (bReset)
599: {
600: /* Set resolution change */
601: }
1.1.1.2 root 602:
603: /* Init clocks for this machine */
604: ClocksTimings_InitMachine ( ConfigureParams.System.nMachineType );
605:
1.1.1.4 ! root 606: /* Mouse settings */
! 607: Configuration_CheckFloatMinMax(&ConfigureParams.Mouse.fLinSpeedNormal,MOUSE_LIN_MIN,MOUSE_LIN_MAX);
! 608: Configuration_CheckFloatMinMax(&ConfigureParams.Mouse.fLinSpeedLocked,MOUSE_LIN_MIN,MOUSE_LIN_MAX);
! 609: Configuration_CheckFloatMinMax(&ConfigureParams.Mouse.fExpSpeedNormal,MOUSE_EXP_MIN,MOUSE_EXP_MAX);
! 610: Configuration_CheckFloatMinMax(&ConfigureParams.Mouse.fExpSpeedLocked,MOUSE_EXP_MIN,MOUSE_EXP_MAX);
1.1.1.2 root 611:
612: /* Check/constrain CPU settings and change corresponding
1.1.1.4 ! root 613: * UAE cpu_level & cpu_compatible variables */
1.1.1.2 root 614: M68000_CheckCpuSettings();
615:
1.1.1.3 root 616: /* Check memory size for each bank and change to supported values */
617: Configuration_CheckMemory(ConfigureParams.Memory.nMemoryBankSize);
1.1.1.4 ! root 618:
! 619: /* Check nextdimension memory size and screen options */
! 620: Configuration_CheckDimensionMemory(ConfigureParams.Dimension.nMemoryBankSize);
! 621: Configuration_CheckDimensionSettings();
! 622:
1.1.1.3 root 623: /* Clean file and directory names */
624: File_MakeAbsoluteName(ConfigureParams.Rom.szRom030FileName);
625: File_MakeAbsoluteName(ConfigureParams.Rom.szRom040FileName);
626: File_MakeAbsoluteName(ConfigureParams.Rom.szRomTurboFileName);
1.1.1.4 ! root 627: File_MakeAbsoluteName(ConfigureParams.Dimension.szRomFileName);
! 628: File_MakeAbsoluteName(ConfigureParams.Printer.szPrintToFileName);
! 629:
! 630: int i;
! 631: for (i = 0; i < ESP_MAX_DEVS; i++) {
! 632: File_MakeAbsoluteName(ConfigureParams.SCSI.target[i].szImageName);
! 633: }
1.1.1.3 root 634:
1.1.1.4 ! root 635: for (i = 0; i < MO_MAX_DRIVES; i++) {
! 636: File_MakeAbsoluteName(ConfigureParams.MO.drive[i].szImageName);
! 637: }
! 638:
! 639: for (i = 0; i < FLP_MAX_DRIVES; i++) {
! 640: File_MakeAbsoluteName(ConfigureParams.Floppy.drive[i].szImageName);
1.1.1.3 root 641: }
642:
1.1 root 643: File_MakeAbsoluteName(ConfigureParams.Memory.szMemoryCaptureFileName);
644: if (strlen(ConfigureParams.Keyboard.szMappingFileName) > 0)
645: File_MakeAbsoluteName(ConfigureParams.Keyboard.szMappingFileName);
1.1.1.2 root 646: File_MakeAbsoluteName(ConfigureParams.Video.AviRecordFile);
1.1 root 647:
648: /* make path names absolute, but handle special file names */
649: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sLogFileName);
650: File_MakeAbsoluteSpecialName(ConfigureParams.Log.sTraceFileName);
651: File_MakeAbsoluteSpecialName(ConfigureParams.RS232.szInFileName);
652: File_MakeAbsoluteSpecialName(ConfigureParams.RS232.szOutFileName);
653: File_MakeAbsoluteSpecialName(ConfigureParams.Midi.sMidiInFileName);
654: File_MakeAbsoluteSpecialName(ConfigureParams.Midi.sMidiOutFileName);
1.1.1.4 ! root 655: }
! 656:
! 657:
! 658: /*-----------------------------------------------------------------------*/
! 659: /**
! 660: * Set defaults depending on selected machine type.
! 661: */
! 662: void Configuration_SetSystemDefaults(void) {
! 663: switch (ConfigureParams.System.nMachineType) {
! 664: case NEXT_CUBE030:
! 665: ConfigureParams.System.bTurbo = false;
! 666: ConfigureParams.System.bColor = false;
! 667: ConfigureParams.System.nCpuLevel = 3;
! 668: ConfigureParams.System.nCpuFreq = 25;
! 669: ConfigureParams.System.n_FPUType = FPU_68882;
! 670: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
! 671: ConfigureParams.System.bDSPMemoryExpansion = false;
! 672: ConfigureParams.System.nSCSI = NCR53C90;
! 673: ConfigureParams.System.nRTC = MC68HC68T1;
! 674: ConfigureParams.System.bNBIC = true;
! 675: break;
! 676:
! 677: case NEXT_CUBE040:
! 678: ConfigureParams.System.bColor = false;
! 679: ConfigureParams.System.nCpuLevel = 4;
! 680: if (ConfigureParams.System.bTurbo) {
! 681: ConfigureParams.System.nCpuFreq = 33;
! 682: ConfigureParams.System.nRTC = MCCS1850;
! 683: } else {
! 684: ConfigureParams.System.nCpuFreq = 25;
! 685: ConfigureParams.System.nRTC = MC68HC68T1;
! 686: }
! 687: ConfigureParams.System.n_FPUType = FPU_CPU;
! 688: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
! 689: ConfigureParams.System.bDSPMemoryExpansion = true;
! 690: ConfigureParams.System.nSCSI = NCR53C90A;
! 691: ConfigureParams.System.bNBIC = true;
! 692: break;
! 693:
! 694: case NEXT_STATION:
! 695: ConfigureParams.System.nCpuLevel = 4;
! 696: if (ConfigureParams.System.bTurbo) {
! 697: ConfigureParams.System.nCpuFreq = 33;
! 698: ConfigureParams.System.nRTC = MCCS1850;
! 699: } else if (ConfigureParams.System.bColor) {
! 700: ConfigureParams.System.nCpuFreq = 25;
! 701: ConfigureParams.System.nRTC = MCCS1850;
! 702: } else {
! 703: ConfigureParams.System.nCpuFreq = 25;
! 704: ConfigureParams.System.nRTC = MC68HC68T1;
! 705: }
! 706: ConfigureParams.System.n_FPUType = FPU_CPU;
! 707: ConfigureParams.System.nDSPType = DSP_TYPE_EMU;
! 708: ConfigureParams.System.bDSPMemoryExpansion = true;
! 709: ConfigureParams.System.nSCSI = NCR53C90A;
! 710: ConfigureParams.System.bNBIC = false;
! 711: break;
! 712: default:
! 713: break;
! 714: }
! 715:
! 716: if (ConfigureParams.System.bTurbo) {
! 717: ConfigureParams.Memory.nMemoryBankSize[0] = 32;
! 718: ConfigureParams.Memory.nMemoryBankSize[1] = 32;
! 719: ConfigureParams.Memory.nMemoryBankSize[2] = 32;
! 720: ConfigureParams.Memory.nMemoryBankSize[3] = 32;
! 721: } else if (ConfigureParams.System.bColor) {
! 722: ConfigureParams.Memory.nMemoryBankSize[0] = 8;
! 723: ConfigureParams.Memory.nMemoryBankSize[1] = 8;
! 724: ConfigureParams.Memory.nMemoryBankSize[2] = 8;
! 725: ConfigureParams.Memory.nMemoryBankSize[3] = 8;
! 726: } else {
! 727: ConfigureParams.Memory.nMemoryBankSize[0] = 16;
! 728: ConfigureParams.Memory.nMemoryBankSize[1] = 16;
! 729: ConfigureParams.Memory.nMemoryBankSize[2] = 16;
! 730: ConfigureParams.Memory.nMemoryBankSize[3] = 16;
! 731: }
1.1 root 732: }
733:
734:
735: /*-----------------------------------------------------------------------*/
736: /**
1.1.1.3 root 737: * Check memory bank sizes for compatibility with the selected system.
738: */
739: int Configuration_CheckMemory(int *banksize) {
740: int i;
741:
742: #define RESTRICTIVE_MEMCHECK 0
743: #if RESTRICTIVE_MEMCHECK
744: /* To boot we need at least 4 MB in bank0 */
745: if (banksize[0]<4) {
746: banksize[0]=4;
747: }
748:
749: /* On monochrome non-Turbo NeXTstations only the first
750: * 2 banks are accessible via memory sockets */
751: if (ConfigureParams.System.nMachineType == NEXT_STATION &&
752: !ConfigureParams.System.bTurbo && !ConfigureParams.System.bColor) {
753: banksize[2]=0;
754: banksize[3]=0;
755: }
756: #endif
757:
758: if (ConfigureParams.System.bTurbo) {
759: for (i=0; i<4; i++) {
760: if (banksize[i]<=0)
761: banksize[i]=0;
762: else if (banksize[i]<=2)
763: banksize[i]=2;
764: else if (banksize[i]<=8)
765: banksize[i]=8;
766: else if (banksize[i]<=32)
767: banksize[i]=32;
768: else
769: banksize[i]=32;
770: }
771: } else if (ConfigureParams.System.bColor) {
772: for (i=0; i<4; i++) {
773: if (banksize[i]<=0)
774: banksize[i]=0;
775: else if (banksize[i]<=2)
776: banksize[i]=2;
777: else if (banksize[i]<=8)
778: banksize[i]=8;
779: else
780: banksize[i]=8;
781: }
782: } else {
783: for (i=0; i<4; i++) {
784: if (banksize[i]<=0)
785: banksize[i]=0;
786: else if (banksize[i]<=1)
787: banksize[i]=1;
788: else if (banksize[i]<=4)
789: banksize[i]=4;
790: else if (banksize[i]<=16)
791: banksize[i]=16;
792: else
793: banksize[i]=16;
794: }
795: }
796: return (banksize[0]+banksize[1]+banksize[2]+banksize[3]);
797: }
798:
1.1.1.4 ! root 799: int Configuration_CheckDimensionMemory(int *banksize) {
! 800: int i;
! 801:
! 802: #if RESTRICTIVE_MEMCHECK
! 803: /* To boot we need at least 4 MB in bank0 */
! 804: if (banksize[0]<4) {
! 805: banksize[0]=4;
! 806: }
! 807: #endif
! 808: for (i=0; i<4; i++) {
! 809: if (banksize[i]<=0)
! 810: banksize[i]=0;
! 811: else if (banksize[i]<=4)
! 812: banksize[i]=4;
! 813: else if (banksize[i]<=16)
! 814: banksize[i]=16;
! 815: else
! 816: banksize[i]=16;
! 817: }
! 818: return (banksize[0]+banksize[1]+banksize[2]+banksize[3]);
! 819: }
! 820:
! 821: void Configuration_CheckDimensionSettings(void) {
! 822: if (ConfigureParams.System.nMachineType==NEXT_STATION) {
! 823: ConfigureParams.Screen.nMonitorType = MONITOR_TYPE_CPU;
! 824: }
! 825: }
! 826:
1.1.1.3 root 827:
828: /*-----------------------------------------------------------------------*/
829: /**
1.1 root 830: * Load a settings section from the configuration file.
831: */
832: static int Configuration_LoadSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
833: {
834: int ret;
835:
836: ret = input_config(pFilename, configs, pSection);
837:
838: if (ret < 0)
839: fprintf(stderr, "Can not load configuration file %s (section %s).\n",
840: pFilename, pSection);
841:
842: return ret;
843: }
844:
845:
846: /*-----------------------------------------------------------------------*/
847: /**
848: * Load program setting from configuration file. If psFileName is NULL, use
849: * the configuration file given in configuration / last selected by user.
850: */
851: void Configuration_Load(const char *psFileName)
852: {
853: if (psFileName == NULL)
854: psFileName = sConfigFileName;
855:
856: if (!File_Exists(psFileName))
857: {
1.1.1.2 root 858: Log_Printf(LOG_DEBUG, "Configuration file %s not found.\n", psFileName);
1.1 root 859: return;
860: }
861:
862: Configuration_LoadSection(psFileName, configs_Log, "[Log]");
1.1.1.3 root 863: Configuration_LoadSection(psFileName, configs_ConfigDialog, "[ConfigDialog]");
1.1 root 864: Configuration_LoadSection(psFileName, configs_Debugger, "[Debugger]");
865: Configuration_LoadSection(psFileName, configs_Screen, "[Screen]");
866: Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]");
867: Configuration_LoadSection(psFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
868: Configuration_LoadSection(psFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.4 ! root 869: Configuration_LoadSection(psFileName, configs_Mouse, "[Mouse]");
1.1 root 870: Configuration_LoadSection(psFileName, configs_Sound, "[Sound]");
871: Configuration_LoadSection(psFileName, configs_Memory, "[Memory]");
1.1.1.3 root 872: Configuration_LoadSection(psFileName, configs_Boot, "[Boot]");
873: Configuration_LoadSection(psFileName, configs_SCSI, "[HardDisk]");
1.1.1.4 ! root 874: Configuration_LoadSection(psFileName, configs_MO, "[MagnetoOptical]");
! 875: Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]");
! 876: Configuration_LoadSection(psFileName, configs_Ethernet, "[Ethernet]");
1.1 root 877: Configuration_LoadSection(psFileName, configs_Rom, "[ROM]");
878: Configuration_LoadSection(psFileName, configs_Rs232, "[RS232]");
879: Configuration_LoadSection(psFileName, configs_Printer, "[Printer]");
880: Configuration_LoadSection(psFileName, configs_Midi, "[Midi]");
881: Configuration_LoadSection(psFileName, configs_System, "[System]");
1.1.1.4 ! root 882: Configuration_LoadSection(psFileName, configs_Dimension, "[Dimension]");
1.1.1.2 root 883: Configuration_LoadSection(psFileName, configs_Video, "[Video]");
1.1 root 884: }
885:
886:
887: /*-----------------------------------------------------------------------*/
888: /**
889: * Save a settings section to configuration file
890: */
891: static int Configuration_SaveSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
892: {
893: int ret;
894:
895: ret = update_config(pFilename, configs, pSection);
896:
897: if (ret < 0)
898: fprintf(stderr, "Error while updating section %s in %s\n", pSection, pFilename);
899:
900: return ret;
901: }
902:
903:
904: /*-----------------------------------------------------------------------*/
905: /**
906: * Save program setting to configuration file
907: */
908: void Configuration_Save(void)
909: {
910: if (Configuration_SaveSection(sConfigFileName, configs_Log, "[Log]") < 0)
911: {
912: Log_AlertDlg(LOG_ERROR, "Error saving config file.");
913: return;
914: }
1.1.1.3 root 915: Configuration_SaveSection(sConfigFileName, configs_ConfigDialog, "[ConfigDialog]");
1.1 root 916: Configuration_SaveSection(sConfigFileName, configs_Debugger, "[Debugger]");
917: Configuration_SaveSection(sConfigFileName, configs_Screen, "[Screen]");
918: Configuration_SaveSection(sConfigFileName, configs_Keyboard, "[Keyboard]");
919: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithMod, "[ShortcutsWithModifiers]");
920: Configuration_SaveSection(sConfigFileName, configs_ShortCutWithoutMod, "[ShortcutsWithoutModifiers]");
1.1.1.4 ! root 921: Configuration_SaveSection(sConfigFileName, configs_Mouse, "[Mouse]");
1.1 root 922: Configuration_SaveSection(sConfigFileName, configs_Sound, "[Sound]");
923: Configuration_SaveSection(sConfigFileName, configs_Memory, "[Memory]");
1.1.1.3 root 924: Configuration_SaveSection(sConfigFileName, configs_Boot, "[Boot]");
925: Configuration_SaveSection(sConfigFileName, configs_SCSI, "[HardDisk]");
1.1.1.4 ! root 926: Configuration_SaveSection(sConfigFileName, configs_MO, "[MagnetoOptical]");
! 927: Configuration_SaveSection(sConfigFileName, configs_Floppy, "[Floppy]");
! 928: Configuration_SaveSection(sConfigFileName, configs_Ethernet, "[Ethernet]");
1.1 root 929: Configuration_SaveSection(sConfigFileName, configs_Rom, "[ROM]");
930: Configuration_SaveSection(sConfigFileName, configs_Rs232, "[RS232]");
931: Configuration_SaveSection(sConfigFileName, configs_Printer, "[Printer]");
932: Configuration_SaveSection(sConfigFileName, configs_Midi, "[Midi]");
933: Configuration_SaveSection(sConfigFileName, configs_System, "[System]");
1.1.1.4 ! root 934: Configuration_SaveSection(sConfigFileName, configs_Dimension, "[Dimension]");
1.1.1.2 root 935: Configuration_SaveSection(sConfigFileName, configs_Video, "[Video]");
1.1 root 936: }
937:
938:
939: /*-----------------------------------------------------------------------*/
940: /**
941: * Save/restore snapshot of configuration variables
942: * ('MemorySnapShot_Store' handles type)
943: */
944: void Configuration_MemorySnapShot_Capture(bool bSave)
1.1.1.3 root 945: {
946: /* ROM files */
947: MemorySnapShot_Store(ConfigureParams.Rom.szRom030FileName, sizeof(ConfigureParams.Rom.szRom030FileName));
948: MemorySnapShot_Store(ConfigureParams.Rom.szRom040FileName, sizeof(ConfigureParams.Rom.szRom040FileName));
949: MemorySnapShot_Store(ConfigureParams.Rom.szRomTurboFileName, sizeof(ConfigureParams.Rom.szRomTurboFileName));
950:
951: /* Memory options */
952: MemorySnapShot_Store(ConfigureParams.Memory.nMemoryBankSize, sizeof(ConfigureParams.Memory.nMemoryBankSize));
953: MemorySnapShot_Store(&ConfigureParams.Memory.nMemorySpeed, sizeof(ConfigureParams.Memory.nMemorySpeed));
954:
955: /* SCSI disks */
956: int target;
957: for (target = 0; target < ESP_MAX_DEVS; target++) {
958: MemorySnapShot_Store(ConfigureParams.SCSI.target[target].szImageName, sizeof(ConfigureParams.SCSI.target[target].szImageName));
1.1.1.4 ! root 959: MemorySnapShot_Store(&ConfigureParams.SCSI.target[target].nDeviceType, sizeof(ConfigureParams.SCSI.target[target].nDeviceType));
! 960: MemorySnapShot_Store(&ConfigureParams.SCSI.target[target].bDiskInserted, sizeof(ConfigureParams.SCSI.target[target].bDiskInserted));
! 961: MemorySnapShot_Store(&ConfigureParams.SCSI.target[target].bWriteProtected, sizeof(ConfigureParams.SCSI.target[target].bWriteProtected));
! 962:
! 963: }
! 964:
! 965: /* MO drives */
! 966: int drive;
! 967: for (drive = 0; drive < MO_MAX_DRIVES; drive++) {
! 968: MemorySnapShot_Store(ConfigureParams.MO.drive[drive].szImageName, sizeof(ConfigureParams.MO.drive[drive].szImageName));
! 969: MemorySnapShot_Store(&ConfigureParams.MO.drive[drive].bDriveConnected, sizeof(ConfigureParams.MO.drive[drive].bDriveConnected));
! 970: MemorySnapShot_Store(&ConfigureParams.MO.drive[drive].bDiskInserted, sizeof(ConfigureParams.MO.drive[drive].bDiskInserted));
! 971: MemorySnapShot_Store(&ConfigureParams.MO.drive[drive].bWriteProtected, sizeof(ConfigureParams.MO.drive[drive].bWriteProtected));
! 972: }
! 973:
! 974: /* Floppy drives */
! 975: for (drive = 0; drive < FLP_MAX_DRIVES; drive++) {
! 976: MemorySnapShot_Store(ConfigureParams.Floppy.drive[drive].szImageName, sizeof(ConfigureParams.Floppy.drive[drive].szImageName));
! 977: MemorySnapShot_Store(&ConfigureParams.Floppy.drive[drive].bDriveConnected, sizeof(ConfigureParams.Floppy.drive[drive].bDriveConnected));
! 978: MemorySnapShot_Store(&ConfigureParams.Floppy.drive[drive].bDiskInserted, sizeof(ConfigureParams.Floppy.drive[drive].bDiskInserted));
! 979: MemorySnapShot_Store(&ConfigureParams.Floppy.drive[drive].bWriteProtected, sizeof(ConfigureParams.Floppy.drive[drive].bWriteProtected));
1.1.1.3 root 980: }
1.1.1.4 ! root 981:
! 982: /* Ethernet options */
! 983: MemorySnapShot_Store(&ConfigureParams.Ethernet.bEthernetConnected, sizeof(ConfigureParams.Ethernet.bEthernetConnected));
1.1 root 984:
1.1.1.4 ! root 985: /* Sound options */
! 986: MemorySnapShot_Store(&ConfigureParams.Sound.bEnableSound, sizeof(ConfigureParams.Sound.bEnableSound));
! 987: MemorySnapShot_Store(&ConfigureParams.Sound.bEnableMicrophone, sizeof(ConfigureParams.Sound.bEnableMicrophone));
! 988:
1.1.1.3 root 989: /* Monitor options */
1.1 root 990: MemorySnapShot_Store(&ConfigureParams.Screen.nMonitorType, sizeof(ConfigureParams.Screen.nMonitorType));
991: MemorySnapShot_Store(&ConfigureParams.Screen.bUseExtVdiResolutions, sizeof(ConfigureParams.Screen.bUseExtVdiResolutions));
992: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiWidth, sizeof(ConfigureParams.Screen.nVdiWidth));
993: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiHeight, sizeof(ConfigureParams.Screen.nVdiHeight));
994: MemorySnapShot_Store(&ConfigureParams.Screen.nVdiColors, sizeof(ConfigureParams.Screen.nVdiColors));
995:
1.1.1.3 root 996: /* System options */
1.1 root 997: MemorySnapShot_Store(&ConfigureParams.System.nCpuLevel, sizeof(ConfigureParams.System.nCpuLevel));
998: MemorySnapShot_Store(&ConfigureParams.System.nCpuFreq, sizeof(ConfigureParams.System.nCpuFreq));
999: MemorySnapShot_Store(&ConfigureParams.System.bCompatibleCpu, sizeof(ConfigureParams.System.bCompatibleCpu));
1.1.1.3 root 1000:
1001: MemorySnapShot_Store(&ConfigureParams.System.nMachineType, sizeof(ConfigureParams.System.nMachineType));
1002: MemorySnapShot_Store(&ConfigureParams.System.bColor, sizeof(ConfigureParams.System.bColor));
1003: MemorySnapShot_Store(&ConfigureParams.System.bTurbo, sizeof(ConfigureParams.System.bTurbo));
1.1.1.4 ! root 1004: MemorySnapShot_Store(&ConfigureParams.System.bNBIC, sizeof(ConfigureParams.System.bNBIC));
1.1.1.3 root 1005: MemorySnapShot_Store(&ConfigureParams.System.nSCSI, sizeof(ConfigureParams.System.nSCSI));
1006: MemorySnapShot_Store(&ConfigureParams.System.nRTC, sizeof(ConfigureParams.System.nRTC));
1007:
1.1 root 1008: MemorySnapShot_Store(&ConfigureParams.System.bBlitter, sizeof(ConfigureParams.System.bBlitter));
1009: MemorySnapShot_Store(&ConfigureParams.System.nDSPType, sizeof(ConfigureParams.System.nDSPType));
1.1.1.4 ! root 1010: MemorySnapShot_Store(&ConfigureParams.System.bDSPMemoryExpansion, sizeof(ConfigureParams.System.bDSPMemoryExpansion));
1.1 root 1011: MemorySnapShot_Store(&ConfigureParams.System.bRealTimeClock, sizeof(ConfigureParams.System.bRealTimeClock));
1012: MemorySnapShot_Store(&ConfigureParams.System.bPatchTimerD, sizeof(ConfigureParams.System.bPatchTimerD));
1.1.1.2 root 1013:
1014: MemorySnapShot_Store(&ConfigureParams.System.bAddressSpace24, sizeof(ConfigureParams.System.bAddressSpace24));
1015: MemorySnapShot_Store(&ConfigureParams.System.bCycleExactCpu, sizeof(ConfigureParams.System.bCycleExactCpu));
1016: MemorySnapShot_Store(&ConfigureParams.System.n_FPUType, sizeof(ConfigureParams.System.n_FPUType));
1017: MemorySnapShot_Store(&ConfigureParams.System.bCompatibleFPU, sizeof(ConfigureParams.System.bCompatibleFPU));
1018: MemorySnapShot_Store(&ConfigureParams.System.bMMU, sizeof(ConfigureParams.System.bMMU));
1019:
1.1.1.4 ! root 1020: /* Dimension options */
! 1021: MemorySnapShot_Store(&ConfigureParams.Dimension.bEnabled, sizeof(ConfigureParams.Dimension.bEnabled));
! 1022: MemorySnapShot_Store(ConfigureParams.Dimension.nMemoryBankSize, sizeof(ConfigureParams.Dimension.nMemoryBankSize));
! 1023: MemorySnapShot_Store(ConfigureParams.Dimension.szRomFileName, sizeof(ConfigureParams.Dimension.szRomFileName));
1.1 root 1024:
1025: if (!bSave)
1026: Configuration_Apply(true);
1027: }
1028:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.