diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index ceb48daab..afab08bfa 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -153,7 +153,7 @@ bool Debugger::startWithFatalError(const string& message) void Debugger::quit(bool exitrom) { if(exitrom) - myOSystem.eventHandler().handleEvent(Event::ExitMode); + myOSystem.eventHandler().handleEvent(Event::ExitGame); else { myOSystem.eventHandler().leaveDebugMode(); diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 356fe2783..83688d4bf 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -562,7 +562,6 @@ void DebuggerDialog::addRomArea() bwidth, bheight, "Run", kDDRunCmd); b->setHelpAnchor("GlobalButtons", true); wid2.push_back(b); - addCancelWidget(b); bwidth = bheight; // 7 + 12; bheight = bheight * 3 + 4 * 2; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 0f1c56525..f9a25433c 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -1852,37 +1852,31 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) if (pressed && !repeated) changeStateByEvent(Event::TogglePlayBackMode); return; - // this event is called when exiting a ROM from the debugger, so it acts like pressing ESC in emulation case EventHandlerState::EMULATION: - case EventHandlerState::DEBUGGER: if (pressed && !repeated) { - if (myState == EventHandlerState::EMULATION) - { #ifdef GUI_SUPPORT - if (myOSystem.settings().getBool("confirmexit")) + if (myOSystem.settings().getBool("confirmexit")) + { + StringList msg; + const string saveOnExit = myOSystem.settings().getString("saveonexit"); + bool activeTM = myOSystem.settings().getBool( + myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine"); + + + msg.push_back("Do you really want to exit emulation?"); + if (saveOnExit != "all" || !activeTM) { - StringList msg; - const string saveOnExit = myOSystem.settings().getString("saveonexit"); - bool activeTM = myOSystem.settings().getBool( - myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine"); - - - msg.push_back("Do you really want to exit emulation?"); - if (saveOnExit != "all" || !activeTM) - { - msg.push_back(""); - msg.push_back("You will lose all your progress."); - } - myOSystem.messageMenu().setMessage("Exit Emulation", msg, true); - enterMenuMode(EventHandlerState::MESSAGEMENU); + msg.push_back(""); + msg.push_back("You will lose all your progress."); } - else -#endif - exitEmulation(true); + myOSystem.messageMenu().setMessage("Exit Emulation", msg, true); + enterMenuMode(EventHandlerState::MESSAGEMENU); } else +#endif exitEmulation(true); + } return; @@ -2193,6 +2187,15 @@ bool EventHandler::changeStateByEvent(Event::Type type) handled = false; break; + case Event::ExitMode: + // special handling for ESC key in debugger + if(myState != EventHandlerState::DEBUGGER) + { + handled = false; + break; + } + [[fallthrough]]; + case Event::DebuggerMode: #ifdef DEBUGGER_SUPPORT if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE