From b5d21b4f9ba659c4dd4f26e340ebd8509c91da6b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 10 Apr 2021 18:42:40 -0700 Subject: [PATCH] UI: Remove extern global for UI message. --- UI/GameSettingsScreen.cpp | 18 ++++++++++-------- UI/GameSettingsScreen.h | 1 + UI/NativeApp.cpp | 1 - Windows/MainWindowMenu.cpp | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 90d56fb763..618f675ec5 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -79,8 +79,6 @@ #include "Windows/W32Util/ShellUtil.h" #endif -extern bool g_ShaderNameListChanged; - GameSettingsScreen::GameSettingsScreen(std::string gamePath, std::string gameID, bool editThenRestore) : UIDialogScreenWithGameBackground(gamePath), gameID_(gameID), enableReports_(false), editThenRestore_(editThenRestore) { lastVertical_ = UseVerticalLayout(); @@ -1260,11 +1258,6 @@ void GameSettingsScreen::update() { RecreateViews(); lastVertical_ = vertical; } - if (g_ShaderNameListChanged) { - g_ShaderNameListChanged = false; - g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); - RecreateViews(); - } } void GameSettingsScreen::onFinish(DialogResult result) { @@ -1292,6 +1285,14 @@ void GameSettingsScreen::onFinish(DialogResult result) { NativeMessageReceived("gpu_clearCache", ""); } +void GameSettingsScreen::sendMessage(const char *message, const char *value) { + UIDialogScreenWithGameBackground::sendMessage(message, value); + if (!strcmp(message, "postshader_updated")) { + g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); + RecreateViews(); + } +} + #if PPSSPP_PLATFORM(ANDROID) void GameSettingsScreen::CallbackMemstickFolder(bool yes) { auto sy = GetI18NCategory("System"); @@ -1530,8 +1531,9 @@ UI::EventReturn GameSettingsScreen::OnLanguageChange(UI::EventParams &e) { UI::EventReturn GameSettingsScreen::OnPostProcShaderChange(UI::EventParams &e) { g_Config.vPostShaderNames.erase(std::remove(g_Config.vPostShaderNames.begin(), g_Config.vPostShaderNames.end(), "Off"), g_Config.vPostShaderNames.end()); - g_ShaderNameListChanged = true; + NativeMessageReceived("gpu_resized", ""); + NativeMessageReceived("postshader_updated", ""); return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 76fd384aed..ec7542f483 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -37,6 +37,7 @@ public: std::string tag() const override { return "settings"; } protected: + void sendMessage(const char *message, const char *value) override; void CreateViews() override; void CallbackRestoreDefaults(bool yes); void CallbackRenderingBackend(bool yes); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e36f59a016..1631461115 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -144,7 +144,6 @@ std::string config_filename; // Really need to clean this mess of globals up... but instead I add more :P bool g_TakeScreenshot; -bool g_ShaderNameListChanged = false; static bool isOuya; static bool resized = false; static bool restarting = false; diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index c4a31fb92b..689cd6366c 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -50,7 +50,6 @@ #include "Core/Core.h" extern bool g_TakeScreenshot; -extern bool g_ShaderNameListChanged; namespace MainWindow { extern HINSTANCE hInst; @@ -1069,9 +1068,10 @@ namespace MainWindow { g_Config.vPostShaderNames.clear(); if (availableShaders[index] != "Off") g_Config.vPostShaderNames.push_back(availableShaders[index]); - g_ShaderNameListChanged = true; g_Config.bShaderChainRequires60FPS = PostShaderChainRequires60FPS(GetFullPostShadersChain(g_Config.vPostShaderNames)); + NativeMessageReceived("gpu_resized", ""); + NativeMessageReceived("postshader_updated", ""); break; }