Răsfoiți Sursa

DirectInput: ignore everything but joysticks and gamepads (thanks, Justin!).

Fixes Bugzilla #2460.
Ryan C. Gordon 10 ani în urmă
părinte
comite
785618afec
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 5 0
      src/joystick/windows/SDL_dinputjoystick.c

+ 5 - 0
src/joystick/windows/SDL_dinputjoystick.c

@@ -345,6 +345,11 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
         return DIENUM_CONTINUE;  /* ignore XInput devices here, keep going. */
     }
 
+    const DWORD devtype = (pdidInstance->dwDevType & 0xFF);
+    if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD)) {
+        return DIENUM_CONTINUE;  /* Ignore touchpads, etc. */
+    }
+
     pNewJoystick = *(JoyStick_DeviceData **)pContext;
     while (pNewJoystick) {
         if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) {