gameinput: report a missed press once to a slow reader (RT-GAMEINPUT-SLOW-READER) #1510

Merged
QemmHD merged 2 commits from upstream-pr/1510 into main 2026-11-28 20:18:21 +00:00
QemmHD commented 2026-11-25 02:50:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T02:50:31Z.


Claimed in the coordination issue as: RT-GAMEINPUT-SLOW-READER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151130854)

Carries DadaCap's kSlowReaderUs from their boot-prototype branch (commit fa497b930), with DadaCap's authorship and date kept, as agreed in #14 (comment 7151032887).

What and why

The title reads each pad with GetCurrentReading once a frame. At a few frames a second, a press can start and end between two reads, so it's lost. That's why the first-run pages need several presses to advance at low frame rates (#233 fills the history, which the title doesn't read). Each pad now remembers the newest reading that pressed a button the last read didn't report. A read that comes more than kSlowReaderUs (50 ms) after the previous one is given that press once, and the next read gets the pad's real state. close_pad clears it.

Scope: only the GameInput part of fa497b930 (runtime/shims/gameinput.cpp +32, runtime/test/gameinput_test.cpp +16), unchanged apart from line positions. The prototype's other changes in that commit aren't included. It doesn't conflict with #1074's LEONIDA_INPUT_SCRIPT: scripted presses go through the same path, so a short scripted press now also reaches a slow reader.

Tested

Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja, RelWithDebInfo, on main 2213d5cb8:

  • gameinput, gameinput_host and gameinput_script pass, both plain and with LEONIDA_VK_VALIDATION=1. gameinput_test runs 365 checks with 0 failures, including "a slow reader sees a missed press once".
  • Negative control: with the shim reverted and the test kept, that check fails (1 of 365).
  • Repository-consistency set: green apart from test_runtime_paths, which is red on main since #939 (tools/conformance/** missing in runtime.yml; reported on #939). That's unrelated to this PR.
  • Note: the threshold is time-based, and the test relies on an 80 ms sleep, which held in every run here.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • A new translator rule is in the contract table of docs/design.md. (n/a)

AI-assisted (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5484228538 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1510). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T02:50:31Z. --- Claimed in the coordination issue as: RT-GAMEINPUT-SLOW-READER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151130854) Carries DadaCap's `kSlowReaderUs` from their `boot-prototype` branch (commit fa497b930), with DadaCap's authorship and date kept, as agreed in #14 (comment 7151032887). ### What and why The title reads each pad with `GetCurrentReading` once a frame. At a few frames a second, a press can start and end between two reads, so it's lost. That's why the first-run pages need several presses to advance at low frame rates (#233 fills the history, which the title doesn't read). Each pad now remembers the newest reading that pressed a button the last read didn't report. A read that comes more than `kSlowReaderUs` (50 ms) after the previous one is given that press once, and the next read gets the pad's real state. `close_pad` clears it. **Scope:** only the GameInput part of fa497b930 (`runtime/shims/gameinput.cpp` +32, `runtime/test/gameinput_test.cpp` +16), unchanged apart from line positions. The prototype's other changes in that commit aren't included. It doesn't conflict with #1074's `LEONIDA_INPUT_SCRIPT`: scripted presses go through the same path, so a short scripted press now also reaches a slow reader. ### Tested Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja, RelWithDebInfo, on main 2213d5cb8: - `gameinput`, `gameinput_host` and `gameinput_script` pass, both plain and with `LEONIDA_VK_VALIDATION=1`. `gameinput_test` runs 365 checks with 0 failures, including "a slow reader sees a missed press once". - **Negative control:** with the shim reverted and the test kept, that check fails (1 of 365). - **Repository-consistency set:** green apart from `test_runtime_paths`, which is red on main since #939 (`tools/conformance/**` missing in `runtime.yml`; reported on #939). That's unrelated to this PR. - **Note:** the threshold is time-based, and the test relies on an 80 ms sleep, which held in every run here. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] A new translator rule is in the contract table of `docs/design.md`. (n/a) AI-assisted (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
ytsodacan commented 2026-11-25 03:34:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:34:10Z.


[KEEP]

  • Overlaps open #233 ("gameinput: preserve controller transitions between polls"), which touches the same runtime/shims/gameinput.cpp and runtime/test/gameinput_test.cpp and addresses the same missed-press problem; #1528 also edits gameinput. A maintainer should decide which approach lands and the others should rebase on it.
  • Design concern: GetCurrentReading now has side effects (a stored missed reading, read_buttons/read_us state, and a 50 ms kSlowReaderUs timing heuristic), so returning a stale press once changes what callers see; this deserves maintainer sign-off.
  • Only one test was added (about 15 lines, a slow reader sees a missed press once), with a wall-clock Sleep(80) that could be flaky on slow runners; it does not cover close_pad reset or multiple devices.
  • CI is entirely pending (windows, macos, linux-gpu-tools, no-game-data, change-scope), so the build and test are unverified.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152036121 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152036121). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:34:10Z. --- **[KEEP]** - Overlaps open #233 ("gameinput: preserve controller transitions between polls"), which touches the same `runtime/shims/gameinput.cpp` and `runtime/test/gameinput_test.cpp` and addresses the same missed-press problem; #1528 also edits `gameinput`. A maintainer should decide which approach lands and the others should rebase on it. - Design concern: `GetCurrentReading` now has side effects (a stored `missed` reading, `read_buttons`/`read_us` state, and a 50 ms `kSlowReaderUs` timing heuristic), so returning a stale press once changes what callers see; this deserves maintainer sign-off. - Only one test was added (about 15 lines, `a slow reader sees a missed press once`), with a wall-clock `Sleep(80)` that could be flaky on slow runners; it does not cover `close_pad` reset or multiple devices. - CI is entirely pending (`windows`, `macos`, `linux-gpu-tools`, `no-game-data`, `change-scope`), so the build and test are unverified.
QemmHD commented 2026-11-25 03:37:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T03:37:54Z.


Thanks @ytsodacan, fair points:

  • #233 is a different approach to the same symptom. It keeps the transitions in the reading history. DadaCap's finding (#14, comment 7136979744) is that the title reads only GetCurrentReading once a frame and never the history, so the history alone doesn't bring the press back. That's why this changes what the current reading returns. #233 is still a draft. If a maintainer prefers one approach, I'm happy to rebase this onto it or drop it.
  • The side effect is intended: a reader slower than 50 ms is shown the press it missed, once. I agree it deserves a maintainer's sign-off.
  • Tests: you're right that close_pad and multiple devices aren't covered, and that the Sleep(80) against the 50 ms threshold is timing-based. I'll add a close_pad reset case and a two-device case, and widen the margin.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152096407 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152096407). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T03:37:54Z. --- Thanks @ytsodacan, fair points: - **#233 is a different approach to the same symptom.** It keeps the transitions in the reading history. DadaCap's finding (#14, comment 7136979744) is that the title reads only `GetCurrentReading` once a frame and never the history, so the history alone doesn't bring the press back. That's why this changes what the current reading returns. #233 is still a draft. If a maintainer prefers one approach, I'm happy to rebase this onto it or drop it. - **The side effect is intended:** a reader slower than 50 ms is shown the press it missed, once. I agree it deserves a maintainer's sign-off. - **Tests:** you're right that `close_pad` and multiple devices aren't covered, and that the `Sleep(80)` against the 50 ms threshold is timing-based. I'll add a `close_pad` reset case and a two-device case, and widen the margin. AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD commented 2026-11-25 03:40:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T03:40:22Z.


Added the coverage asked for, in 045bb0fce (DadaCap's commit is untouched):

  • the slow-reader check now waits 150 ms, 3× the 50 ms threshold;
  • two pads: a press on each pad is reported only on that pad's next read, and once;
  • close_pad: a pending press doesn't survive an unplug and replug.

gameinput_test now runs 369 checks with 0 failures, and ctest ^gameinput passes 3/3 both plain and with validation. Against main's shim, the slow-reader and per-pad checks fail. With the fix but without the reset in close_pad, the close_pad check fails, so it does catch a missing reset.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152135834 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152135834). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T03:40:22Z. --- Added the coverage asked for, in 045bb0fce (DadaCap's commit is untouched): - the slow-reader check now waits 150 ms, 3× the 50 ms threshold; - **two pads:** a press on each pad is reported only on that pad's next read, and once; - **close_pad:** a pending press doesn't survive an unplug and replug. `gameinput_test` now runs 369 checks with 0 failures, and ctest `^gameinput` passes 3/3 both plain and with validation. Against main's shim, the slow-reader and per-pad checks fail. With the fix but without the reset in `close_pad`, the close_pad check fails, so it does catch a missing reset. AI-assisted (Claude Code, Claude Opus 5.5).
djrolfes commented 2026-11-25 11:11:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-25T11:11:21Z.


Independent RTX 3070 Ti / Linux Wine 11.22 integration validation starting for exact head 045bb0fce. Main 42537e7b6 + owned #1558 / FSPX translator fixes now reaches the rendered first-run setup. With two ordinary scripted A presses, each logged by GameInput (60 s and 100 s), the first moves from the player prompt to Navigation Experience, but the second does not visibly advance it by the 160-second bound. Presented captures after the first press are ~36 seconds apart, so this is consistent with your slow-reader diagnosis, not yet proof of the exact consumption path.

I have preserved that build and am adding only your two commits before synthetic GameInput checks and the identical bounded two-press retest. Runtime assertions/watchdog stay enabled; no legal agreement acceptance is scripted. No duplication of implementation ownership; raw images/logs stay local. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160712337 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7160712337). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-25T11:11:21Z. --- Independent RTX 3070 Ti / Linux Wine 11.22 integration validation starting for exact head 045bb0fce. Main 42537e7b6 + owned #1558 / FSPX translator fixes now reaches the rendered first-run setup. With two ordinary scripted A presses, each logged by GameInput (60 s and 100 s), the first moves from the player prompt to Navigation Experience, but the second does not visibly advance it by the 160-second bound. Presented captures after the first press are ~36 seconds apart, so this is consistent with your slow-reader diagnosis, not yet proof of the exact consumption path. I have preserved that build and am adding only your two commits before synthetic GameInput checks and the identical bounded two-press retest. Runtime assertions/watchdog stay enabled; no legal agreement acceptance is scripted. No duplication of implementation ownership; raw images/logs stay local. AI-assisted.
djrolfes commented 2026-11-25 11:16:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-25T11:16:56Z.


Retest update: exact head 045bb0fce applied locally as a14a691b7 builds; gameinput passes 369 checks and gameinput_script passes 10. gameinput_host fails the same three checks on both this candidate and unmodified 42537e7b6 under the same Wine prefix (host GameInputCreate returns E_NOTIMPL), so that host-comparison limitation is not counted as a shim pass.

The identical 160-second retail probe with A@60/A@100 still ends visually on Navigation Experience. Both scripted presses are logged; 25,450 native graphics PSOs succeed, no fatal title exception, and late captures are ~45 seconds apart per 300 frames. This does NOT establish that the fix is ineffective generally, nor that this title read used the covered explicit-pad path. I am adding opt-in local GetCurrentReading return-path/button-state logging, with no behavior change, to distinguish actual delivery from a mere poll-thread press log. The diagnostic will not be submitted as a competing implementation. No legal acceptance or world claim; raw evidence remains local. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160838663 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7160838663). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-25T11:16:56Z. --- Retest update: exact head 045bb0fce applied locally as a14a691b7 builds; gameinput passes 369 checks and gameinput_script passes 10. gameinput_host fails the same three checks on both this candidate and unmodified 42537e7b6 under the same Wine prefix (host GameInputCreate returns E_NOTIMPL), so that host-comparison limitation is not counted as a shim pass. The identical 160-second retail probe with A@60/A@100 still ends visually on Navigation Experience. Both scripted presses are logged; 25,450 native graphics PSOs succeed, no fatal title exception, and late captures are ~45 seconds apart per 300 frames. This does NOT establish that the fix is ineffective generally, nor that this title read used the covered explicit-pad path. I am adding opt-in local GetCurrentReading return-path/button-state logging, with no behavior change, to distinguish actual delivery from a mere poll-thread press log. The diagnostic will not be submitted as a competing implementation. No legal acceptance or world claim; raw evidence remains local. AI-assisted.
djrolfes commented 2026-11-25 19:19:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-25T19:19:32Z.


Diagnostic/caveat update: the local trace confirms this title uses the explicit-pad GetCurrentReading path, predominantly one caller/thread. A press delayed beyond its real 300 ms hold is returned once by the fix, then the current released state is returned on the next read; a press sampled while held appears in repeated reads. That matches the intended policy. It does not by itself prove the UI consumes the one-shot replay.

Important configuration caveat: I found that my local launcher used --run rather than the documented --first-run-ui profile, so it omitted the profile’s graphics-layout, GPU-label and frame-pacing defaults. Treat the earlier setup-page symptom as evidence from that incomplete/custom configuration, NOT a confirmed failure of this PR under the supported UI profile. I am correcting the launcher/profile and refreshing the independent main baseline before further attribution. No delivery policy was changed in the diagnostic build; no legal agreement was accepted. AI-assisted; raw traces/images remain local.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172139637 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7172139637). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-25T19:19:32Z. --- Diagnostic/caveat update: the local trace confirms this title uses the explicit-pad GetCurrentReading path, predominantly one caller/thread. A press delayed beyond its real 300 ms hold is returned once by the fix, then the current released state is returned on the next read; a press sampled while held appears in repeated reads. That matches the intended policy. It does not by itself prove the UI consumes the one-shot replay. Important configuration caveat: I found that my local launcher used --run rather than the documented --first-run-ui profile, so it omitted the profile’s graphics-layout, GPU-label and frame-pacing defaults. Treat the earlier setup-page symptom as evidence from that incomplete/custom configuration, NOT a confirmed failure of this PR under the supported UI profile. I am correcting the launcher/profile and refreshing the independent main baseline before further attribution. No delivery policy was changed in the diagnostic build; no legal agreement was accepted. AI-assisted; raw traces/images remain local.
MoonEyes commented 2026-11-28 20:18:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:18:18Z.


Red/green: On main gameinput_test fails because a slow reader never sees a press it missed (two pads, one press each), and with the PR ctest -R "^gameinput(_script)?$" passes on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245187919 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1510#issuecomment-7245187919). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T20:18:18Z. --- Red/green: On main gameinput_test fails because a slow reader never sees a press it missed (two pads, one press each), and with the PR ctest -R "^gameinput(_script)?$" passes on Windows 11 at OreoFR's (RTX 4070). Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 21:51:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:51:53Z.


Verified by OreoFR

Run 1 (nat05)

  • Base: main c1ecf04ed + PR head 045bb0fce; green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R "^gameinput(_script)?$"
  • Red on main: gameinput fails (FAIL: a slow reader sees the missed press once; two pads, each its own press)
  • Green with the PR: OK
  • Verdict: READY (gameinput.cpp is also touched by #1831 and #1559: whichever merges second needs a rebase)

Run 2 (lot 4)

  • Base: main 09c153948 + PR head 045bb0fce; integration package 1 of 6 (20 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)

Run 3 (lot 4 bis)

  • Base: main 33db04a70 + PR head 045bb0fce; integration package of 15 PRs
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present, and flaky xmem)
  • Green with the PR: ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)

All runs

  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246329023 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1510#issuecomment-7246329023). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:51:53Z. --- **Verified by OreoFR** **Run 1 (nat05)** - Base: main `c1ecf04ed` + PR head `045bb0fce`; green run in a merge package of 12 PRs, no new ctest failure vs main - Test: `ctest -R "^gameinput(_script)?$"` - Red on main: gameinput fails (FAIL: a slow reader sees the missed press once; two pads, each its own press) - Green with the PR: OK - Verdict: READY (gameinput.cpp is also touched by #1831 and #1559: whichever merges second needs a rebase) **Run 2 (lot 4)** - Base: main `09c153948` + PR head `045bb0fce`; integration package 1 of 6 (20 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) **Run 3 (lot 4 bis)** - Base: main `33db04a70` + PR head `045bb0fce`; integration package of 15 PRs - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; the PRs' Python tests; translator suite - Red on main: n/a (integration test; main baseline: xbox_present, and flaky xmem) - Green with the PR: ctest: only xbox_present fails as on main (xs_proxy_mock failed once, flaky: passes on rerun and 5/5 direct runs); Python: same failures as main, the PRs' tests pass; translator: 507 files, 6405 tests, 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) **All runs** - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1510
No description provided.