GameInput: XCL_INPUT_LOCK=1 gives the title the scripted presses only #3739
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3739"
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 vasanex on 2026-12-02T23:04:19Z.
A scripted run (
XCL_PRESS_AT/XCL_PRESS_A_AT) also gets whatever is pressed at the PC: the title's window takes the focus when it opens, and XCL reads the keyboard while it has it. In two unattended world runs for thetitle run:line of #3041, keys pressed at the PC during the run (Tab, and Shift or Ctrl) arrived in the title as View and a stick click.XCL_INPUT_LOCK=1makes the title see the scripted presses only. Without the variable nothing changes.What is in it
crates/xcl/src/hle/gameinput.rs:input_locked();pollreads no controller, keyboard or mouse under the lock (host_pad), the scripted presses still arrive.log_input_lock()logs the lock at startup with the number of scripted presses, and warns when there are none (the title then gets no input at all).press_script()is the press listscripted()already parsed, moved out so the startup line can count it.crates/xcl/src/hle/kbm.rs: under the lock the window does not take the mouse and the keyboard (attach): no raw mouse input, no held cursor, and no "keyboard and mouse play as the gamepad" line next to the lock's.crates/xcl/src/hle/mod.rs: callslog_input_lock()where the registry is built, next to the offline switch.crates/xcl/src/hle/d3d12x/present.rs: the window's title says| User input lockedafter the frame rate and before the compile counts (title_text).README.md: one bullet under Controls.a_locked_input_reads_no_controller_and_keeps_the_scripted_presses(gameinput),a_locked_input_leaves_the_mouse_and_the_keyboard_to_the_pc(kbm), and the title cases inthe_title_counts_dxc_compiles_and_driver_builds.Tested
cargo test --workspace -- --test-threads=4on the head: 3007 passed, 0 failed, 52 ignored; 25SKIPPEDlines (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same tests as onmain.XCL_NETWORK=0on both sides.XCL_INPUT_LOCK=1, on the release build of the head before thekbm.rspart (67ea7859), not repeated on this one:XCL – <name> | N FPS | User input lockedandXCL – <name> | N FPS | User input locked | compiling shaders: DXC …(1698 frames, no device removal, no crash).XCL_PRESS_A_AT=20,24: the lock line with "(2 scripted)", no warning, and A arrives in the title ("gamepad buttons 0x4 pressed for the first time" at 20.0 s; 1411 frames, no device removal, no crash).Regression run
main
5ad98adb:this PR's head:
Not tested
kbm.rspart in a title run: that the cursor stays free and the gamepad line is gone under the lock is read from the code and covered by the unit test of the condition only.gameinput.rsand will need a rebase after whichever merges first; #2984 documentsXCL_PRESS_ATin the README at another place.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T23:15:50Z.
Review of
67ea7859(code reading only, not a merge-check) · 1 mediumIn short: The PR adds
XCL_INPUT_LOCK=1, which stopspollfrom reading the PC's controller, keyboard and mouse, so a scripted run gets only theXCL_PRESS_AT/XCL_PRESS_A_ATpresses. It also logs the lock at startup and marks it in the window title. The input gate is right and opt-in, and nothing blocks the PR. One medium point: under the lock, the keyboard/mouse window hook is still attached.Medium
The lock still attaches keyboard and mouse to the window.
pollskipskbm::apply, butkbm::attachstill runs when the window opens and after preparation (present.rs~887,present/preparation.rs~145). It has no lock check (kbm.rs~496).kbm::on_messagethen hides the cursor and clips it to the window centre each time the window is activated or clicked.Fix: return early from
kbm::attachwhengameinput::input_locked()is set.Checked and fine
input_locked()is false,host_pad(false, …)gives the samexinput_pad().or_else(playstation::pad).unwrap_or_default()as before, and!locked && kbm::enabled()reduces to the old gate.kbm::applyreads are all skipped.scripted()is still merged intos.buttons, and the first-press log still sees scripted buttons.press_script()is the sameOnceLockparse, moved out unchanged.log_input_lock()logs nothing unless the lock is on, andbuildruns it once.title_textgives exactly the old string.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T23:45:17Z.
@Foniass thanks, right:
kbm::attachhad no lock check, and keyboard and mouse are on by default, so under the lock the window still registered raw mouse input, logged the gamepad line next to "not read", and held the cursor on activation.Fixed in
1cea7ef3:attachreturns under the lock, so the window is never recorded forkbmandon_messageleaves the cursor alone. New testa_locked_input_leaves_the_mouse_and_the_keyboard_to_the_pccovers the condition.Suite on
1cea7ef3: 3007 passed, 0 failed, 52 ignored, 25 SKIPPED (the same as on main); smoke in the description.Not tested: the cursor in a title run under the lock (the two lock runs in the description are from the head before this part), and AMD.
Claude Code with Claude Fable 5.2 made the change, ran the tests and wrote this comment.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T23:45:59Z.
Follow-up review of
1cea7ef3, since67ea7859(code reading only, not a merge-check) · no new findingsIn short: This push fixes the point from my last review.
kbm::attachnow returns early underXCL_INPUT_LOCK=1, so the window registers no raw mouse input, logs no "keyboard and mouse play" line, and never holds the cursor. A test covers the decision. Nothing blocks it.Checked and fine
attachchecksattaches(enabled(), gameinput::input_locked())before it storesWINDOW.on_messagereturns at once whenWINDOWis not this window (kbm.rs~569), so the cursor-hold path on activate and click never runs.a_locked_input_leaves_the_mouse_and_the_keyboard_to_the_pccovers all four combinations of enabled and locked.attaches(enabled, false)isenabled, as before. The commit message says so.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.