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

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.9 ! root       12: char Configuration_rcsid[] = "Hatari $Id: configuration.c,v 1.43 2005/06/05 14:19:39 thothy Exp $";
1.1       root       13: 
                     14: #include "main.h"
                     15: #include "configuration.h"
1.1.1.9 ! root       16: #include "cfgopts.h"
1.1.1.8   root       17: #include "audio.h"
1.1.1.5   root       18: #include "file.h"
1.1.1.9 ! root       19: #include "log.h"
        !            20: #include "m68000.h"
        !            21: #include "screen.h"
        !            22: #include "vdi.h"
        !            23: #include "video.h"
1.1.1.6   root       24: #include "uae-cpu/hatari-glue.h"
                     25: 
                     26: 
                     27: BOOL bFirstTimeInstall = FALSE;             /* Has been run before? Used to set default joysticks etc... */
                     28: CNF_PARAMS ConfigureParams;                 /* List of configuration for the emulator */
1.1.1.7   root       29: char sConfigFileName[FILENAME_MAX];         /* Stores the name of the configuration file */
1.1.1.6   root       30: 
                     31: 
1.1.1.9 ! root       32: /* Used to load/save logging options */
        !            33: static const struct Config_Tag configs_Log[] =
        !            34: {
        !            35:        { "sLogFileName", String_Tag, ConfigureParams.Log.sLogFileName },
        !            36:        { "nTextLogLevel", Int_Tag, &ConfigureParams.Log.nTextLogLevel },
        !            37:        { "nAlertDlgLogLevel", Int_Tag, &ConfigureParams.Log.nAlertDlgLogLevel },
        !            38:        { NULL , Error_Tag, NULL }
        !            39: };
        !            40: 
        !            41: 
1.1.1.6   root       42: /* Used to load/save screen options */
1.1.1.9 ! root       43: static const struct Config_Tag configs_Screen[] =
1.1.1.6   root       44: {
1.1.1.9 ! root       45:        { "bFullScreen", Bool_Tag, &ConfigureParams.Screen.bFullScreen },
        !            46:        { "bFrameSkip", Bool_Tag, &ConfigureParams.Screen.bFrameSkip },
        !            47:        { "bAllowOverscan", Bool_Tag, &ConfigureParams.Screen.bAllowOverscan },
        !            48:        { "bInterleavedScreen", Bool_Tag, &ConfigureParams.Screen.bInterleavedScreen },
        !            49:        { "ChosenDisplayMode", Int_Tag, &ConfigureParams.Screen.ChosenDisplayMode },
        !            50:        { "bUseHighRes", Bool_Tag, &ConfigureParams.Screen.bUseHighRes },
        !            51:        { "bUseExtVdiResolutions", Bool_Tag, &ConfigureParams.Screen.bUseExtVdiResolutions },
        !            52:        { "nVdiResolution", Int_Tag, &ConfigureParams.Screen.nVdiResolution },
        !            53:        { "nVdiColors", Int_Tag, &ConfigureParams.Screen.nVdiColors },
        !            54:        { "bCaptureChange", Bool_Tag, &ConfigureParams.Screen.bCaptureChange },
        !            55:        { "nFramesPerSecond", Int_Tag, &ConfigureParams.Screen.nFramesPerSecond },
        !            56:        { NULL , Error_Tag, NULL }
1.1.1.6   root       57: };
                     58: 
                     59: /* Used to load/save joystick options */
1.1.1.9 ! root       60: static const struct Config_Tag configs_Joystick0[] =
1.1.1.6   root       61: {
1.1.1.9 ! root       62:        { "bCursorEmulation", Bool_Tag, &ConfigureParams.Joysticks.Joy[0].bCursorEmulation },
        !            63:        { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[0].bEnableAutoFire },
        !            64:        { NULL , Error_Tag, NULL }
1.1.1.6   root       65: };
1.1.1.9 ! root       66: static const struct Config_Tag configs_Joystick1[] =
1.1.1.6   root       67: {
1.1.1.9 ! root       68:        { "bCursorEmulation", Bool_Tag, &ConfigureParams.Joysticks.Joy[1].bCursorEmulation },
        !            69:        { "bEnableAutoFire", Bool_Tag, &ConfigureParams.Joysticks.Joy[1].bEnableAutoFire },
        !            70:        { NULL , Error_Tag, NULL }
1.1.1.6   root       71: };
1.1.1.5   root       72: 
1.1.1.6   root       73: /* Used to load/save keyboard options */
1.1.1.9 ! root       74: static const struct Config_Tag configs_Keyboard[] =
1.1.1.6   root       75: {
1.1.1.9 ! root       76:        { "bDisableKeyRepeat", Bool_Tag, &ConfigureParams.Keyboard.bDisableKeyRepeat },
        !            77:        { "nKeymapType", Int_Tag, &ConfigureParams.Keyboard.nKeymapType },
        !            78:        { "szMappingFileName", String_Tag, ConfigureParams.Keyboard.szMappingFileName },
        !            79:        { NULL , Error_Tag, NULL }
1.1.1.6   root       80: };
1.1       root       81: 
1.1.1.6   root       82: /* Used to load/save sound options */
1.1.1.9 ! root       83: static const struct Config_Tag configs_Sound[] =
1.1.1.6   root       84: {
1.1.1.9 ! root       85:        { "bEnableSound", Bool_Tag, &ConfigureParams.Sound.bEnableSound },
        !            86:        { "nPlaybackQuality", Int_Tag, &ConfigureParams.Sound.nPlaybackQuality },
        !            87:        { "szYMCaptureFileName", String_Tag, ConfigureParams.Sound.szYMCaptureFileName },
        !            88:        { NULL , Error_Tag, NULL }
1.1.1.6   root       89: };
                     90: 
                     91: /* Used to load/save memory options */
1.1.1.9 ! root       92: static const struct Config_Tag configs_Memory[] =
1.1.1.6   root       93: {
1.1.1.9 ! root       94:        { "nMemorySize", Int_Tag, &ConfigureParams.Memory.nMemorySize },
        !            95:        { "szMemoryCaptureFileName", String_Tag, ConfigureParams.Memory.szMemoryCaptureFileName },
        !            96:        { NULL , Error_Tag, NULL }
1.1.1.6   root       97: };
                     98: 
                     99: 
                    100: /* Used to load/save floppy options */
1.1.1.9 ! root      101: static const struct Config_Tag configs_Floppy[] =
1.1.1.6   root      102: {
1.1.1.9 ! root      103:        { "bAutoInsertDiscB", Bool_Tag, &ConfigureParams.DiscImage.bAutoInsertDiscB },
        !           104:        { "nWriteProtection", Int_Tag, &ConfigureParams.DiscImage.nWriteProtection },
        !           105:        { "szDiscImageDirectory", String_Tag, ConfigureParams.DiscImage.szDiscImageDirectory },
        !           106:        { NULL , Error_Tag, NULL }
1.1.1.6   root      107: };
                    108: 
                    109: /* Used to load/save HD options */
1.1.1.9 ! root      110: static const struct Config_Tag configs_HardDisc[] =
1.1.1.6   root      111: {
1.1.1.9 ! root      112:        /*{ "nDriveList", Int_Tag, &ConfigureParams.HardDisc.nDriveList },*/
        !           113:        { "bBootFromHardDisc", Bool_Tag, &ConfigureParams.HardDisc.bBootFromHardDisc },
        !           114:        { "bUseHardDiscDirectory", Bool_Tag, &ConfigureParams.HardDisc.bUseHardDiscDirectories },
        !           115:        { "szHardDiscDirectory", String_Tag, ConfigureParams.HardDisc.szHardDiscDirectories[DRIVE_C] },
        !           116:        /*{ "szHardDiscDirD", String_Tag, ConfigureParams.HardDisc.szHardDiscDirectories[DRIVE_D] },*/
        !           117:        /*{ "szHardDiscDirE", String_Tag, ConfigureParams.HardDisc.szHardDiscDirectories[DRIVE_E] },*/
        !           118:        /*{ "szHardDiscDirF", String_Tag, ConfigureParams.HardDisc.szHardDiscDirectories[DRIVE_F] },*/
        !           119:        { "bUseHardDiscImage", Bool_Tag, &ConfigureParams.HardDisc.bUseHardDiscImage },
        !           120:        { "szHardDiscImage", String_Tag, ConfigureParams.HardDisc.szHardDiscImage },
        !           121:        { NULL , Error_Tag, NULL }
1.1.1.6   root      122: };
                    123: 
1.1.1.8   root      124: /* Used to load/save ROM options */
1.1.1.9 ! root      125: static const struct Config_Tag configs_Rom[] =
1.1.1.6   root      126: {
1.1.1.9 ! root      127:        { "szTosImageFileName", String_Tag, ConfigureParams.Rom.szTosImageFileName },
        !           128:        { "szCartridgeImageFileName", String_Tag, ConfigureParams.Rom.szCartridgeImageFileName },
        !           129:        { NULL , Error_Tag, NULL }
1.1.1.6   root      130: };
                    131: 
                    132: /* Used to load/save RS232 options */
1.1.1.9 ! root      133: static const struct Config_Tag configs_Rs232[] =
1.1.1.6   root      134: {
1.1.1.9 ! root      135:        { "bEnableRS232", Bool_Tag, &ConfigureParams.RS232.bEnableRS232 },
        !           136:        { "szOutFileName", String_Tag, ConfigureParams.RS232.szOutFileName },
        !           137:        { "szInFileName", String_Tag, ConfigureParams.RS232.szInFileName },
        !           138:        { NULL , Error_Tag, NULL }
1.1.1.6   root      139: };
                    140: 
                    141: /* Used to load/save printer options */
1.1.1.9 ! root      142: static const struct Config_Tag configs_Printer[] =
1.1.1.6   root      143: {
1.1.1.9 ! root      144:        { "bEnablePrinting", Bool_Tag, &ConfigureParams.Printer.bEnablePrinting },
        !           145:        { "bPrintToFile", Bool_Tag, &ConfigureParams.Printer.bPrintToFile },
        !           146:        { "szPrintToFileName", String_Tag, ConfigureParams.Printer.szPrintToFileName },
        !           147:        { NULL , Error_Tag, NULL }
1.1.1.6   root      148: };
                    149: 
1.1.1.7   root      150: /* Used to load/save MIDI options */
1.1.1.9 ! root      151: static const struct Config_Tag configs_Midi[] =
1.1.1.7   root      152: {
1.1.1.9 ! root      153:        { "bEnableMidi", Bool_Tag, &ConfigureParams.Midi.bEnableMidi },
        !           154:        { "szMidiOutFileName", String_Tag, ConfigureParams.Midi.szMidiOutFileName },
        !           155:        { NULL , Error_Tag, NULL }
1.1.1.7   root      156: };
                    157: 
1.1.1.6   root      158: /* Used to load/save system options */
1.1.1.9 ! root      159: static const struct Config_Tag configs_System[] =
1.1.1.6   root      160: {
1.1.1.9 ! root      161:        { "nMinMaxSpeed", Int_Tag, &ConfigureParams.System.nMinMaxSpeed },
        !           162:        { "nCpuLevel", Int_Tag, &ConfigureParams.System.nCpuLevel },
        !           163:        { "nCpuFreq", Int_Tag, &ConfigureParams.System.nCpuFreq },
        !           164:        { "bCompatibleCpu", Bool_Tag, &ConfigureParams.System.bCompatibleCpu },
        !           165:        { "nMachineType", Int_Tag, &ConfigureParams.System.nMachineType },
        !           166:        { "bBlitter", Bool_Tag, &ConfigureParams.System.bBlitter },
        !           167:        { "bRealTimeClock", Bool_Tag, &ConfigureParams.System.bRealTimeClock },
        !           168:        { "bPatchTimerD", Bool_Tag, &ConfigureParams.System.bPatchTimerD },
        !           169:        { "bSlowFDC", Bool_Tag, &ConfigureParams.System.bSlowFDC },
        !           170:        { NULL , Error_Tag, NULL }
1.1.1.6   root      171: };
1.1       root      172: 
                    173: 
                    174: /*-----------------------------------------------------------------------*/
                    175: /*
1.1.1.4   root      176:   Set default configuration values.
1.1.1.2   root      177: */
                    178: void Configuration_SetDefault(void)
                    179: {
1.1.1.9 ! root      180:        int i;
        !           181:        char *homeDir;
1.1.1.4   root      182: 
1.1.1.9 ! root      183:        /* Assume first-time install */
        !           184:        bFirstTimeInstall = TRUE;
1.1.1.4   root      185: 
1.1.1.9 ! root      186:        /* Clear parameters */
        !           187:        memset(&ConfigureParams, 0, sizeof(CNF_PARAMS));
        !           188: 
        !           189:        /* Set defaults for logging */
        !           190:        strcpy(ConfigureParams.Log.sLogFileName, "stderr");
        !           191:        ConfigureParams.Log.nTextLogLevel = LOG_INFO;
        !           192:        ConfigureParams.Log.nAlertDlgLogLevel = LOG_INFO;
        !           193: 
        !           194:        /* Set defaults for (floppy) Disc Image */
        !           195:        ConfigureParams.DiscImage.bAutoInsertDiscB = TRUE;
        !           196:        ConfigureParams.DiscImage.nWriteProtection = WRITEPROT_OFF;
        !           197:        strcpy(ConfigureParams.DiscImage.szDiscImageDirectory, szWorkingDir);
        !           198:        File_AddSlashToEndFileName(ConfigureParams.DiscImage.szDiscImageDirectory);
        !           199: 
        !           200:        /* Set defaults for Hard Disc */
        !           201:        ConfigureParams.HardDisc.nDriveList = DRIVELIST_NONE;
        !           202:        ConfigureParams.HardDisc.bBootFromHardDisc = FALSE;
        !           203:        ConfigureParams.HardDisc.nHardDiscDir = DRIVE_C;
        !           204:        ConfigureParams.HardDisc.bUseHardDiscDirectories = FALSE;
        !           205:        for (i=0; i<MAX_HARDDRIVES; i++)
        !           206:        {
        !           207:                strcpy(ConfigureParams.HardDisc.szHardDiscDirectories[i], szWorkingDir);
        !           208:                File_CleanFileName(ConfigureParams.HardDisc.szHardDiscDirectories[i]);
        !           209:        }
        !           210:        ConfigureParams.HardDisc.bUseHardDiscImage = FALSE;
        !           211:        strcpy(ConfigureParams.HardDisc.szHardDiscImage, szWorkingDir);
        !           212: 
        !           213:        /* Set defaults for Joysticks */
        !           214:        for (i=0; i<2; i++)
        !           215:        {
        !           216:                ConfigureParams.Joysticks.Joy[i].bCursorEmulation = FALSE;
        !           217:                ConfigureParams.Joysticks.Joy[i].bEnableAutoFire = FALSE;
        !           218:        }
        !           219: 
        !           220:        /* Set defaults for Keyboard */
        !           221:        ConfigureParams.Keyboard.bDisableKeyRepeat = TRUE;
        !           222:        ConfigureParams.Keyboard.nKeymapType = KEYMAP_SYMBOLIC;
        !           223:        strcpy(ConfigureParams.Keyboard.szMappingFileName, "");
        !           224: 
        !           225:        /* Set defaults for Memory */
        !           226:        ConfigureParams.Memory.nMemorySize = MEMORY_SIZE_1Mb;
        !           227:        sprintf(ConfigureParams.Memory.szMemoryCaptureFileName, "%s/hatari.sav", szWorkingDir);
        !           228: 
        !           229:        /* Set defaults for Printer */
        !           230:        ConfigureParams.Printer.bEnablePrinting = FALSE;
        !           231:        ConfigureParams.Printer.bPrintToFile = TRUE;
        !           232:        sprintf(ConfigureParams.Printer.szPrintToFileName, "%s/hatari.prn", szWorkingDir);
        !           233: 
        !           234:        /* Set defaults for RS232 */
        !           235:        ConfigureParams.RS232.bEnableRS232 = FALSE;
        !           236:        strcpy(ConfigureParams.RS232.szOutFileName, "/dev/modem");
        !           237:        strcpy(ConfigureParams.RS232.szInFileName, "/dev/modem");
        !           238: 
        !           239:        /* Set defaults for MIDI */
        !           240:        ConfigureParams.Midi.bEnableMidi = FALSE;
        !           241:        strcpy(ConfigureParams.Midi.szMidiOutFileName, "/dev/midi00");
        !           242: 
        !           243:        /* Set defaults for Screen */
        !           244:        ConfigureParams.Screen.bFullScreen = FALSE;
        !           245:        ConfigureParams.Screen.bFrameSkip = FALSE;
        !           246:        ConfigureParams.Screen.bAllowOverscan = TRUE;
        !           247:        ConfigureParams.Screen.bInterleavedScreen = FALSE;
        !           248:        ConfigureParams.Screen.ChosenDisplayMode = DISPLAYMODE_HICOL_LOWRES;
        !           249:        ConfigureParams.Screen.bUseHighRes = FALSE;
        !           250:        ConfigureParams.Screen.bUseExtVdiResolutions = FALSE;
        !           251:        ConfigureParams.Screen.nVdiResolution = GEMRES_640x480;
        !           252:        ConfigureParams.Screen.nVdiColors = GEMCOLOUR_16;
        !           253:        ConfigureParams.Screen.bCaptureChange = FALSE;
        !           254:        ConfigureParams.Screen.nFramesPerSecond = 25;
        !           255: 
        !           256:        /* Set defaults for Sound */
        !           257:        ConfigureParams.Sound.bEnableSound = TRUE;
        !           258:        ConfigureParams.Sound.nPlaybackQuality = PLAYBACK_MEDIUM;
        !           259:        sprintf(ConfigureParams.Sound.szYMCaptureFileName, "%s/hatari.wav", szWorkingDir);
        !           260: 
        !           261:        /* Set defaults for Rom */
        !           262:        sprintf(ConfigureParams.Rom.szTosImageFileName, "%s/tos.img", DATADIR);
        !           263:        strcpy(ConfigureParams.Rom.szCartridgeImageFileName, "");
        !           264: 
        !           265:        /* Set defaults for System */
        !           266:        ConfigureParams.System.nCpuLevel = 0;
        !           267:        ConfigureParams.System.nCpuFreq = 8;
        !           268:        ConfigureParams.System.bCompatibleCpu = FALSE;
        !           269:        /*ConfigureParams.System.bAddressSpace24 = TRUE;*/
        !           270:        ConfigureParams.System.nMachineType = MACHINE_ST;
        !           271:        ConfigureParams.System.bBlitter = FALSE;
        !           272:        ConfigureParams.System.bPatchTimerD = TRUE;
        !           273:        ConfigureParams.System.bRealTimeClock = TRUE;
        !           274:        ConfigureParams.System.nMinMaxSpeed = MINMAXSPEED_MIN;
        !           275:        ConfigureParams.System.bSlowFDC = FALSE;
        !           276: 
        !           277:        /* Initialize the configuration file name */
        !           278:        homeDir = getenv("HOME");
        !           279:        if (homeDir != NULL && homeDir[0] != 0 && strlen(homeDir) < sizeof(sConfigFileName)-13)
        !           280:                sprintf(sConfigFileName, "%s/.hatari.cfg", homeDir);
        !           281:        else
        !           282:                strcpy(sConfigFileName, "hatari.cfg");
1.1.1.2   root      283: }
                    284: 
                    285: 
                    286: /*-----------------------------------------------------------------------*/
                    287: /*
1.1.1.8   root      288:   Copy details from configuration structure into global variables for system,
                    289:   clean file names, etc...
                    290: */
                    291: void Configuration_WorkOnDetails(BOOL bReset)
                    292: {
1.1.1.9 ! root      293:        /* Set resolution change */
        !           294:        if (bReset)
        !           295:        {
        !           296:                bUseVDIRes = ConfigureParams.Screen.bUseExtVdiResolutions;
        !           297:                bUseHighRes = (!bUseVDIRes && ConfigureParams.Screen.bUseHighRes)
        !           298:                                          || (bUseVDIRes && ConfigureParams.Screen.nVdiColors==GEMCOLOUR_2);
        !           299:                VDI_SetResolution(ConfigureParams.Screen.nVdiResolution, ConfigureParams.Screen.nVdiColors);
        !           300:        }
        !           301: 
        !           302:        /* Set playback frequency */
        !           303:        if (ConfigureParams.Sound.bEnableSound)
        !           304:                Audio_SetOutputAudioFreq(ConfigureParams.Sound.nPlaybackQuality);
        !           305: 
        !           306:        /* CPU settings */
        !           307:        if (ConfigureParams.System.nCpuFreq < 12)
        !           308:        {
        !           309:                ConfigureParams.System.nCpuFreq = 8;
        !           310:                nCpuFreqShift = 0;
        !           311:        }
        !           312:        else if (ConfigureParams.System.nCpuFreq > 26)
        !           313:        {
        !           314:                ConfigureParams.System.nCpuFreq = 32;
        !           315:                nCpuFreqShift = 2;
        !           316:        }
        !           317:        else
        !           318:        {
        !           319:                ConfigureParams.System.nCpuFreq = 16;
        !           320:                nCpuFreqShift = 1;
        !           321:        }
        !           322: 
        !           323:        /* Clean file and directory names */
        !           324:        File_MakeAbsoluteName(ConfigureParams.Rom.szTosImageFileName);
        !           325:        File_MakeAbsoluteName(ConfigureParams.Rom.szCartridgeImageFileName);
        !           326:        File_MakeAbsoluteName(ConfigureParams.HardDisc.szHardDiscImage);
        !           327:        File_CleanFileName(ConfigureParams.HardDisc.szHardDiscDirectories[0]);
        !           328:        File_MakeAbsoluteName(ConfigureParams.HardDisc.szHardDiscDirectories[0]);
        !           329:        File_MakeAbsoluteName(ConfigureParams.Midi.szMidiOutFileName);
        !           330:        File_MakeAbsoluteName(ConfigureParams.RS232.szOutFileName);
        !           331:        File_MakeAbsoluteName(ConfigureParams.RS232.szInFileName);
1.1.1.8   root      332: }
                    333: 
                    334: 
                    335: /*-----------------------------------------------------------------------*/
                    336: /*
1.1.1.6   root      337:   Load a settings section from the configuration file.
1.1       root      338: */
1.1.1.9 ! root      339: static int Configuration_LoadSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1       root      340: {
1.1.1.9 ! root      341:        int ret;
1.1       root      342: 
1.1.1.9 ! root      343:        ret = input_config(pFilename, configs, pSection);
1.1       root      344: 
1.1.1.9 ! root      345:        if (ret < 0)
        !           346:                fprintf(stderr, "Can not load configuration file %s (section %s).\n",
        !           347:                        sConfigFileName, pSection);
1.1       root      348: 
1.1.1.9 ! root      349:        return ret;
1.1       root      350: }
                    351: 
                    352: 
                    353: /*-----------------------------------------------------------------------*/
                    354: /*
1.1.1.9 ! root      355:   Load program setting from configuration file. If psFileName is NULL, use
        !           356:   the default (i.e. the users) configuration file.
1.1       root      357: */
1.1.1.9 ! root      358: void Configuration_Load(const char *psFileName)
1.1       root      359: {
1.1.1.9 ! root      360:        if (psFileName == NULL)
        !           361:                psFileName = sConfigFileName;
        !           362: 
        !           363:        if (!File_Exists(psFileName))
        !           364:        {
        !           365:                fprintf(stderr, "Configuration file %s not found.\n", psFileName);
        !           366:                return;
        !           367:        }
        !           368: 
        !           369:        bFirstTimeInstall = FALSE;
        !           370: 
        !           371:        Configuration_LoadSection(psFileName, configs_Log, "[Log]");
        !           372:        Configuration_LoadSection(psFileName, configs_Screen, "[Screen]");
        !           373:        Configuration_LoadSection(psFileName, configs_Joystick0, "[Joystick0]");
        !           374:        Configuration_LoadSection(psFileName, configs_Joystick1, "[Joystick1]");
        !           375:        Configuration_LoadSection(psFileName, configs_Keyboard, "[Keyboard]");
        !           376:        Configuration_LoadSection(psFileName, configs_Sound, "[Sound]");
        !           377:        Configuration_LoadSection(psFileName, configs_Memory, "[Memory]");
        !           378:        Configuration_LoadSection(psFileName, configs_Floppy, "[Floppy]");
        !           379:        Configuration_LoadSection(psFileName, configs_HardDisc, "[HardDisc]");
        !           380:        Configuration_LoadSection(psFileName, configs_Rom, "[ROM]");
        !           381:        Configuration_LoadSection(psFileName, configs_Rs232, "[RS232]");
        !           382:        Configuration_LoadSection(psFileName, configs_Printer, "[Printer]");
        !           383:        Configuration_LoadSection(psFileName, configs_Midi, "[Midi]");
        !           384:        Configuration_LoadSection(psFileName, configs_System, "[System]");
        !           385: 
        !           386:        /* Copy details to global variables */
        !           387:        cpu_level = ConfigureParams.System.nCpuLevel;
        !           388:        cpu_compatible = ConfigureParams.System.bCompatibleCpu;
1.1       root      389: 
1.1.1.9 ! root      390:        Configuration_WorkOnDetails(TRUE);
1.1       root      391: }
                    392: 
                    393: 
                    394: /*-----------------------------------------------------------------------*/
                    395: /*
1.1.1.6   root      396:   Save a settings section to configuration file
1.1       root      397: */
1.1.1.9 ! root      398: static int Configuration_SaveSection(const char *pFilename, const struct Config_Tag configs[], const char *pSection)
1.1       root      399: {
1.1.1.9 ! root      400:        int ret;
1.1       root      401: 
1.1.1.9 ! root      402:        ret = update_config(pFilename, configs, pSection);
1.1       root      403: 
1.1.1.9 ! root      404:        if (ret < 0)
        !           405:                fprintf(stderr, "Error while updating section %s\n", pSection);
1.1       root      406: 
1.1.1.9 ! root      407:        return ret;
1.1       root      408: }
                    409: 
                    410: 
                    411: /*-----------------------------------------------------------------------*/
                    412: /*
1.1.1.6   root      413:   Save program setting to configuration file
1.1       root      414: */
1.1.1.6   root      415: void Configuration_Save(void)
1.1       root      416: {
1.1.1.9 ! root      417:        if (Configuration_SaveSection(sConfigFileName, configs_Log, "[Log]") < 0)
        !           418:        {
        !           419:                fprintf(stderr, "Error saving config file.\n");
        !           420:                return;
        !           421:        }
        !           422:        Configuration_SaveSection(sConfigFileName, configs_Screen, "[Screen]");
        !           423:        Configuration_SaveSection(sConfigFileName, configs_Joystick0, "[Joystick0]");
        !           424:        Configuration_SaveSection(sConfigFileName, configs_Joystick1, "[Joystick1]");
        !           425:        Configuration_SaveSection(sConfigFileName, configs_Keyboard, "[Keyboard]");
        !           426:        Configuration_SaveSection(sConfigFileName, configs_Sound, "[Sound]");
        !           427:        Configuration_SaveSection(sConfigFileName, configs_Memory, "[Memory]");
        !           428:        Configuration_SaveSection(sConfigFileName, configs_Floppy, "[Floppy]");
        !           429:        Configuration_SaveSection(sConfigFileName, configs_HardDisc, "[HardDisc]");
        !           430:        Configuration_SaveSection(sConfigFileName, configs_Rom, "[ROM]");
        !           431:        Configuration_SaveSection(sConfigFileName, configs_Rs232, "[RS232]");
        !           432:        Configuration_SaveSection(sConfigFileName, configs_Printer, "[Printer]");
        !           433:        Configuration_SaveSection(sConfigFileName, configs_Midi, "[Midi]");
        !           434:        Configuration_SaveSection(sConfigFileName, configs_System, "[System]");
1.1       root      435: }
1.1.1.6   root      436: 

unix.superglobalmegacorp.com

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