Fix Switch and Switch 2 player LED patterns

The patterns we were using don't match the official patterns, which fill up as
many lights as players instead of just using the nth player LED. Above 4,
there are some special patterns, as documented on Nintendo's Singaporean site:
https://www.nintendo.com/sg/support/qa/detail/33822
This commit is contained in:
Vicki Pfau
2026-02-07 02:40:54 -08:00
committed by Sam Lantinga
parent 8f8880a8eb
commit 017d950b6b
2 changed files with 7 additions and 5 deletions

View File

@@ -778,9 +778,10 @@ static void UpdateSlotLED(SDL_DriverSwitch_Context *ctx)
{
if (!ctx->m_bInputOnly) {
Uint8 led_data = 0;
const Uint8 player_pattern[] = { 0x1, 0x3, 0x7, 0xf, 0x9, 0x5, 0xd, 0x6 };
if (ctx->m_bPlayerLights && ctx->m_nPlayerIndex >= 0) {
led_data = (1 << (ctx->m_nPlayerIndex % 4));
led_data = player_pattern[ctx->m_nPlayerIndex % 8];
}
WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetPlayerLights, &led_data, sizeof(led_data), NULL);
}