fix(host): the Deck's built-in controls do not also fire the mouse's bindings #1721
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1721
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/Longshot:deck-builtin-mouse"
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, game-free fixtures only (the game run is pending) · Needs: Steam Deck, desktop mode
TL;DR
On a Steam Deck in desktop mode, Steam translates the triggers into mouse clicks for the game's window. The default controls also put Y on the mouse's left button, so pressing R2 fired two actions at once. This PR stops the mouse's gameplay bindings from counting while the Deck's built-in controls are giving input. A new test drives the real input path and passes here; I have not run the build in the game yet.
Breakdown
tests/test_input_background.pydrives the realread_inputthrough the pad and mouse;tests/test_steam_pads.pycovers the pad test itself; the fixtures that stub the changed signatures are updated.Why
In desktop mode Steam applies its desktop layout to any focused window that is not a Steam app, and that layout emits mouse clicks for the triggers. Longshot binds the mouse's left button to Y and the right one to ZL by default, and a mouse button counts while the mouse is captured. So on a Deck the trigger presses twice: once as the trigger, once as the face button. Reported while testing the deck as "what is supposed to be R2 is also bound to X button", and it came and went with the capture, which is what made it look erratic.
See #1563
How to reproduce
Seen on: SteamOS 3 (Steam Deck LCD, VanGogh), desktop mode, game launched outside Steam
Settings and switches: defaults, mouse captured (Mouse camera Native or As the stick)
Steps: in play, press R2
Expected: one action
Actual: on main, the trigger's action and the left button's action (Y, attack) both fire
What changed
The Deck's built-in controls are recognised by identity, and the mouse's gameplay bindings are armed only when they are not contributing.
host/pad_sdl.c: each pad's USB product id is recorded beside its vendor and Steam Input handle;pads_pollsamplessteam_pads_deck_builtin()once a poll after the motion-only skip, andhos_sdl_pads()hands the answer out through the same lock as that poll's buttons, so the two always describe one poll.host/steam_pads.h:steam_pads_deck_builtin(vendor, product, steam_handle), Valve's vendor with the Deck's product id and no Steam Input handle (a stand-in pad's).host/nn_hid.c:pads_readcarries the answer out;read_inputarms the mouse's buttons withmouse_buttons_arm(captured && !deck_builtin_input, menu_mouse). A button already down when the rule applies is let go before it counts again, as the capture's own click already was.host/hos_sdl.c,host/hos_sdl.h,host/prompts.c:hos_sdl_pad_product()and the new parameter at the existing call sites.Measurements
Verdict: passes. The mouse's gameplay bindings no longer fire while the Deck's built-in controls are giving input, and the game-free checks that prove it do not build on
main(they name symbols it does not have) and pass here. Nothing to measure for speed: this routes existing input and draws nothing new.Hardware: Linux x86-64 for the fixtures; the game run is still to come on a Steam Deck LCD.
Scene: none; the fixture supplies a fake pad and a fake mouse state to the real
read_input.Method:
tests/*.py, each compiling the production functions out ofhost/into a small program; one deterministic run each.How to reproduce:
python3 tests/test_input_background.py --case deck-mousein the checkout.1013b434e185baactests/test_input_background.py --case deck-mouseread_inputhas nodeck_builtin_inputto passtests/test_steam_pads.pysteam_pads_deck_builtinon maintests/test_pads_after_menu.pytests/test_motion_background.pyFlags and settings
None: the rule is automatic, with no switch, menu row or ini key. That was the ask: on a Deck the built-in controls are always there.
Testing
Tested: game-free, on Linux.
tests/test_input_background.py(all cases, including the newdeck-mouse),tests/test_steam_pads.py,tests/test_pads_after_menu.py,tests/test_motion_background.py,tests/test_gyro_rearm.py,tests/test_bound_keys.py,tests/test_menu_text_field.py,tests/test_menu_keys.py,tests/test_readme_menu_rows.py,tests/test_stick_buttons.py.tests/run_all.pyon this branch: 676 passed, 37 failed, 125 skipped.main(1013b434) in the same environment: 672 passed, 41 failed, 125 skipped. Every one of this branch's 36 distinct failing files also fails onmain, so none of them comes from this PR:test_bug_report_defaults,test_capture_read_once,test_crt_options,test_damage_debug_menu,test_dev_packs,test_discover,test_display_startup_failure,test_dlss_feature_size,test_failed_compile_keeps_objects,test_guest_imported,test_high_fps_fixes,test_host_guest_writes,test_hud_layout_row,test_invalidate_quick,test_libc_hooks,test_lift_lookups,test_link_skip,test_linux_pressure,test_linux_update,test_log_open_failure,test_missing_nup,test_mods_size_table,test_pending_guest_import,test_pipeline_play_cache,test_prepare_cache_save,test_present_thread,test_profiling_mode,test_psychov35_fsr3_fg,test_readback_timeout_source,test_slow_frames,test_song_note_cue,test_switch_table,test_upscaler_rows,test_vcore_escape,test_walk_key,test_walk.Not tested: the game itself. I have not run a build of this branch on a Deck; the behaviour above is proven through the real
read_inputwith a fake pad and mouse state, not by pressing R2.Must be tested:
steamdeckat https://beanstalk.magicbean.dev/how).Risks
What could break: on a Deck, a mouse's gameplay bindings stop counting while the built-in controls give input, so an external mouse's left click no longer attacks. The pointer, the game's menus and the side buttons are untouched. Other pads and other platforms are untouched.
Turning it off: revert the commit. There is no switch.
Compatibility: nothing changes for a player after updating: no
MKWVK_API_VERSIONchange, and the shader stamp does not holdhost/(nx2/translator_files.py), so the caches are kept.Issues
See #1563
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
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.0b72a8911ee185baac8cFull suite on this branch (Linux VM, 12 at once): 676 passed, 37 failed, 125 skipped. Pristine main
1013b434with the same command in the same environment: 672 passed, 41 failed, 125 skipped. Every one of this branch's 36 distinct failing files also fails on main; four that fail on main (test_bug_report, test_crash_groups, test_hardware_report, test_perf_report) passed here. So nothing in the list comes from this PR, and the box is ticked with the list named in the description.e185baac8cf7eeebab5bNew commits pushed, approval review dismissed automatically according to repository settings
Rebased onto current main: the only conflict was additive state in pads_read — main's
status_used/status_pad(the Steam Deck guide hold) and this fix'sdeck_builtinboth stay. Head is nowf7eeebab, andgit merge-treeonto main is clean, so this is mergeable.The rule itself is unchanged: host/steam_pads.h asks whether Valve's built-in controls are giving input, pads_read hands that out through the same lock as the buttons it was read with, and read_input arms the mouse's gameplay buttons with mouse_buttons_arm(captured && !deck_builtin_input, ...). A mouse click already down when the rule starts applying is let go before it can count again. Nothing else about the mouse changes: pointer, menu clicks and the side buttons are armed as before.
Measured on the Deck: with the fix, L = L only; with it absent, one L press reports L 11 times in a quarter second and D-pad up becomes D-pad left, exactly what the last scheduler-only build reproduced when its branch turned out to be current main without this fix.
Assisted-by: Hermes Agent (qwen38)
Merged current
main(fc4a6769) into the branch; head is33a05484. The conflicts were main's input changes: the HUD binding generation and its cache, Sprint's pad state, and the pad product id now used by the vibration code. The built-in-controls rule is unchanged:pads_readstill hands back whether the Deck's built-in controls gave gameplay input in the same poll as the buttons, and the mouse's gameplay bindings are armed only when they did not.Checks:
tests/run_all.py input5 passed;tests/test_steam_pads.py,tests/test_walk_key.pypass.tests/run_all.py --changed origin/mainis 47 passed / 4 failed / 4 skipped, and all four also fail on cleanmainhere:test_host_guest_writes,test_mods_size_table,test_pads_after_menu(gcc's warning), andtest_sprint.Still WIP for the one remaining item: a real Deck game run. Press R2 in desktop mode and check it fires once, not the trigger plus the mouse's Y.
testing wantedand the Deck build are the next step.WIP: fix(host): the Deck's built-in controls do not also fire the mouse's bindingsto fix(host): the Deck's built-in controls do not also fire the mouse's bindings