diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2025-05-23 01:55:32 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-06-14 16:28:09 -0500 |
| commit | 11c3f7ea8d8c182fdd9c1a3573db8c94eafb5b46 (patch) | |
| tree | b82a98c116441a9496d864f807119b54a620f99d /Source/Core/InputCommon | |
| parent | 2047eaf1d86839b53bb92cf79cfae8be2a568ed6 (diff) | |
InputCommon: Fix occasional misidentification of analog input detection.
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/CoreDevice.h | 2 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index 95f9f5b88e..5318a102f9 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -217,6 +217,8 @@ public: Clock::time_point press_time; std::optional<Clock::time_point> release_time; ControlState smoothness = 0; + + bool IsAnalogPress() const { return smoothness > 1.00001; } }; Device::Input* FindInput(std::string_view name, const Device* def_dev) const; diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 9660d9ede8..505fd0260c 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -139,7 +139,7 @@ void RemoveSpuriousTriggerCombinations(Core::InputDetector::Results* detections) const auto is_spurious = [&](const auto& detection) { return std::ranges::any_of(*detections, [&](const auto& d) { // This is a spurious digital detection if a "smooth" (analog) detection is temporally near. - return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness && + return &d != &detection && d.IsAnalogPress() && !detection.IsAnalogPress() && abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD; }); }; |
