From 647f1f875f65a1c3d1e4ac02a92e7d68d9eef337 Mon Sep 17 00:00:00 2001 From: AZero13 <83477269+SiliconA-Z@users.noreply.github.com> Date: Fri, 20 Feb 2026 13:03:52 -0500 Subject: [PATCH] Fix key repeat issue for L button in remapping Fix key repeat logic for L button in A button mode by comparing raw held keys. --- src/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index f2d77a8c2cd..f3e93e0927f 100644 --- a/src/main.c +++ b/src/main.c @@ -277,13 +277,14 @@ static void ReadKeys(void) // BUG: Key repeat won't work when pressing L using L=A button mode // because it compares the raw key input with the remapped held keys. - // Note that newAndRepeatedKeys is never remapped either. - + // This was fixed in later generations by comparing the raw held keys. +#ifdef BUGFIX + if (keyInput != 0 && gMain.heldKeysRaw == keyInput) +#else if (keyInput != 0 && gMain.heldKeys == keyInput) +#endif { - gMain.keyRepeatCounter--; - - if (gMain.keyRepeatCounter == 0) + if (--gMain.keyRepeatCounter == 0) { gMain.newAndRepeatedKeys = keyInput; gMain.keyRepeatCounter = gKeyRepeatContinueDelay; @@ -306,6 +307,10 @@ static void ReadKeys(void) if (JOY_HELD(L_BUTTON)) gMain.heldKeys |= A_BUTTON; + + // newAndRepeatedKeys is never remapped, but this doesn't matter in vanilla + // as it is only ever checked for D-Pad keys. + // But if you need to remap it, you can do so here. } if (JOY_NEW(gMain.watchedKeysMask))