Make --pause-menu-exit quit the app whenever the game ends

- Fixes #18456

For external launchers (Android handhelds like the Retroid Pocket), which want
control back when the game ends. Before, only the pause menu's Exit quit the
app; now the game exiting by itself, a stop request and dismissing a load
error do too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-20 12:21:37 +02:00
1 parent 7258ffd543
commit ae4b7983aa
4 files changed
+15 -4

No files matched your search

+12 -3
View File
@@ -516,7 +516,7 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
// 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 System_PostUIMessage.
if ((result == DR_OK || quit_) && !bootPending_) {
screenManager()->switchScreen(new MainScreen());
leaveGame();
quit_ = false;
} else {
RecreateViews();
@@ -563,7 +563,7 @@ void EmuScreen::sendMessage(UIMessage message, const char *value) {
INFO_LOG(Log::Loader, "REQUEST_GAME_STOP: running exit callback before shutdown.");
} else {
// No callback (or already in flight, or core not running) - the destructor will take care of shutting down.
screenManager()->switchScreen(new MainScreen());
leaveGame();
}
} else if (message == UIMessage::REQUEST_GAME_RESET) {
if (bootPending_) {
@@ -1532,12 +1532,21 @@ bool EmuScreen::checkPowerDown() {
// Also for REQUEST_STOP.
if (coreState == CORE_POWERDOWN && PSP_GetBootState() == BootState::Complete && !bootPending_) {
INFO_LOG(Log::System, "SELF-POWERDOWN!");
screenManager()->switchScreen(new MainScreen());
leaveGame();
return true;
}
return false;
}
void EmuScreen::leaveGame() {
// Switch screens even when exiting, so the game gets shut down the usual way.
screenManager()->switchScreen(new MainScreen());
if (g_Config.bPauseMenuExitsEmulator) {
INFO_LOG(Log::System, "Game ended, exiting (--pause-menu-exit)");
System_ExitApp();
}
}
ScreenRenderRole EmuScreen::renderRole(bool isTop) const {
auto CanBeBackground = [this, isTop]() -> bool {
if (skipBufferEffects_) {