Skip to content

GameInput: XCL_PRESS_HOLD holds scripted presses longer - #609

Open
pablogonz12 wants to merge 1 commit into
xcl-dev:mainfrom
pablogonz12:gameinput-press-hold
Open

pablogonz12 wants to merge 1 commit into
xcl-dev:mainfrom
pablogonz12:gameinput-press-hold

Conversation

@pablogonz12

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

Regression run

Made with scripts/linux/smoke.sh from #257 under Wine (not smoke.ps1), MSVC builds (cargo xwin), with a local copy of the script in which two lines are changed so that a run which does not reach its end still prints its block (set -eu instead of set -euo pipefail; the data: fallback as an if). main's run did not end within the script's grace time.

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: killed (no exit)
frames shown: 9 (PresentX 14)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 1178e8a37e78cc31c99f2d4e0883c7bebb6e7448
gpu: AMD Radeon RX 9070 XT (RADV GFX1201)
title: Build
seconds: 60
exit: 0x0
frames shown: 8 (PresentX 13)
presents per 2 s (last 3): 0 0 0
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 commands above on the machine described.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants