Fixed controller mapping issues caused by PS3 gyro jitter
authorSam Lantinga <slouken@libsdl.org>
Thu, 05 Dec 2019 13:48:08 -0800
changeset 13316c0c751a347e0
parent 13315 ddca1f52d44d
child 13317 872d4ecd39f6
Fixed controller mapping issues caused by PS3 gyro jitter
src/joystick/SDL_joystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Thu Dec 05 13:18:56 2019 -0800
     1.2 +++ b/src/joystick/SDL_joystick.c	Thu Dec 05 13:48:08 2019 -0800
     1.3 @@ -842,7 +842,7 @@
     1.4  
     1.5      info = &joystick->axes[axis];
     1.6      if (!info->has_initial_value ||
     1.7 -        (!info->has_second_value && info->initial_value == -32768 && value == 0)) {
     1.8 +        (!info->has_second_value && info->initial_value == -32768 && SDL_abs(value) < (SDL_JOYSTICK_AXIS_MAX / 4))) {
     1.9          info->initial_value = value;
    1.10          info->value = value;
    1.11          info->zero = value;