Annotation of hatari/src/configuration.c, revision 1.1.1.16

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.