Skip to content

GameInput: XCL_PRESS_HOLD holds scripted presses longer - #609

Merged
Prime1997 merged 1 commit into
xcl-dev:mainfrom
pablogonz12:gameinput-press-hold
Dec 2, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:mainfrom
pablogonz12:gameinput-press-hold

Conversation

@pablogonz12

@pablogonz12 pablogonz12 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

XCL_PRESS_AT / XCL_PRESS_A_AT hold each scripted button for 200 ms. A title that draws a frame every few seconds reads its pad about as seldom and misses such a press: a retail title under Wine here (about one frame in 4 s while its first screens load) never saw a scripted A; with the press held for 8 s it logs GameInput: gamepad buttons 0x4 pressed for the first time. XCL_PRESS_HOLD=s holds each press for s seconds; without it nothing changes.

What is in it

  • crates/xcl/src/hle/gameinput.rs: XCL_PRESS_HOLD (seconds, > 0; default 0.2), read once; the test of a press moves into held(presses, t, hold); the module and parse_presses docs name the variable.
  • Test a_press_is_held_for_its_hold_time.

Tested

  • AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.3.1), AMD Ryzen 9 9900X, CachyOS (Linux 7.3), Wine 11.0 (Proton CachyOS) with vkd3d-proton v3.1 + the patch from Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257, DXC 1.9.2609, Rust stable, release.
  • Whole workspace (rerun 25 Nov): cargo xwin test --workspace --release --locked --target x86_64-pc-windows-msvc --no-run, then each of the 15 test binaries from its package folder under Wine (GE-Proton11-14, Mesa 26.3.1, DXC 1.9.2609.5, Rust 1.100.0, static CRT) with --test-threads=4; no filters, 0 SKIPPED lines on the head, 0 on the base:
    • this PR (1178e8a): 679 passed, 7 failed, 41 ignored;
    • its base on main (cb868b2): 678 passed, 7 failed, 41 ignored.
    • The same failures on both, all from the Wine / vkd3d-proton / RADV host: disk_free_space_ex_reports_pls_quota, gpu::recomp::tests::gpu_f64_math_random, gpu::recomp::tests::gpu_f64_roots, gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction, hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime, set_predication_buffer_state_and_kickoff, test_title_runs_and_game_folder_is_untouched.
  • Retail title, XCL_PRESS_AT=60:A,90:A,… with XCL_PRESS_HOLD=8: the A press is logged at 61 s; with the default 200 ms no press was logged in a 240 s run with presses every 10 s.

Regression run

Both blocks are the output of each commit's own unmodified scripts/smoke.ps1, written to a file by PowerShell and pasted as is. It ran in Windows PowerShell 7.7.0 (pwsh.exe) under Wine (GE-Proton11-14, Linux), not on native Windows, with MinGit 2.56.1 for git; xcl.exe is an MSVC release build (cargo xwin, static CRT), passed with -Xcl. Host workarounds outside the script: a pseudo-terminal, DOTNET_SYSTEM_GLOBALIZATION_USENLS=1, and importing PowerShell's Utility and Management modules before calling it. main is this PR's base commit; no scripted input in either run, so this is a regression check, not a run of XCL_PRESS_HOLD. These replace the earlier blocks from a bash script. Frame counts at this speed are small and vary between runs. Each commit was run once. Note that this title can end in a device removal on this host even on main (seen in repeat runs of another base commit, see #464).

main:

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: 0x0
frames shown: 9 (PresentX 13)
presents per 2 s (last 3): 2 1 0
device removals: 0
crashes: 0
peak commit: 0 MB

This PR's head:

xcl-smoke v1
commit: 1178e8a37e78cc31c99f2d4e0883c7bebb6e7448
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: 0x0
frames shown: 15 (PresentX 22)
presents per 2 s (last 3): 0 1 1
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

  • Windows; XCL_PRESS_HOLD with the test title's e2e tests (they keep the default).

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, the test and this description, and ran the retail-title press check on the machine described.
  • Claude Code (Claude Sonnet 5.5): on 25 Nov reran the whole-workspace tests and the two smoke runs and updated those two parts of this description.

XCL_PRESS_AT / XCL_PRESS_A_AT hold each button for 200 ms. A title that draws a frame every few seconds (a retail title under Wine here: about one frame in 4 s at the start) reads its pad as seldom and misses such a press. XCL_PRESS_HOLD=s holds each press for s seconds instead; the default stays 200 ms.
@H0UNDZER0

Copy link
Copy Markdown

Tested on an RTX 5080, release build: pass, 686 passed, 0 failed.

  • Commit 1178e8a37e78cc31c99f2d4e0883c7bebb6e7448, this PR's head as is (on its base cb868b2), release build.
  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; Ryzen 7 9700X; Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0). No XCL_* variables set.
  • cargo build --release --workspace --locked: OK, the same single fetch_update warning as main.
  • cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with --show-output): 686 passed, 0 failed, 41 ignored both times. The base cb868b2 gives 685 / 0 / 41 here: the difference is the new a_press_is_held_for_its_hold_time, which passes.
  • SKIPPED: the usual 2, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64).
  • The test title (e2e) ends with failures: 0.

Not tested

  • Scripted presses with XCL_PRESS_HOLD set: no suite test sets XCL_PRESS_AT or XCL_PRESS_A_AT; the new unit test checks held on its own.
  • This PR merged onto a newer main. When this was written that was dd2ae9a; git merge-tree showed no conflict.
  • Debug build, retail titles, scripts/smoke.ps1.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

@mikebuckets171

Copy link
Copy Markdown

Mac/Wine verification of this head as filed (a second host for the counts, not a review of the design).

Tested

  • Host: macOS 27.2 (Apple silicon, M5 Pro), CrossOver 26 bottle, D3DMetal; cross target
    x86_64-pc-windows-gnullvm, LLVM-MinGW 20261117 as the linker.
    cb868b2 (detached at the PR head, not the merged state): cargo build --workspace --locked and
    cargo test --no-run --release --locked green — 15 test executables, no new warnings from these files.
  • The tests, run under Wine in the lib unit binary, filter press: 4 passed, 0 failed, 0 ignored,
    including this PR's own new hle::gameinput::tests::a_press_is_held_for_its_hold_time (the rest of the
    filter's matches are unrelated tests that happen to contain "press"). Nothing else in gameinput
    changed verdict.

What this host can and cannot say about the motivation

With #541 applied, this bench's port run presents ~24 fps and reads the pad continuously, and its own
scripted button run (the port's XCL_REMOTE_INPUT knob: 176 presses in ~15 s held phases) reached the
gamepad state every time. But I never ran XCL_PRESS_AT with the default 200 ms against a title state that
draws one frame every few seconds, so I can neither confirm nor refute the failure mode this PR describes —
the Wine observation in your description (one frame in 4 s, a scripted A never seen, held 8 s and logged) is
the evidence for it, from a title state this bench does not reach.

Related: I have just filed #893 (XCL_STICK_AT / XCL_LOOK_AT, a scripted thumbstick held from a
second until the next entry) for what XCL_PRESS_AT cannot reach: movement and the camera. Its semantics
sidestep the hold-length problem — an entry holds until the next one, so a slow-polling title cannot miss it —
and it applies after kbm in poll(), so if both land the order stays kbm → scripted buttons → scripted
sticks and the three compose without touching each other. I will rebase onto whichever lands first.

Not tested

  • Native Windows run, and the whole suite on a GPU (CONTRIBUTING item 2).
  • A title that actually draws a frame every few seconds: this host has none, so the hold length itself is
    unverified here.

AI use

  • GPT-6 Luna, for this verification run and comment. The commands above were run on the hardware named.

@Alpha325

Copy link
Copy Markdown

I tested 1178e8a37e78cc31c99f2d4e0883c7bebb6e7448 on Windows 11 build 26200 with a debug MSVC build. The synthetic fixture calls gameinput::poll() in a fresh process for each setting, so each case reads XCL_PRESS_HOLD independently.

  • With XCL_PRESS_HOLD=" 8 ", both scripted buttons were active (0xc) after the default 200 ms window would have expired. On the parent commit cb868b2, the same test failed with 0x0.
  • With the setting unset, zero, negative, malformed, or NaN, both presses had expired as expected (0x0).
  • cargo test --offline --locked -p xcl --lib hle::gameinput::tests -- --test-threads=1 returned 10 passed, 0 failed.

The fixture uses synthetic input only. AI use — OpenAI Codex (GPT-6) wrote and ran the test and drafted this report.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (1178e8a)

Hardware / environment

  • PR GameInput: XCL_PRESS_HOLD holds scripted presses longer #609 head 1178e8a37e78cc31c99f2d4e0883c7bebb6e7448, checked out detached with a clean worktree.
  • Windows x64 build 10.0.26200.9974 on an AMD Ryzen 7 3800X 8-Core Processor.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), target x86_64-pc-windows-msvc. DXC reported version 1.9.2609.5 (01b62ad47).
  • The focused run used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1. Both Cargo commands ran outside Invoke-ArcTest.ps1 with incremental compilation and dev/test debug info disabled.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test binaries. It executed zero tests.
  • cargo test -p xcl --lib hle::gameinput::tests:: exited 0. The log contained 10 passed, 0 failed, 0 ignored, 657 filtered out, and 0 case-sensitive lines beginning with SKIPPED .
  • Both commands emitted a deprecation warning for AtomicU32::fetch_update in XGameRuntime.

Observed behavior

The diff adds one unit test, a_press_is_held_for_its_hold_time. The test passed and checked that a press is absent before its scheduled time and that A has expired half a second into a 200 ms hold. With an 8 s hold, A is still active at that point, A and B are both active while their holds overlap, and each button is released at its own end boundary. The other nine GameInput unit tests also passed.

Not tested

The full GPU workspace suite and game smoke runs were omitted. Runtime parsing of XCL_PRESS_HOLD was outside the focused test's coverage. The PR adds no integration test.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr609-focused.log and published.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 29, 2026
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check claim
head: 1178e8a

@github-actions github-actions Bot added area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@BBareth

BBareth commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 9dfbe3e
head: 1178e8a
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test hle::gameinput::tests::a_press_is_held_for_its_hold_time passed, as did the existing gameinput tests.
review: no blocking finding; one file, every hunk read. Scripted presses (XCL_PRESS_AT, XCL_PRESS_A_AT) were held for a fixed 200 ms; XCL_PRESS_HOLD=<seconds> now sets that time, read once, and a missing, unparsable, zero or negative value keeps 200 ms. The window test moved into a small pure function held, which the test covers (default, longer hold, overlapping presses). Without the variable nothing changes. A note from our own runs, not a finding: a title that polls its pad seldom does miss a 200 ms press, so the switch is useful. Not tested by me: a title run with the variable set.
performance: none: one cached float per poll.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Nov 30, 2026
@tiagonleal

tiagonleal commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 9dfbe3e
head: 1178e8a
merge: clean
build: cargo build --workspace -> ok (also cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; #3513 fixes it). hle::gameinput::tests::a_press_is_held_for_its_hold_time ran and passed. With held put back to a fixed 0.2 s window, it fails at gameinput.rs:1366 (left 0, right 4: the 8 s hold is not honoured); file restored after.
review: one file, whole diff read. Without the variable the window is t >= s && t < s + 0.2, the same expression as on main, now inside held (gameinput.rs:273), so default timing is unchanged by construction. Parsing (gameinput.rs:268), checked by running the same expression on sample values: unset, empty, "0", "-1", "abc" and "NaN" all give the 0.2 s default; " 2 " gives 2 (trimmed); "3.5" gives 3.5. Note: "inf" and an overflowing value such as "1e400" parse to infinity and pass the > 0.0 filter, so each scripted press is then held from its time until the end of the run and later presses merge into it; clamping to a finite maximum or refusing non-finite values (h.is_finite()) would avoid that. The value is read once (OnceLock) and not logged, so a run's log does not say which hold was used, and GameInput logs only the first press of each button set (gameinput.rs:330).
performance: scripts/smoke.ps1, 60 s of a retail title, release. Variable unset and no presses: 1587 frames, 18120 MB peak commit against 1659 frames, 17322 MB on the base (after one warm-up). With XCL_PRESS_A_AT=20,24,28,32,36,40,44,48,52,56 (the first presses of our own scripted runs): base 1451 frames, 28848 MB; merge with XCL_PRESS_HOLD unset 1445 frames, 29442 MB; merge with XCL_PRESS_HOLD=3.5 1527 frames, 28303 MB. No device removal, no crash in any run. How far each got, from the logs: in all three press runs the first A is logged at 20.0 s and the title then leaves the screen it waits on, which the log shows as the Opus decoder being made and the same XGameRuntime error report right after: base 20.25 s / 20.72 s, merge unset 20.23 s / 20.67 s, merge with 3.5 s hold 23.56 s / 23.99 s. So with the variable unset the merge reaches the same milestones at the same second as the base, and with the hold the title acts about 3.3 s later, as it would if it reacts when the button is let go; all three end with the same 84239 pipelines made (60753 in the runs without presses). The 3.5 s run also logs a button set 0x2 pressed at 6.97 s, which no script sent (scripted presses are A, 0x4); I take it to be input from this PC's controller or keyboard and did not trace it.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite, tests and smokes, reviewed the diff against the merged source and wrote this)

  • Tiago

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Nov 30, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head 1178e8a

Overlap: #1765 addresses the same problem (a title that reads its pad seldom misses a 200 ms scripted press) differently, by keeping each press down until two of the title's readings have seen it; this PR adds a fixed, configurable hold (XCL_PRESS_HOLD). Neither makes the other's change; main still has the fixed 200 ms window in scripted().
No problems found in the diff. Note that with a long hold, two presses of the same button closer than the hold merge into one (the test asserts this), so XCL_PRESS_HOLD cannot be used to press a button twice quickly.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Prime1997
Prime1997 merged commit dbdcdf7 into xcl-dev:main Dec 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH ready-to-merge Has 2 independent safe merge-checks on current head (#3041) stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants