From f8cca9fe5dc93b051fbb63247edad99533f19bfc Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 24 Feb 2020 16:55:44 -0600 Subject: [PATCH] InputCommon: RoundStickGate's ideal sample count can be 1. --- Source/Core/InputCommon/ControllerEmu/StickGate.cpp | 8 +++++++- Source/Core/InputCommon/ControllerEmu/StickGate.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 0b16103773..3346b874a2 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -54,7 +54,7 @@ constexpr int ReshapableInput::CALIBRATION_SAMPLE_COUNT; std::optional StickGate::GetIdealCalibrationSampleCount() const { - return {}; + return std::nullopt; } OctagonStickGate::OctagonStickGate(ControlState radius) : m_radius(radius) @@ -86,6 +86,12 @@ ControlState RoundStickGate::GetRadiusAtAngle(double) const return m_radius; } +std::optional RoundStickGate::GetIdealCalibrationSampleCount() const +{ + // The "radius" is the same at every angle so a single sample is enough. + return 1; +} + SquareStickGate::SquareStickGate(ControlState half_width) : m_half_width(half_width) { } diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.h b/Source/Core/InputCommon/ControllerEmu/StickGate.h index 217c7f56d7..d044f1932c 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.h +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.h @@ -48,6 +48,7 @@ class RoundStickGate : public StickGate public: explicit RoundStickGate(ControlState radius); ControlState GetRadiusAtAngle(double ang) const override final; + std::optional GetIdealCalibrationSampleCount() const override final; private: const ControlState m_radius;