From e989e5f44c51db2b7ff25a52b712ec15416de1aa Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 28 Sep 2016 22:37:36 -0700 Subject: [PATCH] Allow Windows UI options to work in most places. This makes it so you can change language from the pause screen, etc. --- UI/MiscScreens.cpp | 43 +++++++++++++++++++++++++++++++++++-------- UI/MiscScreens.h | 2 ++ UI/PauseScreen.cpp | 1 + 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 0877e42f75..eb7ea6674a 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -31,10 +31,13 @@ #include "util/random/rng.h" #include "file/vfs.h" #include "UI/ui_atlas.h" -#include "UI/MiscScreens.h" +#include "UI/ControlMappingScreen.h" +#include "UI/DisplayLayoutScreen.h" #include "UI/EmuScreen.h" -#include "UI/MainScreen.h" #include "UI/GameInfoCache.h" +#include "UI/GameSettingsScreen.h" +#include "UI/MainScreen.h" +#include "UI/MiscScreens.h" #include "Core/Config.h" #include "Core/Host.h" #include "Core/System.h" @@ -136,6 +139,16 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager if (PSP_IsInited()) { currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore); } + } else if (!strcmp(message, "control mapping")) { + manager->push(new ControlMappingScreen()); + } else if (!strcmp(message, "display layout editor")) { + manager->push(new DisplayLayoutScreen()); + } else if (!strcmp(message, "window minimized")) { + if (!strcmp(value, "true")) { + gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED; + } else { + gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED; + } } } @@ -153,10 +166,26 @@ void UIScreenWithGameBackground::DrawBackground(UIContext &dc) { } } +void UIScreenWithGameBackground::sendMessage(const char *message, const char *value) { + if (!strcmp(message, "settings")) { + screenManager()->push(new GameSettingsScreen(gamePath_)); + } else { + UIScreenWithBackground::sendMessage(message, value); + } +} + void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) { DrawGameBackground(dc, gamePath_); } +void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) { + if (!strcmp(message, "settings")) { + screenManager()->push(new GameSettingsScreen(gamePath_)); + } else { + UIDialogScreenWithBackground::sendMessage(message, value); + } +} + void UIScreenWithBackground::sendMessage(const char *message, const char *value) { HandleCommonMessages(message, value, screenManager()); I18NCategory *dev = GetI18NCategory("Developer"); @@ -164,6 +193,8 @@ void UIScreenWithBackground::sendMessage(const char *message, const char *value) auto langScreen = new NewLanguageScreen(dev->T("Language")); langScreen->OnChoice.Handle(this, &UIScreenWithBackground::OnLanguageChange); screenManager()->push(langScreen); + } else if (!strcmp(message, "settings")) { + screenManager()->push(new GameSettingsScreen("", "")); } } @@ -203,12 +234,8 @@ void UIDialogScreenWithBackground::sendMessage(const char *message, const char * auto langScreen = new NewLanguageScreen(dev->T("Language")); langScreen->OnChoice.Handle(this, &UIDialogScreenWithBackground::OnLanguageChange); screenManager()->push(langScreen); - } else if (!strcmp(message, "window minimized")) { - if (!strcmp(value, "true")) { - gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED; - } else { - gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED; - } + } else if (!strcmp(message, "settings")) { + screenManager()->push(new GameSettingsScreen("", "")); } } diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 1885110b13..6700db487d 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -45,6 +45,7 @@ public: UIScreenWithGameBackground(const std::string &gamePath) : UIScreenWithBackground(), gamePath_(gamePath) {} virtual void DrawBackground(UIContext &dc); + virtual void sendMessage(const char *message, const char *value) override; protected: std::string gamePath_; }; @@ -65,6 +66,7 @@ public: UIDialogScreenWithGameBackground(const std::string &gamePath) : UIDialogScreenWithBackground(), gamePath_(gamePath) {} virtual void DrawBackground(UIContext &dc) override; + virtual void sendMessage(const char *message, const char *value) override; protected: std::string gamePath_; }; diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index ebb08d44e0..5c4fac4ec5 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -452,6 +452,7 @@ UI::EventReturn GamePauseScreen::OnDeleteConfig(UI::EventParams &e) void GamePauseScreen::sendMessage(const char *message, const char *value) { + UIDialogScreenWithGameBackground::sendMessage(message, value); // Since the language message isn't allowed to be in native, we have to have add this // to every screen which directly inherits from UIScreen(which are few right now, luckily). if (!strcmp(message, "language")) {