mirror of https://github.com/stella-emu/stella.git
cleaned up debugger exiting code (fixes #516)
This commit is contained in:
parent
e75d028c79
commit
d83f415192
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue