Qt: Fix bugs relating to per-game settings

This commit is contained in:
TheLastRar 2022-03-15 20:31:52 +00:00 committed by refractionpcsx2
parent 63998b64cc
commit 5949c772d1
2 changed files with 5 additions and 5 deletions

View File

@ -435,7 +435,7 @@ namespace SettingWidgetBinder
int sif_value; int sif_value;
if (sif->GetIntValue(section.c_str(), key.c_str(), &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 else
Accessor::setNullableIntValue(widget, std::nullopt); Accessor::setNullableIntValue(widget, std::nullopt);
@ -735,7 +735,7 @@ namespace SettingWidgetBinder
{ {
for (int i = 0; enum_values[i] != nullptr; i++) for (int i = 0; enum_values[i] != nullptr; i++)
{ {
if (value == enum_values[i]) if (sif_value == enum_values[i])
{ {
sif_int_value = i; sif_int_value = i;
break; break;
@ -744,9 +744,9 @@ namespace SettingWidgetBinder
} }
Accessor::setNullableIntValue(widget, sif_int_value); 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<int> new_value = Accessor::getNullableIntValue(widget); new_value.has_value()) if (std::optional<int> 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 else
sif->DeleteValue(section.c_str(), key.c_str()); sif->DeleteValue(section.c_str(), key.c_str());

View File

@ -390,7 +390,7 @@ void SettingsDialog::setStringSettingValue(const char* section, const char* key,
{ {
if (m_sif) 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(); m_sif->Save();
} }
else else