From 5949c772d1945d1b2743494f0ba8b3c9956f15db Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Tue, 15 Mar 2022 20:31:52 +0000 Subject: [PATCH] Qt: Fix bugs relating to per-game settings --- pcsx2-qt/SettingWidgetBinder.h | 8 ++++---- pcsx2-qt/Settings/SettingsDialog.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pcsx2-qt/SettingWidgetBinder.h b/pcsx2-qt/SettingWidgetBinder.h index ff89287db6..8d5934d547 100644 --- a/pcsx2-qt/SettingWidgetBinder.h +++ b/pcsx2-qt/SettingWidgetBinder.h @@ -435,7 +435,7 @@ namespace SettingWidgetBinder int sif_value; if (sif->GetIntValue(section.c_str(), key.c_str(), &sif_value)) - Accessor::setNullableIntValue(widget, sif_value); + Accessor::setNullableIntValue(widget, sif_value - option_offset); else Accessor::setNullableIntValue(widget, std::nullopt); @@ -735,7 +735,7 @@ namespace SettingWidgetBinder { for (int i = 0; enum_values[i] != nullptr; i++) { - if (value == enum_values[i]) + if (sif_value == enum_values[i]) { sif_int_value = i; break; @@ -744,9 +744,9 @@ namespace SettingWidgetBinder } Accessor::setNullableIntValue(widget, sif_int_value); - Accessor::connectValueChanged(widget, [sif, widget, section = std::move(section), key = std::move(key), enum_names]() { + Accessor::connectValueChanged(widget, [sif, widget, section = std::move(section), key = std::move(key), enum_values]() { if (std::optional new_value = Accessor::getNullableIntValue(widget); new_value.has_value()) - sif->SetStringValue(section.c_str(), key.c_str(), enum_names[new_value.value()]); + sif->SetStringValue(section.c_str(), key.c_str(), enum_values[new_value.value()]); else sif->DeleteValue(section.c_str(), key.c_str()); diff --git a/pcsx2-qt/Settings/SettingsDialog.cpp b/pcsx2-qt/Settings/SettingsDialog.cpp index 4d37d9091d..dae3ceaa5f 100644 --- a/pcsx2-qt/Settings/SettingsDialog.cpp +++ b/pcsx2-qt/Settings/SettingsDialog.cpp @@ -390,7 +390,7 @@ void SettingsDialog::setStringSettingValue(const char* section, const char* key, { if (m_sif) { - value.has_value() ? m_sif->SetBoolValue(section, key, value.value()) : m_sif->DeleteValue(section, key); + value.has_value() ? m_sif->SetStringValue(section, key, value.value()) : m_sif->DeleteValue(section, key); m_sif->Save(); } else