summaryrefslogtreecommitdiff
path: root/main/input_default.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r--main/input_default.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 4e2fd6f9d4..e7dc9d4b70 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -899,8 +899,14 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
return;
}
- if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
- //changed direction quickly, insert fake event to release pending inputmap actions
+ //when changing direction quickly, insert fake event to release pending inputmap actions
+ float last = joy.last_axis[p_axis];
+ if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) {
+ JoyAxis jx;
+ jx.min = p_value.min;
+ jx.value = p_value.value < 0.5 ? 0.6 : 0.4;
+ joy_axis(p_device, p_axis, jx);
+ } else if (ABS(last) > 0.5 && last * p_value.value < 0) {
JoyAxis jx;
jx.min = p_value.min;
jx.value = p_value.value < 0 ? 0.1 : -0.1;