Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices

This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
This commit is contained in:
Sam Lantinga
2020-11-23 18:24:05 -08:00
parent 0ff5d55a07
commit 5b3616c325
23 changed files with 1804 additions and 1363 deletions

View File

@@ -65,6 +65,11 @@ SDL_XINPUT_JoystickInit(void)
{
s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
if (RAWINPUT_IsEnabled()) {
/* The raw input driver handles more than 4 controllers, so prefer that when available */
s_bXInputEnabled = SDL_FALSE;
}
if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) {
s_bXInputEnabled = SDL_FALSE; /* oh well. */
}
@@ -208,7 +213,7 @@ GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion)
}
}
SDL_free(devices);
#endif /* ifndef __WINRT__ */
#endif /* !__WINRT__ */
/* The device wasn't in the raw HID device list, it's probably Bluetooth */
*pVID = 0x045e; /* Microsoft */