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
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
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/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
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?
Type: fix · Risk: low · Tested on: Linux x86-64 (game-free checks only) · Needs: none
Why
With a button set to Toggle on the Controls page (#137), the pause menu's mouse clicks on that button latch.
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.How to reproduce
Seen on: found reading the code; not seen in the game. Game-free checks on Linux x86-64.
Settings and switches: R set to Toggle on the Controls page (#137).
Steps: Click the R page arrow in the game's pause menu twice.
Expected: The pages turn once per click; each click gives R and then nothing.
Actual: 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.
What changed
The host's menu clicks stay separate from the player's presses, so Toggle no longer latches those clicks. Physical presses, scripts and control bridge presses keep their Toggle behavior.
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.Measurements
Verdict: the new
hold-tapscase fails on main and passes here; the suite has no new failures, including after the rebase.Hardware: 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: 2026-11-14; branch
fix/toggle-menu-taps.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).After rebasing onto main @
543846eb(2026-11-14): #66 (the Walk key) changedread_inputand the test's case lists next to this fix. The rebase keeps both:read_inputstill callshos_oot_autoload_inputand now hands backtaps, andhold-tapssits besidewalk-toggle. One run each:tests/run_all.pygives 485 passed, 2 failed, 84 skipped on main @543846eband on this PR @9953a030; the two failing on both aretest_bake_portability.py(zstandard) andtest_walk_key.py.test_input_background.pypasses every case,walk-toggleandhold-tapsincluded.host/nn_hid.cwith-fsyntax-only(llvm-mingw clang, gcc): the same messages as main's. The Skip title screen row presses A throughhos_hid_taptoo, so with A on Toggle its presses no longer latch either.Flags and settings
None.
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.
Must be tested: None.
Risks
What could break: 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.
Turning it off: Reverting the commit puts the shared word back.
Compatibility: Menu clicks give plain presses with Toggle enabled; the player's presses still latch.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
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 clicks511f6248629953a030feView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.