switch2: The reply to the LED packet is only 8 bytes

This commit is contained in:
Vicki Pfau
2025-10-14 20:20:55 -07:00
committed by Sam Lantinga
parent 82374b4778
commit ee4c2ce120

View File

@@ -221,7 +221,7 @@ static bool UpdateSlotLED(SDL_DriverSwitch2_Context *ctx)
0x09, 0x91, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x09, 0x91, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
unsigned char calibration_data[0x50] = {0}; unsigned char reply[8] = {0};
if (ctx->player_lights && ctx->player_index >= 0) { if (ctx->player_lights && ctx->player_index >= 0) {
SET_LED_DATA[8] = (1 << (ctx->player_index % 4)); SET_LED_DATA[8] = (1 << (ctx->player_index % 4));
@@ -230,7 +230,7 @@ static bool UpdateSlotLED(SDL_DriverSwitch2_Context *ctx)
if (res < 0) { if (res < 0) {
return SDL_SetError("Couldn't set LED data: %d\n", res); return SDL_SetError("Couldn't set LED data: %d\n", res);
} }
return (RecvBulkData(ctx, calibration_data, 0x40) > 0); return (RecvBulkData(ctx, reply, sizeof(reply)) > 0);
} }
static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)