Repository navigation
fix(port): prevent menu close input from leaking into game input - #233
Open
jacobjordan94 wants to merge 1 commit into
Open
jacobjordan94 wants to merge 1 commit into
jacobjordan94 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closing the F8 menu with a controller (A to confirm, or the Select+Start combo) could leak that same button press into the game on the exact frame the menu closed.
Port_Config_InputPressed()polls hardware state directly instead of edges, so whatever button had just closed the overlay was still physically held the instantPort_UpdateInput()'s overlay mask lifted, and that stale press got read as a brand new input.In practice, this meant that if a player had the in-game pause menu open on its default Equipment page and closed F8 with A, the leaked A press reassigned their equipped item, since Equipment's A-button press treats it as "equip the selected item."
Closing with Select+Start leaked a Start press the same way, opening or closing the in-game pause menu right behind F8.
Fixed with a debounce: once an overlay closes,
Port_UpdateInput()now keeps masking all GBA buttons released until every mapped input has actually been released at least once, not just until the overlay itself reports closed.Fixes #225.
Testing
Linux, Bazzite host, built inside a Debian distrobox container.
layer initialized. Entering AgbMain...".