From aa3fc6e904df90ff443c767ada2bfe9e88c4e3be Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 19 Jan 2024 11:43:01 -0800 Subject: [PATCH] Fixed D-pad on Xbox One controllers using the HIDAPI driver --- src/joystick/hidapi/SDL_hidapi_xboxone.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 4631f1fa88..7c0d4a9d03 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -673,16 +673,16 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D if (ctx->last_state[1] != data[1]) { Uint8 hat = 0; - if (data[2] & 0x01) { + if (data[1] & 0x01) { hat |= SDL_HAT_UP; } - if (data[2] & 0x02) { + if (data[1] & 0x02) { hat |= SDL_HAT_DOWN; } - if (data[2] & 0x04) { + if (data[1] & 0x04) { hat |= SDL_HAT_LEFT; } - if (data[2] & 0x08) { + if (data[1] & 0x08) { hat |= SDL_HAT_RIGHT; } SDL_SendJoystickHat(timestamp, joystick, 0, hat);