fix(input): the item carousel turns with the mouse wheel, and the mouse's motion no longer throws its choice #2964
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2964
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/carousel-wheel"
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
Holding Q (L) or R in play opens the item carousel, the row of items to choose from. With the
keyboard and mouse, two things were wrong there (#2672):
game/oot_menu.chas code that turns the carousel with the wheel (item_choice_tick), butit never ran. The game's menus hand the mouse to the screen that shows a focused button. The carousel shows its
choice with none of its buttons focused as it opens, so it was never that screen and the notches were dropped.
stick (
host/nn_hid.c), and the carousel turns with the right stick. A small move holds the stick over, so thechoice kept running until the row's first or last item.
On
main: in play, click into the window, hold Q or R and turn the wheel: the choice stays. Move the mouse a littleleft or right: it runs to an end of the row.
Now:
notch at a time (down to the right, up to the left), with the existing
item_choice_tick.hos_mouse_item_choice_shown, declared inhost/game_host.h). For100 ms after one,
read_inputdrops the mouse's motion from the stick. The mouse is still taken in, so the pointerstays held at the window's centre. This holds with Mouse camera on Native and on As the stick. Off is unchanged (there
the mouse is never the stick).
item_choice_tickis Windows-only, and SDL hands the wheel to the Insertmenu alone), so its
hos_oot_menu_tickdoesn't tell the host, and the mouse steers the carousel as onmain.Read first:
game/oot_menu.c(item_choice_seen, inside#if defined(_WIN32), and the front screen's condition inhos_oot_menu_tick), thenhost/nn_hid.c(hos_mouse_item_choice, and its use beside the Deck's inread_input). The player guide gets a line onthe carousel.
Fixes #2672. See #822: its opt-in item wheel (Twilight Princess style) frees the mouse to a pointer of its own, so the
stick path changed here doesn't concern it.
Testing
Tested: Windows 10, RTX 4090, NVIDIA 617.42, keyboard and mouse, 1280x720 window, a copy of my own adult save in
Zora's Domain (each run in its own profile). A script sent real input: a click to capture the mouse, then Q held,
3 wheel notches (down, down, up), 300 px of mouse motion right then left; then the same with R.
HOS_MENU_TRACE=1, andthe bridge's shot of each step checked by eye. Same steps on both builds:
main(018dd2ef;game/oot_menu.c,host/nn_hid.candhost/display.cunchanged since)4c65c239)the mouse is for screenthe carousel only once the mouse's motion had moved its choicethe mouse is for screenthe carousel, at oncewheel -1: the item choice turned right...)Item-choice turns logged: 0 on
main, 6 here.The game runs were on
4c65c239. The review round (nowcdea304c, onmain56823e27) movesitem_choice_seeninside#if defined(_WIN32), takes its call out of the Linux tick, and changes comments. The Windows code the game runs is thesame, and the two commits
maingained since touch none of these files, so the runs weren't repeated.Checks:
tests/test_oot_menu_mouse.py(Windows only): a carousel with none of its buttons focused still takes the wheel,and its frames tell the host. On the test commit alone (
6a06e395) 3 checks fail: lines 302, 310 and 314, e.g.FAIL line 314: !strcmp(taps, "0.000:RIGHT/60;") && focus_calls == 0 (taps ""). They pass oncdea304c.tests/test_oot_menu_mouse.py,test_the_linux_tick_does_not_tell_the_host(runs everywhere, a source check): theLinux
hos_oot_menu_tickdoesn't callitem_choice_seen. It fails against the first version of this fix (4c65c239:'item_choice_seen' unexpectedly found in "#else ...") and passes oncdea304c.tests/input_background_test.c, new caseitem-choice-motion, through the realread_input: with the carouselshown, the mouse's motion steers nothing, As the stick and Native with L held, and the pointer is still taken in.
On the test commit it fails (
FAIL:193 ... G32(address + 24) == rx, the stick still 20000) on Windows and Linux;here all 29 cases pass on both, with and without
HOS_MOUSE_NATIVE=1in the environment.The fixture now removes every
HOS_MOUSE_*switch, as it doesHOS_INPUT_*.read_inputreadsHOS_MOUSE_NATIVEitself, and with it set
menu-side-buttons,deck-motionanditem-choice-motionfailed.host notice (lines 302, 310), the motion drop (
item-choice-motion).test_oot_menu_mouse.pygets thehost/game_host.hstand-in it has lacked since #2411; this is the same hunk as #2962's.
test_input_background.py's option-4 check endedits slice of
vk_replay.cppat a};inside the option lambda, which stopped the file before any of its C cases ran.It now ends at the lambda's own close, and links libm on Linux.
host/nn_hid.c,game/oot_menu.corhost/game_host.h(54 files) pass on4c65c239, exceptfour that fail the same way on
main(test_game_boundary,test_keyboard_option,test_menu_keys,test_pipeline_tour). Oncdea304cthe ones that cut the changed code ran again and pass (test_hold_toggle,test_walk_key,test_input_movie,test_mouse_stick,test_menu_hooksand others).test_walk_keycuts thechanged code and gets a stand-in.
test_hold_toggleneeds none now. The Windows-only ones among thempass on Windows, apart from
test_sprintandtest_oot_fov_rust, which fail the same way onmainthere: this PClacks the MSVC
msvcrt.libandcargothose two need.cdea304c:scripts/check_host_compile.pycompiles the 119 host units, 0 failed and0 warnings, the same as
main56823e27. Nothing is linked, and the game isn't run there. The whole suite, strict,against
main: see the latest comment.Still to test:
turn as on
main(only the mouse's motion is dropped, not the pad's stick). (by hand)Measurements
Verdict: fixed: the wheel turns the carousel (6 turns logged against 0 on
main), and the mouse's motion leaves thechoice. There's no speed or memory to measure: per input read it adds one atomic load and a compare, and per carousel
frame one atomic store. No render-path work, nothing allocated.
Setup: Windows 10, RTX 4090, NVIDIA 617.42; the game-free tests with llvm-mingw clang (Windows) and gcc (Linux); the
game in a 1280x720 window, the carousel in Zora's Domain (adult), real input, as Testing says.
56823e27(game:018dd2ef, same code)cdea304c(game:4c65c239, same Windows code)tests/test_oot_menu_mouse.pytests/test_input_background.py,item-choice-motionRisks
Only while the item carousel is on screen, on Windows: the mouse's motion no longer moves its choice, and the wheel does. A player
who steered the carousel with the mouse now uses the wheel, Q/R with the arrow keys, or a pad. A pad's own right stick is
untouched. Everywhere else the mouse is as before, and on Linux the carousel is as on
main. A revert is enough to undo it. Nothing changes in saves,longshot_options.inior the caches.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).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.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
https://claude.ai/code/session_01VxeaZiJchH34JFuUAaobK7
Tested in game: Windows 10, RTX 4090, NVIDIA 617.42, 1280x720 window, a copy of my adult save in Zora's Domain, real input (mouse captured): Q held, then R held. Each wheel notch turned the item carousel (6 turns logged, the choice stopping at the row's end), and 300 px of mouse motion right and left left the choice where it was. Same steps on main (
018dd2ef): 0 turns, and the motion threw the choice to the row's end and back to its start. HOS_MENU_TRACE lines and the bridge's shots match.Linux suite (Ubuntu 22.04 under WSL2,
run_all.py --strict), head4c65c239against main495ed9fe: head 828 passed, 88 failed, 10 skipped; main 827 passed, 89 failed, 10 skipped. Nothing fails only on the head;test_input_backgroundfails only on main (the test commit repairs it). The 88 files failing on both: f2i_immediate global_load_16 native_suatom test_blocks_at_start test_bug_report test_cloth_kernels test_cloth_loops test_cloth_sphere test_cloth_step12 test_cloth_step8 test_cloth_step9 test_control_picture test_coop_spirv test_crash_record test_crt_options test_dead_targets_sweep test_default_point_size test_depth_sample_types test_dev_update test_dlss_actor test_dlssg_pace test_draw_parameters test_draw_stream_visibility test_framegen_hdr test_framegen_resources test_fsr3_math test_fsr3_shaders test_fsr3fi_hud_layer test_fsr3fi_hudless_colour test_fsr4_tune test_fsr_uniform_ownership test_game_boundary test_guest_holes test_image_arrays test_image_reaper_threads test_image_view_retry test_keyboard_option test_late_fix_shaders test_lens_eye_pass test_lifter test_linux_pressure test_loaded_modules_drop test_log_levels test_lower_depbar test_lower_lds_after_sts test_lower_register_markers test_menu_keys test_menu_save_atomic test_mesh_fallback_capacity test_mesh_fallback_layout test_mesh_first_types test_mesh_unreachable_outputs test_native_suatom test_nonuniform_image_arrays test_oot_cloth test_oot_occ_raster test_oot_song_inventory test_option_ids test_perf_send test_pipeline_tour test_present_acquire_ahead test_present_image_free test_present_source_crop test_prof_clock test_program_answer_domains test_program_cache_cleanup test_program_cache_one_variant test_reactive_mask test_readback_timeout_reuse test_recording_admission test_reshade_fx test_scene_tonemap_pass test_screensaver test_sim_turf_pools test_spirv_struct_identity test_switch_table test_target_pool_cap test_target_retention test_temporal_present_bandwidth test_tex_desc_memo test_texture_phi_dominance test_thinlto_tls test_unsigned_image_types test_upscaler_round_trip test_vram_compact test_windows_display_startup test_windows_on_linux test_wmma16_spirv_valWIP: fix(input): the item carousel turns with the mouse wheel, and the mouse's motion no longer throws its choiceto fix(input): the item carousel turns with the mouse wheel, and the mouse's motion no longer throws its choicePossibly related, for context:
@review
Recommendation: Request changes. On Linux, the change removes mouse steering of the carousel without providing the wheel control that replaces it on Windows. The new input test also inherits a mouse-mode switch that can make it fail on a developerβs machine.
The change makes the Windows item carousel accept wheel notches without a focused button and suppresses mouse-driven stick movement while the carousel runs. The Windows game run demonstrates the intended fix, but Linux loses an existing way to select items.
Blocking (1): must change before merging.
game/oot_menu.c:874: Linux suppresses mouse steering of the carousel but has no carousel wheel handler. (more on the line) Do: Implement carousel wheel handling on Linux before suppressing its mouse stick, or retain the existing Linux steering until a replacement is available.Should fix (1): not blocking, but worth doing before merging.
tests/test_input_background.py:174: The new case inherits HOS_MOUSE_NATIVE, which overrides the mouse mode set by the fixture. (more on the line) Do: Remove HOS_MOUSE_NATIVE from the case environment, along with any other mouse switches that affect the fixture.@fixcan do L1 and L2.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes on the tested Windows setup: the author reports six wheel turns versus zero on main, and mouse movement no longer changes the selection. Linux gameplay has not been tested, and its wheel handler is absent.
Other systems: The suppression also runs on Linux; Linux does not run the Windows menu wheel handler. Pad stick values are merged before the mouse values are suppressed, so the changed code leaves the pad input intact. Native and As the stick share the suppression when the host routes motion through the stick path.
Switches: None added, changed or removed.
Reviewed:
4c65c239c9against495ed9fe2a: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the diff, commit messages and the changed menu and input paths and their surrounding callers. Skimmed the changed tests, player guide and developer standards; the large output for some full-file reads was truncated. docs/review-checklist.md and the adjacent Tooling checkout were absent. No generated files or translations changed.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during review. The author reports the Windows game run and Linux and Windows game-free checks; CI was still running.
Overlaps and merge order: The pull request identifies #2962 as containing the same test-header repair; its current status and merge order are not available in the supplied evidence.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -861,3 +872,3 @@hos_input_clear_toggles();}void hos_oot_menu_tick(Ctx *c, uint64_t screen) { (void)c; sprint_menu_tick(screen); }void hos_oot_menu_tick(Ctx *c, uint64_t screen) { (void)c; sprint_menu_tick(screen), item_choice_seen(screen); }L1 (blocking): Linux suppresses mouse steering of the carousel but has no carousel wheel handler.
When: On Linux, holding L opens the carousel and item_choice_seen notifies the host, so read_input zeros the mouse stick. The Linux menu tick never calls item_choice_tick, and SDL only forwards wheel events to the Insert menu, so turning the wheel cannot select an item either.
Do: Implement carousel wheel handling on Linux before suppressing its mouse stick, or retain the existing Linux steering until a replacement is available.
@ -171,2 +172,3 @@"-I" + str(folder), str(ROOT / "tests/input_background_test.c"), "-o", str(exe)])"-I" + str(folder), str(ROOT / "tests/input_background_test.c"), "-o", str(exe)]+ ([] if os.name == "nt" else ["-lm"])) # (sqrt, the stick's length: libm is its own library on Linux)for case in ((a.case,) if a.case else CASES):L2 (should fix): The new case inherits HOS_MOUSE_NATIVE, which overrides the mouse mode set by the fixture.
When: With HOS_MOUSE_NATIVE=1 in the environment, item-choice-motion starts in Native mode despite setting mouse_mode to As the stick. Its first packet expects mouse stick movement, but the Native path takes it instead, so the test fails.
Do: Remove HOS_MOUSE_NATIVE from the case environment, along with any other mouse switches that affect the fixture.
Review round (BeanBot's L1, L2): head now
cdea304c(test6a06e395, fixcdea304c), rebased onmain56823e27. Both findings were folded into the two commits.L1 (
game/oot_menu.c), done: only Windows tells the host.item_choice_seenis now inside#if defined(_WIN32), and the Linuxhos_oot_menu_tickis back tomain's (sprint_menu_tickalone). I checked the cause:host/posix/display_sdl.chands the wheel only to the Insert menu (if (menu_open) pointer_update(...)), so Linux had no replacement for the mouse's steering. There the carousel is now as onmain. A Linux carousel wheel can follow separately; I can't run the game on Linux here. Pin:test_oot_menu_mouse.py'stest_the_linux_tick_does_not_tell_the_hostis a source check that runs on Linux. It fails against4c65c239('item_choice_seen' unexpectedly found in "#else ...") and passes oncdea304c.L2 (
tests/test_input_background.py), done: the shared environment drops everyHOS_MOUSE_*switch, as it already didHOS_INPUT_*. I confirmed it: withHOS_MOUSE_NATIVE=1exported before the fix,menu-side-buttons,deck-motionanditem-choice-motionfailed. Now all 29 cases pass with and without it, on Linux and Windows.Re-run on
cdea304c:test_oot_menu_mouse.pyOK (fails at lines 302, 310 and 314 on the test commit).test_input_background.pypasses 29 of 29.test_input_background.pypasses 29 of 29 (item-choice-motionFAIL:193on the test commit).test_hold_toggle,test_walk_key,test_input_movie,test_mouse_stick,test_menu_hooksand the other checks that cut the changed code pass.check_host_compile.py: 119 units, 0 failed, 0 warnings, the same asmain.run_all.py --strict), headcdea304cagainst main56823e27: head 829 passed, 88 failed, 10 skipped; main 827 passed, 90 failed, 10 skipped. Nothing fails only on the head. Only onmain:test_input_background(the test commit repairs it) andtest_longshot_ctl(untouched here; it passes on the head).The game runs in the description (
4c65c239) weren't repeated. The Windows code the game runs is unchanged: the function moved inside the#if, and comments changed.main's two new commits (#2969, #2909) touch none of these files.4c65c239c9cdea304c15@review
Recommendation: Approve. The Windows carousel wheel and mouse behavior are demonstrated in game, and both earlier issues are fixed. Linux retains its previous steering behavior. Recommend approval; not approved on the forge.
On Windows, the mouse wheel turns the item carousel without mouse motion throwing the choice to an end. The change adds a small cross-thread signal and leaves Linux behavior unchanged.
Since the last review (on
4c65c239c9)Resolved: L1 (Linux suppresses mouse steering of the carousel but has no carousel wheel handler.); L2 (The new case inherits HOS_MOUSE_NATIVE, which overrides the mouse mode set by the fixture.)
Checks: Still running: 10 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows game run logged six wheel turns on the PR versus none on main, and mouse movement left the choice in place instead of moving it to the row's ends.
Other systems: Linux no longer sends the carousel signal, so its mouse steering remains as on main. The pad stick is combined separately from the suppressed mouse motion; an in-game pad check remains outstanding. The Windows game run and Linux host compile are reported by the author.
Switches: None added, changed or removed.
Reviewed:
cdea304c15against56823e27a1: Read the diff, commit list, repository agent and contribution rules, and the relevant platform and environment paths. The full output for the larger changed code and test files was truncated, so those files were not read in full; the player guide, PR template and developer standards were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports Windows in-game input checks, game-free checks on Windows and Linux, and a Linux host compile.
Overlaps and merge order: The PR description identifies an overlapping test-header repair in #2962; merge order was not established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.