From 3fbaa5da057ff3e4c333233ec485fac498fddbb0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 12 Jun 2019 10:35:47 -0700 Subject: [PATCH] The hat index passed to the application should be zero-based with no holes --- src/joystick/linux/SDL_sysjoystick.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index a30fe27d8..043d2201d 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -773,9 +773,8 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value) } if (value != the_hat->axis[axis]) { the_hat->axis[axis] = value; - SDL_PrivateJoystickHat(stick, hat, - position_map[the_hat-> - axis[1]][the_hat->axis[0]]); + SDL_PrivateJoystickHat(stick, stick->hwdata->hats_indices[hat], + position_map[the_hat->axis[1]][the_hat->axis[0]]); } }