diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 06abc4a64b..8e9d48467a 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -100,13 +100,13 @@ std::optional<u32> SquareStickGate::GetIdealCalibrationSampleCount() const ReshapableInput::ReshapableInput(std::string name, std::string ui_name, GroupType type) : ControlGroup(std::move(name), std::move(ui_name), type) { - numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50)); + AddDeadzoneSetting(&m_deadzone_setting, 50); } ControlState ReshapableInput::GetDeadzoneRadiusAtAngle(double angle) const { // FYI: deadzone is scaled by input radius which allows the shape to match. - return GetInputRadiusAtAngle(angle) * numeric_settings[SETTING_DEADZONE]->GetValue(); + return GetInputRadiusAtAngle(angle) * GetDeadzonePercentage(); } ControlState ReshapableInput::GetInputRadiusAtAngle(double angle) const @@ -120,6 +120,11 @@ ControlState ReshapableInput::GetInputRadiusAtAngle(double angle) const return GetCalibrationDataRadiusAtAngle(m_calibration, angle); } +ControlState ReshapableInput::GetDeadzonePercentage() const +{ + return m_deadzone_setting.GetValue() / 100; +} + ControlState ReshapableInput::GetCalibrationDataRadiusAtAngle(const CalibrationData& data, double angle) { @@ -267,7 +272,7 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta } // Apply deadzone as a percentage of the user-defined calibration shape/size: - const ControlState deadzone = numeric_settings[SETTING_DEADZONE]->GetValue(); + const ControlState deadzone = GetDeadzonePercentage(); dist = std::max(0.0, dist - deadzone) / (1.0 - deadzone); // Scale to the gate shape/radius: |
