--- hatari/src/gui-sdl/dlgHalt.c 2019/04/09 08:57:07 1.1.1.2 +++ hatari/src/gui-sdl/dlgHalt.c 2019/04/09 08:59:37 1.1.1.3 @@ -23,10 +23,12 @@ const char DlgHalt_fileid[] = "Hatari dl #define DLGHALT_DEBUG 4 #define DLGHALT_QUIT 5 +#define DLGHALT_MSG "Detected double bus/address error => CPU halted!" + /* The "Halt"-dialog: */ static SGOBJ haltdlg[] = { { SGBOX, 0, 0, 0,0, 52,7, NULL }, - { SGTEXT, 0, 0, 2,1, 48,1, "Detected double bus/address error => CPU halted!" }, + { SGTEXT, 0, 0, 2,1, 48,1, DLGHALT_MSG }, { SGBUTTON, SG_DEFAULT, 0, 6,3, 12,1, "_Warm reset" }, { SGBUTTON, 0, 0, 6,5, 12,1, "_Cold reset" }, { SGBUTTON, 0, 0, 28,3, 18,1, "Console _debugger" }, @@ -37,6 +39,20 @@ static SGOBJ haltdlg[] = { /*-----------------------------------------------------------------------*/ /** + * Make Hatari quit + */ +static void do_quit(int exitval) +{ + if (bQuitProgram) { + /* got here again, cold reset emulation to make sure we actually can exit */ + fputs("Halt dialog invoked during Hatari shutdown, doing emulation cold reset...\n", stderr); + Reset_Cold(); + } + Main_SetQuitValue(exitval); +} + +/*-----------------------------------------------------------------------*/ +/** * Show the "halt" dialog */ void Dialog_HaltDlg(void) @@ -48,6 +64,16 @@ void Dialog_HaltDlg(void) #endif SDL_ShowCursor(SDL_ENABLE); + /* if we get halt with --run-vbls, just quit right away */ + if (Main_SetRunVBLs(0)) + { + Log_Printf(LOG_ERROR, DLGHALT_MSG); + do_quit(1); + return; + } + + if (SDLGui_SetScreen(sdlscrn)) + return; SDLGui_CenterDlg(haltdlg); switch (SDLGui_DoDialog(haltdlg, NULL, false)) { @@ -64,16 +90,13 @@ void Dialog_HaltDlg(void) SDL_UpdateRect(sdlscrn, 0,0, 0,0); DebugUI(REASON_CPU_EXCEPTION); break; + case DLGHALT_QUIT: + case SDLGUI_QUIT: + do_quit(0); + break; default: - /* DLGHALTQUIT, SDLGUI_QUIT and GUI errors */ - if (bQuitProgram) { - /* got here again, cold reset emulation to make sure we actually can exit */ - fputs("Halt dialog invoked during Hatari shutdown, doing emulation cold reset...\n", stderr); - Reset_Cold(); - } else { - bQuitProgram = true; - } - M68000_SetSpecial(SPCFLAG_BRK); + /* GUI errors */ + do_quit(1); } SDL_ShowCursor(show); #if WITH_SDL2