diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-06-28 02:43:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-28 02:43:30 +0200 |
| commit | e8965c63e41871538a97630bfdd628119fec6aca (patch) | |
| tree | a1866071a5a83301e451112ae4525119e2e56f02 /Source/Core/InputCommon/ControllerEmu/ControlGroup | |
| parent | e18053d3075dd010a3a9db80d1b29b99cf7b69da (diff) | |
| parent | 4c409411edb2957a0f6505aaf6c93e5c6c71f896 (diff) | |
Merge pull request #10682 from jordan-woyak/gate-size-setting
ControllerEmu: Allow changing the target gate radius of octagon sticks.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup')
3 files changed, 20 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp index aaabfa5b17..539e02b449 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp @@ -65,9 +65,19 @@ 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<ControllerEmu::OctagonStickGate>(gate_radius)) + : AnalogStick(name_, ui_name_, std::make_unique<ControllerEmu::OctagonStickGate>(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."), nullptr, + SettingVisibility::Advanced}, + gate_radius * 100, 0.01, 100); } ControlState OctagonAnalogStick::GetVirtualNotchSize() const @@ -75,4 +85,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 diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h index d5363cecef..47e3ad5743 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h @@ -36,9 +36,11 @@ public: OctagonAnalogStick(const char* name, const char* ui_name, ControlState gate_radius); ControlState GetVirtualNotchSize() const override; + ControlState GetGateRadiusAtAngle(double ang) const override; private: SettingValue<double> m_virtual_notch_setting; + SettingValue<double> m_gate_size_setting; }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp index 2f1eb25d5e..890c43a848 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.cpp @@ -32,7 +32,8 @@ void ControlGroup::AddVirtualNotchSetting(SettingValue<double>* value, double ma AddSetting(value, {_trans("Virtual Notches"), // i18n: The degrees symbol. - _trans("°"), _trans("Snap the thumbstick position to the nearest octagonal axis.")}, + _trans("°"), _trans("Snap the thumbstick position to the nearest octagonal axis."), + nullptr, SettingVisibility::Advanced}, 0, 0, max_virtual_notch_deg); } |
