SDL: Actually we need to enumerate the 8BitDo Xbox SKUs (00096)

From 00096baf18729df5d8a071d110b54128d9776e22 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 8 Nov 2023 00:42:42 -0800
Subject: [PATCH] Actually we need to enumerate the 8BitDo Xbox SKUs

At the point we're calling SDL_IsJoystickXboxSeriesX(), we don't know for sure that the controller is an Xbox controller.

Fixes https://github.com/libsdl-org/SDL/issues/8174

(cherry picked from commit 15bc12165ab56e6fbf93b8f3d18f2a0bb5854d8c)
(cherry picked from commit af7fe2cf9bfb2668266b15720308425739515a90)
---
 src/joystick/SDL_joystick.c | 11 ++++-------
 src/joystick/usb_ids.h      |  2 ++
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 552d105fe647..c08a204219de 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -2346,13 +2346,10 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
         }
     }
     if (vendor_id == USB_VENDOR_8BITDO) {
-        /* 8BitDo started making Xbox form factor controllers after the Series X
-         * release, so we'll assume for now that they all have the share button.
-         *
-         * We know for sure that the Ultimate Wired Controller for Xbox (0x2002)
-         * and the Ultimate Wireless / Pro 2 Wired Controller (0x3106) have them.
-         */
-        return SDL_TRUE;
+        if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 ||
+            product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER2) {
+            return SDL_TRUE;
+        }
     }
     return SDL_FALSE;
 }
diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h
index 1fcdab95c45e..8cf56b46fcd7 100644
--- a/src/joystick/usb_ids.h
+++ b/src/joystick/usb_ids.h
@@ -52,6 +52,8 @@
 #define USB_VENDOR_VALVE        0x28de
 #define USB_VENDOR_ZEROPLUS     0x0c12
 
+#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER1               0x2002 /* Ultimate Wired Controller for Xbox */
+#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER2               0x3106 /* Ultimate Wireless / Pro 2 Wired Controller */
 #define USB_PRODUCT_AMAZON_LUNA_CONTROLLER                0x0419
 #define USB_PRODUCT_ASTRO_C40_XBOX360                     0x0024
 #define USB_PRODUCT_BACKBONE_ONE_IOS                      0x0103