summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControlGroup
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/ControlGroup
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/ControlGroup')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp9
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h2
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp9
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h2
4 files changed, 16 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
index b4b1accc77..aaabfa5b17 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
@@ -40,9 +40,7 @@ AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) const
if (!adjusted)
return {x, y};
- const ControlState modifier = controls[4]->GetState();
-
- return Reshape(x, y, modifier);
+ return Reshape(x, y, GetModifierInput()->GetState());
}
AnalogStick::StateData AnalogStick::GetState() const
@@ -55,6 +53,11 @@ ControlState AnalogStick::GetGateRadiusAtAngle(double ang) const
return m_stick_gate->GetRadiusAtAngle(ang);
}
+Control* AnalogStick::GetModifierInput() const
+{
+ return controls[4].get();
+}
+
OctagonAnalogStick::OctagonAnalogStick(const char* name_, ControlState gate_radius)
: OctagonAnalogStick(name_, name_, gate_radius)
{
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h
index 5e95d12013..d5363cecef 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.h
@@ -23,6 +23,8 @@ public:
StateData GetState() const;
private:
+ Control* GetModifierInput() const override;
+
std::unique_ptr<StickGate> m_stick_gate;
};
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
index cd6ee91cbc..69a3038b42 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
@@ -50,9 +50,7 @@ Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted) const
if (!adjusted)
return {x, y};
- const ControlState modifier = controls[4]->GetState();
-
- return Reshape(x, y, modifier);
+ return Reshape(x, y, GetModifierInput()->GetState());
}
Tilt::StateData Tilt::GetState() const
@@ -76,4 +74,9 @@ ControlState Tilt::GetMaxRotationalVelocity() const
return m_max_rotational_velocity.GetValue() * MathUtil::TAU;
}
+Control* Tilt::GetModifierInput() const
+{
+ return controls[4].get();
+}
+
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h
index adc6fffdb8..b9de77d712 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h
@@ -31,6 +31,8 @@ public:
ControlState GetMaxRotationalVelocity() const;
private:
+ Control* GetModifierInput() const override;
+
SettingValue<double> m_max_angle_setting;
SettingValue<double> m_max_rotational_velocity;
};