Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed XInput correlation for raw input controllers after hotplug events
  • Loading branch information
slouken committed Nov 28, 2020
1 parent 012471e commit 1f2f536
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/joystick/windows/SDL_rawinputjoystick.c
Expand Up @@ -635,6 +635,17 @@ RAWINPUT_AcquireDevice(SDL_RAWINPUT_Device *device)
static void
RAWINPUT_ReleaseDevice(SDL_RAWINPUT_Device *device)
{
#ifdef SDL_JOYSTICK_RAWINPUT_XINPUT
if (device->joystick) {
RAWINPUT_DeviceContext *ctx = device->joystick->hwdata;

if (ctx->xinput_enabled && ctx->xinput_correlated) {
RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot);
ctx->xinput_correlated = SDL_FALSE;
}
}
#endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */

if (SDL_AtomicDecRef(&device->refcount)) {
if (device->preparsed_data) {
SDL_HidD_FreePreparsedData(device->preparsed_data);
Expand Down

0 comments on commit 1f2f536

Please sign in to comment.