Don't corrupt XInput device state during SDL_SYS_JoystickClose().
authorRyan C. Gordon <icculus@icculus.org>
Wed, 28 Aug 2013 22:07:54 -0400
changeset 7711 db9e27a52d77
parent 7710 6364d6836634
child 7712 66b5b8446275
Don't corrupt XInput device state during SDL_SYS_JoystickClose().
src/joystick/windows/SDL_dxjoystick.c
--- a/src/joystick/windows/SDL_dxjoystick.c	Wed Aug 28 22:05:16 2013 -0400
+++ b/src/joystick/windows/SDL_dxjoystick.c	Wed Aug 28 22:07:54 2013 -0400
@@ -1552,21 +1552,7 @@
 void
 SDL_SYS_JoystickClose(SDL_Joystick * joystick)
 {
-    if ( joystick->hwdata->bXInputDevice )
-    {
-        JoyStick_DeviceData *joysticklist = SYS_Joystick;
-        /* scan the opened joysticks and clear the userid for this instance */
-        for( ; joysticklist; joysticklist = joysticklist->pNext)
-        {
-            if ( joysticklist->bXInputDevice && joysticklist->nInstanceID == joystick->instance_id )
-            {
-                joysticklist->XInputUserId = INVALID_XINPUT_USERID;
-            }
-        }
-
-    }
-    else
-    {
+    if (!joystick->hwdata->bXInputDevice) {
         IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
         IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
     }