diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index b2f14ea8a0..c28974828b 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -90,13 +90,10 @@ void ScreenManager::cancelScreensAbove(Screen *screen) { void ScreenManager::update() { std::lock_guard guard(inputLock_); - if (!nextStack_.empty()) { - switchToNext(); - } if (cancelScreensAbove_) { bool found = false; - for (int i = stack_.size() - 1; i >= 0; i--) { + for (int i = (int)stack_.size() - 1; i >= 0; i--) { if (stack_[i].screen == cancelScreensAbove_) { break; } @@ -107,6 +104,10 @@ void ScreenManager::update() { cancelScreensAbove_ = nullptr; } + if (!nextStack_.empty()) { + switchToNext(); + } + if (overlayScreen_) { // NOTE: This is not a full UIScreen update, to avoid double global event processing. overlayScreen_->update(); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 1f0b25631f..1e6e1a90f0 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -227,7 +227,12 @@ void EmuScreen::ProcessGameBoot(const Path &filename) { } std::string error_string = "(unknown error)"; - BootState state = PSP_InitUpdate(&error_string); + const BootState state = PSP_InitUpdate(&error_string); + + if (state == BootState::Off && screenManager()->topScreen() != this) { + // Don't kick off a new boot if we're not on top. + return; + } switch (state) { case BootState::Booting: diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 51d92f8729..04fb63ce9f 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1425,9 +1425,8 @@ void MainScreen::sendMessage(UIMessage message, const char *value) { UIScreenWithBackground::sendMessage(message, value); if (message == UIMessage::REQUEST_GAME_BOOT) { - if (screenManager()->topScreen() == this) { - LaunchFile(screenManager(), Path(std::string(value))); - } + screenManager()->cancelScreensAbove(this); + LaunchFile(screenManager(), Path(std::string(value))); } else if (message == UIMessage::PERMISSION_GRANTED && !strcmp(value, "storage")) { RecreateViews(); } else if (message == UIMessage::RECENT_FILES_CHANGED) {