The GameInput driver handles Xbox controllers

Don't let the raw input driver handle them when GameInput is active
This commit is contained in:
Sam Lantinga 2024-02-17 16:43:07 -08:00
parent 698b7deaa2
commit eb9a7d97f9

View file

@ -23,6 +23,7 @@
#ifdef SDL_JOYSTICK_GAMEINPUT #ifdef SDL_JOYSTICK_GAMEINPUT
#include "../SDL_sysjoystick.h" #include "../SDL_sysjoystick.h"
#include "../usb_ids.h"
#include <stdbool.h> #include <stdbool.h>
#define COBJMACROS #define COBJMACROS
@ -281,6 +282,12 @@ static SDL_bool GAMEINPUT_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 produ
int idx = 0; int idx = 0;
GAMEINPUT_InternalDevice *elem = NULL; 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) { for (idx = 0; idx < g_GameInputList.count; ++idx) {
elem = g_GameInputList.devices[idx]; elem = g_GameInputList.devices[idx];
if (elem && vendor_id == elem->vendor && product_id == elem->product) { if (elem && vendor_id == elem->vendor && product_id == elem->product) {