From 4958c5db3f86ca08c41a448d33e3bc6b265f9754 Mon Sep 17 00:00:00 2001 From: Narayan <117493082+narayanx@users.noreply.github.com> Date: Tue, 19 Aug 2025 18:09:05 -0700 Subject: [PATCH 1/4] modified readme and control display to reflect new controls, commented out stop code --- README.md | 2 +- source/main.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 63f4843..6ccdf45 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The latest 3DSX/CIA/3DS download can be found on the Date: Fri, 22 Aug 2025 00:18:13 -0700 Subject: [PATCH 2/4] got switching with L/R working upon keyup --- source/main.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/source/main.c b/source/main.c index 228dcbc..54ba67f 100644 --- a/source/main.c +++ b/source/main.c @@ -302,6 +302,10 @@ int main(int argc, char **argv) volatile int error = 0; struct dirList_t dirList = { 0 }; + /* ignore key release of L/R if L+R or L+down was pressed */ + bool keyLComboPressed = false; + bool keyRComboPressed = false; + gfxInitDefault(); consoleInit(GFX_TOP, &topScreenLog); consoleInit(GFX_TOP, &topScreenInfo); @@ -353,6 +357,7 @@ int main(int argc, char **argv) { u32 kDown; u32 kHeld; + u32 kUp; static u64 mill = 0; gfxFlushBuffers(); @@ -362,6 +367,7 @@ int main(int argc, char **argv) hidScanInput(); kDown = hidKeysDown(); kHeld = hidKeysHeld(); + kUp = hidKeysUp(); consoleSelect(&bottomScreen); @@ -391,6 +397,11 @@ int main(int argc, char **argv) else puts("Playing"); + keyLComboPressed = true; + // distinguish between L+R and L+Up + if (KEY_R & kDown) { + keyRComboPressed = true; + } continue; } @@ -399,6 +410,7 @@ int main(int argc, char **argv) { consoleSelect(&topScreenLog); showControls(); + keyLComboPressed = true; continue; } @@ -544,7 +556,16 @@ int main(int argc, char **argv) } } - if (kDown & KEY_ZR && fileNum < fileMax) { + // ignore R release if key combo with R used + bool keyRActivation = false; + if (kUp & KEY_R) { + if (!keyRComboPressed) { + keyRActivation = true; + } + keyRComboPressed = false; + } + bool goToNextFile = (kDown & KEY_ZR) || keyRActivation; + if (goToNextFile && fileNum < fileMax) { fileNum += 1; if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST) @@ -559,9 +580,17 @@ int main(int argc, char **argv) if(listDir(from, MAX_LIST, fileNum, dirList) < 0) err_print("Unable to list directory."); continue; } - + // ignore L release if key combo with L used + bool keyLActivation = false; + if (kUp & KEY_L) { + if (!keyLComboPressed) { + keyLActivation = true; + } + keyLComboPressed = false; + } + bool goToPrevFile = (kDown & KEY_ZR) || keyLActivation; // don't go to ../ - if (kDown & KEY_ZL && fileNum > 1) { + if (goToPrevFile && fileNum > 1) { fileNum -= 1; if(fileMax - fileNum > MAX_LIST-2 && from != 0) from--; From 4401238766eeeb52946c3bf1d0229b140f595605 Mon Sep 17 00:00:00 2001 From: Narayan <117493082+narayanx@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:31:02 -0700 Subject: [PATCH 3/4] ZL switching wasn't working fixed, also made pause/play with L+R work if R pressed first, resolving: https://github.com/deltabeard/ctrmus/issues/78 --- source/main.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 54ba67f..b712306 100644 --- a/source/main.c +++ b/source/main.c @@ -288,6 +288,10 @@ err: goto out; } +void pausePlay() { + +} + int main(int argc, char **argv) { PrintConsole topScreenLog, topScreenInfo, bottomScreen; @@ -433,6 +437,22 @@ int main(int argc, char **argv) // continue; // } } + // if R is pressed first + if ((kHeld & KEY_R) && (kDown & KEY_L)) + { + if(isPlaying() == false) + continue; + + consoleSelect(&topScreenLog); + if(togglePlayback() == true) + puts("Paused"); + else + puts("Playing"); + + keyLComboPressed = true; + keyRComboPressed = true; + continue; + } if((kDown & KEY_UP || ((kHeld & KEY_UP) && (osGetTime() - mill > 500))) && @@ -588,7 +608,7 @@ int main(int argc, char **argv) } keyLComboPressed = false; } - bool goToPrevFile = (kDown & KEY_ZR) || keyLActivation; + bool goToPrevFile = (kDown & KEY_ZL) || keyLActivation; // don't go to ../ if (goToPrevFile && fileNum > 1) { fileNum -= 1; From 582022321453ec71e92254291cd42ed708163d7d Mon Sep 17 00:00:00 2001 From: Narayan <117493082+narayanx@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:31:20 -0700 Subject: [PATCH 4/4] deleted stop code --- source/main.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/source/main.c b/source/main.c index b712306..fe581ef 100644 --- a/source/main.c +++ b/source/main.c @@ -288,10 +288,6 @@ err: goto out; } -void pausePlay() { - -} - int main(int argc, char **argv) { PrintConsole topScreenLog, topScreenInfo, bottomScreen; @@ -417,25 +413,6 @@ int main(int argc, char **argv) keyLComboPressed = true; continue; } - - // /* Stop */ - // if(kDown & KEY_B) - // { - // stopPlayback(); - - // /* Clear playback information. */ - // consoleSelect(&topScreenInfo); - // consoleClear(); - // consoleSelect(&topScreenLog); - // //consoleClear(); - - // changeFile(NULL, &playbackInfo); - - // /* If the playback thread is currently playing, it will now - // * stop and tell the Watchdog thread to display "Stopped". - // */ - // continue; - // } } // if R is pressed first if ((kHeld & KEY_R) && (kDown & KEY_L))