/** * Restore 'snapshot' of memory/chips/emulation variables */ void MemorySnapShot_Restore(const char *pszFileName, bool bConfirm) { /* Set to 'restore' */ if (MemorySnapShot_OpenFile(pszFileName, false)) { Configuration_MemorySnapShot_Capture(false); /* Reset emulator to get things running */ IoMem_UnInit(); IoMem_Init(); Reset_Cold(); /* Capture each files details */ // STMemory_MemorySnapShot_Capture(false); CycInt_MemorySnapShot_Capture(false); Cycles_MemorySnapShot_Capture(false); M68000_MemorySnapShot_Capture(false); Video_MemorySnapShot_Capture(false); DebugUI_MemorySnapShot_Capture(pszFileName, false); // IoMem_MemorySnapShot_Capture(false); /* And close */ MemorySnapShot_CloseFile(); /* changes may affect also info shown in statusbar */ Statusbar_UpdateInfo(); } /* Did error? */ if (bCaptureError) Log_AlertDlg(LOG_ERROR, "Unable to restore memory state from file."); else if (bConfirm) Log_AlertDlg(LOG_INFO, "Memory state file restored."); }
/** * 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; }
static int DebugUI_Reset(int argc, char *argv[]) { if (argc != 2) return DebugUI_PrintCmdHelp(argv[0]); if (strcmp(argv[1], "soft") == 0 || strcmp(argv[1], "warm") == 0) Reset_Warm(); else if (strcmp(argv[1], "cold") == 0 || strcmp(argv[1], "hard") == 0) Reset_Cold(); else return DebugUI_PrintCmdHelp(argv[0]); return DEBUGGER_END; }
int LoadTosFromRetroSystemDir(){ char tmp_dir[256]; printf("Trying to TOS load from retro_system_directory\n"); sprintf(tmp_dir, "%s%c%s", RETRO_DIR, slash,"tos.img"); printf("%s ",tmp_dir ); if(File_Exists(tmp_dir)==true){ printf("exist\n"); sprintf(ConfigureParams.Rom.szTosImageFileName,"%s",tmp_dir); if (Reset_Cold())return -1; return 0; } printf("not exist\n"); return -1; }
/** * Check to see if pressed any shortcut keys, and call handling function */ void ShortCut_ActKey(void) { if (ShortCutKey == SHORTCUT_NONE) return; switch (ShortCutKey) { case SHORTCUT_OPTIONS: Dialog_DoProperty(); /* Show options dialog */ break; case SHORTCUT_FULLSCREEN: ShortCut_FullScreen(); /* Switch between fullscreen/windowed mode */ break; case SHORTCUT_MOUSEGRAB: ShortCut_MouseGrab(); /* Toggle mouse grab */ break; case SHORTCUT_COLDRESET: Main_UnPauseEmulation(); Reset_Cold(); /* Reset emulator with 'cold' (clear all) */ break; #if 0 case SHORTCUT_WARMRESET: Main_UnPauseEmulation(); Reset_Warm(); /* Emulator 'warm' reset */ break; case SHORTCUT_SCREENSHOT: ScreenSnapShot_SaveScreen(); /* Grab screenshot */ break; case SHORTCUT_BOSSKEY: ShortCut_BossKey(); /* Boss key */ break; case SHORTCUT_CURSOREMU: /* Toggle joystick emu on/off */ Joy_ToggleCursorEmulation(); break; case SHORTCUT_FASTFORWARD: ShortCut_FastForward(); /* Toggle Min/Max speed */ break; case SHORTCUT_RECANIM: ShortCut_RecordAnimation(); /* Record animation */ break; case SHORTCUT_RECSOUND: ShortCut_RecordSound(); /* Toggle sound recording */ break; #endif case SHORTCUT_SOUND: ShortCut_SoundOnOff(); /* Enable/disable sound */ break; #if 0 case SHORTCUT_DEBUG: ShortCut_Debug(); /* Invoke the Debug UI */ break; #endif case SHORTCUT_PAUSE: ShortCut_Pause(); /* Invoke Pause */ break; case SHORTCUT_QUIT: Main_RequestQuit(); break; #if 0 case SHORTCUT_LOADMEM: MemorySnapShot_Restore(ConfigureParams.Memory.szMemoryCaptureFileName, true); break; case SHORTCUT_SAVEMEM: MemorySnapShot_Capture(ConfigureParams.Memory.szMemoryCaptureFileName, true); break; #endif case SHORTCUT_DIMENSION: ShortCut_Dimension(); break; case SHORTCUT_KEYS: case SHORTCUT_NONE: /* ERROR: cannot happen, just make compiler happy */ default: break; } ShortCutKey = SHORTCUT_NONE; }
/** * Copy details back to configuration and perform reset. */ bool Change_CopyChangedParamsToConfiguration(CNF_PARAMS *current, CNF_PARAMS *changed, bool bForceReset) { bool NeedReset; bool bReInitSCSIEmu = false; bool bReInitEnetEmu = false; bool bReInitSoundEmu = false; bool bReInitIoMem = false; bool bScreenModeChange = false; int i; Dprintf("Changes for:\n"); /* Do we need to warn user that changes will only take effect after reset? */ if (bForceReset) NeedReset = bForceReset; else NeedReset = Change_DoNeedReset(current, changed); /* Do we need to change SCSI disks? */ for (i = 0; i < ESP_MAX_DEVS; i++) { if (!NeedReset && (current->SCSI.target[i].bDiskInserted != changed->SCSI.target[i].bDiskInserted || current->SCSI.target[i].bWriteProtected != changed->SCSI.target[i].bWriteProtected || strcmp(current->SCSI.target[i].szImageName, changed->SCSI.target[i].szImageName))) { bReInitSCSIEmu = true; break; } } /* Note: MO and floppy disk insert/eject called from GUI */ /* Do we need to change Ethernet connection? */ if (!NeedReset && current->Ethernet.bEthernetConnected != changed->Ethernet.bEthernetConnected) { bReInitEnetEmu = true; } /* Do we need to change Sound configuration? */ if (!NeedReset && (current->Sound.bEnableSound != changed->Sound.bEnableSound || current->Sound.bEnableMicrophone != changed->Sound.bEnableMicrophone)) { bReInitSoundEmu = true; } /* Copy details to configuration, * so it can be saved out or set on reset */ if (changed != &ConfigureParams) { ConfigureParams = *changed; } /* Copy details to global, if we reset copy them all */ Configuration_Apply(NeedReset); /* Check if all necessary files exist */ Dialog_CheckFiles(); if (bQuitProgram) { SDL_Quit(); exit(-2); } /* Re-init IO memory map? */ if (bReInitIoMem) { Dprintf("- IO mem<\n"); IoMem_Init(); } /* Re-init SCSI disks? */ if (bReInitSCSIEmu) { Dprintf("- SCSI disks<\n"); SCSI_Reset(); } /* Re-init Ethernet? */ if (bReInitEnetEmu) { Dprintf("- Ethernet<\n"); Ethernet_Reset(false); } /* Re-init Sound? */ if (bReInitSoundEmu) { Dprintf("- Sound<\n"); Sound_Reset(); } /* Force things associated with screen change */ if (bScreenModeChange) { Dprintf("- screenmode<\n"); Screen_ModeChanged(); } /* Do we need to perform reset? */ if (NeedReset) { const char *err_msg; Dprintf("- reset\n"); err_msg=Reset_Cold(); // if (err_msg!=NULL) { // DlgAlert_Notice(err_msg); // return false; // } } /* Go into/return from full screen if flagged */ if (!bInFullScreen && ConfigureParams.Screen.bFullScreen) Screen_EnterFullScreen(); else if (bInFullScreen && !ConfigureParams.Screen.bFullScreen) Screen_ReturnFromFullScreen(); /* update statusbar info (CPU, MHz, mem etc) */ Statusbar_UpdateInfo(); Dprintf("done.\n"); return true; }
/** * Initialise emulation */ static void Main_Init(void) { /* Open debug log file */ if (!Log_Init()) { fprintf(stderr, "Logging/tracing initialization failed\n"); exit(-1); } Log_Printf(LOG_INFO, PROG_NAME ", compiled on: " __DATE__ ", " __TIME__ "\n"); /* Init SDL's video subsystem. Note: Audio and joystick subsystems will be initialized later (failures there are not fatal). */ if (SDL_Init(SDL_INIT_VIDEO | Opt_GetNoParachuteFlag()) < 0) { fprintf(stderr, "Could not initialize the SDL library:\n %s\n", SDL_GetError() ); exit(-1); } ClocksTimings_InitMachine ( ConfigureParams.System.nMachineType ); Resolution_Init(); SDLGui_Init(); Screen_Init(); Main_SetTitle(NULL); // HostScreen_Init(); DSP_Init(); // Floppy_Init(); M68000_Init(); /* Init CPU emulation */ // Audio_Init(); // DmaSnd_Init(); Keymap_Init(); /* call menu at startup */ if (!File_Exists(sConfigFileName) || ConfigureParams.ConfigDialog.bShowConfigDialogAtStartup) Dialog_DoProperty(); else Dialog_CheckFiles(); if (bQuitProgram) { SDL_Quit(); exit(-2); } // const char *err_msg; // // while ((err_msg=Reset_Cold())!=NULL) // { // DlgMissing_Rom(); // if (bQuitProgram) { // Main_RequestQuit(); // break; // } // } Reset_Cold(); // if (bQuitProgram) { // SDL_Quit(); // exit(-2); // } IoMem_Init(); /* done as last, needs CPU & DSP running... */ DebugUI_Init(); }