diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2022-01-04 14:09:50 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2022-01-04 14:09:50 -0600 |
| commit | 78a9bdf04a5745472b4ea86962cfb75170c1c7ee (patch) | |
| tree | ecc16e661a82ab71b363b1a57735dcc23f1ed9fd /Source/Core/InputCommon/ControllerEmu/StickGate.cpp | |
| parent | 953eb49cd8f52495b0cde80487f19c0dc279ca25 (diff) | |
InputCommon: Use value of "Modifier" button "Range" setting rather than always applying 50%.
Make "Clear" button reset "Modifier" "Range" settings to 50%.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 5029fd7f1a..ce9259f06f 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -232,6 +232,15 @@ void ReshapableInput::LoadConfig(IniFile::Section* section, const std::string& d ControlGroup::LoadConfig(section, default_device, base_name); const std::string group(base_name + name + '/'); + + // Special handling for "Modifier" button "Range" settings which default to 50% instead of 100%. + if (const auto* modifier_input = GetModifierInput()) + { + section->Get(group + modifier_input->name + "/Range", &modifier_input->control_ref->range, + 50.0); + modifier_input->control_ref->range /= 100; + } + std::string load_str; section->Get(group + CALIBRATION_CONFIG_NAME, &load_str, ""); const auto load_data = SplitString(load_str, ' '); @@ -313,11 +322,7 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta // This is affected by the modifier's "range" setting which defaults to 50%. if (modifier) { - // TODO: Modifier's range setting gets reset to 100% when the clear button is clicked. - // This causes the modifier to not behave how a user might suspect. - // Retaining the old scale-by-50% behavior until range is fixed to clear to 50%. - dist *= 0.5; - // dist *= modifier; + dist *= modifier; } // Apply deadzone as a percentage of the user-defined calibration shape/size: @@ -330,4 +335,9 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta std::clamp(std::sin(angle) * dist, -clamp, clamp)}; } +Control* ReshapableInput::GetModifierInput() const +{ + return nullptr; +} + } // namespace ControllerEmu |
