From d38a5e75a245db5511f9f145d29d1b09950b44ba Mon Sep 17 00:00:00 2001 From: R Ferreira Date: Sun, 28 Sep 2025 12:18:53 +0100 Subject: [PATCH] oops --- arm9/source/main.cpp | 42 +++++++++++++++++++++++++++++++++++++----- dsmi | 2 +- libntxm | 2 +- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index 27b3057..a593165 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -3460,12 +3460,19 @@ void move_to_top(void) redraw_main_requested = true; } +void move_inst_to_top(void) +{ + handleInstChange(0); + lbinstruments->highlight(0); + lbinstruments->select(0); +} + // Update the state for certain keypresses void handleButtons(u16 buttons, u16 buttonsheld) { u16 ptnlen = song->getPatternLength(song->getPotEntry(state->potpos)); - if(!(buttonsheld & mykey_R)) + if(!(buttonsheld & mykey_R) && !(buttonsheld & mykey_Y)) { if(buttons & mykey_UP) { @@ -3501,8 +3508,30 @@ void handleButtons(u16 buttons, u16 buttonsheld) state->setCursorRow(newrow); pv->updateSelection(); + redraw_main_requested = true; } + + } + + if(!(buttonsheld & mykey_R) && (buttonsheld & mykey_Y)) + { + int move_by = (buttonsheld & mykey_B) ? 4 : 1; + u16 cur_i = lbinstruments->getidx(); + u16 new_i = cur_i; + if(buttons & mykey_DOWN) { + new_i = cur_i + move_by >= 0x7f ? 0x7f : cur_i + move_by; + lbinstruments->highlight(new_i); + lbinstruments->select(new_i); + handleInstChange(new_i); + } + + if(buttons & mykey_UP) { + new_i = cur_i - move_by <= 0 ? 0 : cur_i - move_by; + lbinstruments->highlight(new_i); + lbinstruments->select(new_i); + handleInstChange(new_i); + } } if((buttons & mykey_LEFT)&&(!typewriter_active)) @@ -3585,10 +3614,13 @@ void VblankHandler(void) if(keysheld & mykey_R) { - if(keysheld & mykey_DOWN) - move_to_bottom(); - else if(keysheld & mykey_UP) - move_to_top(); + if(!(keysheld & mykey_Y)) { + if(keysheld & mykey_DOWN) + move_to_bottom(); + else if(keysheld & mykey_UP) + move_to_top(); + } else if (keysheld & mykey_UP) + move_inst_to_top(); } if(keysdown & ~KEY_TOUCH) diff --git a/dsmi b/dsmi index d1ef41b..602691a 160000 --- a/dsmi +++ b/dsmi @@ -1 +1 @@ -Subproject commit d1ef41ba78a8f0f5baf79541289f976a9a27a437 +Subproject commit 602691a8faae9760c7a4b652390c7e0e23fc307f diff --git a/libntxm b/libntxm index 71c75b1..c932488 160000 --- a/libntxm +++ b/libntxm @@ -1 +1 @@ -Subproject commit 71c75b1ea76214d867d42cf9e8b9bef2b1117504 +Subproject commit c932488aad0acc6baecee49c81fdb9419cdf1f1f