From cf908d63b9c61b3e5dcb4cea79737bab9ff5794a Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Tue, 20 May 2025 23:13:20 +0100 Subject: [PATCH] backport controller led flashing from ftpsrv (only flash 1 controller). --- sphaira/source/app.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index cc0576a..c8bd681 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -542,7 +542,7 @@ void App::NotifyClear(ui::NotifEntry::Side side) { } void App::NotifyFlashLed() { - static const HidsysNotificationLedPattern pattern = { + static constexpr HidsysNotificationLedPattern pattern = { .baseMiniCycleDuration = 0x1, // 12.5ms. .totalMiniCycles = 0x1, // 1 mini cycle(s). .totalFullCycles = 0x1, // 1 full run(s). @@ -554,11 +554,19 @@ void App::NotifyFlashLed() { }} }; + Result rc; s32 total; - HidsysUniquePadId unique_pad_ids[16] = {0}; - if (R_SUCCEEDED(hidsysGetUniquePadIds(unique_pad_ids, 16, &total))) { - for (int i = 0; i < total; i++) { - hidsysSetNotificationLedPattern(&pattern, unique_pad_ids[i]); + HidsysUniquePadId unique_pad_id; + + rc = hidsysGetUniquePadsFromNpad(HidNpadIdType_Handheld, &unique_pad_id, 1, &total); + if (R_SUCCEEDED(rc) && total) { + rc = hidsysSetNotificationLedPattern(&pattern, unique_pad_id); + } + + if (R_FAILED(rc) || !total) { + rc = hidsysGetUniquePadsFromNpad(HidNpadIdType_No1, &unique_pad_id, 1, &total); + if (R_SUCCEEDED(rc) && total) { + hidsysSetNotificationLedPattern(&pattern, unique_pad_id); } } }