Fix issue with toggling texture saving via shortcut.

Fixes #20581
This commit is contained in:
Henrik Rydgård committed 2025-07-08 13:51:09 +02:00
1 parent 7d78681b3a
commit 58dd4677e3
3 files changed
+10 -21

No files matched your search

+3 -15
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+6 -5
View File
@@ -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;