src/joystick/windows/SDL_dxjoystick.c
changeset 7711 db9e27a52d77
parent 7709 edd2c14acf66
child 7712 66b5b8446275
equal deleted inserted replaced
7710:6364d6836634 7711:db9e27a52d77
  1550 
  1550 
  1551 /* Function to close a joystick after use */
  1551 /* Function to close a joystick after use */
  1552 void
  1552 void
  1553 SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  1553 SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  1554 {
  1554 {
  1555     if ( joystick->hwdata->bXInputDevice )
  1555     if (!joystick->hwdata->bXInputDevice) {
  1556     {
       
  1557         JoyStick_DeviceData *joysticklist = SYS_Joystick;
       
  1558         /* scan the opened joysticks and clear the userid for this instance */
       
  1559         for( ; joysticklist; joysticklist = joysticklist->pNext)
       
  1560         {
       
  1561             if ( joysticklist->bXInputDevice && joysticklist->nInstanceID == joystick->instance_id )
       
  1562             {
       
  1563                 joysticklist->XInputUserId = INVALID_XINPUT_USERID;
       
  1564             }
       
  1565         }
       
  1566 
       
  1567     }
       
  1568     else
       
  1569     {
       
  1570         IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
  1556         IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
  1571         IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
  1557         IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
  1572     }
  1558     }
  1573 
  1559 
  1574     if (joystick->hwdata != NULL) {
  1560     if (joystick->hwdata != NULL) {