diff options
author | Sam Lantinga <slouken@libsdl.org> | 2021-02-02 11:53:31 -0800 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2021-02-02 11:53:31 -0800 |
commit | f9747ed8501b1ef595114cf076f9d10123066301 (patch) | |
tree | af7a7460dbed5d477166b79095d6c9d93b94d651 | |
parent | 7b5c7fc2659f7d20ddbe0d4117dd2cfce1ca619d (diff) | |
download | sdl-f9747ed8501b1ef595114cf076f9d10123066301.tar.gz |
Fixed detecting the paddles on the Xbox Elite Series 1 controller
-rw-r--r-- | src/joystick/SDL_gamecontroller.c | 7 | ||||
-rw-r--r-- | src/joystick/SDL_joystick.c | 23 | ||||
-rw-r--r-- | src/joystick/SDL_joystick_c.h | 2 | ||||
-rw-r--r-- | src/joystick/hidapi/SDL_hidapi_xboxone.c | 2 |
4 files changed, 3 insertions, 31 deletions
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index bf06fa1a5..9849bcc98 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -585,11 +585,8 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI if (SDL_IsJoystickXboxOneSeriesX(vendor, product)) { /* XBox One Series X Controllers have a share button under the guide button */ SDL_strlcat(mapping_string, "misc1:b15,", sizeof(mapping_string)); - } else if (SDL_IsJoystickXboxOneElite(vendor, product) && - !SDL_IsJoystickXboxOneEliteSeries1(vendor, product)) { - /* XBox One Elite Controllers have 4 back paddle buttons - * The Series 1 controller has paddles but they can't be unmapped - */ + } else if (SDL_IsJoystickXboxOneElite(vendor, product)) { + /* XBox One Elite Controllers have 4 back paddle buttons */ SDL_strlcat(mapping_string, "paddle1:b15,paddle2:b17,paddle3:b16,paddle4:b18,", sizeof(mapping_string)); } else if (SDL_IsJoystickSteamController(vendor, product)) { /* Steam controllers have 2 back paddle buttons */ diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 7dfb980d1..a9177f3e2 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1915,29 +1915,6 @@ SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id) } SDL_bool -SDL_IsJoystickXboxOneEliteSeries1(Uint16 vendor_id, Uint16 product_id) -{ - if (vendor_id == USB_VENDOR_MICROSOFT) { - if (product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_1) { - return SDL_TRUE; - } - } - return SDL_FALSE; -} - -SDL_bool -SDL_IsJoystickXboxOneEliteSeries2(Uint16 vendor_id, Uint16 product_id) -{ - if (vendor_id == USB_VENDOR_MICROSOFT) { - if (product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2 || - product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH) { - return SDL_TRUE; - } - } - return SDL_FALSE; -} - -SDL_bool SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_MICROSOFT) { diff --git a/src/joystick/SDL_joystick_c.h b/src/joystick/SDL_joystick_c.h index c724d0161..7459c2d1b 100644 --- a/src/joystick/SDL_joystick_c.h +++ b/src/joystick/SDL_joystick_c.h @@ -64,8 +64,6 @@ extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name /* Function to return whether a joystick is an Xbox One Elite controller */ extern SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id); -extern SDL_bool SDL_IsJoystickXboxOneEliteSeries1(Uint16 vendor_id, Uint16 product_id); -extern SDL_bool SDL_IsJoystickXboxOneEliteSeries2(Uint16 vendor_id, Uint16 product_id); /* Function to return whether a joystick is an Xbox One Series X controller */ extern SDL_bool SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id); diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 462df5cbb..fe9f305d5 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -530,7 +530,7 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne button4_bit = 0x04; /* The mapped controller state is at offset 4, the raw state is at offset 18, compare them to see if the paddles are mapped */ - paddles_mapped = (SDL_memcmp(&data[4], &data[18], 14) != 0); + paddles_mapped = (SDL_memcmp(&data[4], &data[18], 2) != 0); } else /* if (size == 38) */ { /* XBox One Elite Series 2 */ |