fix(input): a Toggle button no longer latches the game menus' mouse clicks #339
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!339
Loading…
Reference in a new issue
No description provided.
Delete branch "jarynclouatre/Longshot:fix/toggle-menu-taps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
With a button set to Toggle on the Controls page (#137), the pause menu's mouse clicks on that button latch. Set R to Toggle, then click the R page arrow in the game's pause menu twice: the first click holds R for good, the second lets it go, and the pages do not turn once per click. The same happens with A, L, Y or B and the clicks that tap them.
host/oot_menu.csends its clicks as short presses throughhos_hid_tap("0:R/75").host_tapsinhost/nn_hid.cparses them into the samepresses[]as a script's,scripted_inputORs them into the buttons word, andnpad_statesrunshold_toggle_applyover that whole word. A tap's start is a rising edge, so it latches; its end is ignored; the next tap lets go.What changed
host/nn_hid.c): aPressremembers whether it is the host's (host_tapsparses withlive2).scripted_inputandread_inputhand the host's active presses back in a word of their own (taps);npad_stateslatches the player's word and ORstapsin afterhold_toggle_apply. The two words stay apart, so a physical press of the same button held across a click makes no second edge when the click ends.read_input's own checks of held ZR, L and R for the mouse (hos_mouse_native_free,mouse_stick) still see the clicks. Script (HOS_INPUT_SCRIPT,HOS_INPUT_LIVE) and control bridge presses latch as before; the pause edge (Plus, Minus) is unchanged.tests/test_input_background.py,tests/input_background_test.c): the fixture now uses production'shos_hid_tapandhost_tapsinstead of an empty spy. New casehold-taps: with R, then A, set to Toggle, two clicks give the button and then nothing each time (main: R, R, 0, 0 instead of R, 0, R, 0); a physical press still latches, a click while it is held or latched changes nothing, and the next physical press lets go. The existinghold-togglecase (bridge presses latch) is unchanged and passes.Flags and settings
None.
Measurements
main:
5ad0f503(2026-11-14)this PR: fix/toggle-menu-taps @
511f6248Hardware: none used (game-free checks on a Linux x86-64 PC, gcc 15.2, Python 3.14.4; no clang++ there)
Scene: none, the game was not run
Method:
python3 -I -B tests/run_all.py, two runs each, interleaved (main, PR, main, PR, with the other two branches' runs between); both runs of a side gave the same counts. The PR's new or changed checks also run against main's source.How to reproduce: the commands above in a checkout of each commit
5ad0f503511f6248tests/run_all.py(run 1, run 2)test_bake_portability.py,test_pad_layout.py,test_menu_keys.pytest_input_background.py --case hold-tapstest_bake_portability.pyfails here for a missing Python module (zstandard), on main as well.test_pad_layout.pyfails on main since #137 (its fixture lackshost/hold_toggle.h; #331 and #338 fix it).test_menu_keys.pydoesn't build with g++ on main since #137 (#338 fixes it).Testing
Tested: the game-free suite on a Linux PC, as in Measurements.
host/nn_hid.ccompiles (-fsyntax-only) with llvm-mingw 20261104's x86_64-w64-mingw32-clang and with Linux gcc 15.2, with the same warnings as main's; no file paths are touched.Not tested: the pause menu in the game with a Toggle button. The fixture runs production's tap parser, input merge and Npad writer, which is where the latch happened.
Needs other testers: None.
Screenshots
Nothing on screen.
Risk and rollback
A Toggle button no longer latches from the host's own clicks; anything that wanted a menu click to latch would now get a plain press. Reverting the commit puts the shared word back.
Reviewer notes
Issues
None.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
mainand passing here.tests/that reads changed source updated in this PR, not weakened.WIP: fix(input): a Toggle button no longer latches the game menus' mouse clicksto fix(input): a Toggle button no longer latches the game menus' mouse clicksView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.