Skip to content

Commit

Permalink
Reset enhanced mode state when closing a controller
Browse files Browse the repository at this point in the history
Fixes #11912
  • Loading branch information
slouken committed Jan 12, 2025
1 parent b524af1 commit 21cc187
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/joystick/hidapi/SDL_hidapi_ps4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,10 @@ static void HIDAPI_DriverPS4_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joysti
SDL_PS4EnhancedReportsChanged, ctx);

ctx->joystick = NULL;

ctx->report_sensors = false;
ctx->enhanced_mode = false;
ctx->enhanced_mode_available = false;
}

static void HIDAPI_DriverPS4_FreeDevice(SDL_HIDAPI_Device *device)
Expand Down
4 changes: 4 additions & 0 deletions src/joystick/hidapi/SDL_hidapi_ps5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,10 @@ static void HIDAPI_DriverPS5_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joysti
SDL_PS5PlayerLEDHintChanged, ctx);

ctx->joystick = NULL;

ctx->report_sensors = false;
ctx->enhanced_mode = false;
ctx->enhanced_mode_available = false;
}

static void HIDAPI_DriverPS5_FreeDevice(SDL_HIDAPI_Device *device)
Expand Down
4 changes: 4 additions & 0 deletions src/joystick/hidapi/SDL_hidapi_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,10 @@ static void HIDAPI_DriverSwitch_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joy
SDL_PlayerLEDHintChanged, ctx);

ctx->joystick = NULL;

ctx->m_bReportSensors = false;
ctx->m_bEnhancedMode = false;
ctx->m_bEnhancedModeAvailable = false;
}

static void HIDAPI_DriverSwitch_FreeDevice(SDL_HIDAPI_Device *device)
Expand Down

0 comments on commit 21cc187

Please sign in to comment.