From 1cd9041490987a7869ee9c9ee71ac4fe0a123d45 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AreaZR@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:20:38 -0400 Subject: [PATCH 1/3] BUGFIX: Fix L=A by comparing the rawkeys to the previous keyinput instead of the converted keys Also remap newAndRepeatedKeys --- src/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 5f12a2996e44..775ce891cd58 100644 --- a/src/main.c +++ b/src/main.c @@ -258,11 +258,13 @@ static void ReadKeys(void) // because it compares the raw key input with the remapped held keys. // Note that newAndRepeatedKeys is never remapped either. +#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; @@ -285,6 +287,10 @@ static void ReadKeys(void) if (JOY_HELD(L_BUTTON)) gMain.heldKeys |= A_BUTTON; +#ifdef BUGFIX + if (JOY_REPEAT(L_BUTTON)) + gMain.newAndRepeatedKeys |= A_BUTTON; +#endif } if (JOY_NEW(gMain.watchedKeysMask)) From bd113b42fb6fd15300df99bdb0f2b0eaa1239230 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AreaZR@users.noreply.github.com> Date: Mon, 21 Oct 2024 00:13:49 -0400 Subject: [PATCH 2/3] Remove #ifdef BUGFIX newAndRepeatedKeys is only checked for DPAD values, so it doesn't affect pret at all. --- src/main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main.c b/src/main.c index 775ce891cd58..1f27350b1c4a 100644 --- a/src/main.c +++ b/src/main.c @@ -287,10 +287,6 @@ static void ReadKeys(void) if (JOY_HELD(L_BUTTON)) gMain.heldKeys |= A_BUTTON; -#ifdef BUGFIX - if (JOY_REPEAT(L_BUTTON)) - gMain.newAndRepeatedKeys |= A_BUTTON; -#endif } if (JOY_NEW(gMain.watchedKeysMask)) From edd7357765fc5b088f96882d2e0de80703c6bc1d Mon Sep 17 00:00:00 2001 From: Rose <83477269+AreaZR@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:25:21 -0400 Subject: [PATCH 3/3] Add D-Pad comment --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 1f27350b1c4a..b2e415e1e6a1 100644 --- a/src/main.c +++ b/src/main.c @@ -256,7 +256,6 @@ 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. #ifdef BUGFIX if (keyInput != 0 && gMain.heldKeysRaw == keyInput) @@ -287,6 +286,10 @@ static void ReadKeys(void) if (JOY_HELD(L_BUTTON)) gMain.heldKeys |= A_BUTTON; + + // newAndRepeatedKeys is not remapped at all. + // Does not matter in vanilla since newAndRepeatedKeys + // is only checked with D-Pad values anyway. } if (JOY_NEW(gMain.watchedKeysMask))