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

Open
opened 2026-11-26 20:21:36 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1510
Author: @QemmHD
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: claude/gameinput-slow-reader


📝 Commits (2)

  • 0e5e33b gameinput: report a missed press once to a slow reader (RT-GAMEINPUT-SLOW-READER)
  • 045bb0f gameinput_test: close_pad resets a missed press, pads keep their own, wider slow-reader margin

📊 Changes

2 files changed (+97 additions, -0 deletions)

View changed files

📝 runtime/shims/gameinput.cpp (+32 -0)
📝 runtime/test/gameinput_test.cpp (+65 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1510 **Author:** [@QemmHD](https://github.com/QemmHD) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `claude/gameinput-slow-reader` --- ### 📝 Commits (2) - [`0e5e33b`](https://github.com/ubiquitarianism/leonida/commit/0e5e33bc497dee9b01963576aecc3cc49bf28a13) gameinput: report a missed press once to a slow reader (RT-GAMEINPUT-SLOW-READER) - [`045bb0f`](https://github.com/ubiquitarianism/leonida/commit/045bb0fcec9ea44105ae118f8d958dc76fa1b4af) gameinput_test: close_pad resets a missed press, pads keep their own, wider slow-reader margin ### 📊 Changes **2 files changed** (+97 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/gameinput.cpp` (+32 -0) 📝 `runtime/test/gameinput_test.cpp` (+65 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1539
No description provided.