From a261e61e9e3941d10cf0ef3adf8eac00f722b6db Mon Sep 17 00:00:00 2001 From: Filoppi Date: Tue, 4 May 2021 23:47:55 +0300 Subject: InputCommon: add a ton of missing consts fix some related grammar errors only the ButtonManager required code changes --- Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp') diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 797d19aadf..d1b230c373 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -280,7 +280,7 @@ void ReshapableInput::SaveConfig(IniFile::Section* section, const std::string& d } ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlState y, - ControlState modifier) + ControlState modifier) const { x -= m_center.x; y -= m_center.y; -- cgit v1.2.3 From f4fec42165f245e8ad35456a25bfada8428ba1f2 Mon Sep 17 00:00:00 2001 From: Filoppi Date: Tue, 4 May 2021 23:50:23 +0300 Subject: Add mixed comments to input code, make some tooltip clearer --- Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp') diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index d1b230c373..60a3c062bd 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -128,6 +128,7 @@ std::optional SquareStickGate::GetIdealCalibrationSampleCount() const ReshapableInput::ReshapableInput(std::string name_, std::string ui_name_, GroupType type_) : ControlGroup(std::move(name_), std::move(ui_name_), type_) { + // 50 is not always enough but users can set it to more with an expression AddDeadzoneSetting(&m_deadzone_setting, 50); } @@ -285,6 +286,10 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta x -= m_center.x; y -= m_center.y; + // We run this even if both x and y will be zero. + // In that case, std::atan2(0, 0) returns a valid non-NaN value, but the exact value + // (which depends on the signs of x and y) does not matter here as dist is zero + // TODO: make the AtAngle functions work with negative angles: ControlState angle = std::atan2(y, x) + MathUtil::TAU; -- cgit v1.2.3 From 26f664842184a2fd5236de2621eff509b05d0c3d Mon Sep 17 00:00:00 2001 From: Filoppi Date: Wed, 5 May 2021 00:19:45 +0300 Subject: StickGate: add custom clamp value Works exactly as before by default. It will be used by my upcoming input PRs. --- Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/Core/InputCommon/ControllerEmu/StickGate.cpp') diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 60a3c062bd..d57a2402cf 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -281,7 +281,8 @@ void ReshapableInput::SaveConfig(IniFile::Section* section, const std::string& d } ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlState y, - ControlState modifier) const + ControlState modifier, + ControlState clamp) const { x -= m_center.x; y -= m_center.y; @@ -326,8 +327,8 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta // Scale to the gate shape/radius: dist *= gate_max_dist; - return {std::clamp(std::cos(angle) * dist, -1.0, 1.0), - std::clamp(std::sin(angle) * dist, -1.0, 1.0)}; + return {std::clamp(std::cos(angle) * dist, -clamp, clamp), + std::clamp(std::sin(angle) * dist, -clamp, clamp)}; } } // namespace ControllerEmu -- cgit v1.2.3