Restored accidentally removed code to guess XInput device

This commit is contained in:
Sam Lantinga 2022-08-30 19:12:22 -07:00
parent 973a677a2d
commit e5f161bda4
1 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,6 @@ GetXInputName(const Uint8 userid, BYTE SubType)
return name; return name;
} }
#if 0
/* We can't really tell what device is being used for XInput, but we can guess /* 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. 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 */ *pPID = 0x02fd; /* XBox One S Bluetooth */
*pVersion = 0; *pVersion = 0;
} }
#endif /* #if 0 */
static void static void
AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) 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); SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid);
if (!SDL_XInputUseOldJoystickMapping()) { if (!SDL_XInputUseOldJoystickMapping()) {
GuessXInputDevice(userid, &vendor, &product, &version);
pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, pNewJoystick->joystickname, 'x', SubType); pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, pNewJoystick->joystickname, 'x', SubType);
} }
pNewJoystick->SubType = SubType; pNewJoystick->SubType = SubType;