feat(input): record the player's input and replay it frame for frame #1582

Merged
HumanBean merged 12 commits from dyst/Longshot:feat/input-recording into main 2026-11-21 20:14:44 +00:00
Member

Summary

There was no way to give the game the same input twice. Every test run, A/B and bug repro depended on someone, or a script, steering the same way by hand, and nothing could tell when the game itself went another way. This PR lets the game record everything the player's input does to it, frame by frame, and give it back:

  • the controller, after every device and filter;
  • the flight and free camera cheats' inputs;
  • the gyroscope;
  • the native mouse camera;
  • the menu mouse.

Each replay holds itself to two fingerprints of the original run, Link's position and the camera's state, and logs where the game first went its own way. In the game, a 65 s route in Link's house replays exactly, every update of Link's and the camera's identical. In Castle Town's market the input replays exactly, but the game drifts by its last bits from about 22 s (Measurements).

  • HOS_INPUT_RECORD=<file> records.
  • HOS_INPUT_PLAY=<file> plays a recording back in place of the player's devices, the script and the bridge, and checks the run against it. With both set, the replay is recorded too, to another file; naming the played file is refused, so the recording is kept.
  • HOS_INPUT_SNAP=1 puts the camera and Link back where a replay leaves the recording.
  • HOS_INPUT_FROM=boot starts a recording at the game's first read instead of the frame after Link's first update.
  • MX=/MY= in HOS_INPUT_SCRIPT move the mouse, for the native camera's tests.
  • With neither switch set, every hook returns after one atomic load: a player's game reads, locks and copies nothing for it.

Read first:

  • host/input_movie.h: the format and its logic, game-free.
  • host/input_movie.c: the switches, the file, the start and the checks.
  • The hooks:
    • npad_states and GetSixAxisSensorStates in host/nn_hid.c;
    • hos_mouse_camera in host/mouse_native.c;
    • hos_oot_menu_tick in host/oot_menu.c;
    • hos_oot_lift_player in host/hos_main.c.
  • The docs: Input recordings in docs/dev/reference/input.md.

Details:

  • A frame has one pad. The game reads controller No.1 twice in most frames, from its jobs, while Link updates on another worker. Recording, a frame's first read takes the input and its later reads get the same; a replay gives every read of frame n frame n's pad. Camera updates, motion reads and Link's marks are held by their frame and their call within it, so one more or one fewer in a frame shifts nothing after it.
  • Frame 0 is the frame after Link's first update, by the game clock, so a load that takes more or fewer frames doesn't move the input.
  • A replayed menu choice goes to the game only for a button on that screen now, or one of Key Items' items. Any other is counted as not met.
  • hos_close_finish (host/hos_relaunch.c) ends the recording, since ExitProcess runs no atexit handler.
  • The format is ls-input-recording/1, the format of mooki's ls-workbench (play/pilot/inputlog.py). Its pad, cam, gyro, motion, focus, itemkey, frames, view and mark lines are ones that tool's converters pass over.

See #1113

Testing

Tested: Windows 11, RTX 3080 (621.14), Ryzen 9 3900X, at 263874da on main 9dd41326, as a pack over the base. Each run went through the job queue:

  • Settings: the 60 cap, Per frame (HOS_REALTIME_STEP=0), HOS_FIXED_TIME, no sound device, Skip title screen, the native mouse camera on.
  • Input: a frame-clocked script of walks, rolls, swings, the camera stick, and mouse turns with MX=/MY=.
  • Link's house (kokiri-start): one run recorded 3870 frames (7740 reads, 2680 camera updates), then:
    • two replays, each recorded too: both exact. All 7740 reads were given back, 0 of 3869 updates of Link's and 0 of 2680 camera updates were apart, and no frame had another count of reads. The bridge's samples were identical at every common present, recording against each replay and the replays against each other.
    • a replay with HOS_INPUT_SNAP=1: the same, nothing to put back.
    • a replay with HOS_INPUT_RECORD naming the played file: refused in the log, the recording's sha256 the same before and after, the playback carried on.
    • a run with neither switch: no recorder line in the log, and the script played as before.
  • Castle Town market (market-entrance): one run recorded 3818 frames, then two replays. Pads, frames and camera inputs were identical; the game drifted (Measurements). A third replay, with HOS_INPUT_SNAP=1, put Link back at 2013 updates (the largest 0.087 m) and the camera at 144, through his character controller's own move. The game played the route through and the replay ended normally.
  • The checks: python -I -B tests/run_all.py with the Builder's llvm-mingw gives 719 passed, 70 failed, 126 skipped. The same 70 fail on clean main 9dd41326, which has 3 more failures (load-related) and 715 passes; none is touched here. The checks that read the changed files pass:
    • tests/test_input_movie.py: the format; recording and playback; the refusal by name, by another spelling and by a hard link; the cost with neither switch, 1 lock and 0 guest reads in 150 frames of hooks; one extra or missing update a frame.
    • tests/test_oot_menu_mouse.py: a replay's menu choices checked against the screen.
    • test_input_background, test_windows_stop, test_crash_record, test_oot_state_tap and test_mouse_native, the last three among the checks that build the touched files with stubs. test_input_background and test_crash_record fail identically on main.

Still to test:

  • Linux, any GPU: build, then record a short walk with HOS_INPUT_RECORD=run.jsonl and play it with HOS_INPUT_PLAY=run.jsonl (the same save, the 60 cap, HOS_REALTIME_STEP=0). Expect the build to pass and the log's input: playback over at frame N of N, with the replay moving as recorded (@Beanstalk linux, build, then record and replay a walk)
  • A gyroscope pad and the menu mouse in the game, both covered game-free only so far: record a route that turns with the gyro and picks in the pause menu with the mouse, then replay it. Expect motion lines in the recording, and menu choices given matching the recording's count with 0 not met (by hand)

Measurements

Verdict: the input replays exactly. In Link's house the run does too, Link and the camera identical at every update. In the market the game drifts from update 1336 by its last bits, the determinism still open. With the switches unset the PR costs nothing measurable: 71.2 fps against main's 70.6, within main's own spread from run to run (69.9 to 71.2).

Setup: Windows 11, RTX 3080 (621.14), Ryzen 9 3900X, 32 GB. The cost with the switches unset was measured with dev.py ab, this PR against its base, A1 B1 A2 B2:

  • Scene: Hyrule Field, child, from the kokiri-start save and the Debug tab's teleport.
  • Settings: the cap off, every run from one pinned options file.
  • Timing: a warm-up until no frame waited for a pipeline (at least 10 s), then 60 s measured from the frame trace.

Each value below is the mean of the two runs, each run's in brackets. The tool refused to write the section itself, because each run's HOS_CONTROL socket name differs (a per-session random name).

Switches unset, Hyrule Field Before: main @ 9dd41326 After: this PR @ 263874da
fps 70.6 (71.2, 69.9) 71.2 (71.3, 71.1)
1% low 45.2 fps (47.8, 42.6) 46.6 fps (46.5, 46.6)
Median frame time 13.92 ms (13.85, 13.99) 13.82 ms (13.78, 13.86)
p99 frame time 22.20 ms (20.92, 23.48) 21.48 ms (21.50, 21.45)

The replays, from the same runtime: each replay's own checks are in its log, and the bridge's samples were lined up at Link's first update. The 60 cap, Per frame, HOS_FIXED_TIME, no sound device, the native mouse camera on, the same frame-clocked script.

Link's house, 3870 frames After, replay 1: this PR @ 263874da After, replay 2: this PR @ 263874da After, snapped: this PR @ 263874da
Reads given back 7740 of 7740 7740 of 7740 7740 of 7740
Frames with another count of reads 0 0 0
Updates of Link's apart 0 of 3869 0 of 3869 0 of 3869 (0 put back)
Camera updates apart 0 of 2680 0 of 2680 0 of 2680 (0 put back)
Castle Town market, 3818 frames After, replay 1: this PR @ 263874da After, replay 2: this PR @ 263874da
Frames with another count of reads 0 0
Link's first update apart 1336, 0.00002 m 1336, 0.00002 m
Updates of Link's apart 2469 of 3817 2444 of 3817
Camera's first update apart 10, pitch 5e-6° 1338, yaw 5e-5°
Camera updates apart 989 of 3818 85 of 3818

Both market replays left the recording at the same update, at the same position, and stayed together for about 2000 updates. So the difference is most likely the game's own state at frame 0 rather than the input. The recording started at game clock 2183, both replays at 2037. In the PR's first measurements (Hyrule Field, before one pad a frame) 29 and 90 frames started at another read; now none does.

Switches

Switch What it is Ships at Why
HOS_INPUT_RECORD=<file> records the input unset (diag) a test tool: nothing for a player
HOS_INPUT_PLAY=<file> plays a recording back unset (diag) a test tool
HOS_INPUT_SNAP=1 puts the camera and Link back where a replay leaves the recording unset (diag) a route-follower, not a proof: off unless asked
HOS_INPUT_FROM=boot a recording from the game's first read unset: from the frame after Link's first update the load moved the input (768 and 551 frames in two runs)
MX=/MY= in HOS_INPUT_SCRIPT the mouse's motion in a script no default: a script's own for the native camera's tests

Read, not added: HOS_FIXED_TIME, which the header notes, and HOS_MOUSE_SENS, which hos_mouse_sensitivity takes before the first read has set the sensitivity up, as mouse_setup does.

Risks

What could break: nothing with the switches unset. Each hook returns after one atomic load, and the callers read and copy nothing (measured above). The one player-path change besides is hos_mouse_sensitivity(), which only reads: before the first controller read that sets the mouse up, it returns HOS_MOUSE_SENS or the menu's value, clamped 0.1 to 5, where main's camera turned by 0. With the switches set, a recording from another build, save or set of settings replays the input but not the run, and the fingerprints say where.

Turning it off: leave the switches unset.

After updating: nothing changes for a player: no new setting, file or cache.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: not built here, see Still to test; the Windows paths are UTF-8 through the exe's manifest)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary There was no way to give the game the same input twice. Every test run, A/B and bug repro depended on someone, or a script, steering the same way by hand, and nothing could tell when the game itself went another way. This PR lets the game record everything the player's input does to it, frame by frame, and give it back: - the controller, after every device and filter; - the flight and free camera cheats' inputs; - the gyroscope; - the native mouse camera; - the menu mouse. Each replay holds itself to two fingerprints of the original run, Link's position and the camera's state, and logs where the game first went its own way. In the game, a 65 s route in Link's house replays exactly, every update of Link's and the camera's identical. In Castle Town's market the input replays exactly, but the game drifts by its last bits from about 22 s (Measurements). - `HOS_INPUT_RECORD=<file>` records. - `HOS_INPUT_PLAY=<file>` plays a recording back in place of the player's devices, the script and the bridge, and checks the run against it. With both set, the replay is recorded too, to another file; naming the played file is refused, so the recording is kept. - `HOS_INPUT_SNAP=1` puts the camera and Link back where a replay leaves the recording. - `HOS_INPUT_FROM=boot` starts a recording at the game's first read instead of the frame after Link's first update. - `MX=`/`MY=` in `HOS_INPUT_SCRIPT` move the mouse, for the native camera's tests. - With neither switch set, every hook returns after one atomic load: a player's game reads, locks and copies nothing for it. Read first: - `host/input_movie.h`: the format and its logic, game-free. - `host/input_movie.c`: the switches, the file, the start and the checks. - The hooks: - `npad_states` and `GetSixAxisSensorStates` in `host/nn_hid.c`; - `hos_mouse_camera` in `host/mouse_native.c`; - `hos_oot_menu_tick` in `host/oot_menu.c`; - `hos_oot_lift_player` in `host/hos_main.c`. - The docs: Input recordings in `docs/dev/reference/input.md`. Details: - A frame has one pad. The game reads controller No.1 twice in most frames, from its jobs, while Link updates on another worker. Recording, a frame's first read takes the input and its later reads get the same; a replay gives every read of frame n frame n's pad. Camera updates, motion reads and Link's marks are held by their frame and their call within it, so one more or one fewer in a frame shifts nothing after it. - Frame 0 is the frame after Link's first update, by the game clock, so a load that takes more or fewer frames doesn't move the input. - A replayed menu choice goes to the game only for a button on that screen now, or one of Key Items' items. Any other is counted as not met. - `hos_close_finish` (`host/hos_relaunch.c`) ends the recording, since `ExitProcess` runs no atexit handler. - The format is ls-input-recording/1, the format of mooki's [ls-workbench](https://github.com/mooki000/ls-workbench) (`play/pilot/inputlog.py`). Its `pad`, `cam`, `gyro`, `motion`, `focus`, `itemkey`, `frames`, `view` and `mark` lines are ones that tool's converters pass over. See #1113 ## Testing **Tested:** Windows 11, RTX 3080 (621.14), Ryzen 9 3900X, at 263874da on `main` 9dd41326, as a pack over the base. Each run went through the job queue: - **Settings:** the 60 cap, Per frame (`HOS_REALTIME_STEP=0`), `HOS_FIXED_TIME`, no sound device, Skip title screen, the native mouse camera on. - **Input:** a frame-clocked script of walks, rolls, swings, the camera stick, and mouse turns with `MX=`/`MY=`. - **Link's house** (`kokiri-start`): one run recorded 3870 frames (7740 reads, 2680 camera updates), then: - **two replays, each recorded too:** both exact. All 7740 reads were given back, 0 of 3869 updates of Link's and 0 of 2680 camera updates were apart, and no frame had another count of reads. The bridge's samples were identical at every common present, recording against each replay and the replays against each other. - **a replay with `HOS_INPUT_SNAP=1`:** the same, nothing to put back. - **a replay with `HOS_INPUT_RECORD` naming the played file:** refused in the log, the recording's sha256 the same before and after, the playback carried on. - **a run with neither switch:** no recorder line in the log, and the script played as before. - **Castle Town market** (`market-entrance`): one run recorded 3818 frames, then two replays. Pads, frames and camera inputs were identical; the game drifted (Measurements). A third replay, with `HOS_INPUT_SNAP=1`, put Link back at 2013 updates (the largest 0.087 m) and the camera at 144, through his character controller's own move. The game played the route through and the replay ended normally. - **The checks:** `python -I -B tests/run_all.py` with the Builder's llvm-mingw gives 719 passed, 70 failed, 126 skipped. The same 70 fail on clean `main` 9dd41326, which has 3 more failures (load-related) and 715 passes; none is touched here. The checks that read the changed files pass: - `tests/test_input_movie.py`: the format; recording and playback; the refusal by name, by another spelling and by a hard link; the cost with neither switch, 1 lock and 0 guest reads in 150 frames of hooks; one extra or missing update a frame. - `tests/test_oot_menu_mouse.py`: a replay's menu choices checked against the screen. - `test_input_background`, `test_windows_stop`, `test_crash_record`, `test_oot_state_tap` and `test_mouse_native`, the last three among the checks that build the touched files with stubs. `test_input_background` and `test_crash_record` fail identically on `main`. **Still to test:** - Linux, any GPU: build, then record a short walk with `HOS_INPUT_RECORD=run.jsonl` and play it with `HOS_INPUT_PLAY=run.jsonl` (the same save, the 60 cap, `HOS_REALTIME_STEP=0`). Expect the build to pass and the log's `input: playback over at frame N of N`, with the replay moving as recorded (@Beanstalk linux, build, then record and replay a walk) - A gyroscope pad and the menu mouse in the game, both covered game-free only so far: record a route that turns with the gyro and picks in the pause menu with the mouse, then replay it. Expect `motion` lines in the recording, and `menu choices given` matching the recording's count with 0 not met (by hand) ## Measurements **Verdict:** the input replays exactly. In Link's house the run does too, Link and the camera identical at every update. In the market the game drifts from update 1336 by its last bits, the determinism still open. With the switches unset the PR costs nothing measurable: 71.2 fps against `main`'s 70.6, within `main`'s own spread from run to run (69.9 to 71.2). Setup: Windows 11, RTX 3080 (621.14), Ryzen 9 3900X, 32 GB. The cost with the switches unset was measured with `dev.py ab`, this PR against its base, A1 B1 A2 B2: - **Scene:** Hyrule Field, child, from the `kokiri-start` save and the Debug tab's teleport. - **Settings:** the cap off, every run from one pinned options file. - **Timing:** a warm-up until no frame waited for a pipeline (at least 10 s), then 60 s measured from the frame trace. Each value below is the mean of the two runs, each run's in brackets. The tool refused to write the section itself, because each run's `HOS_CONTROL` socket name differs (a per-session random name). | Switches unset, Hyrule Field | Before: main @ 9dd41326 | After: this PR @ 263874da | |---|---|---| | fps | 70.6 (71.2, 69.9) | 71.2 (71.3, 71.1) | | 1% low | 45.2 fps (47.8, 42.6) | 46.6 fps (46.5, 46.6) | | Median frame time | 13.92 ms (13.85, 13.99) | 13.82 ms (13.78, 13.86) | | p99 frame time | 22.20 ms (20.92, 23.48) | 21.48 ms (21.50, 21.45) | The replays, from the same runtime: each replay's own checks are in its log, and the bridge's samples were lined up at Link's first update. The 60 cap, Per frame, `HOS_FIXED_TIME`, no sound device, the native mouse camera on, the same frame-clocked script. | Link's house, 3870 frames | After, replay 1: this PR @ 263874da | After, replay 2: this PR @ 263874da | After, snapped: this PR @ 263874da | |---|---|---|---| | Reads given back | 7740 of 7740 | 7740 of 7740 | 7740 of 7740 | | Frames with another count of reads | 0 | 0 | 0 | | Updates of Link's apart | 0 of 3869 | 0 of 3869 | 0 of 3869 (0 put back) | | Camera updates apart | 0 of 2680 | 0 of 2680 | 0 of 2680 (0 put back) | | Castle Town market, 3818 frames | After, replay 1: this PR @ 263874da | After, replay 2: this PR @ 263874da | |---|---|---| | Frames with another count of reads | 0 | 0 | | Link's first update apart | 1336, 0.00002 m | 1336, 0.00002 m | | Updates of Link's apart | 2469 of 3817 | 2444 of 3817 | | Camera's first update apart | 10, pitch 5e-6° | 1338, yaw 5e-5° | | Camera updates apart | 989 of 3818 | 85 of 3818 | Both market replays left the recording at the same update, at the same position, and stayed together for about 2000 updates. So the difference is most likely the game's own state at frame 0 rather than the input. The recording started at game clock 2183, both replays at 2037. In the PR's first measurements (Hyrule Field, before one pad a frame) 29 and 90 frames started at another read; now none does. ### Switches | Switch | What it is | Ships at | Why | |---|---|---|---| | `HOS_INPUT_RECORD=<file>` | records the input | unset (diag) | a test tool: nothing for a player | | `HOS_INPUT_PLAY=<file>` | plays a recording back | unset (diag) | a test tool | | `HOS_INPUT_SNAP=1` | puts the camera and Link back where a replay leaves the recording | unset (diag) | a route-follower, not a proof: off unless asked | | `HOS_INPUT_FROM=boot` | a recording from the game's first read | unset: from the frame after Link's first update | the load moved the input (768 and 551 frames in two runs) | | `MX=`/`MY=` in `HOS_INPUT_SCRIPT` | the mouse's motion in a script | no default: a script's own | for the native camera's tests | Read, not added: `HOS_FIXED_TIME`, which the header notes, and `HOS_MOUSE_SENS`, which `hos_mouse_sensitivity` takes before the first read has set the sensitivity up, as `mouse_setup` does. ## Risks **What could break:** nothing with the switches unset. Each hook returns after one atomic load, and the callers read and copy nothing (measured above). The one player-path change besides is `hos_mouse_sensitivity()`, which only reads: before the first controller read that sets the mouse up, it returns `HOS_MOUSE_SENS` or the menu's value, clamped 0.1 to 5, where `main`'s camera turned by 0. With the switches set, a recording from another build, save or set of settings replays the input but not the run, and the fingerprints say where. **Turning it off:** leave the switches unset. **After updating:** nothing changes for a player: no new setting, file or cache. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: not built here, see Still to test; the Windows paths are UTF-8 through the exe's manifest) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
HOS_INPUT_RECORD=<file> writes the word and sticks npad_states hands the
game at each read of controller No.1 (after every source of input), as
ls-input-recording/1 (mooki's ls-workbench format) with pad runs, Link's
positions as marks and notes for what it does not hold. HOS_INPUT_PLAY
gives them back from the same read, none of the merge running, and holds
each of Link's updates to the marks, logging the first that differs.
Read 0 is the first read after Link's first update (HOS_INPUT_FROM=boot:
the game's first read). Issue 1113.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The recording now also holds the motion readings the game is handed
(gyro/motion lines), each player camera update's native mouse camera
decisions and turn (cam lines: on, free, held, degrees), the menu
mouse's focus changes and Items page choices (focus/itemkey lines), and
the flight and free camera cheats' inputs with each pad run. A replay
gives each of them back at the same point instead of the devices, the
menu's mouse rows and the window's clock. MX=/MY= in the script grammar
move the mouse for the native camera's tests. The input background
check's harness gets the recording's two stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A test script's MX= and MY= under HOS_INPUT_EXCLUSIVE turned the camera by
0 degrees: read_input returns before the mouse, where the sensitivity is
set up, so it stayed 0. hos_mouse_sensitivity() sets it up when it is not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The game reads controller No.1 twice a frame on its main thread while
Link's update runs on a worker, so the first read after his first update
was the first of a frame's two in one run and the second in another:
every input came half a frame early or late where it changed, and replays
drifted (0.00002 m at a stick's release, 1806 updates in). The start is
now the first read of the frame after his first update, by the game clock
(hos_step_probe's +0xd58), each frame's reads are written as frames runs,
and a replay starts each frame at its recorded first read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(input): a replay records itself too when HOS_INPUT_RECORD is set beside HOS_INPUT_PLAY
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 12s
ca473cafcc
Its own marks, views, frames and camera lines, written as a recording's,
to set beside the one it plays. The last frame is written only when it had
reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 3080 (621.14), Ryzen 9 3900X: Hyrule Field from a save, 60 cap, Per frame, native mouse camera on. Recorded about 60 s (walks, rolls, swings, camera stick, mouse turns), replayed twice: every read given back (6929 of 6929), menu and camera lines given back; the replays' own checks find the game drifting on its own: the camera's pitch by 1e-6 degrees within 20 updates, Link by 0.00002 m after about 1200 updates. Investigating.

Tested in game: Windows 11, RTX 3080 (621.14), Ryzen 9 3900X: Hyrule Field from a save, 60 cap, Per frame, native mouse camera on. Recorded about 60 s (walks, rolls, swings, camera stick, mouse turns), replayed twice: every read given back (6929 of 6929), menu and camera lines given back; the replays' own checks find the game drifting on its own: the camera's pitch by 1e-6 degrees within 20 updates, Link by 0.00002 m after about 1200 updates. Investigating.
futondestroyer left a comment

Verdict: Request changes. The recorder gives us useful evidence about repeatability. Playback can deliver a future frame’s input early, the default path still takes replay locks and reads the guest clock, and recording a replay can overwrite its source tape.

Reviewed head ca473cafcc91 against 430eef4f2cc9. Read the tape format and parser, recorder and playback glue, changed host hooks, fixtures and switch/docs changes. Followed the input, camera, menu and shutdown paths using both exact-revision Graphify maps and source. Code review only. No changes pushed.

Checked The feature captures the final pad word after live input processing, preserves the cheat axes, and reports camera and player-position drift separately. The explicit close hook addresses Windows exits that bypass atexit. The reported Windows run is useful evidence of what the current branch can and cannot reproduce.

Blocking

  1. host/input_movie.c:255 and tests/test_input_movie.py:583. Frame alignment is applied at the next frame’s first read, after an extra read may already have consumed the next frame’s input. The fixture explicitly accepts that outcome: the third read of frame 30 receives frame 31’s first pad, and frame 31 starts by delivering it again. A button edge can therefore happen a frame early. Use the recorded range for the current frame and report missing or surplus reads as input divergence. Test that a surplus read never consumes an event from a later frame, and that an omitted read is reported. Recheck the reported drift after input delivery is accounted for.
  2. host/input_movie.c:209. The switches-unset path still takes two exclusive locks per connected pad read, and begin reads the guest clock every time. The camera snapshots angles before its playback check, Link’s hook loads position before the off check, and live gyro history is copied before the recording hook returns off. Gate those operations on a cached mode so the ordinary path stays cheap, and verify the switches-unset behavior and cost.
  3. host/input_movie.c:191. If playback and recording name the same file, the tape loads first and the writer then opens that path with wb. The first playback read can truncate the original. This also applies to aliases of the same file. Reject an input/output collision or create a separate output safely. Test that the source bytes survive an attempted self-recording.
  4. host/oot_menu.c:830. Live hover passes a button taken from the current screen’s list. Replay passes a saved guest button address straight to the setter after checking only the screen address. Buttons can be rebuilt while a screen remains alive. Resolve the recorded choice against the current screen or validate membership before making the call. Count a missing button or failed setter as missed and exercise that case in the fixture.

Suggestions Validate tape floats for finiteness, and use bounded yaw normalization in hos_mouse_camera. The current camera parser accepts range-overflow results from strtof, and repeated subtraction can fail to make progress. Use UTF-8-aware file opens on Windows for the documented paths. For automation, report verified per-frame delivery separately from reaching the final read index. The reported 29 and 90 frame resyncs matter even when the last read index is 6,929.

Testing The author reports one Windows RTX 3080 capture and two replays with input resyncs and state drift. Linux, physical gyro and menu-mouse playback remain open. Please run the record and replay sequence by hand on Linux or provide a supported farm route that preserves the tape between launches. The description check passed. The guide screenshot job is red on both this head and the base, so the status alone does not establish a new failure. List the failed checks that reproduce on main before marking ready.

The boot-save PR is related to repeatable starting state. No required merge order found.

**Verdict: Request changes.** The recorder gives us useful evidence about repeatability. Playback can deliver a future frame’s input early, the default path still takes replay locks and reads the guest clock, and recording a replay can overwrite its source tape. **Reviewed** head `ca473cafcc91` against `430eef4f2cc9`. Read the tape format and parser, recorder and playback glue, changed host hooks, fixtures and switch/docs changes. Followed the input, camera, menu and shutdown paths using both exact-revision Graphify maps and source. Code review only. No changes pushed. **Checked** The feature captures the final pad word after live input processing, preserves the cheat axes, and reports camera and player-position drift separately. The explicit close hook addresses Windows exits that bypass `atexit`. The reported Windows run is useful evidence of what the current branch can and cannot reproduce. **Blocking** 1. `host/input_movie.c:255` and `tests/test_input_movie.py:583`. Frame alignment is applied at the next frame’s first read, after an extra read may already have consumed the next frame’s input. The fixture explicitly accepts that outcome: the third read of frame 30 receives frame 31’s first pad, and frame 31 starts by delivering it again. A button edge can therefore happen a frame early. Use the recorded range for the current frame and report missing or surplus reads as input divergence. Test that a surplus read never consumes an event from a later frame, and that an omitted read is reported. Recheck the reported drift after input delivery is accounted for. 2. `host/input_movie.c:209`. The switches-unset path still takes two exclusive locks per connected pad read, and begin reads the guest clock every time. The camera snapshots angles before its playback check, Link’s hook loads position before the off check, and live gyro history is copied before the recording hook returns off. Gate those operations on a cached mode so the ordinary path stays cheap, and verify the switches-unset behavior and cost. 3. `host/input_movie.c:191`. If playback and recording name the same file, the tape loads first and the writer then opens that path with `wb`. The first playback read can truncate the original. This also applies to aliases of the same file. Reject an input/output collision or create a separate output safely. Test that the source bytes survive an attempted self-recording. 4. `host/oot_menu.c:830`. Live hover passes a button taken from the current screen’s list. Replay passes a saved guest button address straight to the setter after checking only the screen address. Buttons can be rebuilt while a screen remains alive. Resolve the recorded choice against the current screen or validate membership before making the call. Count a missing button or failed setter as missed and exercise that case in the fixture. **Suggestions** Validate tape floats for finiteness, and use bounded yaw normalization in `hos_mouse_camera`. The current camera parser accepts range-overflow results from `strtof`, and repeated subtraction can fail to make progress. Use UTF-8-aware file opens on Windows for the documented paths. For automation, report verified per-frame delivery separately from reaching the final read index. The reported 29 and 90 frame resyncs matter even when the last read index is 6,929. **Testing** The author reports one Windows RTX 3080 capture and two replays with input resyncs and state drift. Linux, physical gyro and menu-mouse playback remain open. Please run the record and replay sequence by hand on Linux or provide a supported farm route that preserves the tape between launches. The description check passed. The guide screenshot job is red on both this head and the base, so the status alone does not establish a new failure. List the failed checks that reproduce on main before marking ready. [The boot-save PR](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1577) is related to repeatable starting state. No required merge order found.
@ -0,0 +206,4 @@
/* ---- the controller (nn_hid.c npad_states) ---- */
int hos_input_movie_begin(void) {
AcquireSRWLockExclusive(&movie_lock);
Member

Both pad hooks take this exclusive lock even after mode is known to be off, and begin reads the guest clock. Use a cached off path before lock or guest reads, including the caller-side state copies.

Both pad hooks take this exclusive lock even after mode is known to be off, and begin reads the guest clock. Use a cached off path before lock or guest reads, including the caller-side state copies.
@ -0,0 +252,4 @@
ReleaseSRWLockExclusive(&movie_lock);
return;
}
const uint32_t f = movie_reads++;
Member

Bound each pad lookup to the current recorded frame. An extra read currently consumes the next frame’s input early, then next-frame resync delivers it again. The fixture explicitly accepts that.

Bound each pad lookup to the current recorded frame. An extra read currently consumes the next frame’s input early, then next-frame resync delivers it again. The fixture explicitly accepts that.
@ -0,0 +188,4 @@
movie_mode == MOVIE_RECORD ? "replay of this recording" : "replay");
const long long present = (long long)__atomic_load_n(&hos_present_count, __ATOMIC_RELAXED);
if (movie_rec) {
movie_file = fopen(movie_rec_path, "wb");
Member

The input tape was loaded earlier. If this path names that same file, wb truncates the original on playback start. Protect input/output identity, including aliases.

The input tape was loaded earlier. If this path names that same file, wb truncates the original on playback start. Protect input/output identity, including aliases.
host/oot_menu.c Outdated
@ -820,0 +827,4 @@
if (hos_input_movie_playing()) {
MovieMenu m;
while (hos_input_movie_menu_take(screen, &m)) {
if (m.kind == 1) set_focus(c, screen, m.button);
Member

This address comes from a tape. Validate that the button belongs to the current screen, or resolve a stable logical ID, before calling the guest setter. Count a missing or rejected event as missed.

This address comes from a tape. Validate that the button belongs to the current screen, or resolve a stable logical ID, before calling the guest setter. Count a missing or rejected event as missed.
The game reads controller No.1 from its job graphs, twice in most frames,
while Link's update runs on another worker: an input that changed between
a frame's two reads reached Link or not as the race went, and replays left
the recording at the first stick change (the same update in every pair of
runs). Recording, a frame's first read takes the input and its later reads
are given the same pad; a replay gives every read of frame n the pad of
frame n. f counts game frames by the game clock in every line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(input): HOS_INPUT_SNAP puts the camera and Link back where a replay leaves the recording
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
626fb0c8f8
View lines now carry the camera's state block (14 words from +0x178: the
pitch it eases to, the pitch, the yaw), so a replay can be held to all of
it. With HOS_INPUT_SNAP=1 a replay that leaves a fingerprint gets it back:
the block written at the start of that camera update, and Link moved to the
mark's position through the game's own move of his character controller
(OneShotPhysicsCctChangePosition, as the Mark and Return cheats do). Each
snap is counted; the end says how many and the largest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Pushed through 626fb0c8 since this opened:

  • One pad a game frame (376e4491). The game reads controller No.1 twice in most frames, from its job graphs, while Link updates on another worker; an input that changed between a frame's two reads reached Link or not as the race went, so replays left the recording at the first stick change (the same update in every pair of runs). Recording, a frame's first read takes the input and its later reads get the same pad; a replay gives every read of frame n frame n's pad. f counts game frames (the game clock) in every line. In the game this took the pads and frames to identical in every pair of runs (3824 frames).
  • A replay recorded too (ca473caf): HOS_INPUT_RECORD beside HOS_INPUT_PLAY writes the replay's own marks, views and frames, to set beside the recording's.
  • The camera as a second fingerprint (1d345041, 626fb0c8): view lines carry the camera's state block (14 words from +0x178), held to exactly.
  • HOS_INPUT_SNAP=1 (626fb0c8): where a replay leaves a fingerprint, the camera's block is written back and Link is moved to the mark's position through the game's own move of his character controller (OneShotPhysicsCctChangePosition, as Mark/Return do), each counted. Game-free check only so far: not run in the game yet.

What is left is the game's own nondeterminism with identical input: the camera's pitch target (+0x188) starts rising faster 3 frames apart between runs (camera dumps), most likely a background loader finishing at another frame. Under investigation; the description will follow once it is settled.

Pushed through 626fb0c8 since this opened: - **One pad a game frame** (376e4491). The game reads controller No.1 twice in most frames, from its job graphs, while Link updates on another worker; an input that changed between a frame's two reads reached Link or not as the race went, so replays left the recording at the first stick change (the same update in every pair of runs). Recording, a frame's first read takes the input and its later reads get the same pad; a replay gives every read of frame n frame n's pad. `f` counts game frames (the game clock) in every line. In the game this took the pads and frames to identical in every pair of runs (3824 frames). - **A replay recorded too** (ca473caf): `HOS_INPUT_RECORD` beside `HOS_INPUT_PLAY` writes the replay's own marks, views and frames, to set beside the recording's. - **The camera as a second fingerprint** (1d345041, 626fb0c8): view lines carry the camera's state block (14 words from `+0x178`), held to exactly. - **`HOS_INPUT_SNAP=1`** (626fb0c8): where a replay leaves a fingerprint, the camera's block is written back and Link is moved to the mark's position through the game's own move of his character controller (`OneShotPhysicsCctChangePosition`, as Mark/Return do), each counted. Game-free check only so far: **not run in the game yet**. What is left is the game's own nondeterminism with identical input: the camera's pitch target (`+0x188`) starts rising faster 3 frames apart between runs (camera dumps), most likely a background loader finishing at another frame. Under investigation; the description will follow once it is settled.
feat(input): the camera's inputs in its fingerprint: told apart from its state, and put back first by HOS_INPUT_SNAP
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
79014d29cd
The player camera's update makes the pitch it eases to (+0x188, where two
replays of one recording first part) from +0x45c..+0x48c of the object at
0x84c9ede0 (f_80644c80's reads); the sun shadow fits a box there each
frame, so it follows what the renderer sees. View lines carry those 13
words as "in"; a replay says when they leave the recording before the
camera does, and HOS_INPUT_SNAP writes them back before the camera reads
them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner

Two things this needs before it can carry test and A/B routes:

1. Teleports and the Insert menu's other actions in the recording. A teleport, an age switch, an item or a Mark/Return from the Insert menu (or the bridge, or HOS_INPUT_LIVE's !cheat) changes the game directly, not through the controller, so HOS_INPUT_RECORD doesn't see it: the replay presses the same buttons where Link never went, and the marks call it drift from there on. The cheats' on/off state isn't in it either (only the flight and free camera cheats' sticks). A test route almost always starts with one ("teleport to X, walk to Y"), so:

  • record each action where it is taken (the Debug and Cheats actions in host/hos_main.c, the teleport through oot_teleport_followup): an action line with its frame, its number and its argument (destination, age, item), and a cheat line when a toggle changes;
  • on play, take it again at that frame, then wait for the load to end (as the default start waits for Link's first update) before the next pad, so a teleport whose load takes more or fewer frames doesn't move the input after it;
  • the header could note the cheats' state at frame 0, so a replay starts from the same toggles.

2. Determinism, so a replay is the same run and not only the same input. The measurements show the input given back read for read, but the camera's pitch apart in its last bits within 20 updates and Link apart after ~20 s, growing. Until that's found the replay can't be a test ("Link reaches Y"), only a route. Places I'd look, from the numbers:

  • the camera differs first, from update 9-11, and 29/90 frames started at another read: the game reads the pad twice a frame from its jobs while Link updates on another worker, so which read a job saw is the jobs' race. Holding a frame's pad for all its reads doesn't make the job order the same. Worth logging, per frame, which read each consumer took, in both runs;
  • anything the game takes from the wall clock or the host's timers besides HOS_FIXED_TIME (the audio clock with no sound device, nn::os ticks, the mouse camera's window clock if anything still reads it);
  • the game's RNG: whether it is seeded from a tick, and whether it is stepped from a job whose count per frame varies;
  • float state per worker thread (MXCSR / FTZ-DAZ) if the jobs run on different threads in the two runs.

A drift check would help hold it: record, replay twice, and report the first mark apart, so a fix shows as that update number moving out (and a regression as it moving in). Until then HOS_INPUT_SNAP is a good stopgap for routes.

Happy to help with either, the action lines especially.

Two things this needs before it can carry test and A/B routes: **1. Teleports and the Insert menu's other actions in the recording.** A teleport, an age switch, an item or a Mark/Return from the Insert menu (or the bridge, or `HOS_INPUT_LIVE`'s `!cheat`) changes the game directly, not through the controller, so `HOS_INPUT_RECORD` doesn't see it: the replay presses the same buttons where Link never went, and the marks call it drift from there on. The cheats' on/off state isn't in it either (only the flight and free camera cheats' sticks). A test route almost always starts with one ("teleport to X, walk to Y"), so: - record each action where it is taken (the Debug and Cheats actions in `host/hos_main.c`, the teleport through `oot_teleport_followup`): an `action` line with its frame, its number and its argument (destination, age, item), and a `cheat` line when a toggle changes; - on play, take it again at that frame, then wait for the load to end (as the default start waits for Link's first update) before the next pad, so a teleport whose load takes more or fewer frames doesn't move the input after it; - the header could note the cheats' state at frame 0, so a replay starts from the same toggles. **2. Determinism, so a replay is the same run and not only the same input.** The measurements show the input given back read for read, but the camera's pitch apart in its last bits within 20 updates and Link apart after ~20 s, growing. Until that's found the replay can't be a test ("Link reaches Y"), only a route. Places I'd look, from the numbers: - the camera differs first, from update 9-11, and 29/90 frames started at another read: the game reads the pad twice a frame from its jobs while Link updates on another worker, so which read a job saw is the jobs' race. Holding a frame's pad for all its reads doesn't make the *job order* the same. Worth logging, per frame, which read each consumer took, in both runs; - anything the game takes from the wall clock or the host's timers besides `HOS_FIXED_TIME` (the audio clock with no sound device, `nn::os` ticks, the mouse camera's window clock if anything still reads it); - the game's RNG: whether it is seeded from a tick, and whether it is stepped from a job whose count per frame varies; - float state per worker thread (MXCSR / FTZ-DAZ) if the jobs run on different threads in the two runs. A drift check would help hold it: record, replay twice, and report the first mark apart, so a fix shows as that update number moving out (and a regression as it moving in). Until then `HOS_INPUT_SNAP` is a good stopgap for routes. Happy to help with either, the action lines especially.
HumanBean left a comment

Recommendation: Request changes. The design is right: it records input where it reaches the game, it gives each frame its own pad, and the drift checks are honest. But three of the earlier review's blockers are still in the code at this head: the off path takes the lock on every read, recording a replay to its own file wipes it, and replayed menu choices call the game with an unchecked pointer. It is also 196 commits behind main, which has moved docs/development.md and changed every host file this touches. (Posted as a comment review at the maintainer's request.)

For testers and anyone running an A/B: record a run once and play it back with the same input every frame, including the mouse camera, the gyro and the menu mouse. Each replay logs where the game first went its own way. It makes testing better and leaves the player path alone, apart from the small points below.

Does it help: not a perf change. As a test tool: partly, by the PR's own numbers (Windows, RTX 3080, 2 replays of a ~60 s recording). All 6929 reads were given back, but the camera was apart from update 9–11 and Link from update ~1192, and the gap grows. So it replays a route, not yet an exact run (see my comment on determinism and on teleports and Insert menu actions, which aren't recorded).
Other systems: every player runs the new hooks with the switches unset: npad_states (2 exclusive locks and a guest clock read per pad read), hos_mouse_camera (now runs looks_like_camera and a guest read at 0x84c9ede0 before checking native_on()), and Link's update (3 loads and a call). Each is cheap, but none is measured and none returns at once as the description says. hos_mouse_sensitivity() changes the mouse sensitivity path for players too (below). On Linux the build and run are not shown. The menu mouse is Windows-only, so its replay path there isn't reached.
Switches:

  • HOS_INPUT_RECORD, HOS_INPUT_PLAY, HOS_INPUT_FROM and HOS_INPUT_SNAP are all diag switches, off unless set: the right defaults for test tools, and none is a player knob.
  • HOS_INPUT_SNAP is missing from the description's Flags table.
  • The MX=/MY= script grammar has no default and needs none.

Reviewed: 79014d29cd64 against its base 430eef4f2cc9. Read in full where they changed: host/input_movie.c, host/input_movie.h, the host/nn_hid.c, host/mouse_native.c, host/oot_menu.c, host/hos_main.c and host/hos_relaunch.c hunks, and gpu/vk/switches.def. Only skimmed: tests/test_input_movie.py (what it checks), the doc section and the stub-test edits. Nothing run (a code review). Compared against the earlier review at ca473caf.
Fixed in this review: nothing. The rebase isn't a basic conflict: 196 commits, a moved docs file and every touched host file changed on main.
Checked and fine:

  • The earlier blocker 1 (a surplus read taking the next frame's input) is fixed by 376e4491. Every read of frame n now gets frame n's pad (hos_input_movie_begin 275–283), and a different read count is counted, not consumed.
  • A played read skips the whole merge, the title filter and the frame-step filter, and restores the cheats' axes from the pad.
  • The recorded word is the one written to the game (word), so the merge and the recording can't disagree.
  • GetSixAxisSensorStates is bounded by HOS_MOTION_HISTORY on both sides.
  • hos_input_movie_link takes movie_lock under cheats_lock, and nothing takes them the other way round.
  • oot_put_link makes the same OneShotPhysicsCctChangePosition call Mark/Return make, with the vtable check, and restores Ctx.
  • The close happens in hos_close_finish plus atexit, once, under the lock.
  • The parser rejects overlapping runs, out-of-order marks, views and cams, half turns, and wrong word counts.

Blocking (to change before merge)

  1. host/input_movie.c:237 (earlier blocker 2, still open). With no switch set, every pad read still takes movie_lock exclusively and reads the game clock, then hos_input_movie_end takes it again. The description's "every hook returns at once while neither switch is set" isn't true of this code. Fix: after movie_decide, keep an atomic movie_mode == MOVIE_OFF fast path at the top of begin, end and link. hos_mouse_camera can likewise check native_on() (or the movie mode) before looks_like_camera and the guest read, as it did before.
  2. host/input_movie.c:214 (earlier blocker 3, still open). HOS_INPUT_PLAY=run.jsonl HOS_INPUT_RECORD=run.jsonl loads the tape, then opens the same path with wb at the start, and the original recording is gone. That's an easy mistake now that "record a replay too" is a documented use. Refuse it when the two paths are the same file (compare paths, or better GetFileInformationByHandle / stat ids for aliases), or write to <file>.replay.jsonl, and test that the source bytes survive.
  3. host/oot_menu.c:830 (earlier blocker 4, still open). The replay passes m.button, a guest address read from the file, straight to set_focus. Only the screen address is checked. A recording from another build, or a screen whose buttons were rebuilt, makes the game call its setter on a wild pointer. Check that the button is in the current screen's list (as mouse_tick finds it) or record a stable index, and count a miss in movie_menu_missed.
  4. Rebase onto main. docs/development.md no longer exists there (the switches docs are under docs/dev/), and nn_hid.c, mouse_native.c, oot_menu.c, hos_main.c, hos_relaunch.c, switches.def and the four touched tests have all changed since 430eef4f. pr status also lists 5 description items to fix before pr ready (Summary, Still to test, commits in the Measurements columns, Ready for review).

Suggestions (the author may take or leave)

  • host/nn_hid.c:241: hos_mouse_sensitivity() sets hos_mouse_sens from the menu without the 0.1–5 clamp that mouse_sens_keys applies. If it runs before the first mouse_sens_keys, it also overwrites the old mouse_sens.txt value that mouse_sens_keys would have moved into the menu (it checks hos_mouse_sens != 1.0). That would lose a player's old sensitivity, and the file is renamed anyway. It is narrow (the camera update before any read with the native camera on), but it is on the player path. Clamp the value, and let mouse_setup() plus mouse_sens_keys() do the setup.
  • host/input_movie.c:323: motion reads (c) and camera updates (n) are counted since the start, not keyed by frame. One extra or missing motion read or camera update in a replay (the same job race that moved 29/90 frames) shifts every later reading by one. Keying them by (frame, index in the frame), as the pads now are, would stop one race from shifting everything after it.
  • host/input_movie.h:14, :23, :37, :50 and movie_tape_pad's comment still say f is "controller reads". Since 376e4491 it is the game frame.
  • The parser takes strtof results without isfinite (earlier suggestion). A nan in a mark makes every compare drift, and with HOS_INPUT_SNAP it writes NaN into Link's position.
  • The recorder opens files with fopen on paths from the environment. On Windows that is the ANSI code page, not UTF-8; use the host's UTF-8 open if there is one, as other HOS_*_FILE switches do.
  • While recording, a frame's second read skips read_input, so the script, the hold toggles and the live file advance once a frame instead of twice. That's intended, but worth a line in the docs: a recorded run isn't quite an unrecorded one.

Questions

  • Has HOS_INPUT_SNAP been run in the game yet? dyst's last comment said game-free only.

Testing: dyst recorded once and replayed twice on Windows 11, RTX 3080 (numbers above). The test file exercises the format and its logic and checks the wiring by reading the source. There is no Linux build or run (the PR's Must be tested), no gyro pad or menu mouse in the game, no long recording, and no in-game HOS_INPUT_SNAP run. Linux holds the merge, since host code must build there.
Overlaps and merge order: the boot-save PR (a repeatable starting state) pairs with this; no order needed.

**Recommendation: Request changes.** The design is right: it records input where it reaches the game, it gives each frame its own pad, and the drift checks are honest. But three of the earlier review's blockers are still in the code at this head: the off path takes the lock on every read, recording a replay to its own file wipes it, and replayed menu choices call the game with an unchecked pointer. It is also 196 commits behind `main`, which has moved `docs/development.md` and changed every host file this touches. (Posted as a comment review at the maintainer's request.) For testers and anyone running an A/B: record a run once and play it back with the same input every frame, including the mouse camera, the gyro and the menu mouse. Each replay logs where the game first went its own way. It makes testing better and leaves the player path alone, apart from the small points below. **Does it help:** not a perf change. As a test tool: partly, by the PR's own numbers (Windows, RTX 3080, 2 replays of a ~60 s recording). All 6929 reads were given back, but the camera was apart from update 9–11 and Link from update ~1192, and the gap grows. So it replays a route, not yet an exact run (see [my comment](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1582#issuecomment-65283) on determinism and on teleports and Insert menu actions, which aren't recorded). **Other systems:** every player runs the new hooks with the switches unset: `npad_states` (2 exclusive locks and a guest clock read per pad read), `hos_mouse_camera` (now runs `looks_like_camera` and a guest read at `0x84c9ede0` before checking `native_on()`), and Link's update (3 loads and a call). Each is cheap, but none is measured and none returns at once as the description says. `hos_mouse_sensitivity()` changes the mouse sensitivity path for players too (below). On Linux the build and run are not shown. The menu mouse is Windows-only, so its replay path there isn't reached. **Switches:** - `HOS_INPUT_RECORD`, `HOS_INPUT_PLAY`, `HOS_INPUT_FROM` and `HOS_INPUT_SNAP` are all diag switches, off unless set: the right defaults for test tools, and none is a player knob. - `HOS_INPUT_SNAP` is missing from the description's Flags table. - The `MX=`/`MY=` script grammar has no default and needs none. **Reviewed:** `79014d29cd64` against its base `430eef4f2cc9`. Read in full where they changed: `host/input_movie.c`, `host/input_movie.h`, the `host/nn_hid.c`, `host/mouse_native.c`, `host/oot_menu.c`, `host/hos_main.c` and `host/hos_relaunch.c` hunks, and `gpu/vk/switches.def`. Only skimmed: `tests/test_input_movie.py` (what it checks), the doc section and the stub-test edits. Nothing run (a code review). Compared against the earlier review at `ca473caf`. **Fixed in this review:** nothing. The rebase isn't a basic conflict: 196 commits, a moved docs file and every touched host file changed on `main`. **Checked and fine:** - The earlier blocker 1 (a surplus read taking the next frame's input) is fixed by 376e4491. Every read of frame n now gets frame n's pad (`hos_input_movie_begin` 275–283), and a different read count is counted, not consumed. - A played read skips the whole merge, the title filter and the frame-step filter, and restores the cheats' axes from the pad. - The recorded word is the one written to the game (`word`), so the merge and the recording can't disagree. - `GetSixAxisSensorStates` is bounded by `HOS_MOTION_HISTORY` on both sides. - `hos_input_movie_link` takes `movie_lock` under `cheats_lock`, and nothing takes them the other way round. - `oot_put_link` makes the same `OneShotPhysicsCctChangePosition` call Mark/Return make, with the vtable check, and restores `Ctx`. - The close happens in `hos_close_finish` plus `atexit`, once, under the lock. - The parser rejects overlapping runs, out-of-order marks, views and cams, half turns, and wrong word counts. **Blocking** (to change before merge) 1. `host/input_movie.c:237` (earlier blocker 2, still open). With no switch set, every pad read still takes `movie_lock` exclusively and reads the game clock, then `hos_input_movie_end` takes it again. The description's "every hook returns at once while neither switch is set" isn't true of this code. Fix: after `movie_decide`, keep an atomic `movie_mode == MOVIE_OFF` fast path at the top of `begin`, `end` and `link`. `hos_mouse_camera` can likewise check `native_on()` (or the movie mode) before `looks_like_camera` and the guest read, as it did before. 2. `host/input_movie.c:214` (earlier blocker 3, still open). `HOS_INPUT_PLAY=run.jsonl HOS_INPUT_RECORD=run.jsonl` loads the tape, then opens the same path with `wb` at the start, and the original recording is gone. That's an easy mistake now that "record a replay too" is a documented use. Refuse it when the two paths are the same file (compare paths, or better `GetFileInformationByHandle` / `stat` ids for aliases), or write to `<file>.replay.jsonl`, and test that the source bytes survive. 3. `host/oot_menu.c:830` (earlier blocker 4, still open). The replay passes `m.button`, a guest address read from the file, straight to `set_focus`. Only the screen address is checked. A recording from another build, or a screen whose buttons were rebuilt, makes the game call its setter on a wild pointer. Check that the button is in the current screen's list (as `mouse_tick` finds it) or record a stable index, and count a miss in `movie_menu_missed`. 4. Rebase onto `main`. `docs/development.md` no longer exists there (the switches docs are under `docs/dev/`), and `nn_hid.c`, `mouse_native.c`, `oot_menu.c`, `hos_main.c`, `hos_relaunch.c`, `switches.def` and the four touched tests have all changed since `430eef4f`. `pr status` also lists 5 description items to fix before `pr ready` (Summary, Still to test, commits in the Measurements columns, Ready for review). **Suggestions** (the author may take or leave) - `host/nn_hid.c:241`: `hos_mouse_sensitivity()` sets `hos_mouse_sens` from the menu without the 0.1–5 clamp that `mouse_sens_keys` applies. If it runs before the first `mouse_sens_keys`, it also overwrites the old `mouse_sens.txt` value that `mouse_sens_keys` would have moved into the menu (it checks `hos_mouse_sens != 1.0`). That would lose a player's old sensitivity, and the file is renamed anyway. It is narrow (the camera update before any read with the native camera on), but it is on the player path. Clamp the value, and let `mouse_setup()` plus `mouse_sens_keys()` do the setup. - `host/input_movie.c:323`: motion reads (`c`) and camera updates (`n`) are counted since the start, not keyed by frame. One extra or missing motion read or camera update in a replay (the same job race that moved 29/90 frames) shifts every later reading by one. Keying them by `(frame, index in the frame)`, as the pads now are, would stop one race from shifting everything after it. - `host/input_movie.h:14`, `:23`, `:37`, `:50` and `movie_tape_pad`'s comment still say `f` is "controller reads". Since 376e4491 it is the game frame. - The parser takes `strtof` results without `isfinite` (earlier suggestion). A `nan` in a mark makes every compare drift, and with `HOS_INPUT_SNAP` it writes NaN into Link's position. - The recorder opens files with `fopen` on paths from the environment. On Windows that is the ANSI code page, not UTF-8; use the host's UTF-8 open if there is one, as other `HOS_*_FILE` switches do. - While recording, a frame's second read skips `read_input`, so the script, the hold toggles and the live file advance once a frame instead of twice. That's intended, but worth a line in the docs: a recorded run isn't quite an unrecorded one. **Questions** - Has `HOS_INPUT_SNAP` been run in the game yet? dyst's last comment said game-free only. **Testing:** dyst recorded once and replayed twice on Windows 11, RTX 3080 (numbers above). The test file exercises the format and its logic and checks the wiring by reading the source. There is no Linux build or run (the PR's Must be tested), no gyro pad or menu mouse in the game, no long recording, and no in-game `HOS_INPUT_SNAP` run. Linux holds the merge, since host code must build there. **Overlaps and merge order:** [the boot-save PR](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1577) (a repeatable starting state) pairs with this; no order needed.
@ -0,0 +211,4 @@
movie_mode == MOVIE_RECORD ? "replay of this recording" : "replay");
const long long present = (long long)__atomic_load_n(&hos_present_count, __ATOMIC_RELAXED);
if (movie_rec) {
movie_file = fopen(movie_rec_path, "wb");
Owner

Same path as HOS_INPUT_PLAY (or an alias): wb truncates the source recording here. Refuse it, or write beside it.

Same path as HOS_INPUT_PLAY (or an alias): wb truncates the source recording here. Refuse it, or write beside it.
@ -0,0 +234,4 @@
/* Before each read of controller No.1: 0 when the read is to be made (the merge runs, and recording, hos_input_movie_end
takes its pad as the frame's); 1 when *given is the read's pad: a replay's (the recording's for this frame), or
recording, the frame's pad taken at its first read. */
int hos_input_movie_begin(MoviePad *given) {
Owner

Off path: still two exclusive locks and a guest clock read per pad read with no switch set. An atomic MOVIE_OFF check after movie_decide would make it return at once, as the description says.

Off path: still two exclusive locks and a guest clock read per pad read with no switch set. An atomic MOVIE_OFF check after movie_decide would make it return at once, as the description says.
@ -0,0 +11,4 @@
the game, where it points.
Whichever device made it, a replay gives the game the same state at the same point.
Points are counted from the recording's start, the first read of a game frame: `f` is controller reads since then (the
Owner

Stale since 376e4491: f is the game frame now, not controller reads (also :23, :37, :50, movie_tape_pad's comment).

Stale since 376e4491: f is the game frame now, not controller reads (also :23, :37, :50, movie_tape_pad's comment).
host/nn_hid.c Outdated
@ -232,0 +238,4 @@
if (hos_mouse_sens <= 0) {
mouse_setup();
const char *e = getenv("HOS_MOUSE_SENS");
if (!(e && atof(e) > 0)) hos_mouse_sens = rx_option(7, 100) / 100.0;
Owner

No 0.1–5 clamp here, and this can run before mouse_sens_keys moves an old mouse_sens.txt into the menu, losing it.

No 0.1–5 clamp here, and this can run before mouse_sens_keys moves an old mouse_sens.txt into the menu, losing it.
host/oot_menu.c Outdated
@ -820,0 +827,4 @@
if (hos_input_movie_playing()) {
MovieMenu m;
while (hos_input_movie_menu_take(screen, &m)) {
if (m.kind == 1) set_focus(c, screen, m.button);
Owner

m.button is a guest address from the file: check it is one of this screen's buttons before calling the game's setter; count a miss otherwise.

m.button is a guest address from the file: check it is one of this screen's buttons before calling the game's setter; count a miss otherwise.
dyst force-pushed feat/input-recording from 79014d29cd
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
to 263874da30
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
PR description / Description follows the template (pull_request_target) Successful in 14s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 18s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 20s
CI / Website build and checks (pull_request) Successful in 2m56s
2026-11-21 11:01:26 +00:00
Compare
Author
Member

Rebased onto main 9dd41326 and worked through both reviews: 3 commits now, 393200253..263874da3.

The rebase. The 11 review commits were squashed into one first (39320025), so main's 196 commits were resolved once. docs/development.md is gone on main: the switches are rows of docs/dev/developing.md's Scripted input table, and the recordings have their own section, Input recordings. npad_states merged with Sprint and its toggle: a played read skips Sprint too, and the recorded word is still the one written to the game.

The blockers (88b38dd1):

  1. The off path returns at once (futondestroyer 2, HumanBean 1). The run's mode is decided once and read with one atomic load (movie_mode_now). With neither switch set, no hook takes a lock or reads the game clock: npad_states' begin and end, the motion read, the camera and Link's update. The callers do nothing for it either (hos_input_movie_active):

    • hos_mouse_camera checks native_on() before looks_like_camera and the guest read again, as before the PR;
    • the motion readings are copied only for a recording;
    • Link's position is loaded only then.

    The check counts it: 150 frames of every hook take 1 lock (the decision) and make 0 guest reads.

  2. No recording over its own source (futondestroyer 3, HumanBean 2). HOS_INPUT_RECORD naming the file HOS_INPUT_PLAY plays is refused before the start opens it wb. That covers the same name, another spelling of it, and a hard link: the volume serial and file index are compared on Windows, st_dev/st_ino elsewhere. The playback goes on unrecorded. The check plays a cut replay onto the file by all three names, and the recording's bytes survive each time. Without the refusal the bytes check fails.

  3. Replayed menu choices are checked (futondestroyer 4, HumanBean 3). A focus goes to the game's setter only when the file's button is one of the screen's buttons now (each_entry, as mouse_tick finds them). An item key goes only when it is one of Key Items'. Any other is counted in not met, and so is a choice with no setter (hos_input_movie_menu_done). test_oot_menu_mouse now plays five choices: a button of the screen, a stray address, another screen's button, an unknown key and a known one. Only the first and last reach the setters. The same case fails on the old code.

  4. Rebased (HumanBean 4). The description is in the current template now.

The suggestions:

  • Mouse sensitivity (HumanBean, nn_hid.c:241): hos_mouse_sensitivity() no longer sets hos_mouse_sens up. It returns it once a read has set it up, and before that HOS_MOUSE_SENS or the menu's value, clamped 0.1 to 5. mouse_sens_keys still moves an old mouse_sens.txt into the menu at the first read.
  • Keyed by frame (HumanBean, input_movie.c:323), in 263874da. Camera updates, motion reads and Link's marks carry their frame (by the game clock, read on the hook's own thread) and i, their call within the frame. A replay looks up (frame, i): the last line at or before it for states, views and marks, and that exact call for a turn or a motion read. One more or one fewer in a frame leaves the rest alone. The glue check plays one extra of each in one frame and none in another, and every other frame is the recording's.
  • Stale comments (HumanBean, input_movie.h:14): fixed. f is now the game frame in every line, frames lines too (their first read is "read").
  • Finite floats (both): the parser refuses NaN, infinities and floats past their range. It also refuses a view block whose limits, pitches or yaw aren't finite, since those are what HOS_INPUT_SNAP writes back.
  • Bounded yaw (futondestroyer): remainderf(target_yaw, 360) in one step, and no NaN is put back.
  • UTF-8 paths (both): no change needed. The exe's manifest makes the process code page UTF-8, so getenv and fopen take UTF-8 paths as they are (nx2/win_manifest.py, tests/test_utf8_paths.py). A comment in input_movie.c says so.
  • A recorded run isn't quite an unrecorded one (HumanBean): now a line in the docs.
  • Per-frame delivery (futondestroyer): the end line keeps the count of frames whose read count differed from the recording's, separate from the last frame reached.

HumanBean's question (has HOS_INPUT_SNAP run in the game?): yes, now. In Link's house a snapped replay had nothing to put back, the replay being exact. Replaying the market recording, it put Link back at 2013 updates (the largest 0.087 m, his velocity not being put back) and the camera at 144, through the game's own move of his character controller. The game played the whole route and the replay ended normally. HOS_INPUT_SNAP makes a replay follow a route, as the docs say. It does not make the run the same.

HumanBean's comment (teleports and Insert menu actions, determinism): both are follow-ups rather than part of this PR. Action lines need the tape to re-anchor its frames after each load, the way the start does after Link's first update. That's a design of its own, and I'd gladly take the offer to work on it together. On determinism, the frame keys above take one source of shifting out. The rest (job order, timers, RNG, per-thread float state) is the investigation the Measurements' drift numbers track.

Checks: tests/test_input_movie.py, test_oot_menu_mouse, test_windows_stop, test_oot_state_tap, test_mouse_native and the other checks that read the touched files pass. test_input_background, test_crash_record and test_host_guest_writes fail identically on clean main 9dd41326.

In the game (Windows 11, RTX 3080, at 263874da, a pack over the base 9dd41326; the 60 cap, Per frame, HOS_FIXED_TIME, no sound device, the native mouse camera on, the same frame-clocked script of walks, rolls, swings, the camera stick and MX=/MY= mouse turns):

  • Link's house (kokiri-start): recorded 3870 frames (7740 reads, 2680 camera updates), then two replays, each recorded too. Both were exact: 0 of 3869 updates of Link's and 0 of 2680 camera updates apart, no frame with another count of reads, and the bridge's samples identical at every common present. With HOS_INPUT_SNAP=1 the replay was the same and had nothing to put back. Replaying the market recording with it put Link back 2013 times and the camera 144 times; the game played on.
  • A replay recorded onto its own file: refused, the recording's sha256 the same after, the playback carried on.
  • Neither switch: no recorder line, and the script played as before.
  • Castle Town market (market-entrance): the input replayed exactly (pads, frames, camera inputs), but the game drifted. Both replays left the recording at Link's update 1336, by 0.00002 m and at the same position as each other, and one replay's camera pitch differed in its last bits from update 10. The two replays then stayed together for about 2000 updates, which points at the game's state at frame 0 rather than the input: the recording started at game clock 2183, both replays at 2037. That's the first lead for the determinism follow-up.
  • The cost with the switches unset (dev.py ab, this PR against its base, Hyrule Field, 2 runs a side): 71.2 fps (71.3, 71.1) against main's 70.6 (71.2, 69.9), the median frame time 13.82 ms against 13.92 ms, p99 21.48 ms against 22.20 ms. That is within main's own spread.

Still open: a Linux build and run (Still to test names it for the Test Farm), and a gyroscope pad and the menu mouse in the game (game-free only so far). The PR stays WIP until Linux has built it.

Rebased onto `main` 9dd41326 and worked through both reviews: 3 commits now, `393200253..263874da3`. **The rebase.** The 11 review commits were squashed into one first (`39320025`), so `main`'s 196 commits were resolved once. `docs/development.md` is gone on `main`: the switches are rows of `docs/dev/developing.md`'s Scripted input table, and the recordings have their own section, [Input recordings](https://git.magicbean.dev/dyst/Longshot/src/branch/feat/input-recording/docs/dev/reference/input.md#input-recordings). `npad_states` merged with Sprint and its toggle: a played read skips Sprint too, and the recorded word is still the one written to the game. **The blockers** (`88b38dd1`): 1. **The off path returns at once** (futondestroyer 2, HumanBean 1). The run's mode is decided once and read with one atomic load (`movie_mode_now`). With neither switch set, no hook takes a lock or reads the game clock: `npad_states`' begin and end, the motion read, the camera and Link's update. The callers do nothing for it either (`hos_input_movie_active`): - `hos_mouse_camera` checks `native_on()` before `looks_like_camera` and the guest read again, as before the PR; - the motion readings are copied only for a recording; - Link's position is loaded only then. The check counts it: 150 frames of every hook take 1 lock (the decision) and make 0 guest reads. 2. **No recording over its own source** (futondestroyer 3, HumanBean 2). `HOS_INPUT_RECORD` naming the file `HOS_INPUT_PLAY` plays is refused before the start opens it `wb`. That covers the same name, another spelling of it, and a hard link: the volume serial and file index are compared on Windows, `st_dev`/`st_ino` elsewhere. The playback goes on unrecorded. The check plays a cut replay onto the file by all three names, and the recording's bytes survive each time. Without the refusal the bytes check fails. 3. **Replayed menu choices are checked** (futondestroyer 4, HumanBean 3). A focus goes to the game's setter only when the file's button is one of the screen's buttons now (`each_entry`, as `mouse_tick` finds them). An item key goes only when it is one of Key Items'. Any other is counted in `not met`, and so is a choice with no setter (`hos_input_movie_menu_done`). `test_oot_menu_mouse` now plays five choices: a button of the screen, a stray address, another screen's button, an unknown key and a known one. Only the first and last reach the setters. The same case fails on the old code. 4. **Rebased** (HumanBean 4). The description is in the current template now. **The suggestions:** - **Mouse sensitivity** (HumanBean, `nn_hid.c:241`): `hos_mouse_sensitivity()` no longer sets `hos_mouse_sens` up. It returns it once a read has set it up, and before that `HOS_MOUSE_SENS` or the menu's value, clamped 0.1 to 5. `mouse_sens_keys` still moves an old `mouse_sens.txt` into the menu at the first read. - **Keyed by frame** (HumanBean, `input_movie.c:323`), in `263874da`. Camera updates, motion reads and Link's marks carry their frame (by the game clock, read on the hook's own thread) and `i`, their call within the frame. A replay looks up `(frame, i)`: the last line at or before it for states, views and marks, and that exact call for a turn or a motion read. One more or one fewer in a frame leaves the rest alone. The glue check plays one extra of each in one frame and none in another, and every other frame is the recording's. - **Stale comments** (HumanBean, `input_movie.h:14`): fixed. `f` is now the game frame in every line, `frames` lines too (their first read is `"read"`). - **Finite floats** (both): the parser refuses NaN, infinities and floats past their range. It also refuses a view block whose limits, pitches or yaw aren't finite, since those are what `HOS_INPUT_SNAP` writes back. - **Bounded yaw** (futondestroyer): `remainderf(target_yaw, 360)` in one step, and no NaN is put back. - **UTF-8 paths** (both): no change needed. The exe's manifest makes the process code page UTF-8, so `getenv` and `fopen` take UTF-8 paths as they are (`nx2/win_manifest.py`, `tests/test_utf8_paths.py`). A comment in `input_movie.c` says so. - **A recorded run isn't quite an unrecorded one** (HumanBean): now a line in the docs. - **Per-frame delivery** (futondestroyer): the end line keeps the count of frames whose read count differed from the recording's, separate from the last frame reached. **HumanBean's question** (has `HOS_INPUT_SNAP` run in the game?): yes, now. In Link's house a snapped replay had nothing to put back, the replay being exact. Replaying the market recording, it put Link back at 2013 updates (the largest 0.087 m, his velocity not being put back) and the camera at 144, through the game's own move of his character controller. The game played the whole route and the replay ended normally. `HOS_INPUT_SNAP` makes a replay follow a route, as the docs say. It does not make the run the same. **HumanBean's comment** (teleports and Insert menu actions, determinism): both are follow-ups rather than part of this PR. **Action lines** need the tape to re-anchor its frames after each load, the way the start does after Link's first update. That's a design of its own, and I'd gladly take the offer to work on it together. On **determinism**, the frame keys above take one source of shifting out. The rest (job order, timers, RNG, per-thread float state) is the investigation the Measurements' drift numbers track. **Checks:** `tests/test_input_movie.py`, `test_oot_menu_mouse`, `test_windows_stop`, `test_oot_state_tap`, `test_mouse_native` and the other checks that read the touched files pass. `test_input_background`, `test_crash_record` and `test_host_guest_writes` fail identically on clean `main` 9dd41326. **In the game** (Windows 11, RTX 3080, at 263874da, a pack over the base 9dd41326; the 60 cap, Per frame, `HOS_FIXED_TIME`, no sound device, the native mouse camera on, the same frame-clocked script of walks, rolls, swings, the camera stick and `MX=`/`MY=` mouse turns): - **Link's house** (`kokiri-start`): recorded 3870 frames (7740 reads, 2680 camera updates), then two replays, each recorded too. Both were exact: 0 of 3869 updates of Link's and 0 of 2680 camera updates apart, no frame with another count of reads, and the bridge's samples identical at every common present. With `HOS_INPUT_SNAP=1` the replay was the same and had nothing to put back. Replaying the market recording with it put Link back 2013 times and the camera 144 times; the game played on. - **A replay recorded onto its own file:** refused, the recording's sha256 the same after, the playback carried on. - **Neither switch:** no recorder line, and the script played as before. - **Castle Town market** (`market-entrance`): the input replayed exactly (pads, frames, camera inputs), but the game drifted. Both replays left the recording at Link's update 1336, by 0.00002 m and at the same position as each other, and one replay's camera pitch differed in its last bits from update 10. The two replays then stayed together for about 2000 updates, which points at the game's state at frame 0 rather than the input: the recording started at game clock 2183, both replays at 2037. That's the first lead for the determinism follow-up. - **The cost with the switches unset** (`dev.py ab`, this PR against its base, Hyrule Field, 2 runs a side): 71.2 fps (71.3, 71.1) against `main`'s 70.6 (71.2, 69.9), the median frame time 13.82 ms against 13.92 ms, p99 21.48 ms against 22.20 ms. That is within `main`'s own spread. **Still open:** a Linux build and run (Still to test names it for the Test Farm), and a gyroscope pad and the menu mouse in the game (game-free only so far). The PR stays WIP until Linux has built it.
Owner

Thanks, dyst: the three commits cover both reviews, and the exact Link's-house replays are great to see.

Taking you up on the offer: I'm building the follow-ups on top of 263874da and will push them to this branch as new commits after yours (yours untouched, no squash or reword). The plan:

  1. Anchors. The start rule ("the first frame after Link's first update") generalised: an anchor at each of Link's first updates after a load. A replay re-bases its frames at each anchor, so a teleport's load that takes more or fewer frames doesn't move the input after it.
  2. Action and option lines. Every action oot_update_player_cheats takes (menu, HOS_INPUT_LIVE's !cheat, bridge): teleport, age, items, Mark/Return, the hour. Plus the cheat rows' values (flight, free camera, speed, heart protection, damage taken) at the start and on each change. A replay gives them back at their frame and ignores the live sources.
  3. Bounded drift correction. HOS_INPUT_SYNC=<updates> (1 by default, 0 strict) puts Link and the camera back while they are off by less than HOS_INPUT_SYNC_MAX (1 m). Beyond that the replay is reported diverged and stops correcting, so a test fails instead of being steered. This replaces HOS_INPUT_SNAP (it becomes a GONE row).
  4. Start, stop and play at run time. In place of the one decision at the first read. Insert menu rows on the Debug tab (Record input, Play last recording, Drift correction) and bridge commands (record, play, with the recorder's state in status).
  5. Replay mode makes the host's wall-clock choices frame-based while recording and playing: the OCB hold, texture compaction and movie pacing. Each is measured by the first update apart, and dropped if it doesn't move it.
  6. Route files. A clean profile (pads, actions, anchors, positions and angles; no guest words or addresses) that can live in assets/routes/ from a repository save, and dev.py ab --route.

If you're mid-change in any of these files, say so and I'll rebase onto yours before pushing.

Thanks, dyst: the three commits cover both reviews, and the exact Link's-house replays are great to see. Taking you up on the offer: I'm building the follow-ups on top of `263874da` and will push them to this branch as new commits after yours (yours untouched, no squash or reword). The plan: 1. **Anchors.** The start rule ("the first frame after Link's first update") generalised: an anchor at each of Link's first updates after a load. A replay re-bases its frames at each anchor, so a teleport's load that takes more or fewer frames doesn't move the input after it. 2. **Action and option lines.** Every action `oot_update_player_cheats` takes (menu, `HOS_INPUT_LIVE`'s `!cheat`, bridge): teleport, age, items, Mark/Return, the hour. Plus the cheat rows' values (flight, free camera, speed, heart protection, damage taken) at the start and on each change. A replay gives them back at their frame and ignores the live sources. 3. **Bounded drift correction.** `HOS_INPUT_SYNC=<updates>` (1 by default, 0 strict) puts Link and the camera back while they are off by less than `HOS_INPUT_SYNC_MAX` (1 m). Beyond that the replay is reported `diverged` and stops correcting, so a test fails instead of being steered. This replaces `HOS_INPUT_SNAP` (it becomes a GONE row). 4. **Start, stop and play at run time.** In place of the one decision at the first read. Insert menu rows on the Debug tab (Record input, Play last recording, Drift correction) and bridge commands (`record`, `play`, with the recorder's state in `status`). 5. **Replay mode makes the host's wall-clock choices frame-based** while recording and playing: the OCB hold, texture compaction and movie pacing. Each is measured by the first update apart, and dropped if it doesn't move it. 6. **Route files.** A clean profile (pads, actions, anchors, positions and angles; no guest words or addresses) that can live in `assets/routes/` from a repository save, and `dev.py ab --route`. If you're mid-change in any of these files, say so and I'll rebase onto yours before pushing.
A replay now holds through what a test route does besides the controller:

- Anchors. Link's first update after 10 frames without one (a teleport's,
  a door's or the age switch's load) is an anchor, written down; a replay
  re-bases its frames at its own anchor to the recording's, and waits at
  the anchor's frame (that frame's pad given again) when its load takes
  longer. The input after a load is where it was against the game however
  long the load took (a 30- and a 12-frame load for the recording's 20, in
  the check). A load the recording does not have, or one that does not end
  within 15 s of the recording's, is a divergence.
- The Debug tools' actions (teleports, the age, items, Mark and Return,
  the hour) are recorded where oot_update_player_cheats takes them; a
  replay takes none of the player's (the menu's, HOS_INPUT_LIVE's, the
  bridge's, which is told so) and gives the recorded ones at their frame.
- The Debug tools' rows that change what the game does (heart protection,
  flight, the free camera, Link's speed, damage taken) are written at the
  start and at each change; while a replay plays, rx_option answers them
  with the recording's values, so neither the player's menu nor the replay
  changes the other.
- HOS_INPUT_SYNC replaces HOS_INPUT_SNAP and is on by default: Link and the
  camera are put back at every update (HOS_INPUT_SYNC=<n>: every n-th, 0
  never: the exact test) while Link is within HOS_INPUT_SYNC_MAX (1 m) of
  the recording. Past it the replay went another way: said once
  (diverged), nothing put back after it, so a test fails rather than being
  steered back. The end gives the corrections' count, largest and mean, and
  a replay that is recorded too ends its file with a result line.
- Recordings and playbacks start and stop at run time
  (hos_input_record_start/_stop, hos_input_play_start/_stop,
  hos_input_movie_status) for the menu and the bridge to come: a recording
  from Link's next update to <user>/recordings/<date>-<time>-<map>.jsonl by
  default, a playback refused on another map than its header's, and Link
  put at the recording's start first. The state of one recording is one
  struct, cleared between them.
- Route recordings (HOS_INPUT_ROUTE=1) hold no guest words or addresses:
  the camera's yaw and pitch alone, no menu mouse lines, the save they start
  from (HOS_INPUT_SAVE) in the header.
- tests/test_mouse_native.py builds mouse_native.c on Linux again: the
  recording's header and stand-ins for its hooks (it skips on Windows).

Checked here, game-free, through the job queue: tests/test_input_movie.py
(the new cases: a longer and a shorter load, actions and rows, every 4th
update, a divergence, a recording and playback from the run's middle,
another map, a route) and the checks that read the touched code. Not run
in the game yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
- The Insert menu's Debug tab gets three rows in its Developer section
  (gpu/vk/menu/input_recording.cpp, a module of its own, after Save my
  pipeline list: the tab draws only those rows besides its tools): Record input
  starts a recording to the player's recordings folder from Link's next
  update and stops it (its cell: the length so far); Play last recording
  gives the game that recording from where it started on its map, with
  how it goes in its cell (diverged, the corrections, waiting for a load)
  and why it was not played in its line; Drift correction (saved as
  drift_correction: Off, every update, every second, every 5 s) is
  HOS_INPUT_SYNC's choice for it. They work with the Debug tools off.
- MkwVkHost version 42: input_record, input_play and input_status
  (host/rx_backend.c, to host/input_movie.c's start, stop and status).
- The control bridge's record (start, stop; path, route) and play (start,
  stop; path, sync, sync_max) commands, and status's recorder: the mode,
  the frame, Link apart, the corrections, a divergence, the anchors and the
  file. Documented in docs/dev/reference/control-bridge.md.

Checked here, game-free, through the job queue: test_control,
test_longshot_ctl, test_menu_ini_keys (the new key frozen),
test_menu_model, test_vibration_menu, test_bug_report, test_mods_menu,
test_menu_hit, test_input_movie and test_switch_table pass;
test_menu_text_field fails on its Output resolution field (956) here as on
263874da without these changes. Not run in the game yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
Replays left the recording where the host itself decided by the wall
clock, which lands on another frame in each run:

- The OptimizeChangeBank hold (host/oot_ocb_hold.c, 2000 ms) and the
  texture heap's compaction gap (host/oot_tex_compact.c, 1000 ms) take
  their time from hos_input_movie_time while a recording is recorded or
  played: the game clock's sixtieths of a second, so a held neighbour is
  taken, and a compaction asked for, on the same frame of a replay as of
  its recording. The clock goes on from where it was when it changes
  between the wall's and the game's (never back), so a recording started
  in the middle of a run moves neither. With nothing recorded or played it
  is the wall clock, as before.
- A run that records or plays from its start (HOS_INPUT_RECORD,
  HOS_INPUT_PLAY) has no movie pacing (host/nn_vi.c): the 240 fps of a
  movie would leave the Per frame step and its frames with it.
- Frames are the game clock's sixtieths of a second whatever the step: at
  a cap above 60 several of the game's frames share one of the
  recording's, so a route recorded at 60 plays at its own speed in a run
  measured uncapped (dev.py ab --route), Link and the camera put back at
  each update.

Not measured in the game yet: which of these moves the first update apart
is the next step. Checked here, game-free, through the job queue:
test_input_movie (the clock's going on across a change, a replay at half
a frame a frame), test_ocb_hold, test_tex_compact and the checks that cut
nn_vi.c's pacing (test_frame_carry_cap60, test_frame_rate_cap_step,
test_frame_rate_cap_30, test_pacing_policy, test_movie_frame_count,
test_fps_stats, test_present_trace, test_realtime_rate, test_camera_speed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
A route is an input recording the game writes with HOS_INPUT_ROUTE=1 from
a repository save: the controller, motion, the mouse camera's turns, the
Debug tools' actions and rows, the loads, Link's positions and the
camera's angles, all numbers; no guest words and no addresses. That is
what lets it be committed, as the play profiles are (CONTRIBUTING.md and
AGENTS.md say so, and that every other recording stays on the PC).

- dev.py route record --save NAME --name ROUTE: the game started from that
  save through the queue (shared), at the 60 cap with the Per frame step and
  the fixed clock, recording from Link's first update after its load; the
  file checked and put in assets/routes/ when the game is closed.
  dev.py route check and list.
- scripts/devtools/routes.py's check holds a route to its fields, line by
  line (a number or a hex word each; the header naming a repository save,
  from play, profile route); tests/test_routes.py runs it on every
  committed route and on twelve kinds of what a route may not hold.
- dev.py ab --route ROUTE [--sync N]: the route's save instead of a scene;
  after the warm-up the route is played over the control bridge and the
  measured stretch is the route, the same moving input on both sides. A
  run whose replay diverged, or missed one of its loads, is refused.
- assets/routes/README.md: the rules (recorded from a repository save,
  checked, one a pull request).

No route is committed yet: recording one is a game run. Checked here,
game-free, through the job queue: test_routes, test_hos_ab, test_dev_build,
dev.py route check and the --help text; ruff on the changed scripts;
test_dev_ab fails on its Skip title screen row here as on 263874da.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
docs(input): input recordings as they now go: started in the game, loads, actions and rows, drift correction, routes
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 31s
CI / Conventional Commit title (pull_request) Successful in 24s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 36s
CI / Workflow lint (actionlint) (pull_request) Successful in 42s
Third-party parts / As their notes say (pull_request) Successful in 46s
CI / Website build and checks (pull_request) Successful in 3m38s
b8d2dd575f
- docs/dev/reference/input.md: what a recording holds (now the Debug
  tools' actions and rows too), starting and stopping (the Debug tab's
  rows, the bridge, the switches), how a replay holds to its recording
  (frames by the game clock's time, anchors at loads, the fingerprints,
  HOS_INPUT_SYNC and a divergence, the host's time-based choices, an exact
  replay, a replay recorded too), routes, and the format's new lines.
- docs/dev/developing.md's switch table: HOS_INPUT_SYNC, HOS_INPUT_SYNC_MAX
  and HOS_INPUT_ROUTE in HOS_INPUT_SNAP's place.
- docs/user/graphics-and-controls.md: the Developer rows Record input,
  Play last recording and Drift correction.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
Owner

Pushed five commits on top of yours: 263874da → b8d2dd57, a fast-forward. Your three commits are untouched.

  1. ece8a879 anchors, actions and rows, bounded correction, run-time start and stop (host/input_movie.c, .h, hos_main.c, rx_backend.c)
    • Anchors. Link's first update after 10 frames without one is an anchor. A replay re-bases its frames there to the recording's, and waits at the anchor's frame while its own load is longer. A load that doesn't end within 15 s of the recording's is a divergence.
    • Debug tools actions. Actions are recorded where oot_update_player_cheats takes them. A replay takes none of the player's (a bridge teleport gets a refusal) and gives the recorded ones at their frame.
    • Debug tools rows. Heart protection, flight, free camera, speed and damage taken are written at the start and on each change. rx_option answers them from the recording while it plays.
    • HOS_INPUT_SYNC replaces HOS_INPUT_SNAP, on by default: put back at every n-th update (0: never) while Link is within HOS_INPUT_SYNC_MAX (1 m). Past that it's diverged, said once, and nothing is put back after it. A replay that is recorded too ends its file with a result line.
    • Run-time start and stop (hos_input_record_start/_stop, hos_input_play_start/_stop, _status). The session state is one struct, cleared between recordings. A run-time playback refuses a recording from another map and puts Link at its start first.
    • HOS_INPUT_ROUTE=1: no guest words or addresses (view angles only, no menu mouse lines). HOS_INPUT_SAVE goes in the header.
    • test_mouse_native builds on Linux again (it skips on Windows, so it didn't show for you): stand-ins for the recording's hooks.
  2. 082ed925 Debug tab rows and bridge commands
    • Record input, Play last recording and Drift correction (key drift_correction, frozen) in the Debug tab's Developer section, in a module of their own. MkwVkHost goes to version 42 (input_record, input_play, input_status).
    • The bridge's record and play commands, and status's recorder.
  3. 7321b829 the host's own time-based choices by the game clock while recording or playing: the OCB hold and the texture compaction gap.
    • A run that records or plays from its start has no movie pacing.
    • Frames are the game clock's sixtieths of a second at any step, so a 60-cap recording plays at its own speed uncapped.
  4. b686531a routes: assets/routes/ (README, the exception noted in CONTRIBUTING and AGENTS), dev.py route record|check|list, tests/test_routes.py, and dev.py ab --route ROUTE [--sync N], which refuses a run whose replay diverged or missed a load.
  5. b8d2dd57 docs: reference/input.md rewritten around the above, plus the switch table and the user docs' rows.

Checked here (Linux, game-free, through the job queue):

  • test_input_movie passes with the new cases:
    • a 30- and a 12-frame load for the recording's 20;
    • an action given and the player's dropped;
    • the flight row answered;
    • every 4th update;
    • a divergence;
    • record and play from the run's middle, and another map refused;
    • a route;
    • half a frame per frame.
  • These pass: test_routes, test_mouse_native, test_control, test_longshot_ctl, test_menu_ini_keys, test_menu_model, test_hos_ab, test_ocb_hold, test_tex_compact, test_switch_table, and the nn_vi.c pacing checks.
  • dev.py pack over base 9dd41326 builds the host and the renderer.
  • These fail the same way on 263874da without these changes: test_input_background (stick-directions), test_menu_text_field (956, the Output resolution field) and test_dev_ab (the Skip title screen row).

Not run in the game yet. Next:

  • record a route from kokiri-start with a teleport in it, and replay it with HOS_INPUT_SYNC=0 and at 1;
  • measure which of commit 3's changes moves the first update apart (your market lead: frame 0 at game clock 2183 against 2037);
  • a Windows build and run, and the menu rows in the game.
Pushed five commits on top of yours: `263874da` → `b8d2dd57`, a fast-forward. Your three commits are untouched. 1. **`ece8a879` anchors, actions and rows, bounded correction, run-time start and stop** (`host/input_movie.c`, `.h`, `hos_main.c`, `rx_backend.c`) - **Anchors.** Link's first update after 10 frames without one is an anchor. A replay re-bases its frames there to the recording's, and waits at the anchor's frame while its own load is longer. A load that doesn't end within 15 s of the recording's is a divergence. - **Debug tools actions.** Actions are recorded where `oot_update_player_cheats` takes them. A replay takes none of the player's (a bridge teleport gets a refusal) and gives the recorded ones at their frame. - **Debug tools rows.** Heart protection, flight, free camera, speed and damage taken are written at the start and on each change. `rx_option` answers them from the recording while it plays. - **`HOS_INPUT_SYNC`** replaces `HOS_INPUT_SNAP`, on by default: put back at every n-th update (0: never) while Link is within `HOS_INPUT_SYNC_MAX` (1 m). Past that it's `diverged`, said once, and nothing is put back after it. A replay that is recorded too ends its file with a `result` line. - **Run-time start and stop** (`hos_input_record_start`/`_stop`, `hos_input_play_start`/`_stop`, `_status`). The session state is one struct, cleared between recordings. A run-time playback refuses a recording from another map and puts Link at its start first. - **`HOS_INPUT_ROUTE=1`**: no guest words or addresses (view angles only, no menu mouse lines). `HOS_INPUT_SAVE` goes in the header. - `test_mouse_native` builds on Linux again (it skips on Windows, so it didn't show for you): stand-ins for the recording's hooks. 2. **`082ed925` Debug tab rows and bridge commands** - Record input, Play last recording and Drift correction (key `drift_correction`, frozen) in the Debug tab's Developer section, in a module of their own. MkwVkHost goes to version 42 (`input_record`, `input_play`, `input_status`). - The bridge's `record` and `play` commands, and `status`'s `recorder`. 3. **`7321b829` the host's own time-based choices by the game clock** while recording or playing: the OCB hold and the texture compaction gap. - A run that records or plays from its start has no movie pacing. - Frames are the game clock's sixtieths of a second at any step, so a 60-cap recording plays at its own speed uncapped. 4. **`b686531a` routes**: `assets/routes/` (README, the exception noted in CONTRIBUTING and AGENTS), `dev.py route record|check|list`, `tests/test_routes.py`, and `dev.py ab --route ROUTE [--sync N]`, which refuses a run whose replay diverged or missed a load. 5. **`b8d2dd57` docs**: `reference/input.md` rewritten around the above, plus the switch table and the user docs' rows. **Checked here** (Linux, game-free, through the job queue): - `test_input_movie` passes with the new cases: - a 30- and a 12-frame load for the recording's 20; - an action given and the player's dropped; - the flight row answered; - every 4th update; - a divergence; - record and play from the run's middle, and another map refused; - a route; - half a frame per frame. - These pass: `test_routes`, `test_mouse_native`, `test_control`, `test_longshot_ctl`, `test_menu_ini_keys`, `test_menu_model`, `test_hos_ab`, `test_ocb_hold`, `test_tex_compact`, `test_switch_table`, and the `nn_vi.c` pacing checks. - `dev.py pack` over base `9dd41326` builds the host and the renderer. - These fail the same way on `263874da` without these changes: `test_input_background` (stick-directions), `test_menu_text_field` (956, the Output resolution field) and `test_dev_ab` (the Skip title screen row). **Not run in the game yet.** Next: - record a route from `kokiri-start` with a teleport in it, and replay it with `HOS_INPUT_SYNC=0` and at 1; - measure which of commit 3's changes moves the first update apart (your market lead: frame 0 at game clock 2183 against 2037); - a Windows build and run, and the menu rows in the game.
- A playback started from the menu or the bridge takes Link to the
  recording's age and map first: the Debug tab's age switch and its teleport
  to the destination whose map is the recording's (the header now writes the
  age too), each asked again after 12 s and given up after the third, then
  the start after his next update there, and Link put at the recording's
  start. Only a map no teleport goes to is refused. A recording made from
  the game's start (HOS_INPUT_FROM=boot) plays from the switches alone.
- The Debug tab's Play recording opens a page of its own (TAB_RECORDINGS,
  back to Debug): Stop playback while one plays (where it is, the
  corrections), Last recording, then the recordings folder's newest first
  (16, named by their date and map), and No recordings yet when there is
  none. After a restart the last recording is the folder's newest.
  MkwVkHost version 42's input_play takes a path, and input_recording
  lists the folder.
- The cold review's points:
  - a recording made above 60 fps writes its frames lines once a frame of
    its own, so it plays back (several of the game's frames to one);
  - the wait at a load gives up by the game clock's time (15 s), not after
    900 of the game's frames;
  - a load the recording does not have is a divergence that uses up none of
    its anchors, and a rebase never goes back;
  - Link past HOS_INPUT_SYNC_MAX is a divergence with or without the
    correction, and a run-time playback puts Link at the start with
    Drift correction Off too;
  - a replay that is recorded too writes the recording's Debug tools rows;
  - the bridge's record stop says whether a file was written;
  - the three rows have their own place after Set up for a weak laptop;
  - the route checker refuses a key twice, NaN and infinities, and any text
    in the header but what the game writes there.

Checked here, game-free, through the job queue: test_input_movie (another
map's start, a map no teleport goes to, a recording made above 60 fps, an
unmatched load, a recorded replay's rows), test_routes, test_menu_model,
test_menu_ini_keys, test_hos_ab, test_control, test_longshot_ctl; dev.py
pack builds. test_menu_keys, test_menu_module_slots and test_menu_text_field
fail here as on 263874da without these changes. Not run in the game yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
- While a recording plays, the pads are still read for the Insert menu
  (hos_pad_raw), not for the game, so the menu can be driven by a
  controller and Stop playback works; any row of the Play recording page
  stops a playback, whichever the selection is on.
- A playback started from the menu turns the menu into the compact bar,
  on Stop playback, so the game is in view.
- The rows are a section of their own, Input recording, after Developer:
  the Debug tab draws the sections after Developer with their headings;
  Play recording draws the arrow of a row that opens a page.
- A run-time playback holds Link and the camera to the recording for its
  first 30 updates (MOVIE_SETTLE): the game's move of Link lands an update
  late, so the start was apart and often called diverged at frame 1. Those
  holds are not corrections, so a clean replay counts 0.

Checked here, game-free, through the job queue: test_input_movie,
test_menu_model, test_menu_ini_keys, test_hos_ab, test_menu_tune; dev.py
pack builds. Not run in the game yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
docs(input): replaying a recording in the dev loop, for agents and the measure skill
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 21s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
Third-party parts / As their notes say (pull_request) Successful in 16s
CI / Website build and checks (pull_request) Has been cancelled
02b3748731
- developing.md: Replay a recording, how a test uses one (record once,
  play on the change through the queue or the bridge, read the log's
  playback over and diverged lines, a recorded replay's result line),
  which drift correction for which run, and that a recording other than a
  route stays on the PC. Measure a change points at dev.py ab --route for
  a route that moves.
- AGENTS.md: a Read this for that row; the measure skill: dev.py ab
  --route, and asking for a recording when no route goes there.
- input.md: the start's retries and its 30 held updates, the pads that
  reach the menu while a recording plays, the bridge as the agents' way;
  control-bridge.md: play's start takes Link to the recording's map, and
  wrong_map's meaning (as control.c's error now says); the routes README:
  the Play recording page.

Checked here, game-free, through the job queue: test_doc_anchors,
test_switch_table, test_control, test_routes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
Owner

Pushed three commits on top of b8d2dd57 (head now 02b37487), @dyst for your eyes:

  • c5f7061a, a playback starts from anywhere. One started from the menu or the bridge takes Link to the recording's age and map itself (the Debug tab's age switch and teleport, from the header's map and age), then puts him at its start; only a map no teleport goes to is refused. The Debug tab's Play recording is now a page: Stop playback while one plays, Last recording, the recordings/ folder newest first, and an empty state. MkwVkHost 42's input_play takes a path and input_recording lists the folder. Plus the cold review's points: frames above 60 fps, the load wait by the game clock, unmatched loads, divergence without correction, a recorded replay's rows, record stop's written, and the route checker.
  • bcaa7256, from a first try in the game. Stop now works: during playback the pads still reach the menu, not the game. A playback turns the menu into the compact bar. The rows have their own Input recording section on the Debug tab, and Play recording has its arrow. Link and the camera are held to the recording for its first 30 updates, because the game's move of Link lands an update late and replays were calling themselves diverged at frame 1. Those holds aren't counted as corrections.
  • 02b37487, docs. developing.md has a new Replay a recording section (the dev loop for tests and agents). There's also a row in AGENTS.md, the measure skill, and updates to the bridge and input references.

Checked: game-free, on Linux: test_input_movie, test_routes, test_menu_model, test_menu_ini_keys, test_hos_ab, test_control, test_menu_tune, test_doc_anchors and test_switch_table; the pack builds.

Already failing: test_menu_keys, test_menu_module_slots and test_menu_text_field fail here exactly as they do on 263874da.

Not yet tested in the game: the second and third commits.

Pushed three commits on top of b8d2dd57 (head now 02b37487), @dyst for your eyes: - **c5f7061a, a playback starts from anywhere.** One started from the menu or the bridge takes Link to the recording's age and map itself (the Debug tab's age switch and teleport, from the header's `map` and `age`), then puts him at its start; only a map no teleport goes to is refused. The Debug tab's Play recording is now a page: Stop playback while one plays, Last recording, the `recordings/` folder newest first, and an empty state. MkwVkHost 42's `input_play` takes a path and `input_recording` lists the folder. Plus the cold review's points: frames above 60 fps, the load wait by the game clock, unmatched loads, divergence without correction, a recorded replay's rows, `record stop`'s `written`, and the route checker. - **bcaa7256, from a first try in the game.** Stop now works: during playback the pads still reach the menu, not the game. A playback turns the menu into the compact bar. The rows have their own Input recording section on the Debug tab, and Play recording has its arrow. Link and the camera are held to the recording for its first 30 updates, because the game's move of Link lands an update late and replays were calling themselves diverged at frame 1. Those holds aren't counted as corrections. - **02b37487, docs.** developing.md has a new Replay a recording section (the dev loop for tests and agents). There's also a row in AGENTS.md, the measure skill, and updates to the bridge and input references. **Checked:** game-free, on Linux: test_input_movie, test_routes, test_menu_model, test_menu_ini_keys, test_hos_ab, test_control, test_menu_tune, test_doc_anchors and test_switch_table; the pack builds. **Already failing:** test_menu_keys, test_menu_module_slots and test_menu_text_field fail here exactly as they do on 263874da. **Not yet tested in the game:** the second and third commits.
fix(input): the cold review's points on the Play recording page, the start and the listing
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Conventional Commit title (pull_request) Successful in 18s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 24s
CI / Workflow lint (actionlint) (pull_request) Successful in 28s
Third-party parts / As their notes say (pull_request) Successful in 31s
CI / Website build and checks (pull_request) Has been cancelled
95acb020df
- The recordings folder is listed at most once a second (or at once after
  a recording ends), keeping the 64 newest however many there are; the
  menu's rows and the bridge's status read that list, not a scan each,
  and the menu asks the host's status once per 50 ms.
- A replay whose frame was taken from the clock a few frames past a load's
  anchor (Link's update before the frame's first read) is still re-based
  to it (up to MOVIE_ANCHOR_GAP back), not called a load the recording
  does not have.
- The start: the age switch and the teleport each get three tries, each
  asked at once; Stop during them, or giving up, drops the ask not taken
  yet; a recording with no age goes to the age whose map it is; a give-up
  says why under the row.
- The 30 held updates at a run-time start are not counted at all (not
  apart, not corrections), for Link and the camera.
- The page: Last recording shows when one would play (also one made over
  the bridge); No recordings yet records one; "16+" only past 16; a
  refusal shows under the row that was pressed; snake_case keys.
- While a recording plays, the pads reach the menu only as Controller in
  background lets them behind other windows.
- Docs: Replay a recording says which way plays which recording (an
  in-game one through the bridge's play or the menu, one made from the
  start with HOS_INPUT_PLAY); architecture.md's pages list; stale
  comments.

Checked here, game-free, through the job queue: test_input_movie (a new
check of the anchor's re-base), test_menu_model, test_menu_ini_keys,
test_hos_ab, test_menu_tune; dev.py pack builds. Not run in the game yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e3aEPBsd7QfUkaatjP
Owner

Pushed 95acb020 on top of 02b37487: fixes from a cold self-review.

  • Listing: the recordings folder is scanned at most once a second, or right after a recording ends. Before, the 64 oldest were kept, so new recordings stopped showing past 64; now the 64 newest are. The menu and the bridge's status read that list, and the menu asks the host for its status every 50 ms at most. Before, the open page scanned the directory dozens of times a frame.
  • Loads: a replay whose frame lands a few frames past a load's anchor (up to MOVIE_ANCHOR_GAP) is moved back to it. Before, it counted as a load the recording doesn't have, and the playback ended early.
  • Start:
    • the age switch and the teleport each get three tries, asked at once;
    • Stop during them, or giving up, cancels the ask that hasn't been taken yet;
    • a recording with no age goes to the age whose map it is;
    • a give-up shows its reason in the menu.
  • Held start: the 30 held updates at the start are no longer counted as apart or corrected, for Link and the camera.
  • Page:
    • Last recording also shows one made over the bridge;
    • the empty state records one;
    • "16+" only appears past 16;
    • a refusal shows under the row that was pressed;
    • the keys are snake_case.
  • Background: while a recording plays, the controller reaches the menu behind other windows only when the Controller in background setting allows it.
  • Docs: Replay a recording now says which way plays which recording. A recording made in the game plays through the bridge's play or the menu; one made from the start plays with HOS_INPUT_PLAY.

Checked: game-free, on Linux: test_input_movie (with a new check of the load re-base), test_menu_model, test_menu_ini_keys, test_hos_ab and test_menu_tune; the pack builds.

Not yet tested in the game.

Pushed 95acb020 on top of 02b37487: fixes from a cold self-review. - **Listing:** the recordings folder is scanned at most once a second, or right after a recording ends. Before, the 64 oldest were kept, so new recordings stopped showing past 64; now the 64 newest are. The menu and the bridge's status read that list, and the menu asks the host for its status every 50 ms at most. Before, the open page scanned the directory dozens of times a frame. - **Loads:** a replay whose frame lands a few frames past a load's anchor (up to `MOVIE_ANCHOR_GAP`) is moved back to it. Before, it counted as a load the recording doesn't have, and the playback ended early. - **Start:** - the age switch and the teleport each get three tries, asked at once; - Stop during them, or giving up, cancels the ask that hasn't been taken yet; - a recording with no `age` goes to the age whose map it is; - a give-up shows its reason in the menu. - **Held start:** the 30 held updates at the start are no longer counted as apart or corrected, for Link and the camera. - **Page:** - Last recording also shows one made over the bridge; - the empty state records one; - "16+" only appears past 16; - a refusal shows under the row that was pressed; - the keys are snake_case. - **Background:** while a recording plays, the controller reaches the menu behind other windows only when the Controller in background setting allows it. - **Docs:** Replay a recording now says which way plays which recording. A recording made in the game plays through the bridge's `play` or the menu; one made from the start plays with `HOS_INPUT_PLAY`. **Checked:** game-free, on Linux: test_input_movie (with a new check of the load re-base), test_menu_model, test_menu_ini_keys, test_hos_ab and test_menu_tune; the pack builds. **Not yet tested in the game.**
Owner

Rebased onto main c7bd8f80 (37 commits ahead of where it was): the old head was 95acb020, the new one is d2ebcbc9. dyst's three commits are kept, each rebased as it was. The only conflict was in scripts/devtools/ab.py, between main's --dynamic and phase timings and this branch's --route: both are kept. MkwVkHost stays at version 42 (main is still at 41).

Checked: game-free, on Linux, on the rebased tree: test_input_movie, test_routes, test_menu_model, test_hos_ab, test_menu_tune, test_control, test_longshot_ctl, test_doc_anchors, test_switch_table, test_ocb_hold, test_tex_compact, test_mouse_native and test_dev_ab all pass.

Failing, but not from this branch:

  • test_menu_ini_keys fails on grass_distance, a key from main (#1382) that isn't in FROZEN. It fails the same way on main.
  • test_menu_keys, test_menu_modules and test_menu_module_slots fail as before, on errors in rx_nvn.h and the fixture.

Not built: the pack, since there's no shared base at the new main on this PC yet.

Rebased onto main c7bd8f80 (37 commits ahead of where it was): the old head was 95acb020, the new one is d2ebcbc9. dyst's three commits are kept, each rebased as it was. The only conflict was in `scripts/devtools/ab.py`, between main's `--dynamic` and phase timings and this branch's `--route`: both are kept. MkwVkHost stays at version 42 (main is still at 41). **Checked:** game-free, on Linux, on the rebased tree: test_input_movie, test_routes, test_menu_model, test_hos_ab, test_menu_tune, test_control, test_longshot_ctl, test_doc_anchors, test_switch_table, test_ocb_hold, test_tex_compact, test_mouse_native and test_dev_ab all pass. **Failing, but not from this branch:** - test_menu_ini_keys fails on `grass_distance`, a key from main (#1382) that isn't in FROZEN. It fails the same way on main. - test_menu_keys, test_menu_modules and test_menu_module_slots fail as before, on errors in `rx_nvn.h` and the fixture. **Not built:** the pack, since there's no shared base at the new main on this PC yet.
HumanBean force-pushed feat/input-recording from 95acb020df
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Conventional Commit title (pull_request) Successful in 18s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 24s
CI / Workflow lint (actionlint) (pull_request) Successful in 28s
Third-party parts / As their notes say (pull_request) Successful in 31s
CI / Website build and checks (pull_request) Has been cancelled
to d2ebcbc98a
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 16s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 30s
CI / Workflow lint (actionlint) (pull_request) Successful in 31s
Third-party parts / As their notes say (pull_request) Successful in 35s
PR description / Description follows the template (pull_request_target) Failing after 24s
CI / Website build and checks (pull_request) Failing after 32s
2026-11-21 20:09:08 +00:00
Compare
HumanBean changed title from WIP: feat(input): record the player's input and replay it frame for frame to feat(input): record the player's input and replay it frame for frame 2026-11-21 20:14:14 +00:00
HumanBean deleted branch feat/input-recording 2026-11-21 20:14:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!1582
No description provided.