From a7fe88c628ff5b257381d1f8f1aa25f2ac5f4a92 Mon Sep 17 00:00:00 2001 From: ColAlexsanders Date: Mon, 19 Jan 2026 21:27:24 -0600 Subject: [PATCH 1/6] add: changed L/R hold time to 2 seconds and added hold time to ZL/ZR --- source/main.c | 110 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 34 deletions(-) diff --git a/source/main.c b/source/main.c index 38b372f..6d36b31 100644 --- a/source/main.c +++ b/source/main.c @@ -31,8 +31,8 @@ static void showControls(void) printf("\n" "Button mappings:\n" "Pause: L+R or L+Up\n" - "Previous/Next Song: ZL/ZR\n" - "Previous/Next Song: Hold L/R 1s\n" + "Previous/Next Song: ZL/ZR 2s\n" + "Previous/Next Song: Hold L/R 2s\n" "A: Open File\n" "B: Go up folder\n" "Start: Exit\n" @@ -315,12 +315,22 @@ int main(int argc, char **argv) bool keyLComboPressed = false; bool keyRComboPressed = false; + /* ignore key release of ZL/ZR if ZL+ZR or ZL+down was pressed */ + bool keyZLComboPressed = false; + bool keyZRComboPressed = false; + /* track hold time for L and R so they only change song after 1s hold */ u64 lPressTime = 0; u64 rPressTime = 0; bool lHoldTriggered = false; bool rHoldTriggered = false; + /* track hold time for ZL and ZR*/ + u64 zlPressTime = 0; + u64 zrPressTime = 0; + bool zlHoldTriggered = false; + bool zrHoldTriggered = false; + gfxInitDefault(); consoleInit(GFX_TOP, &topScreenLog); consoleInit(GFX_TOP, &topScreenInfo); @@ -389,7 +399,7 @@ int main(int argc, char **argv) kHeld = hidKeysHeld(); kUp = hidKeysUp(); - /* track press times for L and R to support 1s hold to change songs */ + /* track press times for L and R to support 2s hold to change songs */ if (kDown & KEY_L) { lPressTime = osGetTime(); lHoldTriggered = false; @@ -411,6 +421,28 @@ int main(int argc, char **argv) keyRComboPressed = false; } + /* track press times for ZL and ZR to support 2s hold to change songs */ + if (kDown & KEY_ZL) { + zlPressTime = osGetTime(); + zlHoldTriggered = false; + } + if (kDown & KEY_ZR) { + zrPressTime = osGetTime(); + zrHoldTriggered = false; + } + if (kUp & KEY_ZL) { + zlPressTime = 0; + zlHoldTriggered = false; + /* clear combo flag on release */ + keyZLComboPressed = false; + } + if (kUp & KEY_ZR) { + zrPressTime = 0; + zrHoldTriggered = false; + /* clear combo flag on release */ + keyZRComboPressed = false; + } + consoleSelect(&bottomScreen); /* Exit ctrmus */ @@ -625,39 +657,49 @@ int main(int argc, char **argv) */ /* Instant next (ZR) */ - if ((kDown & KEY_ZR) && fileNum < fileMax && dirList.dirNum < fileNum+1) { - fileNum += 1; - if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && - from < fileMax - MAX_LIST) - from++; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); - continue; + if ((kHeld & KEY_ZR) && zrPressTime != 0 && !zrHoldTriggered && !keyZRComboPressed) { + if (osGetTime() - zrPressTime >= 2000) { + if (fileNum < fileMax && dirList.dirNum < fileNum+1) { + fileNum += 1; + if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && + from < fileMax - MAX_LIST) + from++; + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + } + zrHoldTriggered = true; + continue; + } } - /* Instant previous (ZL) */ - if ((kDown & KEY_ZL) && fileNum > 1 && dirList.dirNum < fileNum-1) { - fileNum -= 1; - if(fileMax - fileNum > MAX_LIST-2 && from != 0) - from--; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); - continue; - } + /* Instant previous (ZL) */ + if ((kHeld & KEY_ZL) && zlPressTime != 0 && !zlHoldTriggered && !keyZLComboPressed) { + if (osGetTime() - zlPressTime >= 2000) { + if (fileNum > 1 && dirList.dirNum < fileNum-1) { + fileNum -= 1; + if(fileMax - fileNum > MAX_LIST-2 && from != 0) + from--; + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + } + zlHoldTriggered = true; + continue; + } + } - /* R held for >=1000ms: Next song (only if not part of combo) */ + /* R held for >=2000ms: Next song (only if not part of combo) */ if ((kHeld & KEY_R) && rPressTime != 0 && !rHoldTriggered && !keyRComboPressed) { - if (osGetTime() - rPressTime >= 1000) { + if (osGetTime() - rPressTime >= 2000) { if (fileNum < fileMax && dirList.dirNum < fileNum+1) { fileNum += 1; if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && @@ -676,9 +718,9 @@ int main(int argc, char **argv) } } - /* L held for >=1000ms: Previous song (only if not part of combo) */ + /* L held for >=2000ms: Previous song (only if not part of combo) */ if ((kHeld & KEY_L) && lPressTime != 0 && !lHoldTriggered && !keyLComboPressed) { - if (osGetTime() - lPressTime >= 1000) { + if (osGetTime() - lPressTime >= 2000) { if (fileNum > 1 && dirList.dirNum < fileNum-1) { fileNum -= 1; if(fileMax - fileNum > MAX_LIST-2 && from != 0) From 63e24330fbe77a7ef37bc41401d8de1ac903fe03 Mon Sep 17 00:00:00 2001 From: ColAlexsanders Date: Fri, 23 Jan 2026 21:07:25 -0600 Subject: [PATCH 2/6] change: 3-time button press song skipping (ZR implementation) --- source/main.c | 54 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/source/main.c b/source/main.c index 6d36b31..2d9c5c8 100644 --- a/source/main.c +++ b/source/main.c @@ -8,6 +8,7 @@ */ #include <3ds.h> +#include <3ds/os.h> #include #include #include @@ -21,6 +22,8 @@ #include "main.h" #include "playback.h" +#define MAX_PRESSES 3 // for song skipping - will take three consecutive presses + // of the L/ZL or R/ZR buttons to get to the next song volatile bool runThreads = true; /** @@ -331,6 +334,9 @@ int main(int argc, char **argv) bool zlHoldTriggered = false; bool zrHoldTriggered = false; + u64 press_count[MAX_PRESSES] = {0}; // for song skipping + int press_idx = 0; + gfxInitDefault(); consoleInit(GFX_TOP, &topScreenLog); consoleInit(GFX_TOP, &topScreenInfo); @@ -425,10 +431,14 @@ int main(int argc, char **argv) if (kDown & KEY_ZL) { zlPressTime = osGetTime(); zlHoldTriggered = false; + press_count[press_idx] = zlPressTime; + press_idx = (press_idx + 1) % MAX_PRESSES; } if (kDown & KEY_ZR) { zrPressTime = osGetTime(); zrHoldTriggered = false; + press_count[press_idx] = zrPressTime; + press_idx = (press_idx + 1) % MAX_PRESSES; } if (kUp & KEY_ZL) { zlPressTime = 0; @@ -656,30 +666,36 @@ int main(int argc, char **argv) * and are ignored if they were part of a combo (pause) press. */ - /* Instant next (ZR) */ + + int count = 0; if ((kHeld & KEY_ZR) && zrPressTime != 0 && !zrHoldTriggered && !keyZRComboPressed) { - if (osGetTime() - zrPressTime >= 2000) { - if (fileNum < fileMax && dirList.dirNum < fileNum+1) { - fileNum += 1; - if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && - from < fileMax - MAX_LIST) - from++; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + for (int i = 0; i < MAX_PRESSES; i++){ + if (zrPressTime - press_count[i] <= 1000) { + count++; + if (count == MAX_PRESSES){ + if (fileNum < fileMax && dirList.dirNum < fileNum+1) { + fileNum += 1; + if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && + from < fileMax - MAX_LIST) + from++; + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + } + zrHoldTriggered = true; + //continue; + } } - zrHoldTriggered = true; - continue; } } /* Instant previous (ZL) */ if ((kHeld & KEY_ZL) && zlPressTime != 0 && !zlHoldTriggered && !keyZLComboPressed) { - if (osGetTime() - zlPressTime >= 2000) { + if (press_count[MAX_PRESSES] && osGetTime() - zlPressTime <= 1000) { if (fileNum > 1 && dirList.dirNum < fileNum-1) { fileNum -= 1; if(fileMax - fileNum > MAX_LIST-2 && from != 0) @@ -692,8 +708,8 @@ int main(int argc, char **argv) consoleSelect(&bottomScreen); if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); } - zlHoldTriggered = true; - continue; + zlHoldTriggered = true; + continue; } } From 0dba2964e34429ff103e8bb694a7abc5d2b1f050 Mon Sep 17 00:00:00 2001 From: ColAlexsanders Date: Sat, 24 Jan 2026 17:34:35 -0600 Subject: [PATCH 3/6] change: press ZL/L or ZR/R buttons 3 times for song skips --- source/main.c | 266 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 175 insertions(+), 91 deletions(-) diff --git a/source/main.c b/source/main.c index 2d9c5c8..9ecaef0 100644 --- a/source/main.c +++ b/source/main.c @@ -24,6 +24,7 @@ #define MAX_PRESSES 3 // for song skipping - will take three consecutive presses // of the L/ZL or R/ZR buttons to get to the next song + volatile bool runThreads = true; /** @@ -325,18 +326,28 @@ int main(int argc, char **argv) /* track hold time for L and R so they only change song after 1s hold */ u64 lPressTime = 0; u64 rPressTime = 0; - bool lHoldTriggered = false; - bool rHoldTriggered = false; + //bool lHoldTriggered = false; + //bool rHoldTriggered = false; + + static u64 lPressCount[MAX_PRESSES] = {0}; + static u64 rPressCount[MAX_PRESSES] = {0}; + static int lPressIdx = 0; + static int rPressIdx = 0; /* track hold time for ZL and ZR*/ u64 zlPressTime = 0; u64 zrPressTime = 0; - bool zlHoldTriggered = false; - bool zrHoldTriggered = false; - - u64 press_count[MAX_PRESSES] = {0}; // for song skipping - int press_idx = 0; - + //bool zlHoldTriggered = false; + //bool zrHoldTriggered = false; + + /* track press count for ZL and ZR */ + static u64 zlPressCount[MAX_PRESSES] = {0}; + static u64 zrPressCount[MAX_PRESSES] = {0}; + static int zlPressIdx = 0; + static int zrPressIdx = 0; + + static u64 lastSkipTime = 0; + gfxInitDefault(); consoleInit(GFX_TOP, &topScreenLog); consoleInit(GFX_TOP, &topScreenInfo); @@ -404,51 +415,54 @@ int main(int argc, char **argv) kDown = hidKeysDown(); kHeld = hidKeysHeld(); kUp = hidKeysUp(); + + u64 now = osGetTime(); + int count = 0; /* track press times for L and R to support 2s hold to change songs */ if (kDown & KEY_L) { lPressTime = osGetTime(); - lHoldTriggered = false; - } - if (kDown & KEY_R) { + //lHoldTriggered = false; + lPressCount[lPressIdx] = lPressTime; + lPressIdx = (lPressIdx + 1) % MAX_PRESSES; + } else if (kDown & KEY_R) { rPressTime = osGetTime(); - rHoldTriggered = false; + //rHoldTriggered = false; + rPressCount[rPressIdx] = rPressTime; + rPressIdx = (rPressIdx + 1) % MAX_PRESSES; + } if (kUp & KEY_L) { lPressTime = 0; - lHoldTriggered = false; + //lHoldTriggered = false; /* clear combo flag on release */ keyLComboPressed = false; } if (kUp & KEY_R) { rPressTime = 0; - rHoldTriggered = false; + //rHoldTriggered = false; /* clear combo flag on release */ keyRComboPressed = false; } - /* track press times for ZL and ZR to support 2s hold to change songs */ + /* track press times for ZL and ZR to enable song skipping logic */ if (kDown & KEY_ZL) { zlPressTime = osGetTime(); - zlHoldTriggered = false; - press_count[press_idx] = zlPressTime; - press_idx = (press_idx + 1) % MAX_PRESSES; - } - if (kDown & KEY_ZR) { + zlPressCount[zlPressIdx] = zlPressTime; + zlPressIdx = (zlPressIdx + 1) % MAX_PRESSES; + } else if (kDown & KEY_ZR) { // Prioritizes checking the count of ZL over ZR's, making it to where if both buttons are + // pressed three times, the index doesn't increment. zrPressTime = osGetTime(); - zrHoldTriggered = false; - press_count[press_idx] = zrPressTime; - press_idx = (press_idx + 1) % MAX_PRESSES; + zrPressCount[zrPressIdx] = zrPressTime; + zrPressIdx = (zrPressIdx + 1) % MAX_PRESSES; } if (kUp & KEY_ZL) { zlPressTime = 0; - zlHoldTriggered = false; /* clear combo flag on release */ keyZLComboPressed = false; } if (kUp & KEY_ZR) { zrPressTime = 0; - zrHoldTriggered = false; /* clear combo flag on release */ keyZRComboPressed = false; } @@ -514,6 +528,55 @@ int main(int argc, char **argv) keyRComboPressed = true; continue; } + + // same thing as before but with ZL and ZR + if(kHeld & KEY_ZL) + { + /* Pause/Play */ + if(kDown & (KEY_ZR | KEY_UP)) + { + if(isPlaying() == false) + continue; + + consoleSelect(&topScreenLog); + if(togglePlayback() == true) + puts("Paused"); + else + puts("Playing"); + + keyZLComboPressed = true; + // distinguish between L+R and L+Up + if (KEY_ZR & kDown) { + keyZRComboPressed = true; + } + continue; + } + + /* Show controls */ + if(kDown & KEY_LEFT) + { + consoleSelect(&topScreenLog); + showControls(); + keyZLComboPressed = true; + continue; + } + } + // if ZR is pressed first + if ((kHeld & KEY_ZR) && (kDown & KEY_ZL)) + { + if(isPlaying() == false) + continue; + + consoleSelect(&topScreenLog); + if(togglePlayback() == true) + puts("Paused"); + else + puts("Playing"); + + keyZLComboPressed = true; + keyZRComboPressed = true; + continue; + } if((kDown & KEY_UP || ((kHeld & KEY_UP) && (osGetTime() - mill > 500))) && @@ -660,24 +723,23 @@ int main(int argc, char **argv) } /* - * Handle song change for R and L: - * - Instant change with ZR / ZL (unchanged) - * - L/R physical buttons now require a 1 second continuous hold - * and are ignored if they were part of a combo (pause) press. + * Handle song change for R/ZR and L/ZL: + * - press L/ZL three times within half a second to go back one song + * - same deal with R/ZR but it forwards to the next song */ - - int count = 0; - if ((kHeld & KEY_ZR) && zrPressTime != 0 && !zrHoldTriggered && !keyZRComboPressed) { + if ((kHeld & KEY_ZR) && zrPressTime != 0) { for (int i = 0; i < MAX_PRESSES; i++){ - if (zrPressTime - press_count[i] <= 1000) { + if (zrPressTime - zrPressCount[i] <= 1000) { // 1 second count++; if (count == MAX_PRESSES){ - if (fileNum < fileMax && dirList.dirNum < fileNum+1) { - fileNum += 1; - if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && - from < fileMax - MAX_LIST) - from++; + if (now - lastSkipTime > 1000){ + if (fileNum < fileMax && dirList.dirNum < fileNum+1) { + fileNum += 1; + if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST) + from++; + lastSkipTime = now; + } consoleSelect(&topScreenInfo); consoleClear(); consoleSelect(&topScreenLog); @@ -685,72 +747,94 @@ int main(int argc, char **argv) error = 0; consoleSelect(&bottomScreen); if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + zrPressIdx = 0; + memset(zrPressCount, 0, sizeof(zrPressCount)); } - zrHoldTriggered = true; - //continue; } } } } - - /* Instant previous (ZL) */ - if ((kHeld & KEY_ZL) && zlPressTime != 0 && !zlHoldTriggered && !keyZLComboPressed) { - if (press_count[MAX_PRESSES] && osGetTime() - zlPressTime <= 1000) { - if (fileNum > 1 && dirList.dirNum < fileNum-1) { - fileNum -= 1; - if(fileMax - fileNum > MAX_LIST-2 && from != 0) - from--; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + + if ((kHeld & KEY_ZL) && zlPressTime != 0) { + for (int i = 0; i < MAX_PRESSES; i++){ + if (zlPressTime - zlPressCount[i] <= 1000) { + count++; + if (count == MAX_PRESSES){ + if (now - lastSkipTime > 1000){ + if (fileNum > 1 && dirList.dirNum < fileNum-1) { + fileNum -= 1; + if(fileMax - fileNum > MAX_LIST-2 && from != 0) + from--; + lastSkipTime = now; + } + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + zlPressIdx = 0; + memset(zlPressCount, 0, sizeof(zlPressCount)); + //zlHoldTriggered = true; + } + } } - zlHoldTriggered = true; - continue; } - } - - /* R held for >=2000ms: Next song (only if not part of combo) */ - if ((kHeld & KEY_R) && rPressTime != 0 && !rHoldTriggered && !keyRComboPressed) { - if (osGetTime() - rPressTime >= 2000) { - if (fileNum < fileMax && dirList.dirNum < fileNum+1) { - fileNum += 1; - if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && - from < fileMax - MAX_LIST) - from++; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + } + + if ((kHeld & KEY_R) && rPressTime != 0) { + for (int i = 0; i < MAX_PRESSES; i++){ + if (rPressTime - rPressCount[i] <= 1000) { + count++; + if (count == MAX_PRESSES){ + if (now - lastSkipTime > 1000){ + if (fileNum < fileMax && dirList.dirNum < fileNum+1) { + fileNum += 1; + if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST) + from++; + lastSkipTime = now; + } + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + rPressIdx = 0; + memset(rPressCount, 0, sizeof(rPressCount)); + } + } } - rHoldTriggered = true; - continue; } } /* L held for >=2000ms: Previous song (only if not part of combo) */ - if ((kHeld & KEY_L) && lPressTime != 0 && !lHoldTriggered && !keyLComboPressed) { - if (osGetTime() - lPressTime >= 2000) { - if (fileNum > 1 && dirList.dirNum < fileNum-1) { - fileNum -= 1; - if(fileMax - fileNum > MAX_LIST-2 && from != 0) - from--; - consoleSelect(&topScreenInfo); - consoleClear(); - consoleSelect(&topScreenLog); - changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); - error = 0; - consoleSelect(&bottomScreen); - if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + if ((kHeld & KEY_L) && lPressTime != 0) { + for (int i = 0; i < MAX_PRESSES; i++){ + if (lPressTime - lPressCount[i] <= 1000) { + count++; + if (count == MAX_PRESSES){ + if (now - lastSkipTime > 1000){ + if (fileNum > 1 && dirList.dirNum < fileNum-1) { + fileNum -= 1; + if(fileMax - fileNum > MAX_LIST-2 && from != 0) + from--; + lastSkipTime = now; + } + consoleSelect(&topScreenInfo); + consoleClear(); + consoleSelect(&topScreenLog); + changeFile(dirList.files[fileNum - dirList.dirNum - 1], &playbackInfo); + error = 0; + consoleSelect(&bottomScreen); + if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + lPressIdx = 0; + memset(lPressCount, 0, sizeof(lPressCount)); + } + } } - lHoldTriggered = true; - continue; } } From 488cef8337949c7366af146fc23aea5550b7c19a Mon Sep 17 00:00:00 2001 From: ColAlexsanders Date: Sun, 25 Jan 2026 20:11:03 -0600 Subject: [PATCH 4/6] update: README and main.c comments --- README.md | 6 +-- source/main.c | 144 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 98 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index b914fdd..9ea5b47 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ The latest 3DSX/CIA/3DS download can be found on the 1000){ - if (fileNum < fileMax && dirList.dirNum < fileNum+1) { + if (count == MAX_PRESSES) + { + if (now - lastSkipTime > 1000) // cannot skip song for one second to avoid button spam + { + if (fileNum < fileMax && dirList.dirNum < fileNum+1) + { fileNum += 1; if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST) from++; @@ -747,6 +775,8 @@ int main(int argc, char **argv) error = 0; consoleSelect(&bottomScreen); if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); + + /* reset index after operation completes */ zrPressIdx = 0; memset(zrPressCount, 0, sizeof(zrPressCount)); } @@ -754,14 +784,20 @@ int main(int argc, char **argv) } } } - - if ((kHeld & KEY_ZL) && zlPressTime != 0) { - for (int i = 0; i < MAX_PRESSES; i++){ - if (zlPressTime - zlPressCount[i] <= 1000) { + + if ((kHeld & KEY_ZL) && zlPressTime != 0) + { + for (int i = 0; i < MAX_PRESSES; i++) + { + if (zlPressTime - zlPressCount[i] <= 500) + { count++; - if (count == MAX_PRESSES){ - if (now - lastSkipTime > 1000){ - if (fileNum > 1 && dirList.dirNum < fileNum-1) { + if (count == MAX_PRESSES) + { + if (now - lastSkipTime > 1000) + { + if (fileNum > 1 && dirList.dirNum < fileNum-1) + { fileNum -= 1; if(fileMax - fileNum > MAX_LIST-2 && from != 0) from--; @@ -783,12 +819,17 @@ int main(int argc, char **argv) } } - if ((kHeld & KEY_R) && rPressTime != 0) { - for (int i = 0; i < MAX_PRESSES; i++){ - if (rPressTime - rPressCount[i] <= 1000) { + if ((kHeld & KEY_R) && rPressTime != 0) + { + for (int i = 0; i < MAX_PRESSES; i++) + { + if (rPressTime - rPressCount[i] <= 500) + { count++; - if (count == MAX_PRESSES){ - if (now - lastSkipTime > 1000){ + if (count == MAX_PRESSES) + { + if (now - lastSkipTime > 1000) + { if (fileNum < fileMax && dirList.dirNum < fileNum+1) { fileNum += 1; if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST) @@ -810,12 +851,15 @@ int main(int argc, char **argv) } } - /* L held for >=2000ms: Previous song (only if not part of combo) */ - if ((kHeld & KEY_L) && lPressTime != 0) { - for (int i = 0; i < MAX_PRESSES; i++){ - if (lPressTime - lPressCount[i] <= 1000) { + if ((kHeld & KEY_L) && lPressTime != 0) + { + for (int i = 0; i < MAX_PRESSES; i++) + { + if (lPressTime - lPressCount[i] <= 500) + { count++; - if (count == MAX_PRESSES){ + if (count == MAX_PRESSES) + { if (now - lastSkipTime > 1000){ if (fileNum > 1 && dirList.dirNum < fileNum-1) { fileNum -= 1; @@ -839,9 +883,11 @@ int main(int argc, char **argv) } // play next song automatically - if (error == -1) { + if (error == -1) + { // don't try to play folders - if (fileNum >= fileMax || dirList.dirNum >= fileNum) { + if (fileNum >= fileMax || dirList.dirNum >= fileNum) + { error = 0; continue; } From b1ae39e2ba993fc529955064906eb2952e39c723 Mon Sep 17 00:00:00 2001 From: Alexander H Date: Sun, 25 Jan 2026 20:14:20 -0600 Subject: [PATCH 5/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9ea5b47..4281af4 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ The latest 3DSX/CIA/3DS download can be found on the