Move SDL_IsXInputDevice check above actual joystick allocation

This commit is contained in:
Dimitriy Ryazantcev 2021-06-10 14:06:32 +03:00 committed by Sam Lantinga
parent 766d81ec86
commit f5122377c9

View File

@ -446,6 +446,8 @@ EnumJoysticksCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
CHECK(QueryDevicePath(device, &hidPath)); CHECK(QueryDevicePath(device, &hidPath));
CHECK(QueryDeviceInfo(device, &vendor, &product)); CHECK(QueryDeviceInfo(device, &vendor, &product));
CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
pNewJoystick = *(JoyStick_DeviceData**)pContext; pNewJoystick = *(JoyStick_DeviceData**)pContext;
while (pNewJoystick) { while (pNewJoystick) {
/* update GUIDs of joysticks with matching paths, in case they're not open yet */ /* update GUIDs of joysticks with matching paths, in case they're not open yet */
@ -499,8 +501,6 @@ EnumJoysticksCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4); SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4);
} }
CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
CHECK(!SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)); CHECK(!SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid));
#ifdef SDL_JOYSTICK_HIDAPI #ifdef SDL_JOYSTICK_HIDAPI