diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 1d0d3feef3..36c865664f 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -59,7 +59,7 @@ #include "UI/InstallZipScreen.h" EmuScreen::EmuScreen(const std::string &filename) - : booted_(false), gamePath_(filename), invalid_(true), pauseTrigger_(false) { + : booted_(false), gamePath_(filename), invalid_(true), quit_(false), pauseTrigger_(false) { } void EmuScreen::bootGame(const std::string &filename) { @@ -155,9 +155,10 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) { // TODO: improve the way with which we got commands from PauseMenu. // DR_CANCEL/DR_BACK means clicked on "continue", DR_OK means clicked on "back to menu", // DR_YES means a message sent to PauseMenu by NativeMessageReceived. - if (result == DR_OK) { + if (result == DR_OK || quit_) { screenManager()->switchScreen(new MainScreen()); System_SendMessage("event", "exitgame"); + quit_ = false; } RecreateViews(); } @@ -484,6 +485,7 @@ void EmuScreen::update(InputState &input) { if (errorMessage_.find("ZIP") != std::string::npos) { screenManager()->push(new InstallZipScreen(gamePath_)); errorMessage_ = ""; + quit_ = true; return; } I18NCategory *g = GetI18NCategory("Error"); @@ -494,6 +496,7 @@ void EmuScreen::update(InputState &input) { screenManager()->push(new PromptScreen(errLoadingFile, "OK", "")); errorMessage_ = ""; + quit_ = true; return; } diff --git a/UI/EmuScreen.h b/UI/EmuScreen.h index a90b0f45b4..e6b2bee748 100644 --- a/UI/EmuScreen.h +++ b/UI/EmuScreen.h @@ -64,6 +64,7 @@ private: // Something invalid was loaded, don't try to emulate bool invalid_; + bool quit_; std::string errorMessage_; // If set, pauses at the end of the frame.