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

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

unix.superglobalmegacorp.com

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