DirectInput: ignore everything but joysticks and gamepads (thanks, Justin!).
authorRyan C. Gordon <icculus@icculus.org>
Wed, 08 Apr 2015 02:14:59 -0400
changeset 9475d5adc0c06a03
parent 9474 067b78126485
child 9476 2928e95ffcaf
DirectInput: ignore everything but joysticks and gamepads (thanks, Justin!).

Fixes Bugzilla #2460.
src/joystick/windows/SDL_dinputjoystick.c
     1.1 --- a/src/joystick/windows/SDL_dinputjoystick.c	Wed Apr 08 02:00:14 2015 -0400
     1.2 +++ b/src/joystick/windows/SDL_dinputjoystick.c	Wed Apr 08 02:14:59 2015 -0400
     1.3 @@ -345,6 +345,11 @@
     1.4          return DIENUM_CONTINUE;  /* ignore XInput devices here, keep going. */
     1.5      }
     1.6  
     1.7 +    const DWORD devtype = (pdidInstance->dwDevType & 0xFF);
     1.8 +    if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD)) {
     1.9 +        return DIENUM_CONTINUE;  /* Ignore touchpads, etc. */
    1.10 +    }
    1.11 +
    1.12      pNewJoystick = *(JoyStick_DeviceData **)pContext;
    1.13      while (pNewJoystick) {
    1.14          if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) {