SDL: Fixed the Xbox 360 wireless adapter showing up as a controller

From 47403eccd2dcd6320448ed8b8e87214bffb37378 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 8 Jun 2026 21:31:20 -0700
Subject: [PATCH] Fixed the Xbox 360 wireless adapter showing up as a
 controller

---
 src/joystick/gdk/SDL_gameinputjoystick.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/joystick/gdk/SDL_gameinputjoystick.cpp b/src/joystick/gdk/SDL_gameinputjoystick.cpp
index 1c099236c82c1..a991f211c6b48 100644
--- a/src/joystick/gdk/SDL_gameinputjoystick.cpp
+++ b/src/joystick/gdk/SDL_gameinputjoystick.cpp
@@ -173,6 +173,18 @@ static int GetSteamVirtualGamepadSlot(const char *device_path)
 }
 #endif // GAMEINPUT_API_VERSION >= 1
 
+static bool IsXbox360WirelessAdapter(Uint16 vendor, Uint16 product)
+{
+    if (vendor == USB_VENDOR_MICROSOFT) {
+        if (product == USB_PRODUCT_XBOX360_WIRELESS_RECEIVER ||
+            product == USB_PRODUCT_XBOX360_WIRELESS_RECEIVER_THIRDPARTY1 ||
+            product == USB_PRODUCT_XBOX360_WIRELESS_RECEIVER_THIRDPARTY2) {
+            return true;
+        }
+    }
+    return false;
+}
+
 static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
 {
     GAMEINPUT_InternalDevice **devicelist = NULL;
@@ -220,7 +232,8 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
     }
 #endif
 
-    if (SDL_ShouldIgnoreJoystick(vendor, product, version, product_string) ||
+    if (IsXbox360WirelessAdapter(vendor, product) ||
+        SDL_ShouldIgnoreJoystick(vendor, product, version, product_string) ||
         SDL_JoystickHandledByAnotherDriver(&SDL_GAMEINPUT_JoystickDriver, vendor, product, version, product_string)) {
         return true;
     }