From 643f82539c9bc43a8573fabee3a236bfeb67cd47 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 19 May 2022 22:19:17 -0500 Subject: ControllerEmu: Expose gate size setting for octagon analog sticks. --- .../ControllerEmu/ControlGroup/AnalogStick.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp') diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp index aaabfa5b17..e4d74aa524 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp @@ -65,9 +65,18 @@ OctagonAnalogStick::OctagonAnalogStick(const char* name_, ControlState gate_radi OctagonAnalogStick::OctagonAnalogStick(const char* name_, const char* ui_name_, ControlState gate_radius) - : AnalogStick(name_, ui_name_, std::make_unique(gate_radius)) + : AnalogStick(name_, ui_name_, std::make_unique(1.0)) { AddVirtualNotchSetting(&m_virtual_notch_setting, 45); + + AddSetting( + &m_gate_size_setting, + {_trans("Gate Size"), + // i18n: The percent symbol. + _trans("%"), + // i18n: Refers to plastic shell of game controller (stick gate) that limits stick movements. + _trans("Adjusts target radius of simulated stick gate.")}, + gate_radius * 100, 0.01, 100); } ControlState OctagonAnalogStick::GetVirtualNotchSize() const @@ -75,4 +84,9 @@ ControlState OctagonAnalogStick::GetVirtualNotchSize() const return m_virtual_notch_setting.GetValue() * MathUtil::TAU / 360; } +ControlState OctagonAnalogStick::GetGateRadiusAtAngle(double ang) const +{ + return AnalogStick::GetGateRadiusAtAngle(ang) * m_gate_size_setting.GetValue() / 100; +} + } // namespace ControllerEmu -- cgit v1.2.3