From eb9a7d97f98d38f4645fe8c084dfc72d0ea814dd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 17 Feb 2024 16:43:07 -0800 Subject: [PATCH] The GameInput driver handles Xbox controllers Don't let the raw input driver handle them when GameInput is active --- src/joystick/gdk/SDL_gameinputjoystick.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.c b/src/joystick/gdk/SDL_gameinputjoystick.c index d1e605b993..64e444f659 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.c +++ b/src/joystick/gdk/SDL_gameinputjoystick.c @@ -23,6 +23,7 @@ #ifdef SDL_JOYSTICK_GAMEINPUT #include "../SDL_sysjoystick.h" +#include "../usb_ids.h" #include #define COBJMACROS @@ -281,6 +282,12 @@ static SDL_bool GAMEINPUT_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 produ int idx = 0; GAMEINPUT_InternalDevice *elem = NULL; + if (vendor_id == USB_VENDOR_MICROSOFT && + product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER) { + /* The Xbox One controller shows up as a hardcoded raw input VID/PID, which we definitely handle */ + return SDL_TRUE; + } + for (idx = 0; idx < g_GameInputList.count; ++idx) { elem = g_GameInputList.devices[idx]; if (elem && vendor_id == elem->vendor && product_id == elem->product) {