Trigger a lightbar reset on controller connection (#4927)

Because the config is now parsed earlier than controller connection, we can no longer update the lightbar directly from the input config loading code, at least on startup. It's still used for mid-game input config reload though
This commit is contained in:
kalaposfos13 authored and GitHub committed 2026-08-26 23:57:06 +03:00
1 parent e968c1fff3
commit 54ec7d00a0
1 file changed
+7
+7
View File
@@ -155,6 +155,9 @@ void GameController::SetTouchpadState(int touch_index, bool touch_down, float x,
void GameController::ConnectController(SDL_Gamepad* pad) {
std::lock_guard lock{m_state_mutex};
m_sdl_gamepad = pad;
if (override_colour) {
SetLightBarRGB({});
}
m_states_queue.Clear();
if (!m_state.connected) {
++m_state.connected_count;
@@ -214,6 +217,10 @@ void GameController::PushStateLocked(u64 timestamp) {
void GameController::SetLightBarRGB(u8 const r, u8 const g, u8 const b) {
if (override_colour.has_value()) {
if (m_sdl_gamepad) {
SDL_SetGamepadLED(m_sdl_gamepad, override_colour->r, override_colour->g,
override_colour->b);
}
return;
}
colour = {r, g, b};