src/haptic/windows/SDL_syshaptic.c
changeset 7846 70f1d63482d0
parent 7845 b92b8c52946c
child 7847 038da46576e6
equal deleted inserted replaced
7845:b92b8c52946c 7846:70f1d63482d0
   634  * Checks to see if the haptic device and joystick are in reality the same.
   634  * Checks to see if the haptic device and joystick are in reality the same.
   635  */
   635  */
   636 int
   636 int
   637 SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
   637 SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
   638 {
   638 {
   639     if ((joystick->hwdata->bXInputHaptic == haptic->hwdata->bXInputHaptic) && (haptic->hwdata->userid == joystick->hwdata->userid)) {
   639     if ((joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) {
   640         return 1;
   640         return 0;  /* one is XInput, one is not; not the same device. */
   641     } else {
   641     } else if (joystick->hwdata->bXInputHaptic) {  /* XInput */
       
   642         return (haptic->hwdata->userid == joystick->hwdata->userid);
       
   643     } else {  /* DirectInput */
   642         HRESULT ret;
   644         HRESULT ret;
   643         DIDEVICEINSTANCE hap_instance, joy_instance;
   645         DIDEVICEINSTANCE hap_instance, joy_instance;
   644 
   646 
   645         hap_instance.dwSize = sizeof(DIDEVICEINSTANCE);
   647         hap_instance.dwSize = sizeof(DIDEVICEINSTANCE);
   646         joy_instance.dwSize = sizeof(DIDEVICEINSTANCE);
   648         joy_instance.dwSize = sizeof(DIDEVICEINSTANCE);