diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 509efee5bc..ec32447dae 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -256,7 +256,7 @@ void ControlMappingScreen::sendMessage(const char *message, const char *value) { // Always call the base class method first to handle the most common messages. UIDialogScreenWithBackground::sendMessage(message, value); - if (!strcmp(message, "settings")) { + if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); screenManager()->push(new GameSettingsScreen("")); } diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 403aaa5275..76673b3f1f 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -311,7 +311,7 @@ static void AfterStateBoot(bool success, const std::string &message, void *ignor void EmuScreen::sendMessage(const char *message, const char *value) { // External commands, like from the Windows UI. - if (!strcmp(message, "pause")) { + if (!strcmp(message, "pause") && screenManager()->topScreen() == this) { releaseButtons(); screenManager()->push(new GamePauseScreen(gamePath_)); } else if (!strcmp(message, "lost_focus")) { @@ -346,15 +346,15 @@ void EmuScreen::sendMessage(const char *message, const char *value) { bootPending_ = true; bootGame(value); } - } else if (!strcmp(message, "control mapping")) { + } else if (!strcmp(message, "control mapping") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); releaseButtons(); screenManager()->push(new ControlMappingScreen()); - } else if (!strcmp(message, "display layout editor")) { + } else if (!strcmp(message, "display layout editor") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); releaseButtons(); screenManager()->push(new DisplayLayoutScreen()); - } else if (!strcmp(message, "settings")) { + } else if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); releaseButtons(); screenManager()->push(new GameSettingsScreen(gamePath_)); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 814f1704dd..7289947eba 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1036,11 +1036,11 @@ void GameSettingsScreen::sendMessage(const char *message, const char *value) { // Always call the base class method first to handle the most common messages. UIDialogScreenWithBackground::sendMessage(message, value); - if (!strcmp(message, "control mapping")) { + if (!strcmp(message, "control mapping") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); screenManager()->push(new ControlMappingScreen()); } - if (!strcmp(message, "display layout editor")) { + if (!strcmp(message, "display layout editor") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); screenManager()->push(new DisplayLayoutScreen()); } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index e10fd3e1c5..3be3842386 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -935,18 +935,10 @@ void MainScreen::sendMessage(const char *message, const char *value) { // Always call the base class method first to handle the most common messages. UIScreenWithBackground::sendMessage(message, value); - if (!strcmp(message, "boot")) { + if (!strcmp(message, "boot") && screenManager()->topScreen() == this) { screenManager()->switchScreen(new EmuScreen(value)); } - if (!strcmp(message, "control mapping")) { - UpdateUIState(UISTATE_MENU); - screenManager()->push(new ControlMappingScreen()); - } - if (!strcmp(message, "display layout editor")) { - UpdateUIState(UISTATE_MENU); - screenManager()->push(new DisplayLayoutScreen()); - } - if (!strcmp(message, "settings")) { + if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { UpdateUIState(UISTATE_MENU); screenManager()->push(new GameSettingsScreen("")); } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index b3b6c56151..0b8eba0838 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -155,7 +155,7 @@ void DrawGameBackground(UIContext &dc, const std::string &gamePath) { } } -void HandleCommonMessages(const char *message, const char *value, ScreenManager *manager) { +void HandleCommonMessages(const char *message, const char *value, ScreenManager *manager, Screen *activeScreen) { if (!strcmp(message, "clear jit")) { if (MIPSComp::jit && PSP_IsInited()) { MIPSComp::jit->ClearCache(); @@ -163,9 +163,11 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager if (PSP_IsInited()) { currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore); } - } else if (!strcmp(message, "control mapping")) { + } else if (!strcmp(message, "control mapping") && manager->topScreen() == activeScreen) { + UpdateUIState(UISTATE_MENU); manager->push(new ControlMappingScreen()); - } else if (!strcmp(message, "display layout editor")) { + } else if (!strcmp(message, "display layout editor") && manager->topScreen() == activeScreen) { + UpdateUIState(UISTATE_MENU); manager->push(new DisplayLayoutScreen()); } else if (!strcmp(message, "window minimized")) { if (!strcmp(value, "true")) { @@ -191,7 +193,7 @@ void UIScreenWithGameBackground::DrawBackground(UIContext &dc) { } void UIScreenWithGameBackground::sendMessage(const char *message, const char *value) { - if (!strcmp(message, "settings")) { + if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { screenManager()->push(new GameSettingsScreen(gamePath_)); } else { UIScreenWithBackground::sendMessage(message, value); @@ -203,7 +205,7 @@ void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) { } void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) { - if (!strcmp(message, "settings")) { + if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { screenManager()->push(new GameSettingsScreen(gamePath_)); } else { UIDialogScreenWithBackground::sendMessage(message, value); @@ -211,13 +213,13 @@ void UIDialogScreenWithGameBackground::sendMessage(const char *message, const ch } void UIScreenWithBackground::sendMessage(const char *message, const char *value) { - HandleCommonMessages(message, value, screenManager()); + HandleCommonMessages(message, value, screenManager(), this); I18NCategory *dev = GetI18NCategory("Developer"); - if (!strcmp(message, "language screen")) { + if (!strcmp(message, "language screen") && screenManager()->topScreen() == this) { auto langScreen = new NewLanguageScreen(dev->T("Language")); langScreen->OnChoice.Handle(this, &UIScreenWithBackground::OnLanguageChange); screenManager()->push(langScreen); - } else if (!strcmp(message, "settings")) { + } else if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { screenManager()->push(new GameSettingsScreen("", "")); } } @@ -252,13 +254,13 @@ void UIDialogScreenWithBackground::AddStandardBack(UI::ViewGroup *parent) { } void UIDialogScreenWithBackground::sendMessage(const char *message, const char *value) { - HandleCommonMessages(message, value, screenManager()); + HandleCommonMessages(message, value, screenManager(), this); I18NCategory *dev = GetI18NCategory("Developer"); - if (!strcmp(message, "language screen")) { + if (!strcmp(message, "language screen") && screenManager()->topScreen() == this) { auto langScreen = new NewLanguageScreen(dev->T("Language")); langScreen->OnChoice.Handle(this, &UIDialogScreenWithBackground::OnLanguageChange); screenManager()->push(langScreen); - } else if (!strcmp(message, "settings")) { + } else if (!strcmp(message, "settings") && screenManager()->topScreen() == this) { screenManager()->push(new GameSettingsScreen("", "")); } } @@ -447,7 +449,7 @@ void LogoScreen::update() { } void LogoScreen::sendMessage(const char *message, const char *value) { - if (!strcmp(message, "boot")) { + if (!strcmp(message, "boot") && screenManager()->topScreen() == this) { screenManager()->switchScreen(new EmuScreen(value)); } }