|
|
1.1 root 1: /*
2: Hatari - dlgHalt.c - Emulation halt + reset handling alertbox
3:
4: Copyright (C) 2015 by Eero Tamminen
5:
6: This file is distributed under the GNU General Public License, version 2
7: or at your option any later version. Read the file gpl.txt for details.
8: */
9: const char DlgHalt_fileid[] = "Hatari dlgHalt.c : " __DATE__ " " __TIME__;
10:
11: #include <string.h>
12:
13: #include "main.h"
14: #include "reset.h"
15: #include "debugui.h"
16: #include "dialog.h"
17: #include "screen.h"
18: #include "sdlgui.h"
19:
20: #define DLGHALT_WARM 2
21: #define DLGHALT_COLD 3
22: #define DLGHALT_DEBUG 4
23: #define DLGHALT_QUIT 5
24:
25: /* The "Halt"-dialog: */
26: static SGOBJ haltdlg[] = {
27: { SGBOX, 0, 0, 0,0, 52,7, NULL },
28: { SGTEXT, 0, 0, 2,1, 48,1, "Detected double bus/address error => CPU halted!" },
29: { SGBUTTON, SG_DEFAULT, 0, 6,3, 12,1, "_Warm reset" },
30: { SGBUTTON, 0, 0, 6,5, 12,1, "_Cold reset" },
31: { SGBUTTON, 0, 0, 28,3, 18,1, "Console _debugger" },
32: { SGBUTTON, SG_CANCEL, 0, 28,5, 18,1, "_Quit Hatari" },
33: { -1, 0, 0, 0,0, 0,0, NULL }
34: };
35:
36:
37: /*-----------------------------------------------------------------------*/
38: /**
39: * Show the "halt" dialog
40: */
41: void Dialog_HaltDlg(void)
42: {
43: bool show = SDL_ShowCursor(SDL_QUERY);
44: #if WITH_SDL2
45: bool mode = SDL_GetRelativeMouseMode();
46: SDL_SetRelativeMouseMode(SDL_FALSE);
47: #endif
48: SDL_ShowCursor(SDL_ENABLE);
49:
50: SDLGui_CenterDlg(haltdlg);
51: switch (SDLGui_DoDialog(haltdlg, NULL, false)) {
52:
53: case DLGHALT_WARM:
54: /* Reset to exit 'halt' state (resets CPU and regs.spcflags) */
55: Reset_Warm();
56: break;
57: case DLGHALT_COLD:
58: /* Warm reset isn't always enough to restore emulated system to working state */
59: Reset_Cold();
60: break;
61: case DLGHALT_DEBUG:
62: /* Call the debugger, restore screen so user sees whats on it */
63: SDL_UpdateRect(sdlscrn, 0,0, 0,0);
64: DebugUI(REASON_CPU_EXCEPTION);
65: break;
66: default:
67: /* DLGHALTQUIT, SDLGUI_QUIT and GUI errors */
68: if (bQuitProgram) {
69: /* got here again, cold reset emulation to make sure we actually can exit */
70: fputs("Halt dialog invoked during Hatari shutdown, doing emulation cold reset...\n", stderr);
71: Reset_Cold();
72: } else {
73: bQuitProgram = true;
74: }
75: }
76: SDL_ShowCursor(show);
77: #if WITH_SDL2
78: SDL_SetRelativeMouseMode(mode);
79: #endif
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.