Explorar el Código

Move SDL_IsXInputDevice check above actual joystick allocation

Dimitriy Ryazantcev hace 3 años
padre
commit
f5122377c9
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/joystick/windows/SDL_dinputjoystick.c

+ 2 - 2
src/joystick/windows/SDL_dinputjoystick.c

@@ -446,6 +446,8 @@ EnumJoysticksCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext)
     CHECK(QueryDevicePath(device, &hidPath));
     CHECK(QueryDeviceInfo(device, &vendor, &product));
 
+    CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
+
     pNewJoystick = *(JoyStick_DeviceData**)pContext;
     while (pNewJoystick) {
         /* 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);
     }
 
-    CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
-
     CHECK(!SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid));
 
 #ifdef SDL_JOYSTICK_HIDAPI