Annotation of hatari/src/gui-sdl/dlgHalt.c, revision 1.1.1.2

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"
1.1.1.2 ! root       19: #include "m68000.h"
1.1       root       20: 
                     21: #define DLGHALT_WARM   2
                     22: #define DLGHALT_COLD   3
                     23: #define DLGHALT_DEBUG  4
                     24: #define DLGHALT_QUIT   5
                     25: 
                     26: /* The "Halt"-dialog: */
                     27: static SGOBJ haltdlg[] = {
                     28:        { SGBOX,  0, 0, 0,0, 52,7, NULL },
                     29:        { SGTEXT, 0, 0, 2,1, 48,1, "Detected double bus/address error => CPU halted!" },
                     30:        { SGBUTTON, SG_DEFAULT, 0,  6,3, 12,1, "_Warm reset" },
                     31:        { SGBUTTON, 0,          0,  6,5, 12,1, "_Cold reset" },
                     32:        { SGBUTTON, 0,          0, 28,3, 18,1, "Console _debugger" },
                     33:        { SGBUTTON, SG_CANCEL,  0, 28,5, 18,1, "_Quit Hatari" },
1.1.1.2 ! root       34:        { SGSTOP, 0, 0, 0,0, 0,0, NULL }
1.1       root       35: };
                     36: 
                     37: 
                     38: /*-----------------------------------------------------------------------*/
                     39: /**
                     40:  * Show the "halt" dialog
                     41:  */
                     42: void Dialog_HaltDlg(void)
                     43: {
                     44:        bool show = SDL_ShowCursor(SDL_QUERY);
                     45: #if WITH_SDL2
                     46:        bool mode = SDL_GetRelativeMouseMode();
                     47:        SDL_SetRelativeMouseMode(SDL_FALSE);
                     48: #endif
                     49:        SDL_ShowCursor(SDL_ENABLE);
                     50: 
                     51:        SDLGui_CenterDlg(haltdlg);
                     52:        switch (SDLGui_DoDialog(haltdlg, NULL, false)) {
                     53: 
                     54:        case DLGHALT_WARM:
                     55:                /* Reset to exit 'halt' state (resets CPU and regs.spcflags) */
                     56:                Reset_Warm();
                     57:                break;
                     58:        case DLGHALT_COLD:
                     59:                /* Warm reset isn't always enough to restore emulated system to working state */
                     60:                Reset_Cold();
                     61:                break;
                     62:        case DLGHALT_DEBUG:
                     63:                /* Call the debugger, restore screen so user sees whats on it */
                     64:                SDL_UpdateRect(sdlscrn, 0,0, 0,0);
                     65:                DebugUI(REASON_CPU_EXCEPTION);
                     66:                break;
                     67:        default:
                     68:                /* DLGHALTQUIT, SDLGUI_QUIT and GUI errors */
                     69:                if (bQuitProgram) {
                     70:                        /* got here again, cold reset emulation to make sure we actually can exit */
                     71:                        fputs("Halt dialog invoked during Hatari shutdown, doing emulation cold reset...\n", stderr);
                     72:                        Reset_Cold();
                     73:                } else {
                     74:                        bQuitProgram = true;
                     75:                }
1.1.1.2 ! root       76:                M68000_SetSpecial(SPCFLAG_BRK);
1.1       root       77:        }
                     78:        SDL_ShowCursor(show);
                     79: #if WITH_SDL2
                     80:        SDL_SetRelativeMouseMode(mode);
                     81: #endif
                     82: }

unix.superglobalmegacorp.com

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