mirror of https://github.com/encounter/SDL.git
Don't corrupt XInput device state during SDL_SYS_JoystickClose().
This commit is contained in:
parent
2538d31140
commit
ea4350d821
|
@ -1552,21 +1552,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
||||||
void
|
void
|
||||||
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
||||||
{
|
{
|
||||||
if ( joystick->hwdata->bXInputDevice )
|
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
|
|
||||||
{
|
|
||||||
IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
|
IDirectInputDevice8_Unacquire(joystick->hwdata->InputDevice);
|
||||||
IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
|
IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue