Don't add paddle mappings for the Xbox One Elite Series 1 controller, since they can't be unmapped and read directly on that controller.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 377803e..e67bd57 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -584,8 +584,11 @@ 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)) {
- /* XBox One Elite Controllers have 4 back paddle buttons */
+ } 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
+ */
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 d70c779..7502ad1 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1903,6 +1903,29 @@ 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 b99ffb8..5988364 100644
--- a/src/joystick/SDL_joystick_c.h
+++ b/src/joystick/SDL_joystick_c.h
@@ -64,6 +64,8 @@ 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);