fix(input): the left stick moves the Insert menu as the D-pad does #3307
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
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
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3307
Loading…
Reference in a new issue
No description provided.
Delete branch "fofuxo/Longshot:fix/menu-left-stick"
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?
Summary
On a controller, the Insert menu moved only on the D-pad: the left stick did nothing there, while the game's own menus
follow it. To see it on
main: open the Insert menu with a controller and push the left stick; the focus stays put.With this PR the left stick moves the Insert menu as the D-pad does: one step a push, repeated while held, in every tab
and page. It does so only while the menu is open: in play the stick walks Link, and a mod's debug page shown beside the
game does not move with him. A stick already pushed as the menu opens (Link walking) moves nothing until it is let go
and pushed again, as the D-pad held through the opening. No control can be bound to it, so the game and the Controls page never see it.
host/nn_hid.cpad_left_stick_way:pads_readadds the left stick pushed one way to the pads' inputs as bits oftheir own past
HOS_PAD_N(HOS_PAD_LS_*,gpu/vk/vk_api.h), as the right stick's for the ocarina already are: theway it leans most once past half its travel, held until that axis comes back under 30 percent, so a stick resting
near the line, or turning toward a diagonal, does not press again.
gpu/vk/vk_ui_keys.hpad_ways: the D-pad and those bits as the menu's four moves, the stick's only while the menuis open;
PadWayskeeps every way held across presents, the stick's too, so one pushed as the menu opens is no press;gpu/vk/vk_ui.cppmoves and repeats on them as it did on the D-pad.Every controller reaches
pads_read, the builder's too (the Switch 2 Pro Controller's driver, the Joy-Cons throughSDL), so one place covers them all.
The stick's reading is dyst's
stick_dirsfrom #2421, whichcarries this fix beside its Progress page but cannot land as it is: the menu it read for (
gpu/vk/vk_menu.cpp) has sinceleft the renderer. dyst is a co-author of both commits. #2421's other menu fix (the movement keys moving the menu) is
not taken:
mainrepeats W, A, S and D in the menu already.Read first:
host/nn_hid.cpad_left_stick_way, thengpu/vk/vk_ui_keys.hpad_waysandPadWays.Testing
Tested: Windows 11 (build 26300), NVIDIA GeForce RTX 3070 (driver 621.47), this checkout's runtime (
dev.py rt)over the shared base. In the game, by hand, with each controller: a Switch 2 Pro Controller over USB (the builder's
driver), a DualShock 4, and four Joy-Cons. With each, the left stick moved the Insert menu through its tabs and rows as
the D-pad does, repeated when held, and did not move it from a stick at rest or slightly tilted; the menu closed, the
stick walked Link as before; on the Controls page a binding that waited for a button did not take the stick. After the
review's L1 (head
db4185d2), again in the game: with Link walking, the menu opened with the stick still pushedselected and moved nothing; let go and pushed again, it moved; closing it and playing were as before. Both runs closed
cleanly, with no fatal or device-lost line.
dev.py smoke: PASS (in play fromkokiri-start, 900 frames, themenu opened).
At
e01c8444(onmain@6c06d981, so with #3244's Bluetooth), again in the game by hand: a Switch 2 Pro Controllerover Bluetooth, no cable plugged in. The left stick moved the Insert menu as over USB, held or not, opening the menu
with the stick pushed moved nothing, and the stick walked Link once the menu closed; the game closed with exit status 0.
That run's log was not kept (only its last lines), so the link is the player's word, not a log line.
Checks:
tests/test_menu_left_stick.py(new) fails onmain(the test's commit alone) and passes here, with gcc and g++,with clang and clang++, and with
CC/CXXset. With the fix's key lines undone one at a time (the stick inpad_ways, the hold, the half-way threshold,PadWayskeeping the stick held as the menu opens) it fails each time.e01c8444(the review's fixes, rebased onmain@6c06d981), as atdb4185d2before the rebase,tests/run_all.py --strict --changed origin/main: 79 passed, 2 failed, 6skipped; the two are
test_fps_statsandtest_gfx_effects, which fail onmaintoo (below).d387b2be(before the review),tests/run_all.py --strict(the whole suite, asmise run test; Windows, mise's Python 3.12.15, llvm-mingw's clangfirst on
PATH,CC=gcc): 876 passed, 26 failed, 55 skipped. 25 of the 26 fail onmain@be494221too, run againthere by name:
test_audio_output_errors,test_audio_wave_buffer_release,test_device_lost_exit,test_fixed_share_upscale_shader,test_fps_stats,test_framegen_hdr,test_fsr3fi_hud_layer,test_fsr3fi_hudless_colour,test_fsr4_tune,test_game_font,test_gfx_effects,test_helpers_extract,test_lifter,test_longshot_builder,test_lost_wait_said,test_obj_cache_size,test_present_acquire_ahead,test_present_device_loss,test_present_probe,test_present_probe_retirement,test_present_thread,test_queue_priority,test_rt_refl_lamps,test_submit_oom,test_temporal_present_bandwidth. The 26th,test_fsr4_own_cache, said PASS and then failed in its cache's clean-up under the full run's load; alone it passeshere twice, as on
main. Two of them read a file this changes and fail onmainfor the same reason:test_fps_stats(a markermain's source no longer has) andtest_gfx_effects(no glslang under that name:run_all.pylooks forglslangValidator, tools.lock shipsglslang.exe).Still to test:
Linux run: open the Insert menu with a controller and move through its tabs with the left stick).
Measurements
Verdict: fixed: the left stick moves the Insert menu here and does not on
main. Nothing to measure for speed: thechange adds a few comparisons to each read of the pads (every 2 ms at most) and to each present while a page is hosted. Measured on
main@be494221; rebased since on6c06d981, which changes none of this PR's code, so theresult still holds.
Setup: Windows 11 (build 26300), RTX 3070 (NVIDIA 621.47); the game-free check, and the Insert menu in the game with a
Switch 2 Pro Controller over USB, a DualShock 4 and Joy-Cons.
be494221db4185d2tests/test_menu_left_stick.pyRisks
would move the menu on its own; past the dead zone, the game would walk Link on its own too, and the Stick dead zone
row covers both.
HOS_PAD_N, where no control can be bound (the binds take 0to
HOS_PAD_N - 1), and the game's buttons are read through the binds.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Testing names them.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened. (None needed updating: every check thatreads the changed files passes, but those named under Testing, which fail on
maintoo.)dev.py rt. On Linux, from the diff:host/nn_hid.cgainspad_left_stick_way, plain C onint32_tanduint64_tthat thenew check compiles, and one line in
pads_readreadingpad_raw_nowashos_pad_rawalready does on Linux; theHOS_PAD_LS_*bits arevk_api.h's, which CI's Linux renderer build compiles. No path handling changes. The Linuxrun itself is in Still to test, asked of the Test Farm.)
docs/user/graphics-and-controls.md: the D-pad or the left stick chooses;docs/dev/reference/ui-draw-list.md:nav.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11 (build 26300), RTX 3070 (NVIDIA 621.47), this branch's runtime over the shared base: in the Insert menu, the left stick moved through tabs and rows like the D-pad and repeated when held, with a Switch 2 Pro Controller over USB, a DualShock 4 and four Joy-Cons; a stick at rest did not move it, the stick still walked Link with the menu closed, the Controls page did not bind it. dev.py smoke PASS. No fatal line.
Measurements as a table: the check and the in-game behaviour, main against this PR.
@review
Recommendation: Request changes. The menu can treat a stick already held for movement as a new navigation press when it opens. The new check also requires GCC even when the suite is configured to use another supported C compiler.
The change adds left-stick navigation and repeat to the Insert menu using direction bits in the host’s pad input. It fixes the reported behavior in the author’s Windows controller runs, but introduces an unintended menu press on opening and a compiler dependency in the test suite.
Blocking (1): must change before merging.
gpu/vk/vk_ui.cpp:768: Opening the menu turns a stick direction that was already held into a new menu press. (more on the line) Do: Track the stick’s physical held state across the menu transition and only arm its navigation after release, then add a test that opens the menu with a direction already held.Should fix (1): not blocking, but worth doing before merging.
tests/test_menu_left_stick.py:27: The suite hard-codes gcc for the C fixture instead of using its configured C compiler. (more on the line) Do: Pass the runner’s {cc} to the check, support compiler commands with arguments, and honor CC for direct invocation.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
host/nn_hid.c:925: The new host input path has not been exercised in game on Linux. (more on the line) Do: Run the menu navigation, hold and release, and gameplay checks on Linux with a controller and record the result.@fixcan do L1 and L2.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that the stick did not move the menu on the base and moved and repeated on this head with three controller types on Windows. Linux behavior has not yet been tested in game.
Other systems: The direction bits are outside the bindable button range and do not alter the stick axes passed to gameplay. The menu’s input path also serves hosted mod pages; the stick is excluded from their navigation when the Insert menu is closed. Linux and Steam Deck controller behavior remain unverified.
Switches: None.
Reviewed:
d387b2be22againstbe4942212e: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, both commits, the full diff, vk_ui_keys.h and the new test in full. Read the changed host and renderer sections and their input, menu and test-runner callers; skimmed the remaining portions of the larger changed code and documentation files. The named review checklist and adjacent Tooling checkout were unavailable. No generated files or recorded runs were changed.; nothing run (a code review).Checked and fine:
Testing: No commands from the pull request, builds or tests were run, as requested. The assessment uses the author’s reported runs and read-only source inspection; CI was still running.
Overlaps and merge order: PR #2421 contains the attributed stick-reading approach alongside another menu change; the description says it cannot land as it stands. PR #3244 is a prerequisite for the stated Switch 2 Pro Bluetooth test.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -760,15 +765,17 @@ void ui_tick() {const bool pass = ours && (last & MKW_UI_OUT_PASS_INPUT) && !(last & MKW_UI_OUT_TEXT);const uint32_t raw = host->pad_raw ? host->pad_raw() : 0, press = raw & ~pad_held;pad_held = raw;const uint32_t ways = ui_keys::pad_ways(raw, modal), way_press = ways & ~ways_held;L1 (blocking): Opening the menu turns a stick direction that was already held into a new menu press.
When: While walking with the stick held up, the closed-menu calculation excludes the stick and records no up direction in ways_held. Opening the menu while still holding it makes way_press include up, so the menu moves immediately and then repeats without a new push.
Do: Track the stick’s physical held state across the menu transition and only arm its navigation after release, then add a test that opens the menu with a direction already held.
@ -906,6 +922,7 @@ static void pads_read(uint64_t *buttons, int32_t stick[4], int *deck_builtin_inpif (!sdl_pads || poll_xinput_env) xinput_read(now, &raw, s, &xinput_pads);if (!sdl_pads && xinput_pads > 0) controlled = xinput_pads; /* (XInput-only: no SDL pad to count it) */raw |= pad_right_stick_way(s);raw |= pad_left_stick_way(s[0], s[1], (uint64_t)(uint32_t)pad_raw_now & HOS_PAD_LS_MASK);L3 (should fix): The new host input path has not been exercised in game on Linux.
When: A Linux controller player uses the new host-to-menu path, but the reported controller runs cover Windows only.
Do: Run the menu navigation, hold and release, and gameplay checks on Linux with a controller and record the result.
@ -0,0 +24,4 @@sys.path.insert(0, str(Path(__file__).resolve().parent)) # (tests/srccut.py: python -I leaves this folder off the path)from srccut import block # noqa: E402RUN_ALL_ARGS = ["--cc", "gcc", "--cxx", "{cxx}"]L2 (should fix): The suite hard-codes gcc for the C fixture instead of using its configured C compiler.
When: On a supported Windows or Linux setup with clang available but no gcc, run_all.py marks this check missing and strict mode fails, even when CC=clang. A configured CC is ignored when gcc is present as well.
Do: Pass the runner’s {cc} to the check, support compiler commands with arguments, and honor CC for direct invocation.
d387b2be22db4185d2e5Thanks. Pushed
db4185d2(the branch rewritten so it still reads test, then fix):gpu/vk/vk_ui_keys.hPadWayskeeps every way held across presents, the left stick's too whether or not the menu takes it, so a stick already pushed as the menu opens is no press and starts no repeats; it moves the menu once let go and pushed again, as the D-pad held through the opening does.tests/test_menu_left_stick.pydrives it present by present (the menu opening with the stick up, let go, pushed again; the D-pad and the stick held together), and fails withPadWayskeeping only what the menu took. Checked in the game too: with Link walking, the menu opened with the stick still pushed selected and moved nothing; let go and pushed again, it moved.{cc}and{cxx}, elseCCandCXX, else gcc and g++, and splits a command with arguments. Run with gcc/g++, clang/clang++, andCC=clang CXX=clang++.@Beanstalk on Linux, any GPU, with a controller: build this PR, then in the Insert menu move through the tabs and rows with the left stick (it should move like the D-pad and repeat when held), open the menu while walking with the stick still pushed (nothing should move until the stick is let go and pushed again), and close the menu and walk (the stick should walk Link as on main).
@fofuxo only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was fordb4185d, and the PR has changed since (e01c844), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.db4185d2e5e01c844469Rebased on
main@6c06d981(heade01c8444, no conflict;maintouched onlydocs/user/graphics-and-controls.mdamong this PR's files, another paragraph).tests/test_menu_left_stick.pypasses, andtests/run_all.py --strict --changed origin/maingives the same 79 passed, 2 failed (test_fps_stats,test_gfx_effects, which fail onmaintoo), 6 skipped. The code is unchanged by the rebase, so the in-game runs and the measurement atdb4185d2still hold.The Linux box is ticked from the diff (the reason is beside it); the Linux run in the game stays in Still to test for the Test Farm, which comes during review.
WIP: fix(input): the left stick moves the Insert menu as the D-pad doesto fix(input): the left stick moves the Insert menu as the D-pad does@Beanstalk on Linux, any GPU, with a controller: build this PR, then in the Insert menu move through the tabs and rows with the left stick (it should move like the D-pad and repeat when held), open the menu while walking with the stick still pushed (nothing should move until the stick is let go and pushed again), and close the menu and walk (the stick should walk Link as on main).
@fofuxo only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Tested at
e01c8444with a Switch 2 Pro Controller over Bluetooth (now inmainwith #3244), no cable: the left stick moves the Insert menu as over USB. Moved from Still to test into Tested; the Linux run for the Test Farm is what is left there.@review
Recommendation: Approve. The code is ready: only testing is left. The held-stick fix and configured compiler change address the code items. The Linux in-game input run remains outstanding, and CI is still running. Recommend approval; not approved on the forge.
The left stick can navigate and repeat in the Insert menu while retaining its gameplay use. The change adds directional state tracking and a game-free test.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
host/nn_hid.c:925: The new host input path has not been exercised in game on Linux. When: A Linux controller player uses the new host-to-menu path, but the reported controller runs cover Windows only. Do: Run the menu navigation, hold and release, and gameplay checks on Linux with a controller and record the result.Since the last review (on
d387b2be22)Resolved: L1 (Opening the menu turns a stick direction that was already held into a new menu press.); L2 (The suite hard-codes gcc for the C fixture instead of using its configured C compiler.)
Still open: L3 (The new host input path has not been exercised in game on Linux.)
Checks: Still running: 11 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that the stick did not move the menu on main and did on this PR with three controller types on Windows; the held-through-opening case was also checked in game. This is not a performance change.
Other systems: The host input path also runs on Linux, where an in-game controller run remains outstanding. The new bits sit beyond the bindable range; Windows testing reports that gameplay and binding still work.
Switches: None.
Reviewed:
e01c844469against6c06d98100: Read AGENTS.md, CONTRIBUTING.md, vk_ui_keys.h and test_menu_left_stick.py in full; inspected the diff, commits, the changed UI and host input paths, and the supplied test reports. Other changed files and surrounding code were skimmed, not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The author reports Windows in-game and game-free checks; the Linux run and current CI results are pending.
Overlaps and merge order: PR #2421 contains the related earlier stick fix; this PR adapts it to the current menu.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.