Commit 8342fa7c7e657122b01bf11a79fdd60267d40a11

Sam Lantinga 2019-12-05T13:48:08

Fixed controller mapping issues caused by PS3 gyro jitter

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 96a3b89..08bb159 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -842,7 +842,7 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
 
     info = &joystick->axes[axis];
     if (!info->has_initial_value ||
-        (!info->has_second_value && info->initial_value == -32768 && value == 0)) {
+        (!info->has_second_value && info->initial_value == -32768 && SDL_abs(value) < (SDL_JOYSTICK_AXIS_MAX / 4))) {
         info->initial_value = value;
         info->value = value;
         info->zero = value;