D3D12-INPUT-PAD-TAPE: gameinput tapes the pads the title sees and replays them #2657

Closed
Bloh09 wants to merge 3 commits from upstream-pr/2657 into main
Bloh09 commented 2026-11-29 23:05:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Bloh09 on 2026-11-29T23:05:14Z.


Claimed in the coordination issue as: D3D12-INPUT-PAD-TAPE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263544990)

What and why

Game runs on the d3d12 path can't be repeated input for input today: LEONIDA_KEYS and LEONIDA_KEYS_FILE press keys, but nothing can capture real play (analog sticks, triggers, timing) and play it back. #2464's A/Bs and the 300 s runs asked of rendering PRs need the same input in both arms.

  • LEONIDA_INPUT_RECORD=<file> writes every change of the pads the title is handed: host slots 0-3 and the keyboard/mouse stand-in (slot 4), after the merge, so keyboard play is taped too. One hex line per change, written unbuffered so a crash keeps the tape.
  • LEONIDA_INPUT_REPLAY=<file> hands the title those readings at those times instead of the live pads, in either LEONIDA_ONE_PAD mode.
  • A wait line holds the replay until <file>.go exists. The next line plays then, and later lines keep their spacing, so a recording can be cut to start after a save loads.
  • A malformed line gets counted and skipped, and is never read as a disconnect. Off unless set. The keyboard device, mouse and prompt family stay live.

Adapted from trustno1-coder/VIctory-NVIDIA 1082df39e (GPL-3.0, credited in the module, README and docs), which only taped the host pads and had no tests. New code is gameinput/tape.rs, plus a short hook in State::poll that keeps the update order the same. Docs: d3d12/README.md and docs/gameinput.md.

Tested

  • cargo xwin test --target x86_64-pc-windows-msvc -p leonida-hle --lib gameinput (Rust 1.98.1, run under Wine 10.0 on Linux): 54 passed, 6 of them new. The new tests cover line round-trip, bad lines, replay timing, wait/go gating and spacing, record-then-replay, and a hub test in both pad modes.
  • Full leonida-hle --lib: 222 passed, 2 failed (net::only_loopback_is_reachable, xgamesave::a_kept_blob_past_the_link_limit_is_copied). Both fail the same way on main under Wine.
  • cargo xwin check -p leonida --features diagnostics builds. clippy shows nothing new and rustfmt is clean on the new file.
  • tests/test_docs_links.py, test_docs_env_vars.py, test_docs_table_rows.py, test_docs_encoding.py, test_docs_cli_flags.py pass. python -I scripts/check_no_game_data.py is clean.
  • Not run in the game: no game files here.

GPUs tested: n/a (CPU only, no GPU code touched)

AI-assisted (Grok Bot), reviewed by me.

Skipped/risky: not run in-game; replay times count from input start, so boot drift needs a wait line; only pads are replayed.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5556122867 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657). Originally posted by [Bloh09](https://github.com/Bloh09) on 2026-11-29T23:05:14Z. --- Claimed in the coordination issue as: D3D12-INPUT-PAD-TAPE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263544990) ### What and why Game runs on the d3d12 path can't be repeated input for input today: `LEONIDA_KEYS` and `LEONIDA_KEYS_FILE` press keys, but nothing can capture real play (analog sticks, triggers, timing) and play it back. #2464's A/Bs and the 300 s runs asked of rendering PRs need the same input in both arms. - `LEONIDA_INPUT_RECORD=<file>` writes every change of the pads the title is handed: host slots 0-3 and the keyboard/mouse stand-in (slot 4), after the merge, so keyboard play is taped too. One hex line per change, written unbuffered so a crash keeps the tape. - `LEONIDA_INPUT_REPLAY=<file>` hands the title those readings at those times instead of the live pads, in either `LEONIDA_ONE_PAD` mode. - A `wait` line holds the replay until `<file>.go` exists. The next line plays then, and later lines keep their spacing, so a recording can be cut to start after a save loads. - A malformed line gets counted and skipped, and is never read as a disconnect. Off unless set. The keyboard device, mouse and prompt family stay live. Adapted from trustno1-coder/VIctory-NVIDIA 1082df39e (GPL-3.0, credited in the module, README and docs), which only taped the host pads and had no tests. New code is `gameinput/tape.rs`, plus a short hook in `State::poll` that keeps the update order the same. Docs: `d3d12/README.md` and `docs/gameinput.md`. ### Tested - `cargo xwin test --target x86_64-pc-windows-msvc -p leonida-hle --lib gameinput` (Rust 1.98.1, run under Wine 10.0 on Linux): 54 passed, 6 of them new. The new tests cover line round-trip, bad lines, replay timing, wait/go gating and spacing, record-then-replay, and a hub test in both pad modes. - Full `leonida-hle --lib`: 222 passed, 2 failed (`net::only_loopback_is_reachable`, `xgamesave::a_kept_blob_past_the_link_limit_is_copied`). Both fail the same way on main under Wine. - `cargo xwin check -p leonida --features diagnostics` builds. clippy shows nothing new and rustfmt is clean on the new file. - `tests/test_docs_links.py`, `test_docs_env_vars.py`, `test_docs_table_rows.py`, `test_docs_encoding.py`, `test_docs_cli_flags.py` pass. `python -I scripts/check_no_game_data.py` is clean. - Not run in the game: no game files here. GPUs tested: n/a (CPU only, no GPU code touched) AI-assisted (Grok Bot), reviewed by me. Skipped/risky: not run in-game; replay times count from input start, so boot drift needs a `wait` line; only pads are replayed. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
merzleckeier commented 2026-11-29 23:13:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T23:13:43Z.


I tested 8ac4255d on the exact GitHub merge 23e6eb66 into 452d1d1b6, Win64 under Wine 11.22.

  • MEASURED. The unmodified GameInput suite passed 54/54.
  • MEASURED, replay scheduling A/B. I recorded a synthetic pad changing from neutral to A at 8 ms and back to neutral at 16 ms. The test reused that file and changed only the replay poll schedule. With polls at both 8 and 16 ms, GetNextReading returned both transitions. With the first post-start poll at 16 ms, GetNextReading returned READING_NOT_FOUND after the initial neutral reading, and the current pad was already neutral. Both outcomes repeated on all three runs in each LEONIDA_ONE_PAD mode.
  • READ IN CODE. Replay::apply consumes every due step and hands State::poll one final snapshot. A scheduling delay can therefore erase a recorded tap even from the reading history. Keeping separate history entries for distinct tape times would preserve the edges for GetNextReading. Clients that only read the current state would still depend on their sampling cadence. Replay loop · History update

CPU-only fixture with a test-controlled clock. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264298093 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264298093). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T23:13:43Z. --- I tested `8ac4255d` on the exact GitHub merge `23e6eb66` into `452d1d1b6`, Win64 under Wine 11.22. - **MEASURED.** The unmodified GameInput suite passed 54/54. - **MEASURED, replay scheduling A/B.** I recorded a synthetic pad changing from neutral to A at 8 ms and back to neutral at 16 ms. The test reused that file and changed only the replay poll schedule. With polls at both 8 and 16 ms, `GetNextReading` returned both transitions. With the first post-start poll at 16 ms, `GetNextReading` returned `READING_NOT_FOUND` after the initial neutral reading, and the current pad was already neutral. Both outcomes repeated on all three runs in each `LEONIDA_ONE_PAD` mode. - **READ IN CODE.** `Replay::apply` consumes every due step and hands `State::poll` one final snapshot. A scheduling delay can therefore erase a recorded tap even from the reading history. Keeping separate history entries for distinct tape times would preserve the edges for `GetNextReading`. Clients that only read the current state would still depend on their sampling cadence. [Replay loop](https://github.com/ProjectLeonida/mandy/blob/23e6eb66071c4fba25b2e501bdeda353952c20d3/d3d12/crates/leonida-hle/src/modules/gameinput/tape.rs#L137-L166) · [History update](https://github.com/ProjectLeonida/mandy/blob/23e6eb66071c4fba25b2e501bdeda353952c20d3/d3d12/crates/leonida-hle/src/modules/gameinput.rs#L679-L689) CPU-only fixture with a test-controlled clock. AI-assisted with OpenAI Codex.
Bloh09 commented 2026-11-29 23:28:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Bloh09 on 2026-11-29T23:28:45Z.


Fixed in ebe5768c9: each tape time that comes due in one poll now gets its own history entry, so GetNextReading sees both edges of the 8/16 ms tap (new test fails on 8ac4255d).
Clients that only read the current state still depend on how often they sample.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264490788 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264490788). Originally posted by [Bloh09](https://github.com/Bloh09) on 2026-11-29T23:28:45Z. --- Fixed in ebe5768c9: each tape time that comes due in one poll now gets its own history entry, so `GetNextReading` sees both edges of the 8/16 ms tap (new test fails on 8ac4255d). Clients that only read the current state still depend on how often they sample.
merzleckeier commented 2026-11-29 23:38:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T23:38:37Z.


Thanks, the original missing tap is fixed in my reproducer. I retested ebe5768c on GitHub merge 0de96f60 into 452d1d1b6.

  • MEASURED. The exact Win64 GameInput suite passed 56/56 under Wine 11.22. With the original recorded 8 ms press and 16 ms release, one poll at 16 ms now returns both edges through GetNextReading in 3/3 runs per pad mode.
  • MEASURED, later poll. A single poll at 24 ms also returns both edges, but stamps the release at 24 ms. The temporal reading at 16 ms therefore still reports A held. This repeated in 3/3 runs per mode. As a local A/B, adding the final due snapshot to passed restored the 16 ms release timestamp and a neutral temporal reading in all three runs per mode. The GameInput filter passed 57/57 in that build, including the probe.
  • READ IN CODE. Replay::apply emits the preceding time groups into passed. State::poll writes the final snapshot with now. Appending the last due group before returning lets it use the same timestamp clamp as the earlier ones. Replay return · History timestamps

Synthetic pad and controlled poll clock. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264615776 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264615776). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T23:38:37Z. --- Thanks, the original missing tap is fixed in my reproducer. I retested `ebe5768c` on GitHub merge `0de96f60` into `452d1d1b6`. - **MEASURED.** The exact Win64 GameInput suite passed 56/56 under Wine 11.22. With the original recorded 8 ms press and 16 ms release, one poll at 16 ms now returns both edges through `GetNextReading` in 3/3 runs per pad mode. - **MEASURED, later poll.** A single poll at 24 ms also returns both edges, but stamps the release at 24 ms. The temporal reading at 16 ms therefore still reports A held. This repeated in 3/3 runs per mode. As a local A/B, adding the final due snapshot to `passed` restored the 16 ms release timestamp and a neutral temporal reading in all three runs per mode. The GameInput filter passed 57/57 in that build, including the probe. - **READ IN CODE.** `Replay::apply` emits the preceding time groups into `passed`. `State::poll` writes the final snapshot with `now`. Appending the last due group before returning lets it use the same timestamp clamp as the earlier ones. [Replay return](https://github.com/ProjectLeonida/mandy/blob/0de96f605f4441d42d9c7af0dbef34c68a65eaa9/d3d12/crates/leonida-hle/src/modules/gameinput/tape.rs#L162-L180) · [History timestamps](https://github.com/ProjectLeonida/mandy/blob/0de96f605f4441d42d9c7af0dbef34c68a65eaa9/d3d12/crates/leonida-hle/src/modules/gameinput.rs#L682-L697) Synthetic pad and controlled poll clock. AI-assisted with OpenAI Codex.
ecox982745 commented 2026-11-29 23:53:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-29T23:53:18Z.


Native Windows follow-up for the late poll. I tested ebe5768c9 merged onto 452d1d1b6 (tree 3c52674e0), Windows 11 build 26300, MSVC and Rust 1.98.1. The exact GameInput filter passed 56/56.

A local synthetic test submitted neutral at 0 ms, a press at 8 ms, and a release at 16 ms, then made the first poll after 24 ms. The public temporal vtable call at 16 ms still returned the held button with an 8 ms timestamp, in both pad modes. The current reading was already neutral but carried the poll timestamp. Returning the final due snapshot with its tape timestamp restored the neutral 16 ms temporal reading in both pad modes. With that local change and the updated tape assertion, the filter passed 57/57.

This is independent native coverage of the preceding Wine result. The test uses an unpolled fake input hub and synthetic tape. It does not use game files, a real controller, or GPU rendering. AI-assisted with OpenAI Codex (GPT-6.2 Sol).

Windows retest on c16b0424 (GitHub merge f7696213). The exact GameInput filter passed 57/57 on native Windows 11 build 26300 (MSVC, Rust 1.98.1), including the new late-poll timestamp regression. This was the published source with the synthetic fixtures. No GPU rendering was involved.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264801873 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264801873). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-29T23:53:18Z. --- Native Windows follow-up for the late poll. I tested `ebe5768c9` merged onto `452d1d1b6` (tree `3c52674e0`), Windows 11 build 26300, MSVC and Rust 1.98.1. The exact GameInput filter passed 56/56. A local synthetic test submitted neutral at 0 ms, a press at 8 ms, and a release at 16 ms, then made the first poll after 24 ms. The public temporal vtable call at 16 ms still returned the held button with an 8 ms timestamp, in both pad modes. The current reading was already neutral but carried the poll timestamp. Returning the final due snapshot with its tape timestamp restored the neutral 16 ms temporal reading in both pad modes. With that local change and the updated tape assertion, the filter passed 57/57. This is independent native coverage of the preceding Wine result. The test uses an unpolled fake input hub and synthetic tape. It does not use game files, a real controller, or GPU rendering. AI-assisted with OpenAI Codex (GPT-6.2 Sol). **Windows retest on `c16b0424` (GitHub merge `f7696213`).** The exact GameInput filter passed **57/57** on native Windows 11 build 26300 (MSVC, Rust 1.98.1), including the new late-poll timestamp regression. This was the published source with the synthetic fixtures. No GPU rendering was involved.
Bloh09 commented 2026-11-29 23:54:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Bloh09 on 2026-11-29T23:54:18Z.


Fixed in c16b0424e: the final due snapshot now takes the same clamped tape-time stamp as the earlier ones, so the 24 ms poll stamps the release at 16 ms.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264814814 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264814814). Originally posted by [Bloh09](https://github.com/Bloh09) on 2026-11-29T23:54:18Z. --- Fixed in c16b0424e: the final due snapshot now takes the same clamped tape-time stamp as the earlier ones, so the 24 ms poll stamps the release at 16 ms.
merzleckeier commented 2026-11-30 00:04:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:04:16Z.


Confirmed the timestamp fix on c16b0424 (GitHub merge f7696213).

  • MEASURED. The exact GameInput suite passed 57/57 under Wine 11.22. The recorded 8 ms press and 16 ms release kept those times with polls at 8 and 16 ms, one poll at 16 ms, and one poll at 24 ms. The temporal reading at 16 ms was neutral in all three repetitions per schedule and pad mode.
  • MEASURED, wait and same-time changes. I recorded two pads and added wait before a timestamp that switches A to B across different slots. After creating .go, the 249 ms poll left the tape held. At 250 ms both slot updates got the same timestamp. In one-pad mode this exposed one direct A-to-B change. B went neutral at 258 ms, even though the next poll arrived at 260 ms. Both modes passed in 3/3 runs.

Synthetic pad inputs, a controlled poll clock, and the real record/replay and GameInput vtable paths. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264942530 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7264942530). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T00:04:16Z. --- Confirmed the timestamp fix on `c16b0424` (GitHub merge `f7696213`). - **MEASURED.** The exact GameInput suite passed 57/57 under Wine 11.22. The recorded 8 ms press and 16 ms release kept those times with polls at 8 and 16 ms, one poll at 16 ms, and one poll at 24 ms. The temporal reading at 16 ms was neutral in all three repetitions per schedule and pad mode. - **MEASURED, wait and same-time changes.** I recorded two pads and added `wait` before a timestamp that switches A to B across different slots. After creating `.go`, the 249 ms poll left the tape held. At 250 ms both slot updates got the same timestamp. In one-pad mode this exposed one direct A-to-B change. B went neutral at 258 ms, even though the next poll arrived at 260 ms. Both modes passed in 3/3 runs. Synthetic pad inputs, a controlled poll clock, and the real record/replay and GameInput vtable paths. AI-assisted with OpenAI Codex.
Bloh09 commented 2026-11-30 02:25:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Bloh09 on 2026-11-30T02:25:14Z.


Retested at c16b0424 on Wine (merzleckeier) and native Win11 (ecox982745), 57/57; ready for review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266989620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7266989620). Originally posted by [Bloh09](https://github.com/Bloh09) on 2026-11-30T02:25:14Z. --- Retested at c16b0424 on Wine (merzleckeier) and native Win11 (ecox982745), 57/57; ready for review.
KelboLive commented 2026-12-01 14:19:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:19:40Z.

Review: COMMENTED


Reviewed at c16b0424e; the core claim holds. seen is built after the pad/stand-in/look merge and handed to Tape::apply (gameinput.rs:670-685), recording writes only changed slots to an unbuffered file (tape.rs:98-108, text() :190-204), and replay yields one reading per due tape time with per-edge late polls (tape.rs:140-186, integrated at gameinput.rs:686-700). wait/<file>.go is throttled at 250 ms (tape.rs:147-162), malformed lines are counted and skipped (:207-253), and keyboard/mouse stay live (gameinput.rs:701). leonida-hle is 227/0/2 here (57 gameinput), merge-tree clean against current main.

The slot <= PADS bound is load-bearing, not decoration: removing it lets a slot=5 line through (lines_that_are_not_steps_are_skipped_and_counted fails with the extra Set{slot:5}), which would then index self.now[5] out of range. Good that it is covered.

One case to check before merge: while a wait holds, Replay::apply unconditionally ends with *pads = self.now (tape.rs:181), and self.now starts all None — so it replaces live pads with None. In the default one-pad mode unwrap_or_default() (gameinput.rs:693) hides it, but with LEONIDA_ONE_PAD=0 the update path then reports real disconnects (:695-698) until <file>.go appears. If that is not intended, keep the previous pads until the first step is due. The tests drive Replay::apply directly, so they do not see it.

Minor: multiple wait lines silently recompute shift, which is undocumented.

The two CI failures on this head are shader/Python (test_interp_computed_ij_fallback, a macOS f16 rounding case) and touch none of these four files.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6133128618 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#pullrequestreview-6133128618). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T14:19:40Z. **Review:** COMMENTED --- Reviewed at `c16b0424e`; the core claim holds. `seen` is built after the pad/stand-in/look merge and handed to `Tape::apply` (`gameinput.rs:670-685`), recording writes only changed slots to an unbuffered file (`tape.rs:98-108`, `text()` `:190-204`), and replay yields one reading per due tape time with per-edge late polls (`tape.rs:140-186`, integrated at `gameinput.rs:686-700`). `wait`/`<file>.go` is throttled at 250 ms (`tape.rs:147-162`), malformed lines are counted and skipped (`:207-253`), and keyboard/mouse stay live (`gameinput.rs:701`). `leonida-hle` is 227/0/2 here (57 gameinput), merge-tree clean against current main. The `slot <= PADS` bound is load-bearing, not decoration: removing it lets a `slot=5` line through (`lines_that_are_not_steps_are_skipped_and_counted` fails with the extra `Set{slot:5}`), which would then index `self.now[5]` out of range. Good that it is covered. One case to check before merge: **while a `wait` holds, `Replay::apply` unconditionally ends with `*pads = self.now` (`tape.rs:181`), and `self.now` starts all `None`** — so it replaces live pads with `None`. In the default one-pad mode `unwrap_or_default()` (`gameinput.rs:693`) hides it, but with `LEONIDA_ONE_PAD=0` the `update` path then reports real disconnects (`:695-698`) until `<file>.go` appears. If that is not intended, keep the previous pads until the first step is due. The tests drive `Replay::apply` directly, so they do not see it. Minor: multiple `wait` lines silently recompute `shift`, which is undocumented. The two CI failures on this head are shader/Python (`test_interp_computed_ij_fallback`, a macOS f16 rounding case) and touch none of these four files.
merzleckeier commented 2026-12-01 14:37:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T14:37:48Z.


I reproduced the leading-wait behavior from the review through the actual GameInput hub at c16b0424 + cd0c52fcf. The fake host exposes a connected pad in slot 1, multi-pad mode is on, and the tape starts with wait followed by a different reading for slot 1. Before .go, the live pad does not appear connected to the client and no live reading comes through. After .go, the recorded reading arrives normally.

If a leading wait is intended to let the user navigate to a save with the controller, one narrow implementation is to leave the incoming pads untouched while self.at == 0 and the first step is Wait. That local change kept the live pad visible during the wait, then handed over to the taped value when .go appeared. All 58 GameInput tests passed with the added integration case, including the existing test that holds an already-taped reading through a later wait.

MEASURED with a synthetic pad source, Win64 MSVC target and Wine 11.22. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7314570059 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7314570059). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T14:37:48Z. --- I reproduced the leading-wait behavior from the review through the actual GameInput hub at `c16b0424` + `cd0c52fcf`. The fake host exposes a connected pad in slot 1, multi-pad mode is on, and the tape starts with `wait` followed by a different reading for slot 1. Before `.go`, the live pad does not appear connected to the client and no live reading comes through. After `.go`, the recorded reading arrives normally. If a leading wait is intended to let the user navigate to a save with the controller, one narrow implementation is to leave the incoming pads untouched while `self.at == 0` and the first step is `Wait`. That local change kept the live pad visible during the wait, then handed over to the taped value when `.go` appeared. All 58 GameInput tests passed with the added integration case, including the existing test that holds an already-taped reading through a later wait. MEASURED with a synthetic pad source, Win64 MSVC target and Wine 11.22. AI-assisted (Codex).
MoonEyes commented 2026-12-02 11:52:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T11:52:59Z.


For information: this pull request is carried in #3119, which merges your head c16b0424e (your commits are kept) into current main and fixes the open review point (a leading wait replaced the live pads with none), with a test and a docs note. If you rebase this one yourself, say so and #3119 can be closed.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344537313 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7344537313). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T11:52:59Z. --- For information: this pull request is carried in #3119, which merges your head `c16b0424e` (your commits are kept) into current `main` and fixes the open review point (a leading wait replaced the live pads with none), with a test and a docs note. If you rebase this one yourself, say so and #3119 can be closed. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:29:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:29:04Z.


Verification triage of #2657

Head c16b0424e: this work is carried by MoonEyes' #3119. Verdict: superseded by #3119.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354663211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7354663211). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:29:04Z. --- **Verification triage of #2657** Head `c16b0424e`: this work is carried by MoonEyes' #3119. **Verdict: superseded by #3119.** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:34:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:47Z.


RUN (independent run on Windows, head c16b0424e33a8d66bcbf7e63525745fdd3b0f897, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

The merge is clean, no conflict. The PR touches leonida-hle (gameinput) and docs, not leonida-gpu, so I ran the leonida-hle lib tests instead of the GPU ones. Windows 11, native MSVC, Rust 1.98.1, no GPU, no game files.

Green

  • cargo test -p leonida-hle --release --locked --lib (in d3d12/): 257 passed, 0 failed, 2 ignored.
  • --lib gameinput filter: 59 passed, 0 failed. The 9 new tests (6 in tape.rs, 3 in gameinput.rs) all pass.
  • No diagnostics code is touched, so --features diagnostics was not run.
  • python -I scripts/check_no_game_data.py on tape.rs, docs/gameinput.md and d3d12/README.md: clean.
  • python -I tests/test_d3d12_switches.py: 1 failure out of 20, test_the_tracked_switches_page_matches_the_sources: d3d12/docs/switches.md is out of date, with LEONIDA_INPUT_RECORD and LEONIDA_INPUT_REPLAY missing from the page. Regenerating with python -I tools/d3d12_switches.py --out d3d12/docs/switches.md adds exactly those two rows (684 names instead of 682) and nothing else.

Red

The new tests live in a new file and in new test functions, so "main's version of the changed files" has no tests to fail. I used 6 targeted mutations of the new code instead (each applied alone, then restored with git checkout HEAD --):

Mutation Result
Replay::apply no longer replaces the pads with the tape's killed (5 tests fail)
250 ms throttle of the .go look removed killed (a_wait_holds_until_the_go_file_...)
wait re-base (shift) set to 0 killed (2 tests fail)
record writes every poll, not only changes killed (a_recording_writes_only_changes_and_replays_the_same)
passed readings stamped at the poll time, not the tape time killed (a_later_poll_stamps_each_taped_edge_at_its_tape_time)
passed readings dropped, only the final one handed over killed (2 tests fail)

No mutation survived. I also checked the one known gap with a throw-away test (not kept): a tape that starts with wait, polled before .go exists, hands the title no pad at all instead of the live one. The test fails, so the open review point below is real on this head.

Review

  • Default off: both switches are read only through Tape::from_env, and None means apply is skipped and passed is empty. Off is really off. If both are set, replay wins, as the docs say.
  • Ordering: the pad merge (host pads, stand-in, mouse look) happens before Tape::apply, and the due tape readings go through update in order, ending with the poll's own reading. Timestamps are clamped between the last poll and now, so they never go back. Covered by the two late-poll tests.
  • Open review point, not fixed on this head: while a leading wait holds, Replay::apply still does *pads = self.now, so with LEONIDA_ONE_PAD=0 a live pad used to load the save looks disconnected until <file>.go appears (reproduced by merzleckeier through the hub and by my probe). #3119 carries this head plus that fix.
  • d3d12/docs/switches.md not regenerated although two new switches were added: this fails tests/test_d3d12_switches.py on current main (see Green). It was not red on the PR's own base because that test came later.
  • Docs: d3d12/README.md and docs/gameinput.md describe both switches and the file format; the wait re-basing of the spacing is only half said there (#3119 adds a note).
  • Claim: D3D12-INPUT-PAD-TAPE, with the link to the comment in issues/2570. No Depends on, none needed.
  • Lifetimes and fences: no GPU object, fence or thread is involved. The record file is written unbuffered line by line and ignores write errors on purpose; the file handle lives in the hub state for the whole run.
  • Overlap: #3119 (carry of this head, MoonEyes) supersedes it, and the author has not said they will rebase. The code adapts trustno1-coder/VIctory-NVIDIA 1082df39e (GPL-3.0), credited in the module, README and docs. A maintainer may want to look at that licence note.
  • Other CI: the only red checks on the PR head are semantic-tests (ubuntu-latest) and macos-python, in translator and f16 tests this PR does not touch.
  • In-game runs on this exact head: none posted. Wine and native hub-level test runs by merzleckeier and ecox982745 exist (57 of 57 passed), but they run the unit tests, not the game.

Not covered

  • No run of the game, so the taped play itself was not seen to drive a real session, and the effect of LEONIDA_INPUT_REPLAY with the real host pads (XInput, Sony) is untested here.
  • The keyboard and mouse stand-in were only exercised through the fake host in the tests.
  • No timing measurement of the poll path with a tape on; the hook adds a tape check and a small vector per poll.
  • Only leonida-hle was run; the rest of the workspace and the semantic suite were not.

Verdict

PARTIAL. The code and its 9 new tests are solid (all 6 mutations killed, 257 of 257 hle tests green), but on current main it fails the switches page test (two missing rows) and it still has the leading-wait bug that the review left open; both are fixed or fixable in the carry #3119. In-game run still required: none is posted on this head, and this touches the input path of the render runs.

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359480273 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7359480273). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:34:47Z. --- RUN (independent run on Windows, head `c16b0424e33a8d66bcbf7e63525745fdd3b0f897`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) The merge is clean, no conflict. The PR touches `leonida-hle` (gameinput) and docs, not `leonida-gpu`, so I ran the `leonida-hle` lib tests instead of the GPU ones. Windows 11, native MSVC, Rust 1.98.1, no GPU, no game files. ### Green - `cargo test -p leonida-hle --release --locked --lib` (in `d3d12/`): 257 passed, 0 failed, 2 ignored. - `--lib gameinput` filter: 59 passed, 0 failed. The 9 new tests (6 in `tape.rs`, 3 in `gameinput.rs`) all pass. - No diagnostics code is touched, so `--features diagnostics` was not run. - `python -I scripts/check_no_game_data.py` on `tape.rs`, `docs/gameinput.md` and `d3d12/README.md`: clean. - `python -I tests/test_d3d12_switches.py`: **1 failure out of 20**, `test_the_tracked_switches_page_matches_the_sources`: `d3d12/docs/switches.md` is out of date, with `LEONIDA_INPUT_RECORD` and `LEONIDA_INPUT_REPLAY` missing from the page. Regenerating with `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` adds exactly those two rows (684 names instead of 682) and nothing else. ### Red The new tests live in a new file and in new test functions, so "main's version of the changed files" has no tests to fail. I used 6 targeted mutations of the new code instead (each applied alone, then restored with `git checkout HEAD --`): | Mutation | Result | |---|---| | `Replay::apply` no longer replaces the pads with the tape's | killed (5 tests fail) | | 250 ms throttle of the `.go` look removed | killed (`a_wait_holds_until_the_go_file_...`) | | `wait` re-base (`shift`) set to 0 | killed (2 tests fail) | | record writes every poll, not only changes | killed (`a_recording_writes_only_changes_and_replays_the_same`) | | passed readings stamped at the poll time, not the tape time | killed (`a_later_poll_stamps_each_taped_edge_at_its_tape_time`) | | passed readings dropped, only the final one handed over | killed (2 tests fail) | No mutation survived. I also checked the one known gap with a throw-away test (not kept): a tape that starts with `wait`, polled before `.go` exists, hands the title no pad at all instead of the live one. The test fails, so the open review point below is real on this head. ### Review - **Default off:** both switches are read only through `Tape::from_env`, and `None` means `apply` is skipped and `passed` is empty. Off is really off. If both are set, replay wins, as the docs say. - **Ordering:** the pad merge (host pads, stand-in, mouse look) happens before `Tape::apply`, and the due tape readings go through `update` in order, ending with the poll's own reading. Timestamps are clamped between the last poll and now, so they never go back. Covered by the two late-poll tests. - **Open review point, not fixed on this head:** while a leading `wait` holds, `Replay::apply` still does `*pads = self.now`, so with `LEONIDA_ONE_PAD=0` a live pad used to load the save looks disconnected until `<file>.go` appears (reproduced by merzleckeier through the hub and by my probe). #3119 carries this head plus that fix. - **`d3d12/docs/switches.md` not regenerated** although two new switches were added: this fails `tests/test_d3d12_switches.py` on current `main` (see Green). It was not red on the PR's own base because that test came later. - **Docs:** `d3d12/README.md` and `docs/gameinput.md` describe both switches and the file format; the `wait` re-basing of the spacing is only half said there (#3119 adds a note). - **Claim:** `D3D12-INPUT-PAD-TAPE`, with the link to the comment in issues/2570. No `Depends on`, none needed. - **Lifetimes and fences:** no GPU object, fence or thread is involved. The record file is written unbuffered line by line and ignores write errors on purpose; the file handle lives in the hub state for the whole run. - **Overlap:** #3119 (carry of this head, MoonEyes) supersedes it, and the author has not said they will rebase. The code adapts trustno1-coder/VIctory-NVIDIA 1082df39e (GPL-3.0), credited in the module, README and docs. A maintainer may want to look at that licence note. - **Other CI:** the only red checks on the PR head are `semantic-tests (ubuntu-latest)` and `macos-python`, in translator and f16 tests this PR does not touch. - **In-game runs on this exact head:** none posted. Wine and native hub-level test runs by merzleckeier and ecox982745 exist (57 of 57 passed), but they run the unit tests, not the game. ### Not covered - No run of the game, so the taped play itself was not seen to drive a real session, and the effect of `LEONIDA_INPUT_REPLAY` with the real host pads (XInput, Sony) is untested here. - The keyboard and mouse stand-in were only exercised through the fake host in the tests. - No timing measurement of the poll path with a tape on; the hook adds a tape check and a small vector per poll. - Only `leonida-hle` was run; the rest of the workspace and the semantic suite were not. ### Verdict **PARTIAL.** The code and its 9 new tests are solid (all 6 mutations killed, 257 of 257 hle tests green), but on current `main` it fails the switches page test (two missing rows) and it still has the leading-`wait` bug that the review left open; both are fixed or fixable in the carry #3119. In-game run still required: none is posted on this head, and this touches the input path of the render runs. AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
MoonEyes commented 2026-12-02 23:32:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T23:32:36Z.


RUN (in game, batch of five pull requests), each head merged with git merge --no-ff onto main ef35d683e, in one build: #3176 4c31594b5, #2657 c16b0424e, #2807 e2572082c, #3230 97eefdee4, #3247 3e5887f65. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (47 samples) median 15.8, mean 16.2
Rendered fps, last 120 s median 15.0
Time under 5 fps in the world 1 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches today. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. #3247 has since moved to 3dc6c58b3, which only merges main (81efe4566) into the head above: git diff 3e5887f65 3dc6c58b3 leaves d3d12/scripts/play-nvidia.ps1 and tests/test_win_launchers.py unchanged. If another of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used because main now precompiles every known pipeline by default (88,631 for a new executable, over an hour on this card). The default start was therefore not exercised, and the F1 SAVE AND RESTART path of #3247 was not exercised in game. An earlier attempt of this batch is not counted: the run script gave up waiting while that full precompile ran.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362131857 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7362131857). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T23:32:36Z. --- RUN (in game, batch of five pull requests), each head merged with `git merge --no-ff` onto main `ef35d683e`, in one build: #3176 `4c31594b5`, #2657 `c16b0424e`, #2807 `e2572082c`, #3230 `97eefdee4`, #3247 `3e5887f65`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (47 samples) | median 15.8, mean 16.2 | | Rendered fps, last 120 s | median 15.0 | | Time under 5 fps in the world | 1 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches today. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. #3247 has since moved to `3dc6c58b3`, which only merges `main` (`81efe4566`) into the head above: `git diff 3e5887f65 3dc6c58b3` leaves `d3d12/scripts/play-nvidia.ps1` and `tests/test_win_launchers.py` unchanged. If another of these pull requests changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used because `main` now precompiles every known pipeline by default (88,631 for a new executable, over an hour on this card). The default start was therefore not exercised, and the F1 SAVE AND RESTART path of #3247 was not exercised in game. An earlier attempt of this batch is not counted: the run script gave up waiting while that full precompile ran. AI-assisted (Claude Code).
fiestorra commented 2026-12-03 05:49:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:49:39Z.


VERIFY-2657 — 57 tests de gameinput en verde, y el fichero de 430 líneas sí trae tests (mi primer conteo decía 0 y estaba mal)

Primero la corrección de mi propia medida, porque importa más que el resultado: conté «tests nuevos» con ^\+\s*fn y dio 0 — y tape.rs es un fichero nuevo con #[test] dentro. El patrón no los ve porque en un fichero nuevo las líneas no llevan + delante de la indentación de la misma forma. Lo medí otra vez sobre el contenido y hay al menos tres: a_line_reads_back_as_written, lines_that_are_not_steps_are_skipped_and_counted, a_replay_hands_out_each_reading_at_its_time.

d3d12/crates/leonida-hle/src/modules/gameinput.rs       +159
d3d12/crates/leonida-hle/src/modules/gameinput/tape.rs  +430
docs/gameinput.md, d3d12/README.md

cargo test -p leonida-hle --lib gameinput               57 passed

El cambio: D3D12-INPUT-PAD-TAPE — el tape de los mandos: graba lo que el juego ve y lo reproduce. Y es hermano del LEONIDA_KBM_BINDS de #3276 (que entró esta noche): el mismo módulo, gameinput, y la misma idea — que el input sea un fichero y no un periférico.

Y los nombres de los tests son el contrato de una cinta: «una línea se lee como se escribió», «las líneas que no son pasos se saltan y se cuentan» (la misma regla que el skipped de #3276), y «una repetición entrega cada lectura a su tiempo». Las tres juntas son lo que hace que un tape grabado en una máquina sirva en otra.

Lo que verifiqué: 57 tests de gameinput en verde, con los tres del tape dentro.
Lo que no: la grabación y la reproducción de verdad — necesitan el título y un mando; lo que el test cubre es el formato y el reparto temporal, que es exactamente la parte que no necesita hardware.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369155973 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7369155973). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:49:39Z. --- ## VERIFY-2657 — 57 tests de `gameinput` en verde, y el fichero de 430 líneas **sí trae tests** (mi primer conteo decía 0 y estaba mal) **Primero la corrección de mi propia medida, porque importa más que el resultado**: **conté «tests nuevos» con `^\+\s*fn` y dio 0** — **y `tape.rs` es un fichero nuevo con `#[test]` dentro.** **El patrón no los ve porque en un fichero nuevo las líneas no llevan `+` delante de la indentación de la misma forma.** **Lo medí otra vez sobre el contenido y hay al menos tres**: `a_line_reads_back_as_written`, `lines_that_are_not_steps_are_skipped_and_counted`, `a_replay_hands_out_each_reading_at_its_time`. ``` d3d12/crates/leonida-hle/src/modules/gameinput.rs +159 d3d12/crates/leonida-hle/src/modules/gameinput/tape.rs +430 docs/gameinput.md, d3d12/README.md cargo test -p leonida-hle --lib gameinput 57 passed ``` **El cambio**: **`D3D12-INPUT-PAD-TAPE`** — **el *tape* de los mandos: graba lo que el juego ve y lo reproduce.** **Y es hermano del `LEONIDA_KBM_BINDS` de `#3276`** (**que entró esta noche**): **el mismo módulo, `gameinput`, y la misma idea — que el input sea un fichero y no un periférico.** **Y los nombres de los tests son el contrato de una cinta**: **«una línea se lee como se escribió»**, **«las líneas que no son pasos se saltan y se cuentan»** (la misma regla que el `skipped` de `#3276`), **y «una repetición entrega cada lectura a su tiempo».** **Las tres juntas son lo que hace que un tape grabado en una máquina sirva en otra.** **Lo que verifiqué**: **57 tests de `gameinput` en verde, con los tres del tape dentro.** **Lo que no**: **la grabación y la reproducción de verdad** — **necesitan el título y un mando; lo que el test cubre es el formato y el reparto temporal, que es exactamente la parte que no necesita hardware.**
MoonEyes commented 2026-12-03 18:02:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:02:27Z.


Thanks for the work on this. This pull request has a merge conflict with the current main and has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latest main into your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7387499943 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2657#issuecomment-7387499943). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T18:02:27Z. --- Thanks for the work on this. This pull request has a merge conflict with the current `main` and has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latest `main` into your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome. --- _Generated by [Claude Code](https://claude.ai/code)_

Pull request closed

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!2657
No description provided.