From 6a0963908dbb316f00818822065e26777621bdcc Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 29 May 2025 23:28:16 -0500 Subject: DolphinQt: Make Calibration autocomplete when data is "sensible" and stick is returned to neutral position. --- Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 2852291021..8b8a22e400 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -277,6 +278,16 @@ bool CalibrationBuilder::IsCalibrationDataSensible() const return stats.StandardDeviation() < REASONABLE_DEVIATION; } +bool CalibrationBuilder::IsComplete() const +{ + if (!IsCalibrationDataSensible()) + return false; + + const auto half_calibration = + 0.5 * GetCalibrationRadiusAtAngle(std::atan2(m_prev_point.y, m_prev_point.x) + MathUtil::TAU); + return m_prev_point.LengthSquared() < (half_calibration * half_calibration); +} + ControlState CalibrationBuilder::GetCalibrationRadiusAtAngle(double angle) const { return ControllerEmu::ReshapableInput::GetCalibrationDataRadiusAtAngle(m_calibration_data, angle); -- cgit v1.2.3