CommonHostInterface: Don't save/load input profile rumble for motorless controller types

This commit is contained in:
Albert Liu 2020-12-19 17:42:42 -08:00 committed by Connor McLaughlin
parent 7249825c16
commit a5f04f2a8e
3 changed files with 12 additions and 8 deletions

View file

@ -14,4 +14,3 @@ ButtonL1 = Keyboard/Q
ButtonL2 = Keyboard/1
ButtonR1 = Keyboard/E
ButtonR2 = Keyboard/3
Rumble = Controller0

View file

@ -14,4 +14,3 @@ ButtonL1 = Keyboard/Q
ButtonL2 = Keyboard/1
ButtonR1 = Keyboard/E
ButtonR2 = Keyboard/3
Rumble = Controller0

View file

@ -1846,9 +1846,12 @@ void CommonHostInterface::ApplyInputProfile(const char* profile_path, SettingsIn
}
si.DeleteValue(section_name, "Rumble");
if (Controller::GetVibrationMotorCount(*ctype) > 0)
{
const std::string rumble_value = profile.GetStringValue(section_name, "Rumble");
if (!rumble_value.empty())
si.SetStringValue(section_name, "Rumble", rumble_value.c_str());
}
Controller::SettingList settings = Controller::GetSettings(*ctype);
for (const SettingInfo& ssi : settings)
@ -1903,9 +1906,12 @@ bool CommonHostInterface::SaveInputProfile(const char* profile_path, SettingsInt
profile.AddToStringList(section_name, key_name, binding.c_str());
}
if (Controller::GetVibrationMotorCount(ctype) > 0)
{
const std::string rumble_value = si.GetStringValue(section_name, "Rumble");
if (!rumble_value.empty())
profile.SetStringValue(section_name, "Rumble", rumble_value.c_str());
}
Controller::SettingList settings = Controller::GetSettings(ctype);
for (const SettingInfo& ssi : settings)