GameInput: a scripted stick drives a title's movement and camera #887
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/893"
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?
Imported from ivall/xcl. Originally posted by mikebuckets171 on 2026-11-24T07:52:00Z.
What
XCL_PRESS_AT/XCL_PRESS_A_ATwalk a title's menus with scripted button presses, andkbmmapskeyboard and mouse onto the gamepad — but the keyboard path needs the XCL window to have the focus
(
keyboard()checksGetForegroundWindow, and a background run drops keys that arrive while the windowis not ours), and the right stick is the mouse, which deflects only while it keeps moving. So a run with
nobody at the controls — a Wine host, a CI-launched title, a scripted repro — can press buttons but
cannot hold a thumbstick, which is what a title uses for movement and the camera. There is no way to
script a stick today:
GamepadStatecarriesleft_x/left_y/right_x/right_yand only a real XInputcontroller or
kbmever writes them.XCL_STICK_AT=s:x/y,…(left stick) andXCL_LOOK_AT=s:x/y,…(right) hold a deflection from that seconduntil the next entry:
XCL_STICK_AT=20:0.0/0.9,60:0.0/0.0walks forward for 40 s and then stops.Coordinates are split with
/so one entry stays one comma-separated item, as inXCL_PRESS_AT; valuesclamp to the stick's −1.0…1.0; an entry that does not parse is named and the rest of the track still
applies; a
nanorinfcoordinate — which parses as a float — is refused like a garbled item instead ofreaching the title; each entry logs once
(
GameInput: scripted left stick 0.00,0.90 held from 20.0 s) so a long runcan be read back against what the title did. Applied after
kbm's mapping inpoll(), so while a scripteddeflection holds it is not fought by a key that happens to be down — the way a scripted button press already
works. (#606 is complementary and different: inside
kbmit gives Page Up / Page Down the right stick andresolves that against the mouse deflection by magnitude, which still needs the window to have the focus.)
Independent of #609 (which lengthens scripted button presses) and #606 (which gives the right stick to
Page Up/Page Down through
kbm, so still needs the window focused): none of the three covers what theothers do, and if either lands first I will rebase onto it. I cross-built both heads and ran their tests
under Wine in this bench as they stand today — counts in my comments there.
What is in it
crates/xcl/src/hle/gameinput.rs(+111 / −0): the two variables documented in the module header,parse_stick_track,stick_at(hold-until-next),log_stick_entry(once per entry),scripted_stickscalled from
poll()aftermerge_host_inputs, and three CPU-only unit tests.Tested
x86_64-pc-windows-gnullvmwith LLVM-MinGW 20261117 as the linker;cargo build --workspace --lockedand
cargo test --no-run --release --lockedgreen formainat1ec4c98and for this head (16 testexecutables; one
fetch_updatedeprecation warning thatmainalready prints).09aa37erebased onto1ec4c98(07e2a6c), then refined once — refusing anan/infcoordinate instead of letting
clamppass it through — as81cdf8f, still one commit, still +111 / −0.The
xcl-smokeblock and both Wine test filters below were run on81cdf8f; the 150 s title pair below wasrun on the same patch before that refinement, which changes only what an unparsable entry does.
stick→ 4 passed, 0 failed, 0ignored; filter
gameinput→ 12 passed, 0 failed, includingkeyboard_mouse_config_gates_keyboard_and_kbm_but_keeps_scriptedand the existing reading-callbacktests, so nothing that already read the gamepad changed behaviour.
#258 (
mac-on-main-wipatdb065d8) with #541 applied and this same patch, 150 s cold, two fresh dataroots,
XCL_FRAME_DUMPon every 30th presented frame, each dump compared with the one before it (~1 sapart, ~20k sampled pixels):
0.00,0.90from 60 s → released 95 s →0.00,-0.90from 105 s → released 125 s; right0.70,0.00from 130 s → released 145 sThe deflection reaches the gamepad state the title polls and the run stays clean, but the presented
picture is the same as the control's: the single change in each column is the title's own loading
sequence, which also happens with no input at all. Movement and camera are not demonstrated by this
patch on this host. What is demonstrated is that the sticks can be driven from a script without a
window having the focus — the prerequisite for a run that is meant to show them.
Regression run
xcl-smokeblocks from this Mac host, 60 s each, same title and bottle, a fresh data root per side.Read them honestly: plain
maindoes not run this title on a Wine host at all (it stops ~2 s in with 0presents, 0 draws and no PSO work — #258), so both sides show 0 frames. What the pair does establish is
that this change removes nothing and crashes nothing on the path a Wine host takes; the port numbers above
are the run that does present frames.
Not tested
compared against a scripted stick. The whole-suite counts CONTRIBUTING item 2 asks for are therefore
missing: @Kalmarv offered Windows
xcl-smokepairs for the Mac bench's fixes in #258 (04:34) — this headplus
cargo test --workspace -- --test-threads=4would close this PR's open item.kbmand the scripted sticks in the same run (a keyboard held down while a scripted deflection holds):the override order is unit-tested, not run against a title.
cannot be shown to move anything here (see the pair above).
AI use
line by line and every number above comes from a run on the hardware named.
Imported from ivall/xcl. Originally posted by mikebuckets171 on 2026-11-24T08:02:57Z.
One refinement since filing, on the parser:
nanandinfparse asf32, so an entry like15:nan/0.5used to surviveclampand put a NaN deflection into the state the title reads. They are now refused the way a garbled entry is, with the entry named in the log, and the clamp test carries that case. Wine re-run on the new head81cdf8f: filterstick→ 4 passed / 0 failed (a_stick_track_is_ordered_and_clamped_to_the_sticklogsGameInput: XCL_LOOK_AT entry "15:nan/0.5" not understood (seconds:x/y)and passes), filtergameinput→ 12 passed / 0 failed; the 60 sxcl-smokeblock in the description is from81cdf8f.mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T09:34:16Z.
Linux / AMD RDNA3 datapoint.
Merged state: head
81cdf8fonto main09940bb, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 708 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). GameInput scripted-stick tests green; mirror-upload flake hit.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
upstream-sync referenced this pull request2026-11-25 07:04:28 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:41:57Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:17:26Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:25:48Z.
Triage (#1607) – head
81cdf8fNo open or merged PR scripts the thumbsticks; main has only button scripting (
XCL_PRESS_AT/XCL_PRESS_A_AT).One nit in
gameinput.rs: the module doc andparse_stick_tracksay20:0.9/0.0"walks forward", but that deflects the left stick along x (to the right). The PR description's20:0.0/0.9is the forward one.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.