src/joystick/linux/SDL_sysjoystick.c
changeset 12410 a7ee81795c75
parent 12359 691c32a30fb9
child 12459 34266b6e578d
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Mon Nov 12 19:23:49 2018 -0800
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Wed Nov 14 13:37:22 2018 -0800
     1.3 @@ -776,6 +776,7 @@
     1.4      joystick->hwdata->guid = item->guid;
     1.5      joystick->hwdata->effect.id = -1;
     1.6      joystick->hwdata->m_bSteamController = item->m_bSteamController;
     1.7 +    SDL_memset(joystick->hwdata->abs_map, 0xFF, sizeof(joystick->hwdata->abs_map));
     1.8  
     1.9      if (item->m_bSteamController) {
    1.10          joystick->hwdata->fd = -1;
    1.11 @@ -989,11 +990,13 @@
    1.12                      HandleHat(joystick, code / 2, code % 2, events[i].value);
    1.13                      break;
    1.14                  default:
    1.15 -                    events[i].value =
    1.16 -                        AxisCorrect(joystick, code, events[i].value);
    1.17 -                    SDL_PrivateJoystickAxis(joystick,
    1.18 -                                            joystick->hwdata->abs_map[code],
    1.19 -                                            events[i].value);
    1.20 +                    if (joystick->hwdata->abs_map[code] != 0xFF) {
    1.21 +                        events[i].value =
    1.22 +                            AxisCorrect(joystick, code, events[i].value);
    1.23 +                        SDL_PrivateJoystickAxis(joystick,
    1.24 +                                                joystick->hwdata->abs_map[code],
    1.25 +                                                events[i].value);
    1.26 +                    }
    1.27                      break;
    1.28                  }
    1.29                  break;