From e5f161bda41f9dc9536f7643a25d1c5410ed4c47 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 30 Aug 2022 19:12:22 -0700 Subject: [PATCH] Restored accidentally removed code to guess XInput device --- src/joystick/windows/SDL_xinputjoystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 8871b0148..4fa3555b9 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -127,7 +127,6 @@ GetXInputName(const Uint8 userid, BYTE SubType) return name; } -#if 0 /* We can't really tell what device is being used for XInput, but we can guess and we'll be correct for the case where only one device is connected. */ @@ -239,7 +238,6 @@ GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) *pPID = 0x02fd; /* XBox One S Bluetooth */ *pVersion = 0; } -#endif /* #if 0 */ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) @@ -287,6 +285,8 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) } SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid); if (!SDL_XInputUseOldJoystickMapping()) { + GuessXInputDevice(userid, &vendor, &product, &version); + pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, pNewJoystick->joystickname, 'x', SubType); } pNewJoystick->SubType = SubType;