summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/StickGate.cpp
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2022-01-13 08:32:15 -0500
committerGitHub <noreply@github.com>2022-01-13 08:32:15 -0500
commit1cea399e9c74aa82b89090b01d2d4dac4e6f39be (patch)
tree066b3f96f26dfe9fbd291e2023405dff3ece02d3 /Source/Core/InputCommon/ControllerEmu/StickGate.cpp
parentcfb8b9bcf4eee1f1352b8208e1334ee49282f414 (diff)
parent78a9bdf04a5745472b4ea86962cfb75170c1c7ee (diff)
Merge pull request #10345 from jordan-woyak/modifier-range
InputCommon: Re-enable "Modifier" "Range" settings.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/StickGate.cpp20
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