Skip to content

Commit

Permalink
InputCommon: Fix ControlGroup::SaveConfig with DefaultValue::Disabled
Browse files Browse the repository at this point in the history
I also changed LoadConfig, but that change doesn't affect correctness,
it's only so it looks neat by matching SaveConfig.

This bug was added in 18a4afb, the
commit that introduced DefaultValue::Disabled. The bug can't actually be
triggered in master, but it can be triggered in the Android input
overhaul PR.
  • Loading branch information
JosJuice committed Feb 26, 2023
1 parent 26adf78 commit 9b3816c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,

// enabled
if (default_value != DefaultValue::AlwaysEnabled)
sec->Get(group + "Enabled", &enabled, default_value == DefaultValue::Enabled);
sec->Get(group + "Enabled", &enabled, default_value != DefaultValue::Disabled);

for (auto& setting : numeric_settings)
setting->LoadFromIni(*sec, group);
Expand Down Expand Up @@ -109,7 +109,7 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
const std::string group(base + name + "/");

// enabled
sec->Set(group + "Enabled", enabled, true);
sec->Set(group + "Enabled", enabled, default_value != DefaultValue::Disabled);

for (auto& setting : numeric_settings)
setting->SaveToIni(*sec, group);
Expand Down

0 comments on commit 9b3816c

Please sign in to comment.