src/joystick/windows/SDL_windowsjoystick.c
changeset 12359 691c32a30fb9
parent 12201 8bdc4d340419
child 12503 806492103856
     1.1 --- a/src/joystick/windows/SDL_windowsjoystick.c	Thu Oct 25 13:22:34 2018 -0700
     1.2 +++ b/src/joystick/windows/SDL_windowsjoystick.c	Thu Oct 25 16:53:14 2018 -0700
     1.3 @@ -407,6 +407,18 @@
     1.4      return device->joystickname;
     1.5  }
     1.6  
     1.7 +static int
     1.8 +WINDOWS_JoystickGetDevicePlayerIndex(int device_index)
     1.9 +{
    1.10 +    JoyStick_DeviceData *device = SYS_Joystick;
    1.11 +    int index;
    1.12 +
    1.13 +    for (index = device_index; index > 0; index--)
    1.14 +        device = device->pNext;
    1.15 +
    1.16 +    return device->bXInputDevice ? (int)device->XInputUserId : -1;
    1.17 +}
    1.18 +
    1.19  /* return the stable device guid for this device index */
    1.20  static SDL_JoystickGUID
    1.21  WINDOWS_JoystickGetDeviceGUID(int device_index)
    1.22 @@ -544,6 +556,7 @@
    1.23      WINDOWS_JoystickGetCount,
    1.24      WINDOWS_JoystickDetect,
    1.25      WINDOWS_JoystickGetDeviceName,
    1.26 +    WINDOWS_JoystickGetDevicePlayerIndex,
    1.27      WINDOWS_JoystickGetDeviceGUID,
    1.28      WINDOWS_JoystickGetDeviceInstanceID,
    1.29      WINDOWS_JoystickOpen,