From 58dd4677e3715ccdcd2d7053843e5da4ff0554bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Jul 2025 13:51:09 +0200 Subject: [PATCH] Fix issue with toggling texture saving via shortcut. Fixes #20581 --- GPU/Common/TextureReplacer.cpp | 18 +++--------------- GPU/Common/TextureReplacer.h | 2 +- UI/EmuScreen.cpp | 11 ++++++----- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/GPU/Common/TextureReplacer.cpp b/GPU/Common/TextureReplacer.cpp index 55b3032e85..b29feeb1e8 100644 --- a/GPU/Common/TextureReplacer.cpp +++ b/GPU/Common/TextureReplacer.cpp @@ -102,28 +102,16 @@ void TextureReplacer::NotifyConfigChanged() { // Even if just saving is enabled, it makes sense to reload the ini to get the correct // settings for saving. See issue #19086. This can be expensive though. std::string error; - bool result = LoadIni(&error); + bool result = LoadIni(&error, false); if (!result) { // Ignore errors here, just log if we successfully loaded an ini. } else { INFO_LOG(Log::G3D, "Loaded INI file for saving."); } } - - if (saveEnabled_) { - // Somewhat crude message, re-using translation strings. - auto d = GetI18NCategory(I18NCat::DEVELOPER); - auto di = GetI18NCategory(I18NCat::DIALOG); - std::string str(d->T("Save new textures")); - if (!str.empty()) { - str.append(": "); - str.append(di->T("Enabled")); - g_OSD.Show(OSDType::MESSAGE_INFO, str, 2.0f); - } - } } -bool TextureReplacer::LoadIni(std::string *error) { +bool TextureReplacer::LoadIni(std::string *error, bool notify) { hash_ = ReplacedTextureHash::QUICK; aliases_.clear(); hashranges_.clear(); @@ -214,7 +202,7 @@ bool TextureReplacer::LoadIni(std::string *error) { } auto gr = GetI18NCategory(I18NCat::GRAPHICS); - if (replaceEnabled_) { + if (replaceEnabled_ && notify) { g_OSD.Show(OSDType::MESSAGE_SUCCESS, gr->T("Texture replacement pack activated"), 3.0f); } diff --git a/GPU/Common/TextureReplacer.h b/GPU/Common/TextureReplacer.h index ea70bc09ea..9410dac6dd 100644 --- a/GPU/Common/TextureReplacer.h +++ b/GPU/Common/TextureReplacer.h @@ -131,7 +131,7 @@ public: protected: bool FindFiltering(u64 cachekey, u32 hash, TextureFiltering *forceFiltering); - bool LoadIni(std::string *error); + bool LoadIni(std::string *error, bool notify = true); bool LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverride, std::string *error); void ParseHashRange(const std::string &key, const std::string &value); void ParseFiltering(const std::string &key, const std::string &value); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 469ce3f0fe..f4614e941c 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -896,19 +896,20 @@ void EmuScreen::ProcessVKey(VirtKey virtKey) { case VIRTKEY_TEXTURE_DUMP: g_Config.bSaveNewTextures = !g_Config.bSaveNewTextures; if (g_Config.bSaveNewTextures) { - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("saveNewTextures_true", "Textures will now be saved to your storage"), 2.0, "savetexturechanged"); - System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); + g_OSD.Show(OSDType::MESSAGE_SUCCESS, sc->T("saveNewTextures_true", "Textures will now be saved to your storage"), 2.0, "savetexturechanged"); } else { g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("saveNewTextures_false", "Texture saving was disabled"), 2.0, "savetexturechanged"); } + System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); break; case VIRTKEY_TEXTURE_REPLACE: g_Config.bReplaceTextures = !g_Config.bReplaceTextures; - if (g_Config.bReplaceTextures) - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("replaceTextures_true", "Texture replacement enabled"), 2.0, "replacetexturechanged"); - else + if (g_Config.bReplaceTextures) { + g_OSD.Show(OSDType::MESSAGE_SUCCESS, sc->T("replaceTextures_true", "Texture replacement enabled"), 2.0, "replacetexturechanged"); + } else { g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("replaceTextures_false", "Textures are no longer being replaced"), 2.0, "replacetexturechanged"); + } System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); break;