Exit Blocked by App Prompt should not fire on Stop Emulation

The previous version of this code was nested in a way that was causing Stop Emulation to raise the Confirm Exit dialog immediately.
This commit is contained in:
Squall-Leonhart 2023-10-21 13:34:55 +11:00
commit b03d5837d9

View file

@ -3440,35 +3440,31 @@ void GMainWindow::OnStopGame() {
play_time_manager->Stop(); play_time_manager->Stop();
// Update game list to show new play time // Update game list to show new play time
game_list->PopulateAsync(UISettings::values.game_dirs); game_list->PopulateAsync(UISettings::values.game_dirs);
if (OnShutdownBegin()) {
OnShutdownBeginDialog();
} else {
OnEmulationStopped(); OnEmulationStopped();
} }
} }
}
bool GMainWindow::ConfirmShutdownGame() { bool GMainWindow::ConfirmShutdownGame() {
bool showDialog = false;
if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) { if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) {
if (system->GetExitLocked()) { if (system->GetExitLocked()) {
if (!ConfirmForceLockedExit()) { showDialog = ConfirmForceLockedExit();
return false;
}
} else { } else {
if (!ConfirmChangeGame()) { showDialog = ConfirmChangeGame();
return false;
}
} }
} else { } else {
if (UISettings::values.confirm_before_stopping.GetValue() == if (UISettings::values.confirm_before_stopping.GetValue() ==
ConfirmStop::Ask_Based_On_Game && ConfirmStop::Ask_Based_On_Game &&
system->GetExitLocked()) { system->GetExitLocked()) {
if (!ConfirmForceLockedExit()) { showDialog = ConfirmForceLockedExit();
return false;
} }
} }
if (showDialog && OnShutdownBegin()) {
OnShutdownBeginDialog();
} }
return true;
return showDialog;
} }
void GMainWindow::OnLoadComplete() { void GMainWindow::OnLoadComplete() {