Fixed duplicating a device between XInput and HIDAPI

This commit is contained in:
Sam Lantinga
2020-12-03 18:17:03 -08:00
parent 59f28b7f4b
commit 1031231b29
3 changed files with 21 additions and 12 deletions

View File

@@ -294,7 +294,8 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
}
#ifdef SDL_JOYSTICK_HIDAPI
if (HIDAPI_IsDevicePresent(vendor, product, version, pNewJoystick->joystickname)) {
/* Since we're guessing about the VID/PID, use a hard-coded VID/PID to represent XInput */
if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER, version, pNewJoystick->joystickname)) {
/* The HIDAPI driver is taking care of this device */
SDL_free(pNewJoystick);
return;