From ea4350d821c9aed330b7a5af3d0cfa5bea2f731f Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 28 Aug 2013 22:07:54 -0400 Subject: [PATCH] Don't corrupt XInput device state during SDL_SYS_JoystickClose(). --- src/joystick/windows/SDL_dxjoystick.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/joystick/windows/SDL_dxjoystick.c b/src/joystick/windows/SDL_dxjoystick.c index 9399ee67a..2648ef3ad 100644 --- a/src/joystick/windows/SDL_dxjoystick.c +++ b/src/joystick/windows/SDL_dxjoystick.c @@ -1552,21 +1552,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) 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); }