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

Open
github-bot wants to merge 2 commits from github-bot/gh-1510 into main AGit
Owner

@⁠QemmHD on GitHub · 2026-11-25 02:50 UTC · original
ubiquitarianism:claude/gameinput-slow-reader → main · +97 −0 · 2 files · 2 commits · open

Claimed in the coordination issue as: RT-GAMEINPUT-SLOW-READER (#14)

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

**@⁠QemmHD** on GitHub · 2026-11-25 02:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510) `ubiquitarianism:claude/gameinput-slow-reader` → `main` · +97 −0 · 2 files · 2 commits · open Claimed in the coordination issue as: RT-GAMEINPUT-SLOW-READER (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) 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
A title that reads a pad with GetCurrentReading once a frame, at a few
frames a second, never sees a press that came and went between two
reads. A pad now keeps the newest reading that pressed a button the last
read did not report; a read more than kSlowReaderUs (50 ms) after the
previous one answers that press once, and the next read the pad's real
state.

Carried from DadaCap's boot-prototype fa497b930, split to the GameInput
part (runtime/shims/gameinput.cpp and its test in
runtime/test/gameinput_test.cpp); the other shims in that commit are not
included. Applied unchanged.

AI-assisted. Run on Windows 11, RTX 5080. No game data.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
Review follow-up for the kSlowReaderUs missed-press logic:
- close_pad: a press missed by a slow reader, then an unplug/replug, must
  not come back on the first slow read after reconnecting.
- two pads: a missed press on the Xbox pad and one on the DualSense are
  each reported only on their own pad, once.
- the slow-reader sleeps are now 150 ms (3x kSlowReaderUs) for slow CI.

Tested: ctest -R ^gameinput passes plain and with LEONIDA_VK_VALIDATION=1
(VS 2022, Ninja). Against the pre-fix shim the slow-reader and both
two-pad checks fail (the close_pad check passes trivially there); with the
fix minus close_pad's missed reset, the close_pad check fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:48 +00:00
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:34 UTC · original · edited 2026-11-25 03:44 UTC

[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.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152036121) · edited 2026-11-25 03:44 UTC **[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.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 03:37 UTC · original

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** on GitHub · 2026-11-25 03:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152096407) 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).
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 03:40 UTC · original

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).

**@⁠QemmHD** on GitHub · 2026-11-25 03:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7152135834) 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).
Author
Owner

@⁠djrolfes on GitHub · 2026-11-25 11:11 UTC · original

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** on GitHub · 2026-11-25 11:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7160712337) 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.
Author
Owner

@⁠djrolfes on GitHub · 2026-11-25 11:16 UTC · original

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** on GitHub · 2026-11-25 11:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7160838663) 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.
Author
Owner

@⁠djrolfes on GitHub · 2026-11-25 19:19 UTC · original

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.

**@⁠djrolfes** on GitHub · 2026-11-25 19:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1510#issuecomment-7172139637) 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1510/head:github-bot/gh-1510'
git switch 'github-bot/gh-1510'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1510'
git switch 'github-bot/gh-1510'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1510'
git switch 'github-bot/gh-1510'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1510'
git switch 'main'
git merge --squash 'github-bot/gh-1510'
git switch 'main'
git merge --ff-only 'github-bot/gh-1510'
git switch 'main'
git merge 'github-bot/gh-1510'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.