Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Fix L=A by comparing the rawkeys to the previous keyinput #2042

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,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.

#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;
Expand All @@ -285,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))
Expand Down