Repository navigation
GameInput: scripted presses stay down until the title has read them - #1765
wondercrash wants to merge 2 commits into
Conversation
A scripted press (XCL_PRESS_AT / XCL_PRESS_A_AT) was a fixed 200 ms window of host uptime. When the title's reading thread stalls, the window falls between two reads and the press is never seen: in a retail title's run at 4-22 fps (first GetCurrentReading at 16.2 s), the presses at 24, 26, 32 and 120 s were lost. Presses are now a latch (PressLatch, pure over time and read): down at their time, held until 200 ms have passed AND two readings saw them, then up for 100 ms and two readings before the next press of the same button, so presses cannot merge. The 250 Hz poller peeks without counting; a state it pushes to reading callbacks counts as enough readings, as a callback is not skipped. Each press logs once when first seen by a reading. With the latch, a run of the same title with presses at 11, 13, 24, 26, 32 and 120 s logged all six as seen, the last two 10.7 s and 12.4 s after they were due. Tests drive the latch with 500 ms, stalled and 1 ms read sequences; the 500 ms and stalled ones fail with the old 200 ms window. Assisted-by: omp (Claude Sonnet 5.5) Assisted-by: omp (Claude Opus 5.5)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Tested On In a local variant, I made the callback dispatch report whether it invoked a callback and counted the poller sample only when it did. The 1.15 s read then returned Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC debug. Not tested This is synthetic GameInput API coverage. Retail input and concurrent callback/read delivery were outside the test. AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote and ran the fixture and local variant and drafted this report. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
PR #1765 GameInput verificationTested clean detached head Environment Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB with driver 32.0.101.9175. Wave range 8–32, Tested
Failures and skips
Not tested Retail-title input, scripted press delivery through title callbacks, a paired smoke run against main, or other GPU vendors and drivers. The test title skipped audio voices because no audio device was available. The workspace failures have no main baseline from this run. AI use T3 Code / Codex ( |
The poller counted every state it pushed to reading callbacks as enough readings of a scripted press, even when no callback was called: none registered (the poller runs on after the title unregisters its last one), or each one being unregistered. The latch then let the press go before the title's next GetCurrentReading, which never saw it. dispatch_reading_callbacks now says whether it called a callback, and the poller counts the press (and logs first presses) only then. The new test registers a callback, unregisters it, pushes a due press and reads it: down with the fix, up before it. Assisted-by: omp (Claude Opus 5.5)
|
@thehollowedone thanks, that is a real bug, and your reading of it is right. At Pushed Tested
Regression run: the smoke pair for Not tested
AI use: omp with Claude Opus 5.5 wrote the fix and the test, ran them, and wrote this reply. |
A scripted press (
XCL_PRESS_AT/XCL_PRESS_A_AT) is a fixed 200 ms window of host uptime. A title whose reading thread stalls reads its pad less often than that, and the press falls between two reads: in a retail title's run at 4-22 fps (firstGetCurrentReadingat 16.2 s), the presses at 24, 26, 32 and 120 s were never seen. Now a press stays down until the title has read it: at least 200 ms and two readings, then up for 100 ms and two readings before the next press of the same button, so two presses never merge.Related: #609 (
XCL_PRESS_HOLD=s, a longer fixed hold) fixes the same symptom with a hold the user has to pick. In the run below the reads came up to 12.4 s after a press was due, and the same script has presses 2 s apart (11 and 13 s): a hold long enough for the late ones (≥ 12.4 s) holds the early ones together as one press (#609's test: "presses that overlap are held together"). With the latch neither has to be chosen. If #609 lands first, I will rebase and keepXCL_PRESS_HOLDas the minimum hold. #565 (reading history) and #893 (scripted sticks) touch the same file but not scripted presses; #565 changes the poller thread, so one of the two will need a rebase.What is in it
crates/xcl/src/hle/gameinput.rs, two commits:PressLatch(pure over time and reading):advance(t)moves each press Pending → Down → Up → Done;read(t)is a reading the title is handed and counts it.poll()(whatGetCurrentReadingand the readings hand the title) counts a reading; the 250 Hz poller only peeks (poll_peek), and a state it pushes to the reading callbacks counts as two readings (scripted_delivered), since a callback is not skipped by a slow reader.GameInput: scripted press 5 (A at 32 s) seen at 42.73 s.BUTTON_NAMES) for the parser and the log line.slow_readings_still_see_every_press_and_presses_do_not_merge(reads 500 ms apart),a_press_between_two_distant_readings_is_seen_by_the_next_ones(a 15 s stall),fast_readings_hold_a_press_for_200_ms_and_a_second_press_follows_after_a_gap(1 ms reads). Withread()put back tomain's 200 ms window, the first two fail on the buttons down.e79d734, reported by @thehollowedone): the poller counts a pushed state as delivered only when a reading callback was actually called (dispatch_reading_callbacksreturns whether it called one; the step ispush_to_reading_callbacks). Before, a press pushed after the title unregistered its last callback (or while each one was being unregistered) counted as two readings and was let go unseen. Test:a_press_due_after_the_last_reading_callback_is_unregistered_is_down_in_the_next_reading; with the old step it fails (left: 0, right: 4).Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4:e79d734onmain85e3826): 879 passed, 0 failed, 42 ignored;main85e3826: 875 passed, 0 failed, 42 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_PRESS_AT=11:A,13:A,24:A,26:A,32:A,120:A, on our integration branch (main+ other PRs) with this commit: all six presses logged as seen, at 11.03, 13.03, 24.03, 26.03, 42.73 and 132.37 s (the title did not read its pad between 32 and 42.7 s, nor between 120 and 132.4 s). The run before it, same branch and script without this commit: the title first asked for a reading at 16.2 s, and no A was seen at any scripted time (the log's first A is at 73.7 s).Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input (both runs stay on the start screen),mainfirst, same machine:Not tested
main+ this PR alone, but on our integration branch. The regression pair sends no input, so it does not reach the latch.8cd2f03(first commit); the second commit was checked by the suite and the regression pair only.AI use
main's window, wrote the second commit and its test, ran the suite and wrote this description. The title runs are ours, on the hardware above.