/** * Change given Hatari options * Return false if parsing failed, true otherwise */ static bool Change_Options(int argc, const char *argv[]) { bool bOK; CNF_PARAMS current; Main_PauseEmulation(false); /* get configuration changes */ current = ConfigureParams; ConfigureParams.Screen.bFullScreen = bInFullScreen; bOK = Opt_ParseParameters(argc, argv); /* Check if reset is required and ask user if he really wants to continue */ if (bOK && Change_DoNeedReset(¤t, &ConfigureParams) && current.Log.nAlertDlgLogLevel > LOG_FATAL) { bOK = DlgAlert_Query("The emulated system must be " "reset to apply these changes. " "Apply changes now and reset " "the emulator?"); } /* Copy details to configuration */ if (bOK) { if (!Change_CopyChangedParamsToConfiguration(¤t, &ConfigureParams, false)) { ConfigureParams = current; DlgAlert_Notice("Return to old parameters..."); Reset_Cold(); } } else { ConfigureParams = current; } Main_UnPauseEmulation(); return bOK; }
/** * Main * * Note: 'argv' cannot be declared const, MinGW would then fail to link. */ int main(int argc, char *argv[]) { /* Generate random seed */ srand(time(NULL)); /* Initialize directory strings */ Paths_Init(argv[0]); /* Set default configuration values: */ Configuration_SetDefault(); /* Now load the values from the configuration file */ Main_LoadInitialConfig(); #if 0 /* FIXME: This sometimes causes exits when starting from application bundles */ /* Check for any passed parameters */ if (!Opt_ParseParameters(argc, (const char * const *)argv)) { return 1; } #endif /* monitor type option might require "reset" -> true */ Configuration_Apply(true); #ifdef WIN32 Win_OpenCon(); #endif /* Needed on maemo but useful also with normal X11 window managers * for window grouping when you have multiple Hatari SDL windows open */ #if HAVE_SETENV setenv("SDL_VIDEO_X11_WMCLASS", "previous", 1); #endif /* Init emulator system */ Main_Init(); /* Set initial Statusbar information */ Main_StatusbarSetup(); /* Check if SDL_Delay is accurate */ Main_CheckForAccurateDelays(); /* Run emulation */ Main_UnPauseEmulation(); M68000_Start(); /* Start emulation */ /* Un-init emulation system */ Main_UnInit(); return 0; }
/** * Command: Set command line and debugger options */ static int DebugUI_SetOptions(int argc, char *argv[]) { CNF_PARAMS current; static const struct { const char name[4]; int base; } bases[] = { { "bin", 2 }, { "dec", 10 }, { "hex", 16 } }; const char *arg; int i; if (argc < 2) { return DebugUI_PrintCmdHelp(argv[0]); } arg = argv[1]; for (i = 0; i < ARRAYSIZE(bases); i++) { if (strcasecmp(bases[i].name, arg) == 0) { if (ConfigureParams.Debugger.nNumberBase != bases[i].base) { fprintf(stderr, "Switched default number base from %d to %d-based (%s) values.\n", ConfigureParams.Debugger.nNumberBase, bases[i].base, bases[i].name); ConfigureParams.Debugger.nNumberBase = bases[i].base; } else { fprintf(stderr, "Already in '%s' mode.\n", bases[i].name); } return DEBUGGER_CMDDONE; } } /* get configuration changes */ current = ConfigureParams; /* Parse and apply options */ if (Opt_ParseParameters(argc, (const char * const *)argv)) { ConfigureParams.Screen.bFullScreen = false; Change_CopyChangedParamsToConfiguration(¤t, &ConfigureParams, false); } else { ConfigureParams = current; } return DEBUGGER_CMDDONE; }