Properly exit error screen when hitting cancel.

Fixes #3351.
This commit is contained in:
Unknown W. Brackets 2014-01-25 00:40:14 -08:00
parent 7f995647a3
commit d820768396
2 changed files with 6 additions and 2 deletions

View File

@ -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;
}

View File

@ -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.