perf(vk): the shader store keeps its SPIR-V zstd-compressed #3023

Merged
HumanBean merged 1 commit from HumanBean/Longshot:perf/spirv-store-zstd into mod-api 2026-12-02 19:29:40 +00:00
Owner

Summary

The shared shader store keeps every program's SPIR-V once, but uncompressed: 3.7 GB for one translator's shaders, and 5 to 7 GB on a PC that has been updated a few times. SPIR-V compresses well, so each blob is now one zstd frame (level 1), or the words as they are where that would not be smaller. The same shaders take 0.99 GB.

On top of mod-api (#2822). See #1649 (its "compress each stage", applied to the store from #1809).

Read first: gpu/vk/spirv_pack.h (format, put, read_words, compaction), then kProgramCacheFormat and open_recorded in gpu/vk/vk_progcache.cpp, and store_bounds in builder/crates/build-driver/src/shader_cache.rs.

  • New files, spirv.zpack and spirv.zidx, format 2. An older build takes a head of another version for damage and makes the store again, so the old names are left to the builds that read them.
  • A blob's third head word, and the index's fourth, now hold the word count (low half) and the stored bytes (high half). Hashes are still of the words, checked after decompression.
  • Compression runs with the store's lock released. Compaction copies frames as stored.
  • kProgramCacheFormat 3 → 4, so a program cache naming an old store starts over.
  • The builder's receipt check and scripts/validate_spirv.py read the new format.

Related: #2153 changes Store::read's file handles. Whichever lands second needs a small rebase.

Testing

On the current head (08ca00bc, rebased onto mod-api 582b6a1a with no conflicts): the renderer builds on Linux (dev.py vk). mise run test: 824 passed, 35 failed, 12 skipped. The same 35 all fail on untouched mod-api 582b6a1a: test_astc_upload_chunking, test_async_astc_upload_chunks, test_bind_memo, test_blocks_at_start, test_direct_buffer_writes, test_drawn_page_map, test_draw_stream_visibility, test_early_split_before_draw, test_flat_map, test_fsr_image_retirement, test_fsr_uniform_ownership, test_image_reaper_threads, test_import_reach, test_late_fix_build, test_lifter, test_menu_i18n, test_mirror_bookkeeping, test_pass_barrier, test_present_acquire_ahead, test_present_image_free, test_readback_timeout_reuse, test_recorder_sync, test_recording_admission, test_report_words, test_staging_burst, test_target_retention, test_tex_desc_memo, test_text_keyboard_policy, test_ub_snapshot_default, test_ub_snapshot_gpu_writes, test_vk_wb_cpu_words_fast, test_vram_compact, test_wb_diff_stale_shadow, test_wb_pending_capture, test_wrote_regions. cargo test -p build-driver: 239 pass in the library tests, and a_copy_links_the_builders_files_clones_the_rest_and_refreshes_in_place fails with game_folder_busy, as it does on that base. The game runs below were made before the rebases and not repeated.

Tested: Linux, RTX 3090, NVIDIA 620.70.06. (before the rebases)

  • dev.py rt over base d193d12d: the shader preparation filled the new store, 39,173 noted pipelines built, 0 not made.
  • dev.py smoke twice: PASS both times (in play from kokiri-start, 900 frames, menu opened). In both, the confined dev game could not reach the builder's store and used a fallback program cache with the player's default store (an earlier smoke log from 29 November, without this change, shows the same). The second run loaded the 544 programs the first had written there (56.6 MB of SPIR-V read from compressed blobs), with no read failures.
  • mise run test: 836 passed, 10 failed, 12 skipped. The same 10 fail on mod-api at f53e1c42: test_blocks_at_start, test_draw_stream_visibility, test_fsr_uniform_ownership, test_image_reaper_threads, test_lifter, test_readback_timeout_reuse, test_recording_admission, test_target_retention, test_tex_desc_memo, test_vram_compact.
  • cargo test -p build-driver (244 passed in the library tests), cargo clippy -p build-driver --all-targets -D warnings, cargo fmt --check, pre-commit.
  • tests/spirv_pack_test.cpp has new cases: a frame is smaller and read back by another start; a damaged frame is refused and written again; format 1's files are untouched; compaction keeps a frame readable.

Still to test:

  • Windows (llvm-mingw): build and start, expecting the store made and read (CI for the compile; the start by hand or @Beanstalk). Not compiled for Windows here.
  • A game that plays from a store the preparation filled (the launcher's Play, which sets LONGSHOT_SHADER_STORE): programs load with no "did not read" lines (by hand).

Measurements

Verdict: the same shaders take 3.7x less disk. Load time and fps were not measured.

Setup: Linux, RTX 3090. The store a preparation of this PR wrote (50,898 blobs); the sizes are the word counts and stored bytes in its index. main was not run: its store (format 1, the same spirv_pack.h as mod-api's before this PR) keeps these words uncompressed, so the first column is their size. Measured on the head before the rebases, which did not change the format.

Before: main @ dec32f72 After: this PR @ a18747be
SPIR-V 3.706 GB 0.993 GB

Cost, from a one-thread Python and libzstd microbenchmark over 3,061 sampled blobs (rough, not a timed run): decompression about 67 µs for an average shader (91 KB) at about 1.35 GB/s, compression about 550 MB/s. LZ4 on the same sample decompressed about 3.5x faster but stored 1.7x as much.

Risks

  • One more shader preparation after updating: the old store is not converted.
  • Disk goes up before it goes down: spirv.pack and spirv.idx stay for older builds until the player deletes them.
  • The Launcher needs LongshotLauncher #397 before this reaches players: without it, "Free up space" neither counts nor frees the new files.
  • A play shader cache shared with a build of format 3: the builder's shaders/<translator>/<driver>/ folder is not keyed by kProgramCacheFormat, so a player who alternates an older build and this one with the same translator has each start replace the other's program cache (as with earlier format bumps). The store itself is not affected.
  • scripts/validate_spirv.py reads the new store only: a format-3 cache's stages in spirv.pack need that tree's script.
  • Reading a blob now costs a decompression on the loading thread.
  • A revert is enough: the old files are never written by this build.

Checklist

This PR's base is mod-api: read main below as the base.

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 check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

## Summary The shared shader store keeps every program's SPIR-V once, but uncompressed: 3.7 GB for one translator's shaders, and 5 to 7 GB on a PC that has been updated a few times. SPIR-V compresses well, so each blob is now one zstd frame (level 1), or the words as they are where that would not be smaller. The same shaders take 0.99 GB. On top of `mod-api` ([#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822)). See [#1649](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1649) (its "compress each stage", applied to the store from [#1809](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1809)). Read first: `gpu/vk/spirv_pack.h` (format, `put`, `read_words`, compaction), then `kProgramCacheFormat` and `open_recorded` in `gpu/vk/vk_progcache.cpp`, and `store_bounds` in `builder/crates/build-driver/src/shader_cache.rs`. - **New files, `spirv.zpack` and `spirv.zidx`, format 2.** An older build takes a head of another version for damage and makes the store again, so the old names are left to the builds that read them. - A blob's third head word, and the index's fourth, now hold the word count (low half) and the stored bytes (high half). Hashes are still of the words, checked after decompression. - Compression runs with the store's lock released. Compaction copies frames as stored. - `kProgramCacheFormat` 3 → 4, so a program cache naming an old store starts over. - The builder's receipt check and `scripts/validate_spirv.py` read the new format. Related: [#2153](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2153) changes `Store::read`'s file handles. Whichever lands second needs a small rebase. ## Testing **On the current head** (08ca00bc, rebased onto `mod-api` 582b6a1a with no conflicts): the renderer builds on Linux (`dev.py vk`). `mise run test`: 824 passed, 35 failed, 12 skipped. The same 35 all fail on untouched `mod-api` 582b6a1a: `test_astc_upload_chunking`, `test_async_astc_upload_chunks`, `test_bind_memo`, `test_blocks_at_start`, `test_direct_buffer_writes`, `test_drawn_page_map`, `test_draw_stream_visibility`, `test_early_split_before_draw`, `test_flat_map`, `test_fsr_image_retirement`, `test_fsr_uniform_ownership`, `test_image_reaper_threads`, `test_import_reach`, `test_late_fix_build`, `test_lifter`, `test_menu_i18n`, `test_mirror_bookkeeping`, `test_pass_barrier`, `test_present_acquire_ahead`, `test_present_image_free`, `test_readback_timeout_reuse`, `test_recorder_sync`, `test_recording_admission`, `test_report_words`, `test_staging_burst`, `test_target_retention`, `test_tex_desc_memo`, `test_text_keyboard_policy`, `test_ub_snapshot_default`, `test_ub_snapshot_gpu_writes`, `test_vk_wb_cpu_words_fast`, `test_vram_compact`, `test_wb_diff_stale_shadow`, `test_wb_pending_capture`, `test_wrote_regions`. `cargo test -p build-driver`: 239 pass in the library tests, and `a_copy_links_the_builders_files_clones_the_rest_and_refreshes_in_place` fails with `game_folder_busy`, as it does on that base. The game runs below were made before the rebases and not repeated. **Tested:** Linux, RTX 3090, NVIDIA 620.70.06. (before the rebases) - `dev.py rt` over base d193d12d: the shader preparation filled the new store, 39,173 noted pipelines built, 0 not made. - `dev.py smoke` twice: PASS both times (in play from `kokiri-start`, 900 frames, menu opened). In both, the confined dev game could not reach the builder's store and used a fallback program cache with the player's default store (an earlier smoke log from 29 November, without this change, shows the same). The second run loaded the 544 programs the first had written there (56.6 MB of SPIR-V read from compressed blobs), with no read failures. - `mise run test`: 836 passed, 10 failed, 12 skipped. The same 10 fail on `mod-api` at f53e1c42: `test_blocks_at_start`, `test_draw_stream_visibility`, `test_fsr_uniform_ownership`, `test_image_reaper_threads`, `test_lifter`, `test_readback_timeout_reuse`, `test_recording_admission`, `test_target_retention`, `test_tex_desc_memo`, `test_vram_compact`. - `cargo test -p build-driver` (244 passed in the library tests), `cargo clippy -p build-driver --all-targets -D warnings`, `cargo fmt --check`, pre-commit. - `tests/spirv_pack_test.cpp` has new cases: a frame is smaller and read back by another start; a damaged frame is refused and written again; format 1's files are untouched; compaction keeps a frame readable. **Still to test:** - Windows (llvm-mingw): build and start, expecting the store made and read (CI for the compile; the start by hand or @Beanstalk). Not compiled for Windows here. - A game that plays from a store the preparation filled (the launcher's Play, which sets `LONGSHOT_SHADER_STORE`): programs load with no "did not read" lines (by hand). ## Measurements **Verdict:** the same shaders take 3.7x less disk. Load time and fps were not measured. Setup: Linux, RTX 3090. The store a preparation of this PR wrote (50,898 blobs); the sizes are the word counts and stored bytes in its index. `main` was not run: its store (format 1, the same `spirv_pack.h` as `mod-api`'s before this PR) keeps these words uncompressed, so the first column is their size. Measured on the head before the rebases, which did not change the format. | | Before: main @ dec32f72 | After: this PR @ a18747be | |---|---|---| | SPIR-V | 3.706 GB | 0.993 GB | Cost, from a one-thread Python and libzstd microbenchmark over 3,061 sampled blobs (rough, not a timed run): decompression about 67 µs for an average shader (91 KB) at about 1.35 GB/s, compression about 550 MB/s. LZ4 on the same sample decompressed about 3.5x faster but stored 1.7x as much. ## Risks - **One more shader preparation after updating:** the old store is not converted. - **Disk goes up before it goes down:** `spirv.pack` and `spirv.idx` stay for older builds until the player deletes them. - **The Launcher needs [LongshotLauncher #397](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/397)** before this reaches players: without it, "Free up space" neither counts nor frees the new files. - **A play shader cache shared with a build of format 3:** the builder's `shaders/<translator>/<driver>/` folder is not keyed by `kProgramCacheFormat`, so a player who alternates an older build and this one with the same translator has each start replace the other's program cache (as with earlier format bumps). The store itself is not affected. - `scripts/validate_spirv.py` reads the new store only: a format-3 cache's stages in `spirv.pack` need that tree's script. - Reading a blob now costs a decompression on the loading thread. - A revert is enough: the old files are never written by this build. ## Checklist This PR's base is `mod-api`: read `main` below as the base. ### 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 check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The game side (between the C host and the lifted game) moves from C to Rust (game/crates). A mod API lets script mods,
in TypeScript or JavaScript run by QuickJS in the game, read and change the game with the permissions the player
grants; file mods load as before. Every game setting and feature becomes a system mod on that API (game/mods, Rust or
TypeScript), the Insert menu and the Mods tab included. longshot-builder becomes the game's only entrypoint, its
sandboxer (Landlock and seccomp on Linux, an AppContainer on Windows) and its broker over one framed channel. The former
#2434, squashed.

Co-authored-by: Chloe Christley <[email protected]>
Co-authored-by: Jer9 <[email protected]>
Co-authored-by: snaildev99 <[email protected]>
Co-authored-by: SqueezyLemonade <[email protected]>
Co-authored-by: flashman4 <[email protected]>
Co-authored-by: dyst <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Summary

**Why.** On the mod API branch ([#2822](#2822)) a headless run's screenshots (`RX_VK_SHOTS`, `RX_VK_SHOT_MENU=1`) drew the mods' UI with a copy of the window's draw order of their own, without Colour vision, and laid the hosted debug page out at the window's size instead of the shot's. This makes the shot and the window draw the overlays through one function, so a headless shot shows what a window would: mods' HUDs, windows and world labels, then the Insert menu (the menu system mod) and its page.

**What changed**

- `gpu/vk/vk_menu.cpp`/`.h`: `draw_overlays` draws the mods' UI, then the menu and its hosted page; `menu_record` (the window) and `menu_record_image` (a shot) both call it, and the shot takes the window's Colour vision mode.
- `gpu/vk/vk_replay.cpp`: the shot path passes Colour vision as the window does.
- `gpu/vk/vk_ui.cpp`: the hosted debug page is laid into the shot's size when headless.
- `gpu/vk/switches.def`: `RX_VK_SHOT_MENU`'s row says what it draws (default off, unchanged).
- Docs: `docs/dev/developing.md` (screenshots on a timer), the guide images README.
- `docs/dev/reference/control-bridge.md`: `menu_key` works headless only with `RX_VK_SHOT_MENU=1`, which ticks the menu there.
- Tests: `tests/test_fps_overlay_order.py` runs both record paths with stubs and checks they make the same draws and colour mode; `tests/test_ui_renderer.py` follows `draw_overlays`.

## Testing

**Tested:** Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06), on bfa15b49 (before the rebase onto mod-api 4cc50ca1; f32312f8 compiles and passes the changed checks), a headless run through the job queue with the sandbox on, 1920x1080 shots every 20 presents, `RX_VK_MENU_SCRIPT` opening the Insert menu and stepping through its tabs, and the `link-hud` example loaded through `LONGSHOT_DEV_MODS`: the shots show the menu system mod's Graphics, Audio, Gameplay, Controls and NFC tabs as a window shows them, and link-hud's HUD (hearts and rupees, top left) and its label over Link with the menu closed.

**Still to test:**
- A shot after a mod is switched off in the Mods tab, expecting its HUD gone (by hand, or a menu script that turns it off)

## Measurements

**Verdict:** nothing to measure: the change is in a diagnostic switch's path (`RX_VK_SHOT_MENU`, off by default); a window's present calls the same draws as before, in the same order.

## Risks

- A window's overlays now go through `draw_overlays`; the test checks the window and shot paths make the same draw sequence. No switch to turn it off: the window path's order is unchanged.

## Checklist

### Ready for review

- [x] One topic, on current `main`; the title is a Conventional Commit. *(On the mod API branch, the base of this PR.)*
- [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). *(The two checks this changes pass; the rest is the mod API branch's.)*
- [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.
- [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.
- [ ] Approved in review, every comment answered.
- [ ] CI passes on the head.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #2837
## Summary

Fourteen of the game-free checks (`tests/run_all.py`) failed on `mod-api`, on the old head (816d2354) as on the one rebased on main 46291934: each fixture copies real code out of the tree and had not followed it. While they fail, CI's game-free checks on [#2822](#2822) cannot pass. Test fixtures only; no game, renderer or builder code changes.

- **Video** (catch-up, hold early, input limit, vcore acquire): a `movie_now` stand-in, host/nn_video.c's clock without the background hold.
- **Shader cache and memory** (program cache cleanup and one variant, loaded modules drop, Linux pressure): the shader store held as a pointer, as `vk_progcache.cpp` holds it.
- **Present source crop**: `drain_framegen_sets`. **Guest holes**: `UploadLayoutGuard` and the transfer layout.
- **Windows display startup and screensaver**: the window icons and DPI, and `WM_NCDESTROY`.
- **Controller in background**: read through `PADS_IN_BACKGROUND_SETTING` (off while Pause in background is on); the fixture takes that macro from host/nn_hid.c.
- **Text keyboard policy**: newer clang's `-Wunused-but-set-global` on the fixture's counter.
- **Windows on Linux**: the renderer job runs `dev compile`.

Read first: tests/test_input_background.py (the only check whose reading changed, not just its stand-ins).

## Testing

**Tested:** Linux (CachyOS, clang and gcc): the 14 checks pass with `tests/run_all.py --exact`; before this change each failed on the old `mod-api` head and on the rebased one. Nothing the game runs changes, so no game run.

**Still to test:** None (CI's game-free checks run them on Linux and Windows).

## Measurements

Nothing to measure: test fixtures only.

## Risks

None for players: only tests change. A fixture's stand-in could hide a real change in the code it copies; each stand-in mirrors the code's own behaviour as named above.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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 check under `tests/` that reads changed source is updated, not weakened.
- [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)

Reviewed-on: #2848
feat(modapi): nav.closest, the closest point on the game's navmesh, made after its navmesh update

## Summary

A first `longshot/nav` module: `nav.closest(position, { radius })` settles with the point on the game's own navmesh
closest to a position (and its distance), or null. A mod can now put a spawned actor where a character could stand,
check that a spot is walkable, or snap a marker to the ground, as the game's AI does (its
`QueryGetClosestNavMeshPoint`). It is the first of the navmesh calls: paths, line of sight along the navmesh and a mod's
own cuts come next, on the same site (`docs/dev/reference/nav.md`, "What comes next").

- **`game-core`**:
  - `nav` (new) asks the game's closest-point call (`nav.closest`, `f_80542dc0`). The request is built on the guest
    stack, as the game's callers build it (`layout::nav`), for the map's first character type, with the default
    filter and no navmesh object of the asker's own.
  - The manager comes from its variable (`nav.manager`, `0x84eaedb0`); 0 means no navmesh now.
  - Fixed slots hand queries over without a lock, as `rays` does.
- **One site**: `nav.updated`, the return of the navmesh manager's update job (`f_80781b00`, which holds the manager's
  lock exclusively while it steps the Havok AI world). Queries are made there, on that job's thread, once every lock is
  released.
  - This is the reason the main thread never asks itself: the call takes the same lock shared, and the update may wait
    on jobs the main thread runs, which is the reason `world.ray` is cast after the physics step.
  - The site is off while nothing is asked.
- **`api`**: `services::nav` (new). It allows at most 64 queries a frame for a mod, and nulls a query that has waited 4
  frames (a pause, a load). Answers settle at the next serial point. It needs `state.read`.
  - The feature is `has("nav.closest")`.
  - Schema: `nav.toml`, plus `NavPoint` and `NavOptions` in `types.toml`.
- **Docs**:
  - `docs/modding/nav.md`, the guide.
  - `docs/dev/reference/nav.md`: what was read of the game, the request's layout, the threading, and the run.
  - The generated reference.

Read first: `game/crates/game-core/src/nav.rs`, the `nav.updated` site in `game/sites/sites.toml`, and
`game/crates/api/src/services/nav.rs`.

## Testing

**Tested:** Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24, build `e0f3ccfa`.

**Game-free tests:**
- `game-core` `nav`: 6 new tests, run with `host_sys::fake`.
  - Asked, made and taken.
  - Cancelled.
  - Every slot taken.
  - The request in guest memory, byte for byte as the game builds it, against a fake call.
  - Nothing near, no manager, a bad ask.
  - The feature needs the call, the manager and the site.
- `api` `services::nav`: 2 new tests (a point read as a `NavPoint` with its distance, and the radius rules). The settling
  and the limit are covered by the in-game run.
- `game-core` (all), `game-sites`, and the builder's `sites` (the new site's owner line) pass.
- `schema-gen --check`, `tests/test_doc_anchors.py`, and `cargo check --workspace` are clean.

**In the game:** a probe mod's in-game test, `dev.py game-tests`, sandboxed and headless. Link starts in Kokiri Forest
at (-46.09, 118.44, 15.39).
- `has("nav.closest")` is true.
- From Link: the point 0.05 m below his feet.
- From 1.5 m above him (radius 3): the ground below, 1.55 m away.
- From 30 m above (radius 2): null.
- 40 queries in one frame along a 20 m line, 1 m up (radius 4): all settled, 34 points and 6 null, where the line left
  the walkable ground.
- 70 asked in one frame: 64 asked, the other 6 thrown as a `LimitError` at the call.
- The test: `ok - test/nav.test.ts: the closest navmesh point is under Link, found from above, and none 30 m up`, 1
  passed, exit 0.
- Run again on this branch's head, rebased on the squashed `mod-api` (`eaf4a48b9`), with the builder confining the
  game: the same numbers, and the test passed (exit 0). It was merged locally with #2726 and #2747, which a sandboxed
  test run on the new `mod-api` needs; that merge was not pushed. The first runs were on the earlier `mod-api`, before
  the rebase and BeanBot's batch-bounding commit.

**Still to test:**
- @Beanstalk: Linux, in the game: `dev.py game-tests` of a mod calling `nav.closest` at Link in Kokiri Forest.
- By hand: Hyrule Field's tiled navmesh, and a map with none.
- By hand: a query across a load, which should be null after 4 frames.

<details><summary>The 118 checks that fail on Windows on mod-api (`eaf4a48b9`) too</summary>

`test_antilag.py`, `test_astc_decoder_gpu.py`, `test_async_safe_frees.py`, `test_audio_output_devices.py`, `test_audio_source_load.py`, `test_auto_handheld.py`, `test_bc_copy_layer_pitch.py`, `test_builder_channel.py`, `test_builtin_compute_unoptimized.py`, `test_capture_dimensions.py`, `test_capture_readback_visibility.py`, `test_capture_resources.py`, `test_coopmat_probe_failures.py`, `test_crash_record.py`, `test_desc_counts.py`, `test_dev_ab.py`, `test_dev_build.py`, `test_dev_migrate.py`, `test_dev_packs.py`, `test_dev_update.py`, `test_device_policy.py`, `test_draw_binds.py`, `test_draw_stream_visibility.py`, `test_drs.py`, `test_dummy_views.py`, `test_dump_readback.py`, `test_fallback_pipeline_state.py`, `test_float_add_subgroup.py`, `test_framegen_resources.py`, `test_framelog_sink.py`, `test_fsr3_release_frees.py`, `test_fsr3fi_hud_mask.py`, `test_fsr4_bind_dispatch.py`, `test_fsr4_tune.py`, `test_fsr_image_retirement.py`, `test_fsr_uniform_ownership.py`, `test_game_menu_mouse_buttons.py`, `test_gcn_mesh_shared_warp.py`, `test_image_view_retry.py`, `test_import_buffer_binding.py`, `test_import_log.py`, `test_import_reach.py`, `test_inline_write_order.py`, `test_input_background.py`, `test_input_movie.py`, `test_job_queue.py`, `test_lifter.py`, `test_linux_pressure.py`, `test_loaded_modules_drop.py`, `test_longshot_builder.py`, `test_longshot_ctl.py`, `test_lost_wait_said.py`, `test_low_vram_texture_mips.py`, `test_menu_hooks.py`, `test_mesh_fallback_strict_fmul.py`, `test_mesh_first_types.py`, `test_pads_after_menu.py`, `test_parity_gates.py`, `test_pass_barrier.py`, `test_pass_hazard.py`, `test_pcache_header_read.py`, `test_pipeline_key_values.py`, `test_pipeline_state_portable.py`, `test_pipeline_states.py`, `test_present_probe.py`, `test_present_queue_default.py`, `test_present_sites.py`, `test_present_source_crop.py`, `test_program_answer_domains.py`, `test_program_cache_cleanup.py`, `test_program_cache_one_variant.py`, `test_push_state.py`, `test_queue_priority.py`, `test_recorder_own_idle.py`, `test_recorder_parts.py`, `test_recorder_sync.py`, `test_recording_admission.py`, `test_replay_write_order.py`, `test_reshade_fx.py`, `test_run_all_mingw.py`, `test_same_draw.py`, `test_same_dyn.py`, `test_sampler_admission.py`, `test_seed_reader.py`, `test_shader_store.py`, `test_sparse_bind_failure.py`, `test_sparse_bind_ranges.py`, `test_split_ub_flush.py`, `test_staging_burst.py`, `test_taau_typed_dispatch.py`, `test_table_track.py`, `test_target_layouts.py`, `test_target_reuse_memory.py`, `test_temporal_present_bandwidth.py`, `test_texel_buffer_ownership.py`, `test_texture_init_barrier.py`, `test_texture_staging_publication.py`, `test_ub_snapshot_default.py`, `test_ub_update_batch.py`, `test_ui_record.py`, `test_ui_texture_upload.py`, `test_vcore_video_acquire.py`, `test_vendor_fixes.py`, `test_vertex_bind.py`, `test_vertex_bind_range.py`, `test_video_catchup.py`, `test_video_hold_early.py`, `test_video_input_limit.py`, `test_vk_occlusion_queries.py`, `test_vulkan_clear_mip.py`, `test_vulkan_copy_span.py`, `test_vulkan_copy_span_gpu_compile.py`, `test_wb_diff_observations_gpu.py`, `test_widen_alpha.py`, `test_windows_on_linux.py`, `test_windows_stop.py`, `test_wmma16_zero_c_kchain.py`, `test_xinput_thread.py`

</details>

## Measurements

Nothing to measure: the site is off while no mod asks, and a query is one call of the game's own on its navmesh job's thread.

## Risks

- **Safety of the call.** It is made on the navmesh job's thread once the job has released its locks, while the game's
  own readers take the same lock shared from their threads. The call is a reader too.
- **Wrong answers.** If the game changed its request layout, a query would answer wrong, not crash: the request is the
  game's own, fully written and zeroed. The site's signature pins the build.
- **Reverting** is enough: nothing is written to saves.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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): Windows, this branch: 669 passed, 120 failed, 47 skipped. The same 118 fail on mod-api; the other two (`test_host_alloc_wait`, `test_mesh_args_cleanup`) pass on rerun, flaky under the full run.
- [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 check under `tests/` that reads changed source is updated, not weakened.
- [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)

Co-authored-by: BeanBot <[email protected]>
Reviewed-on: #2745
Reviewed-by: HumanBean <[email protected]>
## Summary

[Your first mod](docs/modding/getting-started.md) was written for someone typing every step themselves. It now opens with two ways to make a mod: **by hand**, through the steps, or **with a coding agent**, with an example of what to tell the agent and a list of what stays the player's (the game's questions, new permissions, playing it, which save tests may use, nothing of the game leaving the PC). Step 5 now shows how to watch the running game from a terminal (`mod status`, `mod log --follow`, `mod shot`), which is also how an agent sees what a mod does.

The page is also shorter and plainer: a "You should see" after each command, numbered sub-steps where there are several, the launcher's folder layouts moved to a "Finding `Longshot.exe`" section at the end, and the side notes (plain JavaScript, no Node) gathered under "Good to know". Every command, manifest field and code example is unchanged.

[agents.md](docs/modding/agents.md) said the control bridge's commands were gone. They are in the builder's mod tool (`game/crates/modtool`, `cmd::live`), so that section is now "Watching the running game" with the commands, the loop says to run `mod run` in the background and watch it, and the page names `types/longshot.d.ts` as the API as this Longshot has it.

A second commit is an accuracy pass over docs/modding against the code. A mod is now shared mainly from git: step 9 is "Check and share it" (push the folder, tag versions; players add the repository as a source and `mod install` it; `mod publish` for a signed repo; `mod pack` last, for one file to hand out or host), and agents.md, README.md, scripting.md and packages.md say the same. Also fixed: `mod check`'s expected output (the `local` owner's hint), the real-game tests (`mod test --game`), the log's place (`diagnostics/logs/`, found with `mod where`), the example count (48), examples.md's lists, `#:schema` (not `"$schema"`), trust.json's wording, and scripting.md's stale "not in the builder's tools yet".

Read first: docs/modding/getting-started.md, "Two ways to make a mod" and "Make it with a coding agent".

## Testing

**Tested:** Linux: `tests/run_all.py --exact` on the checks that read docs/modding (test_doc_anchors, test_check_pr_description, test_dev_check, test_gfx_effects, test_gfx_world, test_world_depth) pass; pre-commit on both files passes. The running-game commands were checked against `game/crates/modtool/src/lib.rs` (the fallthrough to `cmd::live`) and docs/modding/tools.md.

**Still to test:**
- Any PC: follow "Make it with a coding agent" with an agent from an empty folder, expecting it to make, test and run a mod while the person answers the game's questions (by hand).

## Measurements

Nothing to measure: docs only.

## Risks

None for players: docs only. The agent prompt links agents.md on `main`, which has this page only once mod-api is merged.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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] 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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2852
## Summary

With **Mouse camera: Native**, walking through a loading zone with forward held swings the camera 45 to 90 degrees after
the load, and further the more the view was turned away from Link as he left
([#1728](#1728); the controller reports there fit too when Native
is on, since it acts without the mouse moving).

The native mouse look (`game_core:📷:mouse`) keeps its own yaw and pitch and puts them back into the player camera
at every update, so the game's follow camera never drifts the view. It starts again from the game's angles only for a
new camera, a stick turn, a camera state other than 3 or 4, or 150 ms without an update. A map change can pass none of
those, so the new map's camera, which the game puts behind Link, was turned back to the angles the mouse held in the map
left: a swing by however far the view stood from Link's facing as he went through.

Now, while a map loads, while its arrival's events play and for 30 updates after them, the camera's angles are the
mouse's start at each update. The mouse still turns them, and the new map's camera stays where the game put it. An event
with no load (Navi's words as Link walks, which this game plays during normal play) leaves the mouse's angles held, so
the follow camera's drift that the hold prevents does not come back.

On `mod-api` ([#2822](#2822)), where the mouse look is the game
side's Rust. Read `MouseLook::settling` in `game/crates/game-core/src/camera/mouse.rs` first.

Fixes #1728

## Testing

**Tested:** On this PC (CachyOS Linux, RTX 3090), on `mod-api` @ aea64d3a.
- In the game, headless, `HOS_MOUSE_NATIVE=1`, from the `market-entrance` save: Link walked out through the Market's
  gate into Hyrule Field, with the player camera's fields read from memory each sample (`HOS_CONTROL_MEM=ro`). Before
  (`mod-api`) and after (this PR) the camera came out behind Link (the view's yaw 0 with his facing 0). After, it
  followed the game for the settle window and was held again after it. No faults in either log.
- What those reads showed, and why this walk does not swing here: the player camera is the same object before and after
  the load. Its yaw (+0x1a4) is kept in the map's own frame: the Market's view at -180 had yaw 0, and Hyrule Field's view
  at 0 had -180. The camera kept updating in state 3 through the departure event. On this PC the camera then missed more
  than 150 ms of updates during the load, which already resets the hold. A load over within 150 ms (a fast PC, as the
  reporter's Ryzen 9 9900) keeps the old map's yaw, which points another way in the new map: the swing. That case is what
  `a_load_seen_only_by_the_map_changing_is_a_new_start` checks, and why the map's name is watched as well as the flag.
- `cargo test -p game-core`: 355 passed. The two new tests (`a_new_maps_camera_is_the_games_not_the_last_maps_mouse`,
  `a_load_seen_only_by_the_map_changing_is_a_new_start`) fail on `mod-api` (the camera held at the mouse's 90 degrees
  instead of the new map's -30 and -180) and pass here. With the fix's `|| settling` taken out they fail again.
- `cargo clippy -p game-core --all-targets` and `cargo fmt --check`: clean.
- `mise run test` (before the rebase onto #2848): 821 passed, 17 failed, 11 skipped. Run one at a time after the
  rebase, the 17 give the same results here as on `mod-api` @ aea64d3a: 14 pass, and `test_lifter.py`,
  `test_present_source_crop.py` and `test_text_keyboard_policy.py` fail on both. None of them reads the mouse look.
- Not tested here: the reporter's case (forward held, the mouse turned at the exit). A headless run gets no mouse
  motion, and this PC's loads leave the camera stale. It is in Still to test.

**Still to test:**
- Windows or Linux, keyboard and mouse, Mouse camera Native: hold W through a loading zone, straight and with the mouse
  turned as you pass, expecting the camera behind Link after the load with no swing (by hand).
- The same with W let go during the transition, and with Disable camera centering on and off, expecting no change from
  `mod-api` (by hand).

## Measurements

Nothing to measure: a fix in the mouse look's decisions; its cost is one flag read and the map's name per player camera update while Mouse camera is Native.

## Risks

- During a load's arrival and for about half a second after it (30 updates), the game's own camera moves (its follow,
  its placement) count, as they do while the stick turns the camera; the mouse still turns the view throughout.
- A load the flag does not show would keep the old behaviour. A revert is enough to undo it.
- Nothing changes for Mouse camera As the stick or Off, saves or `longshot_options.ini`.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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). (3 fail on `mod-api` too, named in Testing)
- [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 fix: a game-free test that fails on `main` and passes here.
- [x] A check under `tests/` that reads changed source is updated, not weakened. (`test_mouse_native.py` and `test_input_movie.py` read it: both pass unchanged)
- [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)

Reviewed-on: #2851
## Summary

[#2745](#2745) (nav.closest) was merged into `mod-api` with three rustfmt diffs, in game/crates/api/src/services/mod.rs (`pub mod nav;` out of order) and game/crates/game-core/src/nav.rs (two places). CI's Rust job runs `cargo fmt --check`, so it fails on `mod-api`, which blocks [#2822](#2822). This is `cargo fmt -p api -p game-core`, nothing else.

## Testing

**Tested:** Linux: `cargo fmt --check -p api -p game-core` reported the three diffs on mod-api (aea64d3a) and passes here.

**Still to test:** None.

## Measurements

Nothing to measure: formatting only.

## Risks

None: formatting only.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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] 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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2855
## Summary

The Insert menu's layout used to be written down twice. `game/mods/menu/src/layout.ts` listed every row of every tab in order (200 keys). The system mods' `mod.toml` files also gave 245 rows a `place`, but the menu read a `place` only for a row the layout did not name. So 184 rows had two places, and the one in `mod.toml` was ignored.

Now there is one rule, the same one a player's mod already uses: every row goes where its declaration's `place` says. `layout.ts` keeps only the tabs, the pages, the headings, and the menu's own links and lines, down from about 300 lines to about 100. Each row is laid out by `view.ts` `laidOut`:
- If the place names a row or link (`after` or `before`), the row goes next to it, in that row's section.
- Otherwise it goes at the end of its `section`, or at the end of the tab's untitled top when it names no section.
- Rows at the same spot go by `order`, then in the order they were declared.
- An anchor that is not on the tab is ignored, and so are anchors that loop back on each other.

The layout's links and lines are placed by the same rule.

Every row stays where it was. To get there, 14 place lines changed across the graphics, interface, developer, cheats, controls and damage mods. Layout preset and Button prompts are now placed on the Controls page, which is where they were already drawn.

The settings table in `docs/user/graphics-and-controls.md` listed six rows in a different order from the menu. Those lines now follow the menu's order.

Removed:
- the row lists in `layout.ts` and `view.ts`'s `panelKeys` and `LAID_OUT`;
- `tests/test_system_settings_placed.py`, a Python re-implementation of `laidOut`;
- `game/crates/longshot-game/tests/menu_places.tsv` and the test that read it.

Read first: `game/mods/menu/src/view.ts` (`panelLines`), `game/mods/menu/src/layout.ts`, and `game/mods/menu/test/menu.test.ts` (`PLACED` and the layout tests).

Part of the mod-api cleanup (area 5).

## Testing

**Tested:** On Linux with an RTX 3090:
- **Snapshot.** Before changing anything, I ran the old `laidOut` on the old manifests (the recordings rows included) and the new `laidOut` on the new manifests. Every tab and page matches in order and in each row's section. That snapshot is now `PLACED` in `menu.test.ts`, and the menu's layout tests are held to it.
- **Menu tests.** They pass on the fake game: `cargo test -p modtool the_typescript_system_mods_pass_their_tests`, run through the queue. That covers each tab drawn in `PLACED`'s order and every system mod's place naming a tab, heading and anchor the menu has (these checks used to be in `test_system_settings_placed.py`). It also covers each section keeping a row on every PC, `laidOut`'s rules on rows made up for the test, and the docs table in the menu's order.
- **Other checks:**
  - `cargo test -p longshot-game menu` passes.
  - `cargo clippy -p modtool -p longshot-game --all-targets` is clean.
  - `schema-gen --check` passes.
  - `run_all --exact` passes for `test_menu_ini_keys`, `test_pipeline_share`, `test_audio_volume`, `test_pad_speaker`, `test_upscaler_rows` and `test_menu_i18n`.
- **Full `tests/run_all.py`:** 732 passed and 2 failed, and neither failure is from this change. `test_lifter`'s `cargo fmt --check` trips on `api/services/mod.rs` and `game-core/src/nav.rs` from #2745, which is already on mod-api. `byte_compile_tracked` looks for the deleted Python test because the jj workspace's git index is stale; it passes on a checkout of the commit.
- **Game run.** I ran a headless game from the kokiri-start save through the queue. The Insert menu opened, hosted by `system/menu`, and all seven tabs were stepped through with no script error. The bridge's screenshots show the game picture without the menu, so they say nothing about the rows' order.

**Still to test:**
- Any PC: open the Insert menu and look through every tab and page, expecting the same rows in the same order as on mod-api (by hand).
- Any PC: switch the cheats mod off on the Mods tab, expecting Damage taken to stay on the Debug tab under Input recording (by hand).

## Measurements

Nothing to measure: no game code or rendering changed. The menu's own cost test still passes (see Risks for its tab-switch ceiling). Measured outside the game, `laidOut` for the Graphics tab takes 0.32 ms against 0.50 ms before.

## Risks

- **Rows in a different place.** A place that does not match the old layout would move a row. `PLACED` fails on any such move with all of Longshot's mods on.
- **Optional mods off.** Some rows sit in a slightly different place than before:
  - With the Damage mod off, Mark position goes last on the Debug tab. Before, the old algorithm put it next to Return to mark. With every mod on it is last, as it was, so `order = 120` keeps it there.
  - With the Grass mod off, the shadow rows now stay under Detail. Before, they fell to the end of the tab.
- **Players' mods.** A row whose place gives only `tab`, or names an anchor that is missing, now goes to the end of the tab's untitled top, before its first heading. Before, it went to the end of the tab. The docs already said "the tab's top"; the code now matches them. The mod API is not shipped yet.
- **Cost test.** It now declares every system row, not only the rows the layout named: 58 on the Graphics tab where it was 38. So its tab-switch ceiling goes from 4.5 to 5.5 ms. It measured 4.49 ms with a quiet queue and 5.35 ms while a game ran beside it, which is close to the new ceiling on a busy PC.
- **Translation.** Game queue priority was already untranslated on mod-api, which made the menu's translation test fail. It is now on `UNTRANSLATED`.
- **Reverting.** A revert is enough. Nothing changes in players' files.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; the title is a Conventional Commit.
- [x] 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). (`run_all`: 2 failures, both named above as not from this change.)
- [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 check under `tests/` that reads changed source is updated, not weakened.
- [ ] Screenshots of the same spot on `main` and here, for a change that shows on screen. (The bridge's screenshots do not include the menu: a by-hand look is in Still to test.)
- [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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2861
## Summary

A mod can now add a **game language**: a new choice on the Game language row (Gameplay tab), beside the game's 16,
with the game's own text translated. The ask came from the USenRT retranslation (an "English (Retranslation)" next to
ordinary English), but nothing here is specific to it.

```toml
[[gameLanguages]]
id   = "en-US-x-retold"     # a language code none of the game's has: what the settings keep
name = "English (Retold)"   # the row's choice
base = "en-US"              # the game's language it is played in
```

The texts are `languages/<id>/<message file>.json`, one JSON object of texts by label (the shape of `longshot/i18n`'s
`strings/<lang>.json`), tags written as `content.text` writes them. No code and no permission.

Chosen, the next start:
- tells the game the base (`host/nn_applet.c` asks the game side, `hos_mod_language`);
- serves the base's text archive with the mod's texts in it: the language folder becomes texts patches made in
  memory, `"replace": true` (a label the game's file lacks is skipped and logged, never added), applied by the
  existing merged-file step and cached in `modcache/`.

Every other language, the base included, stays the game's. The settings keep the id, so an update keeps the choice.
If the mod is off, the game falls back to the id's first part when that is one of the game's (`en-US-x-retold`:
English (US)), else English (US). The setting is kept, so turning the mod back on brings the language back.

**For a launcher:** `Longshot.exe --profile P --output json mod languages` lists the row's choices: the game's 16, then
the languages the profile's mods add. The launcher change that uses it is a separate PR. A launcher that never asks
still shows the 16, as now.

Read first:
- `game/crates/api/src/game_languages.rs`: the list, the code rule, the run's languages;
- `game/crates/api/src/loader/language.rs`: the folder made into patches;
- the `game_init` change in `game/crates/longshot-game/src/lib.rs`: the languages published after the scan, and the
  settings opened after them;
- `host/nn_applet.c`;
- `docs/modding/i18n.md#game-languages`.

## Testing

**Tested:** Linux, RTX 3090, a pack on this PC's shared base, three headless runs from `kokiri-start`, with a local
pack of the USenRT retranslation (2,109 texts in 384 message files; it stays on this PC):
- **The mod's language chosen:**
  - the log shows `oe: language en-US-x-usenrt, a mod's, played in en-US` and the mod's 384 texts patches;
  - the merged `Mals/USen.Product.110.sarc.zs` matches, message by message, the archive the retranslation's own
    repacker builds from the same game files, on 21,137 of 21,138 messages;
  - the one difference is the microphone hint, which Longshot rewords for the PC (the merge starts from that wording,
    as every texts patch does).
- **English (US) chosen, mod on:** `oe: language en-US`; no texts patches applied.
- **The mod's language chosen, mod absent:** `... is not one the game has, nor one a mod on adds: en-US`; the setting
  is left as it is.
- **Checks:** `cargo test` for content, api, modtool, longshot-game and build-driver; clippy and fmt; schema
  regenerated; `tests/test_game_language.py`, with new cases for a mod's language, its fallback, `HOS_LANGUAGE` and the
  renderer's Auto. `nn_applet.c` syntax-checks with llvm-mingw and Linux clang.

**Still to test:**
- Any PC: open the Insert menu with the language chosen, expecting the Game language row to show its name. The control
  bridge's `option get game_language` reads 0 here for every language, a stock `ja` too, so it couldn't settle this
  (by hand).
- Windows: one start with a mod's language chosen, expecting the same log lines (`@Beanstalk`).
- A dialogue the retranslation changes, read in game (by hand).

## Measurements

Nothing to measure for a player without a mod's language: no new work runs. With one chosen, the cost is the
merged-file step's existing work for one text archive (about 2.4 MB) at the first start, then the cached file. Not
timed here.

## Risks

- **Mod-api only:** the manifest field, `"replace"` on texts patches and `mod languages` are new API, so nothing
  shipped changes.
- **Settings order:** the settings are opened slightly later in `game_init` (after the mod scan, still before the
  renderer loads). The host reads its language line from its own early copy, so it's unaffected.
- **A launcher with its own fixed list** shows a mod language's id rather than its name until it asks `mod languages`.
- **To undo:** a revert is enough.

## Checklist

### Ready for review

- [ ] One topic, on current `main`; the title is a Conventional Commit. (On `mod-api`, where the mod API lives.)
- [x] 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). (Only the touched crates' tests and
      `test_game_language.py` ran.)
- [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 check under `tests/` that reads changed source is updated, not weakened.
- [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux built; Windows syntax-checked only.)
- [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)

https://claude.ai/code/session_016o1k1QvyUwMcv8kvCNXuco
Reviewed-on: #2881
## Summary

The Insert menu's rows moved to the system mods' `mod.toml` and the TS menu mod, but the renderer and the host still carried the old C++ menu: `#ifndef MENU_LAYOUT_ONLY` guards around code that always built (the macro is defined nowhere), empty and write-only modules, 32 `Options` fields only an applier wrote, helpers only the old rows called, option ids nothing answers, `HOS_SETTING`'s ignored id, `MkwVkHost` slots no renderer code calls, and `host->version` gates that can never be false. This deletes them (area 1 of the mod-api cleanup survey, 1a and 1b together). It changes no behaviour except one bug:

- **Fix: the `-` and `=` keys did nothing.** They called `rx_option_set(7, …)`, which only moved the renderer's `opts.mouse_sens` (read by nothing); at the next read `host/nn_hid.c` took the game's value back. They now set `system/controls`' `mouse_sensitivity` through `game_setting_set`, as the flight shortcut does, rounded to the setting's steps of 10 (the game refuses a value off them). A press not at the end moves at least one step (at 10 %, `=` gives 20 %, where 125 % would round back to 10 %). On `main`/mod-api: in play with the mouse captured, press `=`; Controls' Mouse sensitivity stays at 100.

What went, by area:
- `gpu/vk/menu/`: the guards; `camera`, `motion`, `controller_speaker`, `volume`, `headset`, `autosave`, `detail`.cpp; the write-only appliers in `menu_settings`, `controller`, `gpu`, `gameplay`, `threads`, `audio`; `apply_preset`/`apply_auto`; `output.cpp`'s walkers; `Dlss5Preset`.
- Helpers: `upscaler_rows.h`'s steppers and fixed-stop block, `framegen_rows.h` down to `fixed_top`, `vk_menu_hit.h` down to what the ReShade bar uses, `vk_ui_theme.h`'s prompts, banner, paragraphs, shadows and unused palette, `i18n::plural`, `fmt_into`, the transition autosave's dead copy, `resolution_auto`, `mods_now_ns`, `kMicLevelHelp`, `env_release`; `hos_reset_binding`, `host_guest_alloc`.
- `HOS_SETTING(field, otherwise)` (49 call sites); every option id but the jitter's and the host's four notices; `game/options.h`.
- `MkwVkHost`: `tex_layout`, `guest_alloc`, `gyro_status`, `nfc_dir`, `reset_binding`, `rebind_control`, `binding_is_default`, `game_settings_generation`, `game_setting_text`, `game_setting_hint` (`MKWVK_API_VERSION` 82); `vk_host` filled with designated initialisers (every member maps to the function it did); the game's exports only those named (`game_settings_generation`, `game_setting_hint`, `game_camera_scale`, `game_movie_age`).
- The `host->version >= N` gates: the renderer takes a host of its own version only (`vk_main.cpp` `init_body`), as architecture.md already said.
- Website: the settings table's restart wording for Upscaler and Frame generation by matches their declarations (they change at once; only with Streamline running DLSS FG does a change wait for the next start); Volume and the Simulated turf link have help. The settings page reads the mods' declarations and the menu mod's own layout (`view.ts` `laidOut`) instead of parsing C++ rows that no longer exist.
- Docs: architecture.md's Insert menu part and AGENTS.md's menu rule describe settings declared in system mods.

Kept, being live: `hos_rebind_control`, `hos_binding_is_default`, `hos_sdl_gyro_status`, `hos_nfc_dir`, `hos_guest_word` (the game's Rust calls them); `game_setting_text`/`_row`/`_get`/`_set` (host and renderer); `upscaler_rows.h`'s step tables (`snap`, Auto's tuning); `Map`/`Hit` for the ReShade comparison bar; `aspect_started`; `kTierResolution`.

Read first: `host/nn_hid.c` `mouse_sens_set`, `host/game_settings.h`, `gpu/vk/vk_api.h`'s ids, `host/rx_backend.c` `vk_host`, `tests/area_settings.py`, `tests/vk_host_members.py`.

See #2822.

## Testing

**Tested:** in the game on this PC (Linux, RTX 3090), a pack and runtime of this branch on cb37f5ab (rebased since onto 12f42db5, #2861: the conflicts were docs, `layout.ts` and a website test's expected order, no C/C++), under gamescope: reached play from kokiri-start; the control bridge read `mouse_sensitivity` 100, after `=` 130, after `-` `-` 80 (`option get`); Insert opened the menu on Graphics (`menu_open: true`, hosted `system/menu`). Game-free: `tests/run_all.py` 834 passed, 3 failed; `test_lifter.py` fails on mod-api@origin too, `test_drs.py` and `test_stick_inversion_rest.py` were this branch's and are fixed (re-run through the queue: all three pass). `cargo test`/`clippy -D warnings`/`fmt --check` on `longshot-game`: pass. Windows: renderer `dev compile --only renderer` with llvm-mingw: pass; host C with llvm-mingw: 79 of 80 units, `host/nn_video.c` failing on `libavcodec/avcodec.h` not found (FFmpeg not on this PC's Windows tools; the file is untouched). `tests/test_mouse_settings.py` runs `mouse_sens_keys` over a stand-in game that refuses off-step values: it fails on mod-api@origin ("- and = hand the sensitivity to the renderer…") and on each mutation (off the steps, 70 % for `-`, another key, the call removed). Its ends case (10 % `=` gives 20 %, 20 % `-` gives 10 %) fails at 95dcd124 and passes at 433d3b2b, with gcc and clang (`--cc` now defaults from `CC`); `host/nn_hid.c` at 433d3b2b passes `-fsyntax-only` with llvm-mingw and gcc. Every rewritten check was run against its mutation. Website (after the rebase): `node --test` 97 pass, 1 fail (`publication.test.ts`, a fixture unrelated to this); `astro build` passes; `check-site.ts` passes (the Debug tab's ammunition lines reworded to name no game items).

**Still to test:**
- Windows: the game starts, the menu opens and `=`/`-` change Mouse sensitivity (`@Beanstalk` smoke on Windows NVIDIA).

## Measurements

Nothing to measure: deletions, and a fix shown by its test above.

## Risks

A renderer and host from different commits no longer start together (82), as before for any layout change. Input recordings name settings by the declarations' `legacyId`s, which this does not touch (`test_option_ids.py` now holds them distinct). Players notice only that `-` and `=` work, in steps of 10 %. A revert is enough.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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): `test_lifter.py` fails on mod-api@origin too.
- [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 fix: a game-free test that fails on `main` and passes here.
- [x] A check under `tests/` that reads changed source is updated, not weakened.
- [x] `MKWVK_API_VERSION` bumped (`MkwVkHost` or `MkwVkRenderer` in `gpu/vk/vk_api.h` changed).
- [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows host: every unit compiles at this head with the pinned FFmpeg 9.0.2 headers from tools.lock, queue job ffm-hostwin2)
- [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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2877
## Summary

The players' mods page, `docs/user/using-mods.md`, still said "Nothing downloads or unpacks mods for you", and it
only described emulator-style folders put in `mods/` by hand. Players can now add sources (a git repository, a signed
`longshot-repo.json`, an `.lsmod` URL) in the launcher or with `Longshot.exe mod source add`, and install, update, pin
and remove mods from them. The page now covers both ways to get mods:
- **from a source**: the launcher's Mods > Repositories / Discover, or `mod source add`, `search`, `install`,
  `update`, `pin`, `remove`. It also covers repo keys, the store and `mod gc`;
- **a mod of your own**: an `.lsmod` or `.zip`, a Longshot mod's folder or an emulator mod, put in the profile's
  `mods/` or copied in with `mod add` / `mod import`.

What it said about file mods (romfs/exefs, the Mods tab, the order, the size table, the log) is kept.

The README that `mod init` writes ended with "`mod pack` makes its `.lsmod`". It now says how to share the mod, as
getting-started.md's step 9 does: push to git and tag each version, `mod publish` for a repo, `mod pack` for one
file. Its test checks this text.

`docs/modding/template/AGENTS.md`, `CLAUDE.md` and `README.md` were stale and read by nothing (`mod init` writes its
own README; the builder only hashes the folder). They are removed. api-schema.md's list of the template's files now
includes `.gitignore`.

Read first: `docs/user/using-mods.md`, then `game/crates/modtool/src/cmd/init.rs`.

**`mod init --test`** (second commit). `mod init` still writes no test; `--test` also writes `test/main.test.ts`, from `docs/modding/template/test/main.test.ts` (kept), which `mod test` passes as written. Help, tools.md, agents.md, testing.md, getting-started.md step 6 and api-schema.md say so.

## Testing

**Tested:** Linux. No game run: docs, plus a string the builder's `mod init` writes.
- `cargo test -p modtool --lib cmd::init` (through the job queue): 2 passed
- `python3 -I tests/run_all.py --exact tests/test_doc_anchors.py tests/test_check_pr_description.py tests/test_dev_check.py`: 3 passed
- `pre-commit run --files` on the changed files: passed
- A fresh reviewer checked every claim against modtool (USAGE, service.rs, sources.rs), mod-store and the launcher's
  labels. Its three wording fixes are in.

- Review fixes (a0b07a96): the source example adds with `--yes` before searching; `pin` says it installs the version.
- `tests/run_all.py`, the whole suite, once through the job queue on a0b07a96: 734 passed, 1 failed, 114 skipped: the only failure, `tests/test_lifter.py` (build-core's `control::tests::the_socket_is_made_private_and_a_client_handed_over`, control.rs:428), fails the same way on mod-api @ 12f42db5.

**Still to test:**
- None

- `cargo test -p modtool --lib cmd::init` (through the job queue) on the second commit: 3 passed, including the new `init_test_writes_a_starter_test_that_mod_test_passes` (runs `init --test` then `mod test`: 2 passed) and plain init writing no `test/`.

## Measurements

Nothing to measure: docs and an opt-in `mod init` flag; nothing the game runs changed.

## Risks

Nothing a player notices except the new README text in a mod made with `mod init`. If the launcher's Mods page labels
change, the page's names for them (Mods, Repositories, Discover, Add mods) will need updating.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; the title is a Conventional Commit.
- [x] Tested on my own PC, as Testing says (no game run needed).
- [x] `mise run test` passes (any failure that also fails on `main` is named). (`tests/test_lifter.py`: build-core's socket hand-over test, failing on mod-api @ 12f42db5 too.)
- [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 check under `tests/` that reads changed source is updated, not weakened (init's test checks the README).
- [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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2868
## Summary

The development builds had two incremental build systems. The Rust builder is incremental by content: its object
store, the lifts by key, the game's Rust by key, and a shared shader cache. Over it, `scripts/devtools/packs.py`
(1,328 lines) and `build.py` kept a second one: a base, packs made of the files that differ from it, and runtimes
assembled from both. To do that, the Python guessed at the builder's insides:
- the link lists, the sources that carry the version, and which paths reach a link;
- `kProgramCacheFormat`, read with a regex;
- the renderer's cache file names, kept as a copied list.

`shadercache.py` was a second shared shader cache, with a key of its own. On mod-api nearly every change reaches the
game's Rust, so a pack was the whole module anyway.

This replaces both with one builder command and keeps only the policy in Python.

- **`longshot-builder dev runtime <dir>`** (new, `build-driver/src/dev_runtime.rs`) has four modes:
  - **With `--game` (a build):** it is `dev build`. Every file whose bytes are the base's (`--base`) is a hard link of
    the base's file. The install still stages each file and renames it in, so nothing ever writes through a link.
  - **Without `--game` (a copy):** a copy of the base. The builder's files are linked, the rest cloned, and the play
    state is left out. It is refreshed in place, and the runtime's settings and env file are kept.
  - **`--prepare-only`:** the shaders prepared, only when the caches it has are not known to be this translator's,
    program-cache format's and shader list's.
  - **`--give-back`:** what a run added to the runtime's caches goes into the base and the PC's shared cache.
- **The caches:**
  - Seeded as copy-on-write clones from the base and from the builder's own shared shader cache
    (`<cache>/shaders/<translator>f<format>/<drivers>/`).
  - Shared by name from an allowlist, checked against the renderer's source by a test, never its per-folder fault list
    or play markers.
  - Recorded per folder (`cache/longshot_runtime_caches.txt`).
  - Published back only when a preparation got to its end, never shrinking a file, under the renderer's locks.
- **The build** writes `program_cache_format=` into `longshot_version.txt`.
- **`longshot-builder info`** lists a new capability, `dev_runtime`.
- **`dev.py`:**
  - `rt`: this checkout over the nearest base, in its own warm work folder. Two queue jobs under the base's lock: the
    build (`build` mode), then `--prepare-only` (`shared` mode, the GPU).
  - `pack` is gone, folded into `rt`.
  - `rt --empty` is a copy of the base.
  - `ab` keeps a runtime that is current.
  - `check`'s builds and its cache harvest use the same steps.
- **`dev.py packs base|pack|rt|warm`** keep the Test Farm's command lines and files:
  - `base.json` (`commit`, `game_source`, `upscalers`);
  - `pack.json` (`generated`, `deleted`);
  - `dev_packs.busy`, and the work folders' `build_times.json`.

  A pack is now a game folder of its own over the base. `packs base` still refuses a tree with uncommitted sources.
- **`dev.py builder -- ARGS`** replaces `packs run`; `mise run build` and `build-dev` run it. `packs head`, which
  nothing ran, is gone.
- **New `dev.py smoke`:** one headless queue run of a runtime. It plays from a save, presents 900 frames, opens the
  Insert menu, takes a screenshot and checks the log, then says PASS or FAIL. Every agent here kept its own script for
  this.
- **New `dev.py disk [--prune]`:** what the development data uses on the disk, and what is safe to remove: never a
  store, never a runtime a process uses. It replaces `dev.py bases --prune`.
- **New `dev.py tools`**, which `mise run tools` now runs: tools.lock's build tools installed once in the PC's shared
  tools-store, with the checkout's `tools/` a link to them. Before, every checkout unpacked its own.
- **Removed:** `shadercache.py` and its test, and about 700 lines of packs.py. packs.py went from 1,328 lines to 629.

Read first:
- `builder/crates/build-driver/src/dev_runtime.rs`;
- `folder::install`'s `base` argument;
- `scripts/devtools/packs.py`;
- `build.py`'s `cmd_rt`;
- docs/dev/reference/build.md, "A runtime for development".

## Testing

**Tested:** Linux (CachyOS), RTX 3090.
- **One build job:**
  - this branch's builder compiled;
  - `tests/run_all.py`;
  - the old flow (mod-api's `dev.py pack --own-work` + `rt`) against the new (`dev.py rt`): a first build, a small C
    change (`host/hos_main.c`) and a small Rust change (`game/crates/longshot-game/src/cheats.rs`), over the shared
    base 462919343e, with the same builder program.

  In the new flow, 46 of the runtime's 54 files were hard links of the base's. A C change then put 2 files in and kept
  52, and a Rust change put 1 file in.
- **Then one shared job:**
  - `dev runtime --prepare-only` prepared the new runtime in 97 s and published 7 cache files into the shared cache;
  - `dev.py smoke` on it: **PASS**. In play from kokiri-start, 900 frames, the Insert menu opened with its page, no
    FATAL line.
- **Checks:**
  - `cargo test -p build-driver -p longshot-builder` passes (queue);
  - clippy `-D warnings` is clean;
  - `cargo fmt -p` is clean for both crates.
- **`tests/run_all.py`:**
  - 734 passed, 2 failed, 114 skipped.
  - `test_lifter.py` fails on `cargo fmt --all --check` of `game/crates/api/src/services/mod.rs` and
    `game/crates/game-core/src/nav.rs`. Those are mod-api's own (#2745), not touched here, and they fail on mod-api too.
  - `test_dev_packs.py` failed because the job's `LONGSHOT_BUILD` leaked into one test. That is fixed here, and the
    test passes with `LONGSHOT_BUILD` set.
- **The light checks:** test_dev_packs, build, ab, check, disk, smoke, game_tests, update, migrate, mise_build,
  job_queue, doc_commands and doc_anchors pass; pre-commit is clean on every changed file.
- **The review's fixes (2d99edab..2006d19c)**, one build job: `cargo fmt --check` and clippy `-D warnings` of
  build-core and build-driver clean; `cargo test` of `dev_runtime` 11 passed (new: a unit taken whole and never to shrink
  a cache, a give-back skipping a unit a running game holds); test_dev_smoke, test_dev_disk, test_dev_packs,
  test_doc_anchors and test_doc_commands pass.
- No host, renderer or other C/C++ file changed, so no llvm-mingw compile was needed.

**Still to test:**
- **Test Farm** (it runs main's `packs.py`): a run on this branch once it has a base. Expecting `packs base`, `pack pr`
  and `rt` to work as before, with `base.json` and `pack.json` read as before (`@Beanstalk` after the Farm's changes
  in Risks).
- **Windows** (`dev.py rt`, `rt --empty`): expecting the hard links, the CoW-or-copy clones and `dev.py tools`'
  junction to work (by hand).
- **This PC** (`dev.py disk`): a real dry run over the development folder. Expecting a listing with sizes and nothing
  removed (by hand).
- **Any GPU** (`dev.py packs warm` and `dev.py check`): expecting `--give-back` to copy grown caches back (by hand).

## Measurements

**Verdict:** the tools' own cost per change went from minutes to seconds. A runtime takes no disk beyond its own
files, and the old flow's 1.5 GB per checkout is gone.

Setup:
- this PC; one queue build job;
- the same builder program on both sides, `LONGSHOT_NO_PREPARE=1`;
- each side run in its own new checkout over the same base;
- each step's wall time, from its log's timestamps;
- disk as btrfs exclusive bytes (`btrfs filesystem du`).

| | Before: mod-api @ cb37f5ab (`dev.py pack --own-work` + `rt`) | After: this PR @ dbc97d8b (`dev.py rt`) |
|---|---|---|
| First build in a new checkout | 211 s for the pack (the change over the base), plus rt | 27 s |
| Small C change | 118 s (pack 32 s, then rt about 86 s) | 8 s |
| Small Rust change | 94 s (pack 40 s, then rt about 54 s) | 9 s |
| Disk of the change's own folders | 1,534 MB (pack-work.d 1,378, rt 156, the pack 0) | 1,151 MB (the work folder; the runtime 0) |

**Caveat:** the new side ran second. It took the objects and the game's Rust for the very same edits from the shared
store, which the old side had just compiled; the old pack's compile was its "done in" (0 to 1 min). So the
like-for-like number is the tooling's cost outside the compile: old rt about 54 to 86 s plus pack overhead, against new
about 8 s in all. A second run with distinct edits per side was not made, to keep to one queue job.

**Switches:** no new switch. `LONGSHOT_JOBS` (the builder's compilers at once) is not changed here and ships at its
default, unset: one compiler per CPU thread but one, so the PC stays usable while it builds (the launcher's Automatic
does the same). `LONGSHOT_BUILD` (a ready-made `longshot-builder` for dev.py, already on mod-api) is a development
tool's variable, unset by default: each step uses the tree's own builder. Neither is read by the renderer or the host,
so neither has a `gpu/vk/switches.def` row.

**The review's fixes (2d99edab..2006d19c)** change no timing: give-back and publish choose and lock differently, smoke and disk
judge differently. Nothing there to measure.

## Risks

- **The Test Farm, which must change three things:**
  1. It starts `<runtime>/longshot` directly. On mod-api the game is `longshot-game`, and only the builder starts it.
  2. Main's `packs.py` will need each side's builder to have `dev runtime`. A PR builder from before it exits 2 with
     "older than this dev.py". Check for `dev_runtime` in `longshot-builder info`'s `capabilities.builder`, and use an
     older tree's `packs.py` for such a builder.
  3. A pack is now a whole game folder, `packs/<name>/game`, whose unchanged files are hard links of the base's; there
     are no loose files over the base any more. `pack.json`'s `generated` and `deleted` are always empty.
- **Existing runtimes and bases on this PC keep working** (copy and build mode accept folders the old Python made).
  But they hold no `program_cache_format=` line and no caches note, so:
  - each runtime prepares once, incrementally over its caches, after this lands;
  - an old base gives its runtimes no caches until it is built again with this builder.
- **Removed commands:** `dev.py pack`, `packs run` (now `dev.py builder`), `packs head` and `bases --prune` (now
  `dev.py disk --prune`). Scripts calling them get an argparse error.
- **`dev.py ab`'s "current" check** does not notice a change to `tools.lock` or the build tools alone.
- **Players:** the only player-visible change is the build's new `program_cache_format=` line in
  `longshot_version.txt`. A revert is enough.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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). Run as `tests/run_all.py`; its one
  failure, `test_lifter`'s `cargo fmt --all --check` of `game/crates/api/src/services/mod.rs` and
  `game/crates/game-core/src/nav.rs`, is mod-api's own (#2745) and fails there too, as Testing says.
- [x] Measured against `main`, or Measurements says why there is nothing to measure (against `mod-api`, this PR's
  base).
- [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible.

### When it applies

- [x] A check under `tests/` that reads changed source is updated, not weakened.
- [x] Docs updated.
- [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2869
## Summary

Switching to a tab of the Insert menu with many rows did all its reading at once. The first frame read the tab's declarations and laid them out. The next frame read every row's state and also drew the first rows. That second frame was the heaviest of the switch. With every system row in the menu (#2861: the Graphics tab has 58), it went over the menu's 4.5 ms budget in the debug cost test.

This change does three things:
- **Keeps each page's layout.** The menu keeps each page's declarations, laid out, until their generation moves on: a mod starts or stops, the language changes, or the renderer's lists change. A tab shown again reads nothing to lay itself out.
- **Reads the rows earlier on a page shown again.** Its rows are read in the frame that takes its kept declarations, the frame before it is drawn, so its first drawing frame reads only the rows that changed since. A page's first showing reads as before: declarations in one frame, rows with its first drawing, never both reads in one frame (putting both in one frame made the debug first showing 5.7 ms).
- **Fixes the generation.** It only counted each row's key, label and kind. Now it counts every field the menu gets from a declaration (help, kind and choices, place, flags, native use, a slider's unit, display scale and default). So a mod declared again with other choices or another place is read again. This change was needed for the kept layouts to be safe.

`laidOut` also builds the menu's own lines more cheaply: one shared flags object, and no set to follow an anchor's chain.

Profiling (stack samples of `mod test` on the release fake game) showed where a switch's time goes. Per frame, it is about 24 components drawn and their commit. The rest was the reads: about 0.2 ms to read the rows and 0.3 ms for the declarations and their layout, all landing on the switch's first drawing frame. With the reads moved, the heaviest frame is now an ordinary drawing frame.

Files to read: `game/mods/menu/src/main.tsx` (`declsOf`, the `laid` read in `Menu`), `game/crates/api/src/services/settings_host.rs` (`generation_of`), `game/mods/menu/test/menu.test.ts` (the cost test and the new reads test).

## Testing

**Tested:** Linux, RTX 3090.
- **Queue jobs:**
  - `cargo test -p modtool the_typescript_system_mods_pass_their_tests` (debug) passes, every menu test included.
  - `cargo test -p api settings_host` and `cargo clippy -p api` pass.
  - `dev.py pack` and `dev.py rt` pass.
- **Smoke run, headless (shared queue):** kokiri-start, then Insert, then all seven tabs stepped through. Status showed `menu_open`, hosted by `system/menu`, and the log has no script error. One 3.7 ms warning for the menu's first open came while the PC was paging. The bridge's screenshots do not include the menu.

- **New test:** "a page switched to again reads no declarations until they change; its rows are read with them". It fails on #2861: the rows were read a frame after the declarations.
- **Cost test, made stricter:** a tab shown again is held to `SWITCH_MS` 4.5 ms again, with every system row. A tab's first showing is timed apart, under `FIRST_MS` 5.5 ms (the switch's ceiling in #2861). For it, the rows are declared again with a label changed, which gives a new generation, and the test asserts that the declarations were read again.
- **Generation test:** `a_row_declared_again_with_another_format_or_default_moves_the_generation_on` (`cargo test -p api`): another unit, display scale or default each move the generation on (review L1).
- **Revisit test, frame by frame:** the Audio tab shown again has its rows read in a frame before the one that first draws it, and none in that frame (review L2).
- **Queue job on 656c1a57:** `cargo test -p modtool` (228 passed), `cargo test -p api --lib` (452 passed), clippy `-D warnings` and rustfmt pass.
- **Release fake game:** all 34 menu tests pass on `mod test` (release builder).

**Still to test:**
- Any PC: open the Insert menu, switch between tabs, and open and close the pages. Expect every row drawn as before and the switch a little quicker (by hand).
- Any PC: change the menu's language, then switch tabs. Expect every label in the new language (by hand).

## Measurements

**Verdict:** in the debug test, a tab shown again now costs 1.61 ms in its heaviest frame, against 4.49 ms before. A tab's first showing is as before.

Setup: Linux, RTX 3090; the menu's cost test (`LONGSHOT_COST_REPORT=1`), its heaviest frame of script CPU while a tab or page is switched to, the least of 5 samples (#2861: every switch read the declarations again; here, a tab shown again). Each side is the least of 5 samples in one job, the two sides from separate jobs, not interleaved. 656c1a57 after it changes only the generation's hash (once per declarations' list, not per frame) and the tests, so the numbers hold for the head.

| | Before: mod-api @ 12f42db5 | After: this PR @ 1dcf4b82 |
|---|---|---|
| Graphics switch, debug `cargo test -p modtool` (the test's ceiling) | 4.49 ms (#2861's job; 5.35 under load) | 1.61 ms (shown again; first showing under 5.5, asserted) |

## Risks

- **A stale layout.** A kept page's declarations would go stale if they changed without the generation moving on. The generation now covers every field a declaration gives the menu, and the menu's language and the renderer's lists already moved it. A revert is enough to undo this.
- **More re-reads.** A mod restarted or declared again with other help or choices now moves the generation, so the menu reads every page again. That happens rarely: when a mod starts or stops.
- **The rows read a frame earlier.** The page shown is still the one before until the next frame, as it was.
- **Nothing for players to notice** apart from the speed. Their files and saves are unchanged.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; 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). On 656c1a57: 836 passed, 1 failed: `tests/test_lifter.py` (the builder's `control::tests::the_socket_is_made_private_and_a_client_handed_over`), code this PR does not touch; mod-api's own CI fails run_all at 12f42db5.
- [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 check under `tests/` that reads changed source is updated, not weakened.
- [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.
- [ ] 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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Reviewed-on: #2874
What fires settingsHost.changed, what an idle open menu still costs, which Insert menu rows are settings and where
they come from; stale references to the old menu's code removed. Reviewed in #2888, rebased onto mod-api 1f49aeec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
The renderer reads settings only from the game's snapshot and reports facts; the screen's shape is known before the first settings read (Windows and Linux), device ids reach the host whole or not at all, and the game language is chosen once under a lock (MkwVkHost.game_language, MKWVK API 83). Reviewed in #2882.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
145 choice switches become hidden settings in five system mods (renderer, memory, thread, upscaling, host settings); their old switches still set them, LONGSHOT_SET and --set win. switches.def's SETTING rows, checked against the mods. Reviewed in #2894.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
HOS_FRAME_COST=1 counts the frame's cost and the acquire phase's CPU time (MKWVK API 84); the acquire phase's per-frame scans cut; a lone function handler on the plain trampoline is counted in its site's readers, so its removal waits for it. Reviewed in #2880.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
game.h is generated by cbindgen from longshot-game's exports and ffi.rs from host/game_host.h by ffi-gen; both --checked in CI with schema-gen. Reviewed in #2896.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
Rows' hints and states are hintWhen/textWhen/lockedWhen/... data in the area mods' mod.toml (renderer_lines.rs and game_state removed); the settings service pushes rowsChanged with the rows that changed, only to the mods that read them (no polling); longshot/ui gains useSyncExternalStore and longshot/settings-host/store gives useRow/useDecls/useRows/useStatus; the Insert menu is plain components on it, split into files, its hand-made caches gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
The builder is the only entrypoint, sandbox and broker: restarts, the environment, the control bridge (one command set), crash records and bug reports, log redaction, the Linux files service, the player's folders as the builder's roots, the Steam Deck's sensors and the Switch 2 Pro controller with its NFC reader, one start message (MKWVK API 85). Reviewed in #2898.

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

Finding a new hook site meant reading lifted code by hand. This adds three development-only tools that take a behaviour
of the game to the function and instruction a site goes on, and a page on how to use them
(docs/dev/reference/reverse-engineering.md, with a worked synthetic example and how the site's signature or
fingerprint is then written):

- **A code index.** `longshot-builder dev facts` writes what the lift's own discovery knows of each function (calls past
  PLT stubs, virtual-call slots, string and data references, constants and floats, function pointers and vtables,
  exports, guest stores), and `dev disasm` decodes a range. `scripts/re.py index` loads the facts into SQLite under
  `~/.cache/longshot-dev/re`. It then answers callers/callees, xrefs, strings, const, float, vtable, vslot, vcalls,
  path, dis and ir queries, as text or `--json`.
- **A function-hit trace.** The guest profile's instrumented build counts the functions. The control bridge's new
  `trace` command marks a window; `re.py trace diff` lists the functions that ran in one window and not in another.
- **A write-watch.** With `LONGSHOT_WATCH_STORES=1`, the lift tests every guest store against a watched range. The
  bridge's new `watch` command sets the range and writes what hit it: each writing function and instruction, the
  values and the frames. `watch` needs `HOS_CONTROL_MEM`.
- `dev.py rt --re` builds both into `build-linux/rt-<checkout>-re`, from a work folder of its own.

Read first: `builder/crates/llvm/src/lib.rs` (`watch`), `host/re_watch.c`, `host/control.c` (`cmd_re`),
`builder/crates/longshot-builder/src/dev/facts.rs`, `scripts/re.py`.

Everything the tools make (the index, the traces, the watches) is made from the game and stays on the PC, under
`~/.cache/longshot-dev/re`. Nothing of it is in this PR; the tests use synthetic images, facts and windows.

## Testing

**Tested:** Linux, RTX 3090. Tested in game: the index on the real game (built from this PC's game, every query
answered). In one shared run of the `--re` runtime, the trace windows diffed (walking against idle, rolling
against walking, each naming the functions only in the second), and a write-watch on the player's position named one
writer with its three stores, a hit every frame while he walked; 12 more watches on other objects named their writers.
The game-free parts of trace and watch are also covered by the tests below.

Checks, in one build-mode job (retools-check), all pass:
- `dev.py rt`: the normal runtime builds over the base.
- `scripts/check_host_compile.py`: 82 host units, 0 failed.
- `cargo test` and `cargo clippy -D warnings` for llvm and longshot-builder. llvm has a new watch-IR test, compiled by
  clang; with the option off, nothing of it is emitted.
- `run_all --exact`: test_re, test_re_dev, test_control (the control and re_dev C tests, and control.c's llvm-mingw
  compile), test_doc_commands, test_doc_anchors.
- `host/re_watch.c` and `host/guest_profile.c` compiled with llvm-mingw (`-Wall -Wextra -Werror`).

Earlier, outside the queue: `cargo test -p lift`, `-p build-driver`, test_guest_profile_write, test_switch_table,
pre-commit.

**Still to test:**
- This PC (Linux, RTX 3090): `dev.py rt --re`, then two trace windows and a watch of a known field, expecting a short
  diff and the field's writers named (by hand, in the first site-finding session).

## Measurements

Nothing to measure: with the switch off the lifted IR is unchanged (a test checks it), so normal builds and fps are unchanged; the `-re` build is development only. Every lift cache is rebuilt once, as with any change to the lifter's sources.

## Risks

Development only. `LONGSHOT_WATCH_STORES` is off unless set to `1`, and `trace` and `watch` answer `unavailable` in a
normal build. A revert is enough. Players notice nothing, apart from the lift rebuilding once after the update.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; the title is a Conventional Commit.
- [x] 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). (the tests that read the changed files pass in retools-check; the whole suite is not run)
- [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 check under `tests/` that reads changed source is updated, not weakened.
- [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
- [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)

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc

Reviewed-on: #2924
The missing mod APIs that need no new hook site (docs: Longshot-notes/missing-mod-apis-plan.md, the non-RE split).

- camera: a rig's `roll` (setRoll, angles().roll), turned where the view site writes an override's matrix, and an
  off-centre `lens` ({ zoom, x, y } or { tile: { grid, col, row } }, setLens), put on the gameplay projection's rows in
  the registers at the jitter sites, before the jitter, so the game culls with its whole view; its window is kept
  inside the picture. Features camera.override.roll and .lens (Preview). The fake game's view shows both.
- gfx.screenshot({ name? }) (new permission gfx.capture, low): the next frame shown, at the picture's own size, as a
  PNG under <user>/screenshots/<publisher>/<name>/, the Promise settling with its path. Renderer: shot_full
  (MKWVK 86) on the control bridge's shot path, sized per shot, a .part of its own; host: hos_mod_screenshot and a
  ticket ring.
- gfx.effect({ ..., inputs: ["depth"] }) at beforeUpscale: the scene's depth at binding 1, at render size, moved to
  read-only as the upscalers sample it, and a renderer-filled depthModel param with linearDepth in the template
  (gpu/vk/fx_depth.h, vk_effects.cpp, vk_temporal.cpp; GAME_OUT_FROM_DEPTH, GAME_FILL_DEPTH_MODEL). Preview.
- items: each grant belongs to the save slot it was asked in and is given only there; slots deleted, made anew or
  copied hand their grants on; an older journal's keys are known in every slot; nothing is given between a reload
  and storage seeing its slot.
- stats.modTime() (no permission) and stats.mods() (mods.inspect): each mod's script time, as the inspector shows it.
- actors.spawn: 64 a mod, 32 asked in 60 frames, 128 for all mods.
- builder: the user folder's screenshots/ is one the game writes (USER_SUBDIRS), so gfx.screenshot works in the sandbox.
- audio: a game run showed the game's music has no sub mix of its own (every voice goes through splitters into the
  master's input mix); recorded in docs/dev/reference/mods-audio.md, setGroupVolume/duck stay absent.
- Examples: photo-mode rolls, shoots and takes 2 x 2 tiles; a colour-filter kit over gfx.outputEffect.
- Docs: camera (tiled photos), gfx (screenshots, the scene's depth, a colour filter), the sandbox's folders, actors (re-attaching after a load
  or a map change), items, system-mods, the dev references; generated reference, permissions, scripting, .d.ts,
  game.h, ffi.rs and the served mod schema.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
- builder: the sandbox reads the test mode's folder (--mod-tests, else HOS_MOD_TESTS): the game names its mods in
  LONGSHOT_DEV_MODS only once started, after the plan, so dev.py game-tests found no mod since #2898; and writes
  its results' folder (HOS_MOD_TESTS_OUT, SWITCH_DIRS), where it wrote no results.json.
- runner: game.press/hold take a PadButton or a replay's name, any case; another throws at the call (a name the
  sealed pad draft lacked threw "object is not extensible" in the filter every frame).
- runner: a mod's tests hold the mod's grants, as they change, no more; the setup API holds the runner's own beside
  them for its calls alone (native.setup), and what it subscribed to is delivered with them (Perms::runner_of,
  delivers). A pad filter has the controller read by itself.
- gfx.effect, outputEffect, programs.afterDraw: a shader's compile is work no budget counts (CallHost::uncounted);
  a call's time, the frame's and its cost leave out every such compile (TypeScript's too).
- menu: a binding row's Reset resets that control in the host (hos_binding_reset) and its Toggle, instead of a press
  the renderer does not have (unknown_row).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
feat: main's #2900, #2902, #2903, #2843, #2876, #2926 and #2884 in mod-api's systems
Some checks failed
PR description / Title and description (pull_request_target) Successful in 32s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m37s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m56s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 26m27s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m3s
CI / Website build and checks (pull_request) Failing after 1m53s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 18m44s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
041890bbef
The rebase of mod-api onto main left these out of the stack, since each needs a system mod-api made. Here they are
in that form, with no old one carried:

- #2903, the occlusion heightfield rasterizer and Hi-Z pyramid on host code: the new crate game/crates/occ-raster
  (AVX2 + FMA at run time, a scalar path otherwise), hooked as the cloth is (occ.raster, occ.rasterEnd); kill switch
  HOS_NATIVE_OCC_RASTER (on, 0, check). Rust tests against main's reference model, both paths.
- #2902, the unmapped descriptor and event pools CPU_NO_ACCESS: sites pool.descFlags and pool.eventFlags, Rust
  callbacks in game-core's engine; kill switch HOS_POOL_FLAGS_SITES.
- #2900, no neighbouring map preloaded during play: the hidden setting system/host-settings:ocb_preload
  (HOS_OCB_PRELOAD=1 the game's preload), off by default as on main; fixes/ocb_hold.rs.
- #2843's hold: the hidden setting system/memory-settings:target_pool_hold beside target_pool_mb
  (RX_VK_TARGET_POOL_HOLD), Auto 128 presents.
- #2876's cores: host_cores' Auto is 8 where the PC reports at least 8 logical processors, else 6.
- #2926, DLSS FG through: a setting of the graphics mod (dlss_fg_through, Streamline or NGX), placed with the frame
  generation rows, its lines and lock as data; the renderer reads it from the settings and reports its state.
- #2884, Restart now on Windows: the builder starts the game again on the game's channel restart, on every system;
  a play test of main's cases. No exit status or relaunch of the game's own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
feat(modapi): pose an actor's bones and hold an actor still (actors.pose, poseBone, setPose, clearPose, freeze)
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
809cbd68d1
Mods read an actor's skeleton and pose its bones, and hold an actor still:

- `pose(actor)` (actors.read): the bones of the actor's model, each its name, index, parent and local transform.
- `poseBone(actor, { bone | index, rotation?, translation?, scale?, mode? })` and `clearPose(actor)` under a new
  permission, `actors.pose` (low: only the picture changes): a standing override written every frame, on top of the
  game's animation (`add`) or in its place (`set`), until cleared, the actor gone or the mod stopped. One mod poses an
  actor at once; Link may be posed.
- `setPose(actor, list<BonePose>)`: a whole pose in one call, taken in one frame. The schema and its bindings take a
  list of options records as a parameter now (schema-gen, the thunks, the script side's conversion, the .d.ts).
- Link's main bones have stable aliases of the API's own (`head`, `neck`, `spine`, `hips`, `armL/R`, `forearmL/R`, `handL/R`,
  `weaponL`, `weapon`, `thighL/R`, `shinL/R`, `footL/R`, `toeL/R`), all read back in a game run, which the pose calls take and `pose` reads as each bone's `alias`.
- `freeze(actor, frozen)` (actors.write): the game skips the actor's whole update from its next frame, while it is
  still drawn in its last pose. Not Link; several mods' holds stand together.

Hot inline table rules (game/sites/sites.toml): `actors.pose` and its four siblings at the entry of each skeleton step method that makes its
bones' world matrices from their local transforms (`skeleton_pose`), and `actors.hold` in GameActor's per-frame
method right after it rebuilds the frame flags, before it tests the flag that skips the update (`actor_hold`). With
nothing posed, read or held, each is one relaxed load. The main thread publishes the tables `actors.poses` (keyed by
the model's world matrices, the pointer that ties a skeleton to its actor) and `actors.holds` (game_core::pose); the
sites write on the actor's own thread. An added pose starts from the transform found under the site's last write when
the game did not write the bone again, so it never adds up; a cleared bone is put back.

Confirmed in game runs: setPose of three bones by alias in one frame (screenshot); (kokiri-start): Link's 309 bones read by name, his head turned and scaled and his arm raised
in the screenshot, put back on clearPose; a rolling rock held for 2 s kept its place and rolled on when let go, and
Navi held for 2 s stayed drawn in one place and wing pose. The step has five sibling methods (one per kind of skeleton: Navi's and the plants'
go through another than Link's); the same rule is on each.

The fake game gives every actor a three-bone skeleton (`game.bones(key)`), and the example mod `statues` freezes the
enemies near Link and tilts his head. Docs: docs/modding/actors.md (Posing, Holding an actor still),
docs/dev/reference/actors.md, hooks.md's rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
test(sites): the pool flags' sites in the owners table (#2902)
Some checks failed
PR description / Title and description (pull_request_target) Successful in 35s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 50s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m22s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m53s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 39m28s
CI / Website build and checks (pull_request) Failing after 1m58s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 19m7s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m7s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 55m52s
5740a5dff9
The rebase onto main added pool.descFlags and pool.eventFlags to game/sites/sites.toml without their lines in
builder/crates/sites/tests/site_owners.txt, so the sites repository test failed on mod-api.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
fix: mod-api on Windows: every fix its Windows tests turned up, in one pull request (#2938)
Some checks failed
CI / What the change needs (pull_request) Successful in 5s
CI / Third-party parts and guide screenshots (pull_request) Successful in 9s
PR description / Title and description (pull_request_target) Successful in 31s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 4m15s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 20m6s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 21m8s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 21m33s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 39m35s
CI / Website build and checks (pull_request) Failing after 20m1s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1h0m3s
a9670495ab
## Summary

For [#2822](#2822) (into `mod-api`). Every fix a Windows test of `mod-api` turned up, in one pull request, as asked: the eleven open pull requests below, rebased onto `mod-api` @ 5740a5df with their commits as they were reviewed, and the Windows bugs found since. Each commit is one fix or one check, a fix after the test that shows it. They close in favour of this one.

**Carried over** (each pull request's description says how to see its bug on `mod-api`):

| Was | What |
|---|---|
| [#2824](#2824) | `longshot_builder.py build`: the release's C++ runtime link-args reach rustc whole (they went in one character at a time) |
| [#2826](#2826) | Five game-free checks that fail only on Windows: their stand-ins follow the branch's host code (tests only) |
| [#2829](#2829) | Switching one mod off while the game runs no longer stops every other mod the start turned on |
| [#2830](#2830) | The workspace passes clippy for Windows' target (three lints behind their `cfg`, one new: `GAME_BUILDER_E_FAILED` imported on Unix only) |
| [#2832](#2832) | Windows: a changed folder mod's content module runs again while the game runs |
| [#2834](#2834) | Two builder checks that fail only on Windows: their fixtures name Windows' programs and whole paths (tests only) |
| [#2835](#2835) | Windows: an unchanged link is not run again (a drive's colon is no option's separator, in every argument: `main`'s [#2872](#2872), now in `mod-api`, skips the output's own argument, and `compile_link`'s unchanged rebuild still linked again with it alone) |
| [#2838](#2838) | Windows: a confined game reads a profile past 260 characters (the file layer takes `\\?\`), the builder's file rules keeping every refusal |
| [#2842](#2842) | While the menu starts it says so, never that it could not start, and not over its page |
| [#2844](#2844) | longshot-game's integration tests link on Windows (the version text through host-sys) |
| [#2845](#2845) | Four game-side checks that fail only on Windows: whole paths, a file system that folds case (tests only) |

[#2827](#2827) and [#2847](#2847) are not here: [#2898](#2898) covers them (their closing comments say how).

**New** (each found by running `mod-api`'s checks on Windows; how to see it is in its commit):

- **fix(sandbox): the file service opens what the game asks to write, and the folders it makes.** After every open the service checks it is no link (`GetFileInformationByHandleEx(FileAttributeTagInfo)`), which Windows answers only for a handle with `FILE_READ_ATTRIBUTES`; a handle that cannot be told is taken as a link. The service opened with the game's own access, so on Windows every file a confined game opened to write only (`GENERIC_WRITE`) was refused, and every folder it made was made and then reported not made. Wine does not check the right, so `files_windows`' check passed there. `open_in` now adds the right to the service's own handle; the game's handle carries what it asked and the attributes' read every CreateFileW handle has (the next fix), which the check asserts.
- **fix(sandbox): the game's handle from the file service reads its attributes, as CreateFileW's does.** Windows' CreateFileW gives every handle `FILE_READ_ATTRIBUTES` and `SYNCHRONIZE` beside what was asked; the service gave the confined game only what it asked. Rust's `std::fs::metadata` (and `is_dir`, `is_file`) opens with access 0 and reads the attributes by the handle, so every one of those calls on a file or folder the builder serves failed: the save list found no save, and `dev.py smoke` stayed on the title screen ("skip title: there is no saved game"). The rules decide on what was asked, as before; a STAT already tells the attributes of any path they let the game open, so the handle reads nothing more.
- **fix(bridge): a shot to a path is staged on Windows too.** `longshot_bridge.py` and `Longshot.exe mod shot` asked the game on Windows to write the path itself (a pipe has no folder to stage beside), which a confined game cannot: `dev.py smoke`'s menu shot failed ("the PNG could not be written"). On Windows a shot to a path is now staged in the game's `temp/` as on Linux and moved by the client, read through no link (`FILE_FLAG_OPEN_REPARSE_POINT` in Rust; in Python the name is no reparse point and the file opened is the one looked at). With no path, the game writes its own default, as before.
- **fix(builder): an older build's user folder moves to the new place.** `settle` flushed each copied file through `File::open(...).sync_all()`: Windows' FlushFileBuffers refuses a read-only handle, so every copy failed and the saves stayed in the game folder at every start.
- **fix(builder): a game file extracted before is checked whole, never taken as damaged.** `file_damaged` read the zstd magic with `read_at` and hashed the rest from the file's position: Windows' `seek_read` moves it (Unix's pread does not), so every `.zs` a second extraction checked was counted damaged.
- **fix(builder): importing earlier saves never replaces a file at the profile's saves place.** Linux's rename refuses a folder over a file and the import fails, leaving the earlier saves to try again; Windows' rename replaced the file and said it was done.
- **fix(mods): a mod whose id has a device's name takes screenshots.** A part of the id that is `nul` (or `con`, `aux`, `prn`, `comN`, `lptN` on Windows 10) was a screenshots folder Windows cannot make: it gets `_` first, as the mods' stores' files do.
- **docs(dev): on Windows, run the confined game from a shell outside a packaged app.** A Store (MSIX) app that keeps AppData virtualized (the Claude desktop app is one) puts its processes' writes there in a copy of its own, and the tools it starts inherit that; the confined game sees the real folders, so the run folder and a staged shot are not where it looks. `reference/build.md`, Where dev data lives.
- **fix(builder): an older user folder's read-only file moves with it.** The move flushes each copy through a handle that may write it, and Windows' copy keeps the read-only attribute: one read-only file kept the whole move back, tried again at every start. Such a copy is made writable for the flush, then read-only again (BeanBot's review, L2).
- **fix(dev): `re.py` closes the index it opened**, so Windows can delete or replace it (`test_re.py` failed in its cleanup).
- **fix(builder): a base's file swapped for another is not linked into a runtime.** A game folder's note keeps each file's (size, time, id); the id was 0 on Windows, and Windows' copy keeps the time, so another file of the same bytes was still linked. The note records Windows' file id now. A note written before (id 0) is taken only when the file's bytes are its SHA-256 too, read once, and the install that keeps it notes the id (BeanBot's review, L1), so no game folder copies its files again after the update, and no file swapped in meanwhile is kept, taken as the builder's or linked into a runtime.
- **fix(builder): the same source compiles to the same object.** clang wrote the compile's time into each COFF object's header; the llvm-mingw route's compiles now take `-mno-incremental-linker-compatible`, as the link already takes `/Brepro` (`compile_link`'s byte-for-byte check failed whenever two compiles fell in different seconds).
- **fix(dev): `dev.py ab`'s report, and every `dev.py` tool's, to a pipe or a file is UTF-8** (cp1252 has no Δ: the report raised UnicodeEncodeError), and **`dev.py migrate` leaves no base marked busy** (it deleted its marker while it was open, which Windows refuses).
- **Tests only, from `main`'s PRs the re-squash brought in:** the host cores check (#2876) stands in for `GetActiveProcessorCount`, the count `hos_cores` asks Windows for; the profile symbols check leaves its ELF reader (Linux's) out on Windows, as where its tools are missing.
- **Tests only:** the control pipe's check waits for the builder's instance (`WaitNamedPipeW` returns at once on Windows while there is none); `user_of`'s check takes the game folder as `user_of` does (never `\\?\`); the screenshot check compares the settled path, not its debug text; `prepare_only`'s check names the game program by this system's name; a package's second extraction expects the case pair written again where the file system folds case; the audio output devices' fixture takes the start's settings from the shared stand-in.

Read first: `builder/crates/build-core/src/files_windows.rs` (`open_in`, OPEN's `give_access`), `scripts/longshot_bridge.py` (`take_shot`, `Bridge.request`), then `user_folder.rs` (`copy_tree`), `build-driver/src/folder.rs` (`stat_of`, `stat_matches`), `build-driver/src/play.rs` (`carry_saves`), `game-files/src/nup.rs` (`file_damaged`), `build-compile/src/toolchain.rs` (`reproducible_object`).

## Testing

**Tested:** On this PC: Windows 11 Pro (build 26300), RTX 5080 (NVIDIA 621.40), Ryzen 9 9900X3D. Everything built and run without MSVC: Rust 1.99.1 on the `x86_64-pc-windows-gnullvm` host, `tools.lock`'s llvm-mingw for C and C++ and as linker; the builder and the runtime import no MSVC runtime (`llvm-objdump -p`).

- **In the game, confined (the log's `sandbox: in the AppContainer`), `dev.py smoke`: PASS** (from `kokiri-start`: in play, 900 frames, the Insert menu open with its page `system/menu`, the bridge's shot staged in the game's `temp\` and moved to the run folder; no FATAL line, every system mod started; `files: 237 served by the builder` at the first frame in play). Runtime made by `dev.py rt` at ee7b1726 with the builder at 545f97c6 (the file service's fixes); the shot's fix is the client's (`longshot_bridge.py`, at the head). On `mod-api` without them the same run stays on the title screen (`skip title: there is no saved game`), and with the first alone fails its shot (`the PNG could not be written`). A windowed run of the same runtime with the Insert menu opened over the bridge shows the menu over the game.
- **Game-free, Windows** (`mise run test`'s `run_all.py --strict`, 12 at once) at 13cf57a6 (the head but its docs note): 797 passed, 10 failed, 49 skipped. The 10: the nine renderer checks Risks names (they fail on `main` too) and `test_lifter`, whose workspace tests had one intermittent `longshot-game` failure (Risks; 187 of 187 in 8 runs alone). The skips are the checks whose tools this PC lacks (gcc, Linux-only ones). Rust: `cargo fmt --check`; clippy `-D warnings` for the workspace and `modtool`; tests of `build-core` (148), `modtool` (221), `sites`, `longshot-game` (187), and the workspace's earlier.
- **Game-free, Linux** (WSL Ubuntu 24.04, an export of the branch): `mise.toml`'s `rust` task's commands and `run_all.py --strict` at 809cbd68 (only environment failures, no glslang, spirv-val, llvm-mc or dav1d, and the nine renderer checks); for the last commits, fmt, clippy and the tests of `modtool` (243) and `build-core` (183), `test_longshot_ctl` (55), `test_pipeline_tour`, `test_job_queue`.
- **The sandbox's checks at the head:** on Windows `build-core`'s `files_windows` and `files_rules` tests (21) and `sandbox_windows`' with the crate's 148; on Linux `test_sandbox_windows.py` (19 checks: the start decision, the path form, the file service handing no more than the access decided), `test_sandbox_linux.py`, `test_builder_files_linux.py`, `test_sandbox_profile.py`, `test_sandbox_save_folders.py`, `test_pad_appcontainer.py`. `test_builder_files_wine.py` skipped there (no llvm-mingw in WSL); the same `files_windows` code's tests run natively here, where Windows checks the access rights Wine does not. The rules' normalizer refuses the plain form of every `\\?\` path its test refuses (checked once, by hand), so the file layer's taking the prefix off opens no way around a rule.
- **The review's fixes** (at 319bdf5e): each test fails before its fix and passes after; with the zero-id entry's hash check taken out, its test fails again. Windows: `build-driver` (219) and `build-core`'s `user_folder` tests, fmt and clippy `-D warnings` for both crates. Linux: `build-driver` 244 of 244 in three whole runs, fmt and clippy for both crates. Builder code only (an install's note, the user folder's move): not run in the game since.
- **The reproducible-object flag** (review L4): tools.lock's llvm-mingw clang, the 31 host C files that compile alone, -O2, without and with `-mno-incremental-linker-compatible`, through the queue: the objects the same bytes but the header's 4-byte time (335,411 bytes both ways); one file's compile 301 ms without, 279 ms with. The whole set's times are noise on this PC today (9 to 34 s a round, other builds running, no order by the flag); a quiet PC's numbers: by hand.
- **A Windows account that may not make links** (this one makes them through Developer Mode alone, without `SeCreateSymbolicLinkPrivilege`): `test_longshot_ctl.py`'s `ShotStaging` run with `os.symlink` refusing as Windows refuses such an account (`WinError 1314`): its two session tests pass, the link test is skipped saying why (`no symbolic link can be made here: [WinError 1314] ...`), its plain take and `staged_at` checks before the skip passing. `modtool`'s `windows_tests` now takes its plain file before the link (e2d9c75a), so such an account runs that half: passing here with links, and with the link refused (a local edit, not committed, making the link fail with `ERROR_PRIVILEGE_NOT_HELD`): the plain file taken, then `skipped: no symbolic link can be made here: A required privilege is not held by the client. (os error 1314)`. Not run from a real account without the right.
- **Each fix:** its test (the commit before it) fails on `mod-api` for the bug's reason and passes here; with the fix's key line taken out, it fails again.

**Still to test:**
- Linux in the game, confined (Landlock): none of these fixes is Linux's, but the shot's clients changed for both; no Linux PC here: `@Beanstalk dev.py smoke on Linux, confined: in play from the save, the menu open, its shot taken`.
- Windows on AMD and Intel GPUs: the file service and the shots are no GPU's, but the in-game run is one card's: `@Beanstalk dev.py smoke on Windows with an AMD and an Intel GPU, confined: in play from the save, the menu open, its shot taken`.

## Measurements

Nothing to measure: fixes and checks. The file service's handles gain the attribute read (its own checks, and the game's handle as CreateFileW's has it), and a bridge shot on Windows is moved once by the client; nothing on a path the game runs every frame changes. No switch is added: `LONGSHOT_NO_CLANG` in the diff is the tests' own variable `mod-api` already has (with no clang, a check that needs one passes over it, as `a64`'s llvm-mc check does), which the object check follows.

## Risks

**The sandbox:** as tight as `mod-api` has it, and checked. The file service's own handle can now read attributes, which its checks after every open need; the handle the game is given carries the access the request was allowed (or less, for a folder) and the attributes' read every CreateFileW handle carries, which a STAT already gives of any path the rules let the game open: the rules decide on what was asked, unchanged. The shot change is the clients' (outside the sandbox): the game writes only its own `temp/`, which it could already, and the client takes a plain file there through no link, on Windows as on Linux. Every refusal of the service's rules is unchanged; [#2838](#2838)'s `\\?\` paths keep every refusal (`files_rules/windows.rs` checks it). Nothing here touches the sandbox's plan or its grants. The sandbox is `mod-api`'s only; `main` has none.

For players on Windows: an older build's `user\` folder beside the game now does move to `%APPDATA%\Longshot` at the first start, as the move was meant to; a screenshot folder of a mod whose id has a device's name is named with `_` first; an earlier saves' import with a file where the profile's saves go now fails and says so, and leaves the file. A revert is enough for each. On a drive that gives Windows no file ids (FAT32 or exFAT, some network shares), a game folder's note has none to record, and its entries are compared by size and time alone, as `mod-api` compares them now: a different file of the same size and time put in such a game folder could still be kept by a build, or linked into a runtime (a build after it is changed or removed puts it right). Hashing every file at every build there would close it, at a cost each build: not done.

Named, not changed here (as `mod-api`'s rules have them): on a Windows PC with tools.lock's llvm-mingw alone (no gcc), the checks whose `RUN_ALL_ARGS` name gcc or g++ are skipped, or fail with `--strict`, as `tests/run_all.py` says of a compiler that is not there; about ten checks' own test programs pass a path through the ANSI code page and fail from a temporary folder whose path has a letter outside it (both on `main` too). `modtool`'s `the_typescript_system_mods_pass_their_tests` failed once on this PC with two builds beside it and passed alone and in two whole runs (its cost checks read the wall clock on Windows): not changed, watched. Two tests are intermittent on Windows with their crate's other tests beside them, never alone (40 runs each): `game-core`'s `fixes::barrier::tests::an_or_and_its_wake_end_a_wait_on_another_thread` (2 of 40: the waiter can see the OR itself before `wake`, which then finds no one) and `game-sites`' `phase::tests::callbacks_run_by_order_then_by_when_added_and_stop_after_removal` (1 of 40: `on_thread` reads the process-wide phase thread, which another test's run of the same phase moves): test races, not changed. One more, seen once in a whole run under load and never alone (187 of 187, 8 runs): `longshot-game`'s `settings_now::tests::a_new_installs_output_resolution_is_the_size_the_run_started_at`, whose new install's size is skipped when the process-wide `AT_START` was first filled by a test whose settings are the Handheld profile's (`set_up_for_a_weak_laptop_is_a_preset_of_the_games`, `a_preset_chosen_in_the_game_sets_its_rows_and_a_row_changed_makes_it_custom`): test order, not changed. And on Linux, `build-driver`'s `dev_runtime::tests::a_copy_links_the_builders_files_clones_the_rest_and_refreshes_in_place` fails now and then with the whole crate's tests beside it, on `mod-api` too (3 of 6 runs at 5740a5df: `game_folder_busy`, the runtime's folder lock still held at its next copy), never alone; `a_give_back_skips_a_unit_a_running_game_holds` failed once so: not changed. Nine renderer checks fail on every system on `main` @ 4908cc6d and on `mod-api` alike (`test_blocks_at_start`, `test_draw_stream_visibility`, `test_fsr_uniform_ownership`, `test_image_reaper_threads`, `test_readback_timeout_reuse`, `test_recording_admission`, `test_target_retention`, `test_tex_desc_memo`, `test_vram_compact`: their cuts of `gpu/vk` no longer match it), `main`'s to mend, not this pull request's.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; the title is a Conventional Commit. (One topic: `mod-api`'s Windows fixes, in one pull request as asked; on `mod-api` @ 5740a5df.)
- [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 `mod-api` 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 fix: a game-free test that fails on `mod-api` and passes here (each fix's key line taken out, its test fails).
- [x] A check under `tests/` that reads changed source is updated, not weakened.
- [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths (the checks whose test programs take a path through the ANSI code page are named in Risks).
- [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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #2938
perf(ui): cheaper reconcile and canvas recording, analytic box shadows, text outlines
Some checks failed
PR description / Title and description (pull_request_target) Successful in 34s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m23s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 19m34s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 25m14s
CI / Website build and checks (pull_request) Failing after 1m55s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 18m53s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 40m5s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1h0m3s
1e8153d50d
longshot/ui's runtime: a host whose element is kept (the same props) is not looked at again, nor a component's; a
frozen style given again keeps its ref; a Canvas's drawing methods are one shared set (no closures a canvas), a flat
path's points checked in one loop, and two draw lists told apart by their commands' own values before any points.
The FPS counter of ef2d111d at Dev/Large: 2.9 ms a redraw before, 1.7 after (fake game).

Box shadows are drawn per pixel, the Gaussian in closed form (the draw list's contract, reference.rs), dithered: no
bands, any blur the same cost (was four stepped rects). New on the Canvas: d.text's shadow (an outline the game
draws) and d.path's fillTo (a fill fading down the shape).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
feat(modapi): animations and faces (actors.animate, animation, faceNames, play, expression, stopAnimation, setAnimRate, setAnimVar, setAnimationRules, animated)
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Successful in 33s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m19s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m25s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m34s
CI / Website build and checks (pull_request) Failing after 1m18s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 19m11s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 40m6s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
f63cdf4707
Reads an actor's animation slots and the states its animation graph has; plays a state on a slot by the game's own
request (made at the actor's own update, the name kept by the engine for the session); holds a slot's speed every frame
at the controller's advance, after the game's own reset; sets the controller's named variables; stops a slot; and tells
and rules the game's own plays (cancel, another state, cross-fade, speed) through an engine callback on the central play.

New: permission actors.animate (medium); sites actors.animPlay (engine, can return), actors.animAdvance and
actors.animate (inline table rules anim_advance and actor_animate); game_core::anim; services/animations.rs; the fake
game's controllers (game.animation, setFaces, playAnimation); the expressions example. Preview: docs/dev/reference/
actors.md#animations says what a game run confirmed and what it did not.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
mod-api took all of oxc 0.157.0 from oxc's repository by tag, so its formatter, which oxc does not publish,
shared one copy with the compiler. A tag can move, a release vendored crates.io's crates only, and cargo's
checkout of oxc's whole repository passes Windows' MAX_PATH (a player's pull request build stopped on it).

- oxc_formatter and oxc_formatter_core come from GitHub by rev (the commit of tag crates_v0.157.0); every
  other oxc crate is crates.io's 0.157.0, patched in for the formatter's, so one copy of each.
- scripts/renhdrum.py vendors a git package pinned to a full commit on github.com or git.magicbean.dev with
  cargo vendor of that commit, kept by commit; the release's offline cargo home replaces the git source with
  it, so no build checks the repository out.
- tests/test_cargo_lock_sources.py refuses any other source: a tag, a branch, another host.
- Windows from-source tells git and libgit2 core.longpaths for a git dependency's checkout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
ci(pr-builder): CI builds and publishes each pull request's and mod-api's own longshot-builder for the launcher
Some checks failed
PR description / Title and description (pull_request_target) Successful in 35s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 11s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m14s
pr-builder / pr-builder (push) Failing after 7m31s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 19m33s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 24m27s
CI / Website build and checks (pull_request) Failing after 2m3s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 40m3s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 19m48s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1h0m5s
74c7f3bb99
pr-builder.yml (pull_request_target, so the base branch's workflow and scripts) builds both platforms'
program from a non-draft pull request's head, and from each push to main or mod-api, with the base's
scripts/longshot_builder.py program over the head's tree fetched as data (LONGSHOT_SOURCE_TREE). The
compile, which runs the pull request's code, runs as an unprivileged user with an empty environment; its
processes are killed after it and its programs read back with its rights. describe writes
builder-<platform>.json; scripts/pr_builders.py, base code alone with the job's token, checks them, splits
each program into parts the forge's tunnel takes, publishes the pre-release builder-<commit> and prunes.
Unsigned: the launcher checks the SHA-256s (integrity) and keeps its warning for unreviewed code.

Also: the Windows builder's header check takes the controllers' System32 DLLs (hid, setupapi, winusb), and
game-rust links a cdylib dependency with llvm-mingw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
fix(ci): pr-builder unpacks llvm-mingw on Python 3.10, has cmake, and runs the program's steps in the tree built
Some checks failed
CI / What the change needs (pull_request) Successful in 6s
CI / Third-party parts and guide screenshots (pull_request) Successful in 9s
PR description / Title and description (pull_request_target) Successful in 32s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m8s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m2s
pr-builder / pr-builder (push) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
665f2b685e
The first pr-builder run (mod-api 74c7f3bb) stopped twice: Python 3.10's backported tar "data" filter
resolves a relative link from the destination (gh-107845) and refused llvm-mingw's
<arch>/include -> ../generic-w64-mingw32/include, and the container had no cmake, which shaderc-sys (the
packager's) builds with. helpers.extract takes its own filter before 3.12 (the same rules, links resolved from
their own folder); the container installs cmake and ninja; the llvm-mingw step fails when the unpack does; `program` runs its steps in the tree it builds, where the packager finds tools.lock (the job's own folder holds base/ and src/).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
ci(launcher-builders): named jobs, Linux and Windows side by side, cached downloads and target, glslang
Some checks failed
PR description / Title and description (pull_request_target) Successful in 36s
CI / What the change needs (pull_request) Successful in 14s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m12s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 20m4s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 26m14s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 40m4s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 23m37s
CI / Website build and checks (pull_request) Failing after 2m12s
Builders for the launcher / Windows builder (push) Failing after 1h8m43s
Builders for the launcher / Linux builder (push) Failing after 1h9m55s
Builders for the launcher / Publish (push) Has been skipped
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
61812d5c1a
pr-builder.yml is now "Builders for the launcher": a Linux builder and a Windows builder job run side by
side (each as before: the base's scripts, the build unprivileged), then Publish, base code alone with the
job's token, takes both through artifacts and publishes. The downloads and cargo's target folder are cached,
restored by every run, saved only by pushes to main and mod-api, the target's unchanged files dated back
(ci_source_times). glslang (mise.toml's pin) compiles the colour-vision and crt effects the builder left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
ci: the launcher builds a pull request's builder itself, so CI no longer does
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
PR description / Title and description (pull_request_target) Successful in 32s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m13s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 16m16s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 23m21s
CI / Website build and checks (pull_request) Failing after 2m10s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 21m33s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m26s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
f1fcf680eb
The Longshot Launcher now compiles each commit's own longshot-builder on the player's PC (the commit's source, the Rust and
tools it pins, CMake and Ninja), and that builder makes the version with `from-source --archive`. Removed: the
"Builders for the launcher" workflow (.forgejo/workflows/pr-builder.yml), scripts/pr_builders.py and its tests,
`longshot_builder.py describe` (its json was only the launcher's download check), LONGSHOT_SOURCE_TREE (only the
workflow built another tree as data), and the docs of the CI route, rewritten for the local one (releases.md, build.md).
Kept: `longshot_builder.py program` and the rest of its steps, the oxc pins, the git vendoring, the Cargo.lock guard and the
extract fix.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(renhdrum): the vendoring's throwaway manifest is its own workspace, so a cache inside another Cargo project still vendors
Some checks failed
PR description / Title and description (pull_request_target) Successful in 34s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
033d61b519
fix(builder): a pack's shaders pass their STAMP check though the pack leaves the scripts that made them out
Some checks failed
PR description / Title and description (pull_request_target) Successful in 38s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m39s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
e132adfa0c
fix(mods): a mod in the older format (mod.json) is told to be republished, not that its mod.toml is missing
Some checks failed
CI / What the change needs (pull_request) Successful in 6s
CI / Third-party parts and guide screenshots (pull_request) Successful in 10s
PR description / Title and description (pull_request_target) Successful in 42s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m23s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
b256a24cd5
Installing a package, a folder or a source's mod that has a mod.json and no mod.toml now says: This mod uses an older
mod format (mod.json): its author needs to republish it for this version. The Mods tab says the same for such a
package or folder in a profile's mods/. Tested by a modtool unit test (and mod-manifest's name check).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(mods): an install whose download doesn't match a cached repository index refreshes that index once and tries again
Some checks failed
CI / What the change needs (pull_request) Successful in 7s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Successful in 32s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m39s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m11s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 23m22s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 26m41s
CI / Website build and checks (pull_request) Failing after 1m56s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 20m59s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1h0m3s
11dd9a9d70
build(tools): llvm-mingw's Windows tool keeps llvm-ar and its x86-64 drivers (#2963)
Some checks failed
PR description / Title and description (pull_request_target) Successful in 33s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m47s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 17m47s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m6s
CI / Website build and checks (pull_request) Failing after 2m0s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 19m51s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 38m56s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
2540f4579c
## Summary

The pin half of a tool bump (docs/dev/reference/releases.md, "Bumping a tool"): tools.lock's trimmed llvm-mingw for Windows keeps `llvm-ar.exe` and llvm-mingw's two x86-64 drivers (`x86_64-w64-mingw32-clang.exe`, `x86_64-w64-mingw32-clang++.exe`), and `LLVM_MINGW_TRIM` goes to 2, a new package version (a version's files never change).

Why: the trimmed llvm-mingw has no archiver. A developer's game build on Windows archives the game's Rust's C, C++ and CMake objects (shaderc's among them, whose paths pass 260 characters) with whatever `ar` the PC has: none on a clean PC, or MinGW's, which cannot open those paths. #2961 hands the toolchain's `llvm-ar` to cargo and CMake when there is one, and for now names rustup's `llvm-tools` in setup.md. `llvm-ar.exe` loads `libLLVM-<n>.dll`, which the trim keeps already.

The drivers: `scripts/longshot_builder.py`'s Windows build names `x86_64-w64-mingw32-clang.exe` as its linker and C compiler and `x86_64-w64-mingw32-clang++.exe` as its C++ one, in the llvm-mingw it is given. A build from source on Windows (the launcher's, #2961) gives it the source tools' trimmed llvm-mingw, which has `clang.exe` and `clang++.exe` only, so the builder could not be made. They are llvm-mingw's small drivers (14 KB each, running `clang-<n>.exe` as `clang.exe` does).

Read first: `builder/tools/windows-x64/llvm-mingw.sh` (`trim_llvm_mingw`), `builder/tools/pins.sh`.

Once tools.lock names the new version, a player's from-source build on Windows changes too: `from_source::archiver` finds `tools/llvm-mingw/bin/llvm-ar.exe`, so RenHDrum is compiled from the source instead of `renhdrum_not_built` (the running builder's library). docs/dev/reference/build.md's "with none (a Steam Deck, Windows)" then goes stale: that line changes with tools.lock's line, in the third pull request.

See #2961.

## Testing

**Tested:** the recipe itself not yet: it runs in Ubuntu 22.04 (`builder/tools/docker.sh` or the Check tools workflow), which this Windows PC does not have. Its files, on Windows 11 (the three added by hand from llvm-mingw 20261104's UCRT x86-64 release to tools.lock's `20261104-x64-1`):
- `scripts/longshot_builder.py build --target windows --profile release` with that llvm-mingw as `LONGSHOT_MINGW`: the builder is made (the drivers as linker, CC and CXX).
- That builder's `from-source --archive` of #2961's head under the launcher's data folder, with that llvm-mingw as the source tools' and MinGW's `ar` first on the PATH: done in 349 s; shaderc's CMake took `tools/llvm-mingw/bin/llvm-ar.exe` (its toolchain file); RenHDrum built from the source (`renhdrum.dll`, no `renhdrum_not_built`); the version's `Longshot.exe` answers `--version`.

**Still to test:**
- The Check tools workflow on this branch: `windows-x64/llvm-mingw`, expecting the archive made the same twice, `bin/llvm-ar.exe` and the two `bin/x86_64-w64-mingw32-clang*.exe` in it, a new version `20261104-x64-2` (by hand: someone with write access dispatches `tools-check.yml`).
- Windows, with the archive in a checkout's `tools.lock` (make.sh's `add.sh`): `tools\llvm-mingw\bin\llvm-ar.exe --version` runs; `dev.py rt` then `dev.py smoke` with no other `llvm-ar` on the PATH, expecting PASS (by hand).
- Windows, a from-source build with it (`longshot-builder build --source ...`): RenHDrum compiled, no `renhdrum_not_built` warning (by hand).

## Measurements

Nothing to measure: a build tool's archive gains one small program; the game is built as before.

## Risks

- The archive grows by `llvm-ar.exe` and the two drivers (small programs over the DLL and `clang-<n>.exe` it already carries).
- With the new tools.lock line, a Windows from-source build compiles RenHDrum where it took the running builder's library before.
- Nothing changes until tools.lock names the new version; revert is enough before that.

## Checklist

### Ready for review

- [x] One topic, on current `mod-api`; the title is a Conventional Commit.
- [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. Not yet: the recipe needs Ubuntu 22.04 (Still to test).
- [ ] `mise run test` passes (any failure that also fails on `main` is named). Not run for this branch: it changes two shell recipes, which `tests/test_tools_pins.py` checks on Linux (CI).
- [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

- [ ] A check under `tests/` that reads changed source is updated, not weakened. `tests/test_tools_pins.py` reads `pins.sh`; nothing in it needs a change (CI runs it).
- [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)

Co-authored-by: neotoxicfr <[email protected]>
Reviewed-on: #2963
fix(game): small chests' award no longer waits on Navi's turn above 60 fps (#2809)
Some checks failed
PR description / Title and description (pull_request_target) Successful in 33s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m8s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 15m19s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m17s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 22m40s
CI / Website build and checks (pull_request) Failing after 1m58s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 37m14s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m6s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 1h0m3s
f53e1c42ee
## Summary

Opening a small chest above 60 fps could hold Link in the award scene for seconds longer than it should. At 144 fps the
scene took 7.9 s of game time instead of 4.1 s, and at 240 fps 13.2 s. With this change it takes 4.1 s at both.

**Why:** the scene waits for Navi to finish turning. Each frame the game turns her level heading by the frame's step,
which is right, and then projects it onto the plane of her banked up vector. That projection swings the heading a fixed
angle (2.4 degrees in the orientation she was seen stuck in), whatever the step. At 144 fps the swing outweighs the
turn, so she never comes within the 5 degrees that end it, and the event goes on only at its own 360-frame limit.

**The change:** a site before the projection, `navi.turnHeading` (`f_808b5ff0`), gives the game a heading that already
lies in up's plane and has swung by the step's part only, so the projection keeps it. At a frame-rate cap of 60, or on a
frame of a 60th or longer, the game's own heading is used.

**To see it on mod-api:** set the cap to 144 or higher and reach it, then open a small chest (Kokiri Forest, Mido's
house). Link holds his pose while Navi hangs banked short of the chest. At 120 fps it did not show.

Read first: `navi_heading_rule` in `game/crates/game-core/src/fixes/high_fps.rs`, then `navi.turnHeading` in
`game/sites/sites.toml`.

This is for `mod-api` (#2434). See #2579 (its chest delay; its item rotation and spawn cutscene are not covered), and
#2561, which may be the same wait for its chest (its sign is not covered, and nothing here was checked against it).

## Testing

**Tested:** Windows 11, NVIDIA RTX 3080. The in-game runs were on mod-api `5c1cd9f5b` with these two commits, before the
rebase onto `4c498c8aa`, which had no conflicts. **The rebased head has not run in the game.**

- A small chest in Mido's house, opened by a script. A local test switch (not in this branch) held each frame's step to a
  fixed size, so the times are in game time and don't depend on how fast the PC ran. Results in Measurements.
- The large Kokiri Sword chest was not slowed on mod-api: 1600, 1567 and 1568 sixtieths at 60, 120 and 240 fps.
- On the rebased head: game-core's `high_fps` and `every_` tests (34), the `sites` crate's (46 and 6), `cargo fmt` and
  clippy (`--lib`) pass. `navi_turns_as_far_in_a_second_at_144_fps_as_at_60` fails on the first commit, whose rule does
  nothing, and passes on the second.
- `test_patch_hooks_defined`, `test_thread_locations`, `test_game_fov` and `test_dev_check` pass.
  `test_present_sites` fails on this PC (`unsetenv` undeclared under llvm-mingw), and fails the same way on mod-api
  `4c498c8aa`. The rest of the suite has not run.

**Still to test:**
- Windows, the rebased head: a small chest at a real cap of 144 or more (the PC tested on could not hold one), expecting
  the same length as at 60 (by hand)
- Windows, the rebased head: a small chest at a cap of 60 and at 90 or 120, expecting no change from mod-api (by hand)
- Windows: Navi's flight and turns in ordinary play above 60 fps, such as calling her and targeting, expecting nothing odd
  (by hand)
- Linux: a small chest at 144 fps or more, expecting the same length as at 60 (by hand)

## Measurements

**Verdict:** the small chest's event is as long at 144 and 240 fps as it is at 60.

Setup: Windows 11, RTX 3080; the small chest's event in Mido's house, in sixtieths of a second of game time, each frame's
step fixed. **One run each.** The "mod-api" column's 60, 120 and 240 rows are from an earlier build. The 144 row's two
numbers are from one build with the rule on and off, and the earlier build gave the same 476.

Baseline: mod-api @ 5c1cd9f5b, which this is for, not main: the fix's Rust site layer is on mod-api only. The After
column is these two commits on it, before the rebase.

| Frame step | Before: mod-api @ 5c1cd9f5b | After: this PR @ f3952c489 |
|---|---|---|
| 1/60 | 248 | 273 |
| 1/120 | 247 | not run |
| 1/144 | 476 | 244 |
| 1/240 | 795 | 245 |

The 273 at 1/60 is not explained. The rule does nothing there (it returns before changing anything at a whole step), and
the run was not repeated. No frame-time cost was measured: the site runs only while Navi turns, and it is a few
trigonometric calls.

## Risks

Navi's turning above a 60 fps cap is the only thing that changes. A revert is enough, and a cap of 60 turns it off. A
player notices nothing after updating except the shorter scene. The site is for the e0f3ccfa build's `f_808b5ff0`, with
a signature. Other callers of `f_808b7510`, the turn it uses, were not looked at.

## Checklist

### Ready for review

- [ ] One topic, on current `main`; the title is a Conventional Commit. (One topic, but on `mod-api`, its tip on 2026-11-29.)
- [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (Run before the rebase; the rebased head is owed.)
- [ ] `mise run test` passes (any failure that also fails on `main` is named). (Only the tests named in Testing have run.)
- [ ] Measured against `main`, or Measurements says why there is nothing to measure. (One run each; 60 fps is to be repeated.)
- [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible.

### When it applies

- [x] A fix: a game-free test that fails on `main` and passes here.
- [x] A check under `tests/` that reads changed source is updated, not weakened.
- [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)

Reviewed-on: #2809
perf(vk): the shader store keeps its SPIR-V zstd-compressed
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
a18747bedc
Each blob is a zstd frame (level 1), or the words as they are where that
would not be smaller: one translator's 3.7 GB of SPIR-V takes 0.99 GB. New
files, spirv.zpack and spirv.zidx (format 2), since an older build makes a
store of another version again. kProgramCacheFormat 3 -> 4.

See #1649.

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

Tested in game: Linux, NVIDIA RTX 3090, driver 620.70.06, headless dev.py smoke from kokiri-start twice (PASS): in play, 900 frames, menu opened. The shader preparation before them filled the new store (39,173 noted pipelines, 0 not made). The second run loaded 544 programs from compressed blobs in the fallback store with no read failures.

Tested in game: Linux, NVIDIA RTX 3090, driver 620.70.06, headless dev.py smoke from kokiri-start twice (PASS): in play, 900 frames, menu opened. The shader preparation before them filled the new store (39,173 noted pipelines, 0 not made). The second run loaded 544 programs from compressed blobs in the fallback store with no read failures.
HumanBean force-pushed perf/spirv-store-zstd from a18747bedc
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to 6e73af1d83
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
2026-12-02 18:24:23 +00:00
Compare
HumanBean force-pushed perf/spirv-store-zstd from 6e73af1d83
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to 08ca00bc04
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
2026-12-02 18:47:04 +00:00
Compare
HumanBean changed title from WIP: perf(vk): the shader store keeps its SPIR-V zstd-compressed to perf(vk): the shader store keeps its SPIR-V zstd-compressed 2026-12-02 19:28:41 +00:00
HumanBean merged commit 5934a4650a into mod-api 2026-12-02 19:29:40 +00:00
HumanBean deleted branch perf/spirv-store-zstd 2026-12-02 19:29:41 +00:00
BeanBot left a comment

Recommendation: Approve. The recorded store is about 2.7 GB smaller for the sampled shader set, but the effect on preparation and loading time is unknown. Windows and the launcher’s prepared-store play path still need testing, and the launcher cleanup change must land before release. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Stores each shader stage as a zstd frame when that saves space, preserving separate files for older builds. This saves substantial disk space at the cost of compression during preparation and decompression during reads.

Should fix (2): not blocking, but worth doing before merging.

  • L1 tests/test_spirv_pack.py:80: The format-bump check still accepts any program-cache format of 2 or higher, so it does not protect this change’s required bump from 3 to 4. (more on the line) Do: Add a compatibility test that starts with a format-3 cache and verifies that this build rejects or replaces it; ensure reverting the bump makes the test fail.
  • L2 tests/test_validate_spirv.py:78: The only validator test for compressed frames silently skips when zstandard is unavailable. (more on the line) Do: Declare zstandard as a test dependency and require the compressed-frame case to run, or use a checked-in synthetic frame that needs no package to create.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3 gpu/vk/spirv_pack.h:260: Compression and decompression change preparation and cache-loading work, but their player-facing cost has not been measured. (more on the line) Do: Compare repeated base and head runs for shader preparation and cold and warm startup, including cache size and memory, on the same machine and build; report the spread and frame pacing during play.
  • L4 gpu/vk/spirv_pack.h:432: The supported Windows and builder-prepared-store paths have not been exercised in a game run on this head. (more on the line) Do: Build and run on Windows, and launch a game through the launcher after preparation using LONGSHOT_SHADER_STORE; verify that prepared programs load without read failures. Cover affected Tier 1 systems, including AMD and Steam Deck, as required by the repository.

@fix can do L1 and L2.

Checks: Still running: PR description / Title and description (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Yes for store size: the PR reports 3.706 GB of words stored in 0.993 GB for 50,898 blobs, using the new store’s index counts. Overall player impact is unproven: preparation, cold and warm load times, frame pacing, and memory were not measured against the base.

Other systems: The store is shared by preparation and play across drivers and game folders; its reads also occur during program-cache loading and compaction. Linux NVIDIA smoke runs read the fallback store, but did not exercise play from the builder-prepared store. Windows, AMD and Steam Deck behavior and timing remain unmeasured. The launcher’s cleanup needs LongshotLauncher #397 to count and remove the new files.

Switches: No switches added, changed or removed. LONGSHOT_SHADER_STORE retains its existing default and semantics; its files now use the compressed format. RX_VK_PROGRAM_CACHE_ZSTD remains a separate cache mode.

Reviewed: 08ca00bc04 against 582b6a1abf: Read the repository rules, standards and PR template; the diff and commit; spirv_pack.h, the changed validator and its tests, and the changed store tests. Read the relevant program-cache initialization and builder store-selection and receipt paths; skimmed the remainder of the large builder and program-cache files and the mechanical test and documentation changes. No recorded run artifacts or translations were included in the diff. docs/review-checklist.md and the adjacent Tooling AGENTS.md were unavailable.; nothing run (a code review).

Checked and fine:

  • The commit has an AI-assistance trailer, and no game-derived files or generated shader outputs appear in the diff.
  • Stored lengths are bounded before allocation and offset addition in the renderer; decompressed words are checked against their hash.
  • Compression occurs outside the store lock, followed by a second lookup under the lock.
  • The format-1 store files have separate names and are not overwritten by the new store.

Testing: Read-only review; no commands from the project, builds or tests were run. The author reports Linux build and smoke results and names failures also observed on the base.

Overlaps and merge order: LongshotLauncher #397 is needed before release for cleanup of the new files. Longshot #2153 also changes store read handles; whichever lands second needs a rebase. This PR is based on mod-api #2822.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The recorded store is about 2.7 GB smaller for the sampled shader set, but the effect on preparation and loading time is unknown. Windows and the launcher’s prepared-store play path still need testing, and the launcher cleanup change must land before release. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Stores each shader stage as a zstd frame when that saves space, preserving separate files for older builds. This saves substantial disk space at the cost of compression during preparation and decompression during reads. **Should fix (2)**: not blocking, but worth doing before merging. - **L1** `tests/test_spirv_pack.py:80`: The format-bump check still accepts any program-cache format of 2 or higher, so it does not protect this change’s required bump from 3 to 4. (more on the line) **Do:** Add a compatibility test that starts with a format-3 cache and verifies that this build rejects or replaces it; ensure reverting the bump makes the test fail. - **L2** `tests/test_validate_spirv.py:78`: The only validator test for compressed frames silently skips when zstandard is unavailable. (more on the line) **Do:** Declare zstandard as a test dependency and require the compressed-frame case to run, or use a checked-in synthetic frame that needs no package to create. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3** `gpu/vk/spirv_pack.h:260`: Compression and decompression change preparation and cache-loading work, but their player-facing cost has not been measured. (more on the line) **Do:** Compare repeated base and head runs for shader preparation and cold and warm startup, including cache size and memory, on the same machine and build; report the spread and frame pacing during play. - **L4** `gpu/vk/spirv_pack.h:432`: The supported Windows and builder-prepared-store paths have not been exercised in a game run on this head. (more on the line) **Do:** Build and run on Windows, and launch a game through the launcher after preparation using LONGSHOT_SHADER_STORE; verify that prepared programs load without read failures. Cover affected Tier 1 systems, including AMD and Steam Deck, as required by the repository. `@fix` can do L1 and L2. **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for store size: the PR reports 3.706 GB of words stored in 0.993 GB for 50,898 blobs, using the new store’s index counts. Overall player impact is unproven: preparation, cold and warm load times, frame pacing, and memory were not measured against the base. **Other systems:** The store is shared by preparation and play across drivers and game folders; its reads also occur during program-cache loading and compaction. Linux NVIDIA smoke runs read the fallback store, but did not exercise play from the builder-prepared store. Windows, AMD and Steam Deck behavior and timing remain unmeasured. The launcher’s cleanup needs LongshotLauncher #397 to count and remove the new files. **Switches:** No switches added, changed or removed. LONGSHOT_SHADER_STORE retains its existing default and semantics; its files now use the compressed format. RX_VK_PROGRAM_CACHE_ZSTD remains a separate cache mode. **Reviewed:** 08ca00bc04ee against 582b6a1abf03: Read the repository rules, standards and PR template; the diff and commit; spirv_pack.h, the changed validator and its tests, and the changed store tests. Read the relevant program-cache initialization and builder store-selection and receipt paths; skimmed the remainder of the large builder and program-cache files and the mechanical test and documentation changes. No recorded run artifacts or translations were included in the diff. docs/review-checklist.md and the adjacent Tooling AGENTS.md were unavailable.; nothing run (a code review). **Checked and fine:** - The commit has an AI-assistance trailer, and no game-derived files or generated shader outputs appear in the diff. - Stored lengths are bounded before allocation and offset addition in the renderer; decompressed words are checked against their hash. - Compression occurs outside the store lock, followed by a second lookup under the lock. - The format-1 store files have separate names and are not overwritten by the new store. **Testing:** Read-only review; no commands from the project, builds or tests were run. The author reports Linux build and smoke results and names failures also observed on the base. **Overlaps and merge order:** LongshotLauncher #397 is needed before release for cleanup of the new files. Longshot #2153 also changes store read handles; whichever lands second needs a rebase. This PR is based on mod-api #2822. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -229,0 +257,4 @@
const void* bytes = w;
size_t stored = n * 4;
#ifndef SPIRV_PACK_NO_ZSTD
std::vector<uint8_t> frame(ZSTD_compressBound(n * 4));
Member

L3 (should fix): Compression and decompression change preparation and cache-loading work, but their player-facing cost has not been measured.

When: A fresh preparation compresses every new stage and a warm start decompresses stages as they are read; the reported one-thread microbenchmark does not show the resulting build or load time.

Do: Compare repeated base and head runs for shader preparation and cold and warm startup, including cache size and memory, on the same machine and build; report the spread and frame pacing during play.

**L3** (should fix): Compression and decompression change preparation and cache-loading work, but their player-facing cost has not been measured. *When:* A fresh preparation compresses every new stage and a warm start decompresses stages as they are read; the reported one-thread microbenchmark does not show the resulting build or load time. **Do:** Compare repeated base and head runs for shader preparation and cold and warm startup, including cache size and memory, on the same machine and build; report the spread and frame pacing during play.
@ -378,0 +429,4 @@
bool whole = true;
if (stored < plain) {
#ifndef SPIRV_PACK_NO_ZSTD
const size_t got = ZSTD_decompress(out, plain, packed.data(), stored);
Member

L4 (should fix): The supported Windows and builder-prepared-store paths have not been exercised in a game run on this head.

When: The reported Linux smoke runs used a fallback store; they do not cover the launcher’s Play path reading the store filled by preparation, and Windows has not been started with the new format.

Do: Build and run on Windows, and launch a game through the launcher after preparation using LONGSHOT_SHADER_STORE; verify that prepared programs load without read failures. Cover affected Tier 1 systems, including AMD and Steam Deck, as required by the repository.

**L4** (should fix): The supported Windows and builder-prepared-store paths have not been exercised in a game run on this head. *When:* The reported Linux smoke runs used a fallback store; they do not cover the launcher’s Play path reading the store filled by preparation, and Windows has not been started with the new format. **Do:** Build and run on Windows, and launch a game through the launcher after preparation using LONGSHOT_SHADER_STORE; verify that prepared programs load without read failures. Cover affected Tier 1 systems, including AMD and Steam Deck, as required by the repository.
@ -76,1 +77,4 @@
zbic = ROOT / "third_party/zbic"
zstd = folder / "zstd.o"
subprocess.run([args.cxx, "-x", "c", "-O1", "-I" + str(zbic), "-c", str(zbic / "zstd.c"), "-o", str(zstd)], check=True, cwd=folder)
subprocess.run([args.cxx, "-std=c++20", "-O1", "-g", "-Wall", "-Wextra", "-Werror", "-D_CRT_SECURE_NO_WARNINGS",
Member

L1 (should fix): The format-bump check still accepts any program-cache format of 2 or higher, so it does not protect this change’s required bump from 3 to 4.

When: If kProgramCacheFormat is reverted to 3, the store tests still accept it, while a format-3 cache can be accepted with offsets into the old store.

Do: Add a compatibility test that starts with a format-3 cache and verifies that this build rejects or replaces it; ensure reverting the bump makes the test fail.

**L1** (should fix): The format-bump check still accepts any program-cache format of 2 or higher, so it does not protect this change’s required bump from 3 to 4. *When:* If kProgramCacheFormat is reverted to 3, the store tests still accept it, while a format-3 cache can be accepted with offsets into the old store. **Do:** Add a compatibility test that starts with a format-3 cache and verifies that this build rejects or replaces it; ensure reverting the bump makes the test fail.
@ -75,2 +75,4 @@
store.f.close()
# (a blob kept as a zstd frame, where the package is there to make one)
try:
Member

L2 (should fix): The only validator test for compressed frames silently skips when zstandard is unavailable.

When: A test environment without that package reports success even if compressed-store reading is broken, although compressed frames are the normal new format.

Do: Declare zstandard as a test dependency and require the compressed-frame case to run, or use a checked-in synthetic frame that needs no package to create.

**L2** (should fix): The only validator test for compressed frames silently skips when zstandard is unavailable. *When:* A test environment without that package reports success even if compressed-store reading is broken, although compressed frames are the normal new format. **Do:** Declare zstandard as a test dependency and require the compressed-frame case to run, or use a checked-in synthetic frame that needs no package to create.
Author
Owner

Open question after merge: an fps gap in an A/B on AMD, not yet explained.

RX 580 (RADV), i7-9700K, Linux, Hyrule Field, 1920x1080 at 67 %, uncapped, headless, 45 s a run, three interleaved runs each (dev.py ab, two runtimes):

mod-api 582b6a1a with this PR
avg fps 57.4, 56.5, 55.7 53.7, 53.9, 53.2
median frame 17.45, 17.45, 17.57 ms 17.78, 17.74, 17.77 ms
1% low 52.6, 36.2, 31.3 fps 29.9, 29.5, 29.4 fps

GPU time was the same (14.2-14.3 ms) and both sides read their prepared stores with no failed reads. CPU time was about 25 % higher with this PR in phases it does not touch (draw, command recording, memory sync, the game's main thread), so a build or machine effect is possible, but not shown. (dev.py ab wrote no verdict only because the two builds' versions differ.)

A control is queued on the same PC: this PR's runtime with the baseline's game executable. I will post what it shows.

🤖 Generated with Claude Code

**Open question after merge: an fps gap in an A/B on AMD, not yet explained.** RX 580 (RADV), i7-9700K, Linux, Hyrule Field, 1920x1080 at 67 %, uncapped, headless, 45 s a run, three interleaved runs each (`dev.py ab`, two runtimes): | | mod-api 582b6a1a | with this PR | |---|---|---| | avg fps | 57.4, 56.5, 55.7 | 53.7, 53.9, 53.2 | | median frame | 17.45, 17.45, 17.57 ms | 17.78, 17.74, 17.77 ms | | 1% low | 52.6, 36.2, 31.3 fps | 29.9, 29.5, 29.4 fps | GPU time was the same (14.2-14.3 ms) and both sides read their prepared stores with no failed reads. CPU time was about 25 % higher with this PR in phases it does not touch (draw, command recording, memory sync, the game's main thread), so a build or machine effect is possible, but not shown. (`dev.py ab` wrote no verdict only because the two builds' versions differ.) A control is queued on the same PC: this PR's runtime with the baseline's game executable. I will post what it shows. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Follow-up on the fps gap above: the control does not show it coming from this PR.

Same PC. Control: this PR's runtime (its renderer and its compressed caches) with the baseline's game executable, against the baseline, three interleaved runs each:

mod-api 582b6a1a control
avg fps 53.7, 50.3, 51.6 (51.9) 56.0, 50.3, 56.6 (54.3)
median frame 17.82, 18.54, 17.94 ms 17.63, 18.84, 17.55 ms

The control is not slower. The baseline itself moved from 55.7-57.4 fps in the first session to 50.3-53.7 here, so this PC's spread between sessions is larger than the first gap. Why the first session's two builds differed is not established (their game executables are not byte-identical; nor was a plain effect of the machine ruled out).

Load time, with the shader store and program caches evicted from the OS cache before each launch (hard drive), same game executable on both sides:

mod-api control
launch to in play 16.33, 14.92, 14.83 s (15.4) 15.79, 14.95, 17.37 s (16.0)
teleport to the Market 6.41, 8.72, 7.45 s 6.35, 9.47, 6.77 s

The runs overlap: no load-time difference shown either way at three runs each. All launches read the prepared store, with no failed reads.

🤖 Generated with Claude Code

**Follow-up on the fps gap above: the control does not show it coming from this PR.** Same PC. Control: this PR's runtime (its renderer and its compressed caches) with the **baseline's game executable**, against the baseline, three interleaved runs each: | | mod-api 582b6a1a | control | |---|---|---| | avg fps | 53.7, 50.3, 51.6 (51.9) | 56.0, 50.3, 56.6 (54.3) | | median frame | 17.82, 18.54, 17.94 ms | 17.63, 18.84, 17.55 ms | The control is not slower. The baseline itself moved from 55.7-57.4 fps in the first session to 50.3-53.7 here, so this PC's spread between sessions is larger than the first gap. Why the first session's two builds differed is not established (their game executables are not byte-identical; nor was a plain effect of the machine ruled out). Load time, with the shader store and program caches evicted from the OS cache before each launch (hard drive), same game executable on both sides: | | mod-api | control | |---|---|---| | launch to in play | 16.33, 14.92, 14.83 s (15.4) | 15.79, 14.95, 17.37 s (16.0) | | teleport to the Market | 6.41, 8.72, 7.45 s | 6.35, 9.47, 6.77 s | The runs overlap: **no load-time difference shown either way** at three runs each. All launches read the prepared store, with no failed reads. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!3023
No description provided.