D3D12-INPUT-PAD-TAPE: gameinput tapes the pads the title sees and replays them #2657
Closed
github-bot
wants to merge 3 commits from
github-bot/gh-2657 into main
AGit
pull from: github-bot/gh-2657
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
github/ubiquitarianism--leonida!2657
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2657"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Bloh09 on GitHub · 2026-11-29 23:05 UTC · original
Bloh09:feat/d3d12-input-pad-tape→main· +607 −12 · 4 files · 3 commits · closed without mergingClaimed in the coordination issue as: D3D12-INPUT-PAD-TAPE (#2570)
What and why
Game runs on the d3d12 path can't be repeated input for input today:
LEONIDA_KEYSandLEONIDA_KEYS_FILEpress 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 eitherLEONIDA_ONE_PADmode.waitline holds the replay until<file>.goexists. The next line plays then, and later lines keep their spacing, so a recording can be cut to start after a save loads.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 inState::pollthat keeps the update order the same. Docs:d3d12/README.mdanddocs/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.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 diagnosticsbuilds. 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.pypass.python -I scripts/check_no_game_data.pyis clean.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
waitline; only pads are replayed.Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.@merzleckeier on GitHub · 2026-11-29 23:13 UTC · original
I tested
8ac4255don the exact GitHub merge23e6eb66into452d1d1b6, Win64 under Wine 11.22.GetNextReadingreturned both transitions. With the first post-start poll at 16 ms,GetNextReadingreturnedREADING_NOT_FOUNDafter the initial neutral reading, and the current pad was already neutral. Both outcomes repeated on all three runs in eachLEONIDA_ONE_PADmode.Replay::applyconsumes every due step and handsState::pollone 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 forGetNextReading. Clients that only read the current state would still depend on their sampling cadence. Replay loop · History updateCPU-only fixture with a test-controlled clock. AI-assisted with OpenAI Codex.
@Bloh09 on GitHub · 2026-11-29 23:28 UTC · original
Fixed in
ebe5768c9: each tape time that comes due in one poll now gets its own history entry, soGetNextReadingsees both edges of the 8/16 ms tap (new test fails on8ac4255d).Clients that only read the current state still depend on how often they sample.
@merzleckeier on GitHub · 2026-11-29 23:38 UTC · original
Thanks, the original missing tap is fixed in my reproducer. I retested
ebe5768con GitHub merge0de96f60into452d1d1b6.GetNextReadingin 3/3 runs per pad mode.passedrestored 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.Replay::applyemits the preceding time groups intopassed.State::pollwrites the final snapshot withnow. Appending the last due group before returning lets it use the same timestamp clamp as the earlier ones. Replay return · History timestampsSynthetic pad and controlled poll clock. AI-assisted with OpenAI Codex.
@ecox982745 on GitHub · 2026-11-29 23:53 UTC · original · edited 2026-11-30 00:17 UTC
Native Windows follow-up for the late poll. I tested
ebe5768c9merged onto452d1d1b6(tree3c52674e0), 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 mergef7696213). 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 on GitHub · 2026-11-29 23:54 UTC · original
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 on GitHub · 2026-11-30 00:04 UTC · original
Confirmed the timestamp fix on
c16b0424(GitHub mergef7696213).waitbefore 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 on GitHub · 2026-11-30 02:25 UTC · original
Retested at
c16b0424on Wine (merzleckeier) and native Win11 (ecox982745), 57/57; ready for review.@KelboLive on GitHub · 2026-12-01 14:19 UTC · original · reviewed
Reviewed at
c16b0424e; the core claim holds.seenis built after the pad/stand-in/look merge and handed toTape::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 atgameinput.rs:686-700).wait/<file>.gois 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-hleis 227/0/2 here (57 gameinput), merge-tree clean against current main.The
slot <= PADSbound is load-bearing, not decoration: removing it lets aslot=5line through (lines_that_are_not_steps_are_skipped_and_countedfails with the extraSet{slot:5}), which would then indexself.now[5]out of range. Good that it is covered.One case to check before merge: while a
waitholds,Replay::applyunconditionally ends with*pads = self.now(tape.rs:181), andself.nowstarts allNone— so it replaces live pads withNone. In the default one-pad modeunwrap_or_default()(gameinput.rs:693) hides it, but withLEONIDA_ONE_PAD=0theupdatepath then reports real disconnects (:695-698) until<file>.goappears. If that is not intended, keep the previous pads until the first step is due. The tests driveReplay::applydirectly, so they do not see it.Minor: multiple
waitlines silently recomputeshift, 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 on GitHub · 2026-12-01 14:37 UTC · original
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 withwaitfollowed 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 == 0and the first step isWait. That local change kept the live pad visible during the wait, then handed over to the taped value when.goappeared. 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 on GitHub · 2026-12-02 11:52 UTC · original
For information: this pull request is carried in #3119, which merges your head
c16b0424e(your commits are kept) into currentmainand 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 on GitHub · 2026-12-02 18:29 UTC · original
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
@MoonEyes on GitHub · 2026-12-02 21:34 UTC · original
RUN (independent run on Windows, head
c16b0424e33a8d66bcbf7e63525745fdd3b0f897, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)The merge is clean, no conflict. The PR touches
leonida-hle(gameinput) and docs, notleonida-gpu, so I ran theleonida-hlelib 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(ind3d12/): 257 passed, 0 failed, 2 ignored.--lib gameinputfilter: 59 passed, 0 failed. The 9 new tests (6 intape.rs, 3 ingameinput.rs) all pass.--features diagnosticswas not run.python -I scripts/check_no_game_data.pyontape.rs,docs/gameinput.mdandd3d12/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.mdis out of date, withLEONIDA_INPUT_RECORDandLEONIDA_INPUT_REPLAYmissing from the page. Regenerating withpython -I tools/d3d12_switches.py --out d3d12/docs/switches.mdadds 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 --):Replay::applyno longer replaces the pads with the tape's.golook removeda_wait_holds_until_the_go_file_...)waitre-base (shift) set to 0a_recording_writes_only_changes_and_replays_the_same)a_later_poll_stamps_each_taped_edge_at_its_tape_time)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.goexists, 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
Tape::from_env, andNonemeansapplyis skipped andpassedis empty. Off is really off. If both are set, replay wins, as the docs say.Tape::apply, and the due tape readings go throughupdatein 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.waitholds,Replay::applystill does*pads = self.now, so withLEONIDA_ONE_PAD=0a live pad used to load the save looks disconnected until<file>.goappears (reproduced by merzleckeier through the hub and by my probe). #3119 carries this head plus that fix.d3d12/docs/switches.mdnot regenerated although two new switches were added: this failstests/test_d3d12_switches.pyon currentmain(see Green). It was not red on the PR's own base because that test came later.d3d12/README.mdanddocs/gameinput.mddescribe both switches and the file format; thewaitre-basing of the spacing is only half said there (#3119 adds a note).D3D12-INPUT-PAD-TAPE, with the link to the comment in issues/2570. NoDepends on, none needed.semantic-tests (ubuntu-latest)andmacos-python, in translator and f16 tests this PR does not touch.Not covered
LEONIDA_INPUT_REPLAYwith the real host pads (XInput, Sony) is untested here.leonida-hlewas 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
mainit fails the switches page test (two missing rows) and it still has the leading-waitbug 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 on GitHub · 2026-12-02 23:32 UTC · original
RUN (in game, batch of five pull requests), each head merged with
git merge --no-ffonto mainef35d683e, in one build: #31764c31594b5, #2657c16b0424e, #2807e2572082c, #323097eefdee4, #32473e5887f65. 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.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 mergesmain(81efe4566) into the head above:git diff 3e5887f65 3dc6c58b3leavesd3d12/scripts/play-nvidia.ps1andtests/test_win_launchers.pyunchanged. 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;
-PrecompileUsedwas used becausemainnow 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 on GitHub · 2026-12-03 05:49 UTC · original
VERIFY-2657 — 57 tests de
gameinputen 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*fny dio 0 — ytape.rses 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.El cambio:
D3D12-INPUT-PAD-TAPE— el tape de los mandos: graba lo que el juego ve y lo reproduce. Y es hermano delLEONIDA_KBM_BINDSde#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
skippedde#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
gameinputen 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 on GitHub · 2026-12-03 18:02 UTC · original
Thanks for the work on this. This pull request has a merge conflict with the current
mainand 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 latestmaininto 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
Pull request closed