mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 06:15:35 +00:00
WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled
Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false. That causes WGI and DInput backends to take ownership of XInput-compatible controllers, because they think there's no XInput-specific backend enabled. In WGI's case, it will actually race with RawInput to open the device. By properly excluding XInput devices from WGI, we can ensure that the sets of devices managed by WGI and RawInput don't intersect. This makes the race harmless, since they'll never both go after the same device.
This commit is contained in:
parent
74f35a7cbd
commit
f6dc47caef
|
@ -238,7 +238,12 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
|
|||
{
|
||||
SDL_GameControllerType type;
|
||||
|
||||
if (!SDL_XINPUT_Enabled()) {
|
||||
/* XInput and RawInput backends will pick up XInput-compatible devices */
|
||||
if (!SDL_XINPUT_Enabled()
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
&& !RAWINPUT_IsEnabled()
|
||||
#endif
|
||||
) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,12 @@ SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
|
|||
UINT i, raw_device_count = 0;
|
||||
LONG vidpid = MAKELONG(vendor, product);
|
||||
|
||||
if (!SDL_XINPUT_Enabled()) {
|
||||
/* XInput and RawInput backends will pick up XInput-compatible devices */
|
||||
if (!SDL_XINPUT_Enabled()
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT
|
||||
&& !RAWINPUT_IsEnabled()
|
||||
#endif
|
||||
) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue