summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2023-06-06 22:07:14 +0200
committerJosJuice <josjuice@gmail.com>2023-06-06 22:07:14 +0200
commit71ac6ec23962a360e1f08abc3c7ff989ac8f1106 (patch)
tree3390ecffdea00c07fcec2c01c7737d0fad52058c /Source/Core/InputCommon/ControllerInterface
parent5d40871dd458ccb289beabeb35a2eff4c4c5625e (diff)
InputCommon: Don't treat two analog inputs as a spurious trigger combo
I've received a report from an Android user with a gamepad (a "BSP-D3") where one physical trigger is controlling two analog axes at the same time. This was causing RemoveSpuriousTriggerCombinations to delete both axes, which is clearly not a desireable outcome. With this change, now the axis with the greatest smoothness is kept, or both in case they have the same smoothness.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
index e28e044866..7b21cf78e0 100644
--- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp
@@ -138,8 +138,8 @@ void RemoveSpuriousTriggerCombinations(
{
const auto is_spurious = [&](auto& detection) {
return std::any_of(detections->begin(), detections->end(), [&](auto& d) {
- // This is a suprious digital detection if a "smooth" (analog) detection is temporally near.
- return &d != &detection && d.smoothness > 1 &&
+ // This is a spurious digital detection if a "smooth" (analog) detection is temporally near.
+ return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness &&
abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD;
});
};