feat(game)!: the game side and the whole mod API in Rust, with system mods and the sandbox on by default #2822

Open
HumanBean wants to merge 2 commits from mod-api into main
Owner

Summary

Why. On main the game side (everything between the C host and the lifted game) is C (game/*.c), with each
setting and feature wired into it and into the C++ Insert menu, and the only mods are file mods (romfs, exefs,
cheats) loaded by game/mods.c. There is no way for a mod to run code, and the game runs with the player's full
rights. This moves the game side to Rust, adds a mod API that script mods run on, rebuilds every setting and feature
as a system mod on that same API, and makes the builder start every game confined.

This is #2434 squashed into one commit (the same tree as
its last head, 696eed7f). Its reviews, comments and earlier test runs are there; the full history is on
HumanBean:wip/mod-api-history, which
holds the commits named below (75b9274d, fdab42dd).

What changed

  • The game side in Rust (game/crates: game-core, game-sites, api, script, ui, content,
    longshot-game and their helpers), linked into the game as one static library. The hook sites stay tables
    (game/sites) the lifter reads. Design: game/DESIGN.md.
  • The mod API. Script mods in TypeScript or JavaScript, run by QuickJS in the game, which compiles a mod's
    TypeScript itself as it loads it (no Node, no build step). mod.toml is the manifest. A mod asks for permissions
    the player grants; it gets events, settings, storage, UI (HUD, windows, world labels), input, the network (when
    confirmed) and the game's state through the longshot modules. Turning a mod off puts back what it changed that the
    game has not saved yet. Mods can also add content, and hook sites of their own that the next game build places.
    File mods load as before. Docs: docs/modding/, with 41 example mods and their tests.
  • System mods. Every game setting and feature is a system mod in game/mods, on the same API as players' mods:
    Rust (cheats, shadows, widescreen, sprint and walk, HDR, grass, prompts...), TypeScript (the Insert menu itself, the
    Mods tab, the mod inspector, Discord status, the FPS counter, CRT, colour vision, text, area names, Skip title...),
    and six settings-only mod.tomls. The TypeScript ones are compiled into the program. Every
    longshot_options.ini key keeps its name (tests/test_menu_ini_keys.py's FROZEN list).
  • The builder is the game's only entrypoint, sandboxer and broker. Only longshot-builder starts the game
    process; tools start it through longshot-builder game. On Linux the builder applies Landlock and no_new_privs
    and the game a seccomp filter; on Windows the game runs in an AppContainer with no capability (its plan made in Rust,
    build_core::sandbox_windows). The game starts no process. Everything it may not do itself goes to the builder over
    one framed channel (host/builder_channel.h; the game's side is Rust, builder_link): the mods' network and IPC,
    settings writes, saves, crash reports, controllers, restarts, message boxes, and the links and folders it opens. A
    mod's network is confirmed in the builder's own window and kept in the profile's trust.json, which the game can
    read and never write. The environment the builder passes is one list (build_core::env_own).
  • The game thread's frame. In a steady frame the mod runtime does almost nothing: an event no mod listens to
    builds nothing, the settings host, the mods list and the UI step only on a change, and the script watchdog sleeps
    until the next deadline.
  • Dev builds. The game's Rust is kept in the object store by its inputs' key and built once per PC, beside the C
    compile.

What players see change

  • Script mods can be installed and run (a preview: API 0.x), each asking for its permissions in the Mods tab.
  • The game runs confined. HOS_SANDBOX=0 in the real environment turns that off; longshot_env.txt cannot.
  • The Insert menu has the same tabs and rows, now drawn by the menu system mod; the Mods tab holds every mod, system
    mods included, and Discord status moved there from Gameplay.
  • Cheats' switches start off once after updating: they now live in the cheats mod's settings. Needs a line in the
    release notes.
  • Start to play is about 5 s shorter: Skip title loads the newest save straight away.
  • The settings guide has no Graphics tab picture until the new menu has a game-free capture.

Read first: game/DESIGN.md, game/game.h, docs/modding/README.md, docs/dev/reference/builder.md,
docs/dev/reference/sandbox.md, gpu/vk/vk_api.h (MKWVK_API_VERSION 80).

Testing

Tested: Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06), on 75b9274d (the head adds docs, test fixes,
main's newest (a docs change) and #2751 (the dev queue), none of it in the game), the sandbox on (Landlock ABI 9, seccomp, network closed), through the job queue:

  • Boot to play: all 29 system mods running with no faults, audio open, settings saved, no [error] line.
  • The control bridge through the builder: status, shot, menu keys, mods, mod logs and quit answer.
  • Network: a mod asking net:https://example.org gets the builder's question and is refused until confirmed; a
    development mod's fetch returns 200.
  • Controllers through the builder (no pad plugged in): no errors.
  • A forced crash (HOS_CRASH_TEST): a complete crash record in the game folder's diagnostics/bug-reports.
  • Cloth (HOS_NATIVE_CLOTH=check): 0 mismatches over every kernel.
  • The Insert menu and every tab, and the Mods tab: no errors.
  • A mod's lifecycle: a permission the player denies is refused and the mod runs on; one taken back is refused from then
    on (permissions.changed fires); a hot reload that does not compile keeps the old instance running and says why; a
    good one runs the new code with the grants kept; switching it off fires stopping, ends its timers and its settings
    listener.
  • Hooks: a profile mod observing items.pouchAdd built into the game (longshot-builder build, one site placed) and
    called at a pouch add; switched off it is "off at the next start" (as the docs say), and after a restart its site
    is called by nothing.

The checks: mise run test on 75b9274d, then the failing ones again on the head: 15 fail, each also failing on main
(2a146054) with the same error (compared message by message: the program-cache fixtures' spirv_pack::Store, the guest
holes' UploadLayoutGuard, the video and input fixtures, test_windows_on_linux, test_xinput_thread); the Rust
workspace's fmt, clippy -D warnings and cargo test --release pass. The Windows game folder cross-links with llvm-mingw; it has not run on Windows.

Still to test:

  • Linux and Windows: the parity gates (scripts/parity_gates.py) and feature checks, expecting main's results apart
    from "Fixed on the way" (@Beanstalk, or by hand)
  • Windows on the Test Farm: start with the sandbox on, expecting play inside the AppContainer, the broker running, saves
    committing, shots written, mods' IPC through the broker (@Beanstalk)
  • The menu fault on Windows reported in the comments (settings host calls), expecting none after a fix (@Beanstalk)
  • Windows through the Launcher's Play, the default AppContainer: switch the Insert and Mods pages repeatedly (with a
    restart), save and load a chosen slot, a second profile kept apart; expecting no menu faults
    (the earlier report) (@Beanstalk or
    a tester)
  • A stopped mod's HUD and world label gone from the screen, in a windowed run (the headless shots draw the Insert
    menu alone, not mods' UI), and a crash reported by longshot-builder play at the next start (by hand)
  • Steam Deck and AMD (the lab PC): boot to play from kokiri-start with the sandbox on, expecting no sandbox refusals in
    the log (@Beanstalk)

Measurements

Verdict: fps, 1 % lows and frame-time tails level with main or better; start to play about 5 s shorter. The game
thread does about 0.1–0.2 ms more CPU a frame (the mod runtime's own frame; accepted, closing it is a follow-up), and
the process keeps about 90 MB more private memory.

Setup: Linux 7.3, RTX 3090, NVIDIA 620.70.06; Hyrule Field (child), 1080p native, Upscaler Off, fixed resolution,
uncapped, no player mods; dev.py ab, main (2a146054) against this PR (75b9274d), interleaved, the median of each
run (the first 600 frames left out). The PC had other work on it: compare the sides, not the fps against other PRs.

Menu closed, 3 × 90 s Before: main @ 2a146054 After: this PR @ 75b9274d
fps (median run) 121.7 121.6
1 % low (median run) 96.3 106.7
frame time median / p99 (ms) 8.21 / 10.38 8.22 / 9.37
game thread CPU (main_cpu_ms) 1.85–1.88 1.93–1.95
VRAM / process private (MB) 7155–7475 / 2448–2459 7155–7379 / 2485–2562
launch to play (s) 11.2–11.3 5.1–7.3

On a quieter PC earlier the same day (3 × 90 s): main_cpu_ms 1.64–1.66 against 1.80–1.85, fps level (136.9–138.4
against 138.3–139.3).

  • Insert menu open (2 × 60 s, the clean pair): fps level (123.4 against 123.1); the game thread +0.3 ms, the menu
    being a script mod here.
  • An active example mod (link-hud, its HUD read every frame; 2 × 60 s against the PR without it): no fps or
    frame-time loss; the game thread +0.07 ms.
  • Full build time: not measured on this head.
  • On current main (1413b172): the PR side (75b9274d) already holds main to 01d6878b; main's commits since
    2a146054 are Debug-tab rows, Pause in background (off unless the window is behind), the program cache's store and
    the dev tools, none in a steady frame's work, so the comparison holds. The head's commits since 75b9274d change docs,
    tests and the dev queue only.

Switches this adds or changes, the default each ships at and why (rows in gpu/vk/switches.def):

Kill switches, on by default (each is the new behaviour; =0 is the old one, for an A/B or a fallback):

  • HOS_SANDBOX: on; every run confines itself, a run the system cannot confine goes on unconfined with a player's
    script mods held. On for safety, not from measurements; its cost is in the table above.
  • HOS_GAME_BARRIER_WAIT: on; three parallel-for job barriers wait on their mask word instead of sleeping 20 us and
    polling. =0 against unset, 2 × 60 s: 137.3 against 138.1 fps, within the spread; it ships on because it ends the
    polling (less CPU awake), with no cost measured.
  • HOS_GAME_FIRST_NIGHT_FIX: on; clears the first adult night's stuck time lock so the clock runs (a fix).
  • HOS_MODS_WATCH: on; mods/ and profile.json watched by the system's change notices, so folder script mods hot-reload.
  • HOS_SHADOW_RES: Highest is the game's 3072 at 16:9 and grows only past 16:9 (4512 at 21:9, 5120 at 32:9), as on
    main at 16:9.
  • HOS_SHADOW_SPLITS: cascade 0 ends at 15 m at 16:9 (12 m at 32:9), cascade 1 at 45 m. =0 (the game's
    splits) against unset, 2 × 60 s: 126.1 against 131.5 fps, every =0 run below every default run; the default costs
    nothing and keeps near shadows sharp.
  • HOS_SYSTEM_MODS_OFF: unset, every system mod by its own rules; for A/Bs and parity runs.
  • RX_VK_DRS: on, host dynamic resolution drives Render resolution Auto (unchanged default, the row reworded).
  • RX_VK_FG_AUTO_GUARD: on, frame generation's Auto steps down when overloaded (unchanged default, the row reworded).
  • RX_VK_FX, RX_VK_WORLD, RX_VK_TEX_PACKS: on, script mods' screen effects, world shapes and texture packs are
    drawn; =0 for an A/B only.

Tuning:

  • RX_VK_FX_BUDGET_US: 2000; a script mod's screen effect over 2 ms of GPU time a frame is stopped for the session.
  • HOS_WIDE_MAX_PX: 5120 x 2160 pixels, a native size already of the picture's shape keeps its own.

Player and builder overrides, unset by default (unset is the normal run; the builder or launcher sets them):
HOS_AUDIO_DEVICE, HOS_LANGUAGE, HOS_MOUSE_NATIVE, HOS_RES_SCALE, HOS_NO_MODS (the menu or saved choice
applies); LONGSHOT_SAFE_START, LONGSHOT_SET, LONGSHOT_MOD_STORE,
LONGSHOT_SHADER_CACHE, LONGSHOT_GAME_MODULE (set by longshot-builder play); LONGSHOT_SHADER_STORE,
LONGSHOT_NFC_DIR, RX_VK_DLSS_DIR (the user's own folders); LONGSHOT_PREPARE_ONLY (off, a normal run).

Set by the builder for the game it starts, never by a run: LONGSHOT_BUILDER_CHANNEL, LONGSHOT_BUILDER_PIPES,
LONGSHOT_PADS_FD, LONGSHOT_NUP_HANDLE, LONGSHOT_SANDBOX_BY_BUILDER, LONGSHOT_SANDBOX_NEEDS, LONGSHOT_SANDBOX_NOTE,
LONGSHOT_SANDBOX_PRIVATE, LONGSHOT_SANDBOX_USER.

Set by the builder or the game for themselves (unset in any other run): LONGSHOT_CONTROL_BY_BUILDER,
LONGSHOT_CRASH_BY_BUILDER, LONGSHOT_CRASH_DUMP, LONGSHOT_LOG_PATH, LONGSHOT_BUILD_STAMP (the builder's stamp the
game says in its hello), HOS_START_SLOT (the profile's start_slot).

Diagnostics and tests, off by default (no cost when unset): HOS_CONTROL_PEER_SID (unset: the control pipe is this
user's alone), HOS_CRASH_MINIDUMP (off), HOS_EVENT_STATS (off), LONGSHOT_WAIT_FOR_DEBUGGER (off),
RX_VK_NOOPT (off: the driver's optimizer on), RX_VK_SKIP_CODE (unset: nothing left out), the tests' own
LONGSHOT_COST_REPORT, LONGSHOT_TEST_GAME, LONGSHOT_TEST_SETTINGS_WRITE_ALONE; HOS_AB, HOS_CHAIN, HOS_CONTROL, HOS_CONTROL_EVAL,
HOS_ENV_FILE, HOS_GAME_TRACE_SAVES, HOS_INPUT_SCRIPT, HOS_INPUT_SYNC (1, with HOS_INPUT_PLAY only),
HOS_MOD_TESTS, HOS_MOD_TESTS_OUT, HOS_MOD_TESTS_SAVE, HOS_MOD_TESTS_TIMEOUT (3600 s), HOS_PRESENT_TRACE,
HOS_PROFILE_DIR, HOS_SAMPLE_FILE, HOS_SYSTEM_MODS_DIR, HOS_WINDOW_NOACTIVATE, LONGSHOT_DEV_MODS,
RX_VK_DUMP, RX_VK_FRAMELOG, RX_VK_FRAME_LOG, RX_VK_HANG_DUMP, RX_VK_LOG_TEX_HASH, RX_VK_MENU_SCRIPT,
RX_VK_SHOTS; the game-free tests' LONGSHOT_FAKE_ASPECT.

Development tools only, not read by the game: LONGSHOT_CACHE (unset: the installed launcher's builder cache),
LONGSHOT_RUST_STORE_MB (unset: 30 GB kept of the game's Rust in the object store), LONGSHOT_CARGO_TARGET_ROOT, LONGSHOT_SCCACHE (on when sccache is
installed), LONGSHOT_SHADER_STORE_DEV (on), LONGSHOT_HEADS, LONGSHOT_QUEUE_*, LONGSHOT_GAMESCOPE (shared jobs
only), LONGSHOT_GAMESCOPE_SIZE (1920x1080), LONGSHOT_GAMESCOPE_TIMEOUT (60 s), LONGSHOT_FFMPEG,
LONGSHOT_GLSLANG, LONGSHOT_REQUIRE_SHADERS, LONGSHOT_NO_CLANG, RX_GAME_MODULE (build flags).

Not switches (constants and enums the check matched by name): HOS_BIND_*, HOS_KEY_SPRINT, HOS_PAD_*, HOS_SW_N,
HOS_PROMPT_*, HOS_REBIND_*, HOS_RENDER_*, HOS_NET_*, HOS_LOG_*, HOS_OPT_* (old option numbers, kept so
input recordings replay), HOS_T_* (the env-line parser's kinds), HOS_PATH_CAP, LONGSHOT_SANDBOX_ANYTHING (a test's
name under the sandbox's own prefix), HOS_HUD_DEFAULT_PLACEMENT, HOS_WIDE_MENUS_EXTENDED, HOS_HEAP_BASE, HOS_SYSTEM_BASE,
HOS_CONTROL_GAME_CLIENTS/_FLAGS/_JSON, LONGSHOT_PROFILE_SETTINGS. Named only as removed:
HOS_GAME_CHEATS, HOS_GAME_PROTECT_HEARTS, HOS_GAME_BOOT_SAVE/HOS_BOOT_SAVE (now LONGSHOT_SET or the Skip
title mod), HOS_GAME_TELEPORT_EVENT, HOS_GAME_TELEPORT_STARTER.

Risks

  • Large: one commit of about 2,500 files. A slip in a ported fix or hook could show in one area only; the parity gates catch
    that. The fallback is a revert of this one commit; there is no switch back to the C game side.
  • The sandbox can refuse something a player's setup needs. HOS_SANDBOX=0 in the real environment turns it off
    (longshot_env.txt cannot).
  • Review findings: the three full reviews' findings are fixed on this head (the folder open by real path, the
    network's per-mod limits from the builder's copy, one settings writer, the log tails out of the game's reach).
  • Undo is not a rollback. A stopped mod puts back only its changes the game has not saved, and only where the game
    still has the mod's value; saves are never rewritten. Release notes say it that way.
  • Not in this PR: the Rust renderer's interface (its branch is on 51, this on 80) is checked on its own integration
    branch; VR (OpenXR) under the sandbox is a written limit: a runtime that starts its own service from the game cannot.
  • After updating: cheats off once, Discord status on the Mods tab. longshot_options.ini, saves, file mods and
    caches read the same. A renderer built for an older MKWVK_API_VERSION refuses to load, as it should.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (main's newest is merged in.)
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (Linux; Windows cross-linked
    only.)
  • mise run test passes (any failure that also fails on main is named). (15 failures, each failing on main with the
    same error.)
  • 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.
    (The site tables hold masked signatures and addresses only.)

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
    (HOS_SANDBOX ships on for safety, its cost in the table.)
  • A check under tests/ that reads changed source is updated, not weakened.
  • MKWVK_API_VERSION bumped (MkwVkHost or MkwVkRenderer in gpu/vk/vk_api.h changed). (To 80.)
  • The SPIR-V headers regenerated (a shader changed). (No longer checked in: the build compiles the shaders, and mise run test reads what it compiled.)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (The llvm-mingw checks of mise run test on 75b9274d.)
  • Screenshots of the same spot on main and here, for a change that shows on screen. (Compared on this PC, not posted: the hyrule-field scene's spot after its teleport, 1080p native, main 2a146054 and 75b9274d: the same picture, only the fireflies and Navi moved.)
  • Docs updated. (game/DESIGN.md, docs/dev/reference/ (sandbox, builder, broker-net, mods), the modding docs,
    docs/dev/developing.md.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

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

🤖 Generated with Claude Code

## Summary **Why.** On `main` the game side (everything between the C host and the lifted game) is C (`game/*.c`), with each setting and feature wired into it and into the C++ Insert menu, and the only mods are file mods (`romfs`, `exefs`, cheats) loaded by `game/mods.c`. There is no way for a mod to run code, and the game runs with the player's full rights. This moves the game side to Rust, adds a mod API that script mods run on, rebuilds every setting and feature as a system mod on that same API, and makes the builder start every game confined. This is [#2434](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2434) squashed into one commit (the same tree as its last head, 696eed7f). Its reviews, comments and earlier test runs are there; the full history is on [HumanBean:wip/mod-api-history](https://git.magicbean.dev/HumanBean/Longshot/src/branch/wip/mod-api-history), which holds the commits named below (75b9274d, fdab42dd). **What changed** - **The game side in Rust** (`game/crates`: `game-core`, `game-sites`, `api`, `script`, `ui`, `content`, `longshot-game` and their helpers), linked into the game as one static library. The hook sites stay tables (`game/sites`) the lifter reads. Design: `game/DESIGN.md`. - **The mod API.** Script mods in TypeScript or JavaScript, run by QuickJS in the game, which compiles a mod's TypeScript itself as it loads it (no Node, no build step). `mod.toml` is the manifest. A mod asks for permissions the player grants; it gets events, settings, storage, UI (HUD, windows, world labels), input, the network (when confirmed) and the game's state through the `longshot` modules. Turning a mod off puts back what it changed that the game has not saved yet. Mods can also add content, and hook sites of their own that the next game build places. File mods load as before. Docs: `docs/modding/`, with 41 example mods and their tests. - **System mods.** Every game setting and feature is a system mod in `game/mods`, on the same API as players' mods: Rust (cheats, shadows, widescreen, sprint and walk, HDR, grass, prompts...), TypeScript (the Insert menu itself, the Mods tab, the mod inspector, Discord status, the FPS counter, CRT, colour vision, text, area names, Skip title...), and six settings-only `mod.toml`s. The TypeScript ones are compiled into the program. Every `longshot_options.ini` key keeps its name (`tests/test_menu_ini_keys.py`'s FROZEN list). - **The builder is the game's only entrypoint, sandboxer and broker.** Only `longshot-builder` starts the game process; tools start it through `longshot-builder game`. On Linux the builder applies Landlock and `no_new_privs` and the game a seccomp filter; on Windows the game runs in an AppContainer with no capability (its plan made in Rust, `build_core::sandbox_windows`). The game starts no process. Everything it may not do itself goes to the builder over one framed channel (`host/builder_channel.h`; the game's side is Rust, `builder_link`): the mods' network and IPC, settings writes, saves, crash reports, controllers, restarts, message boxes, and the links and folders it opens. A mod's network is confirmed in the builder's own window and kept in the profile's `trust.json`, which the game can read and never write. The environment the builder passes is one list (`build_core::env_own`). - **The game thread's frame.** In a steady frame the mod runtime does almost nothing: an event no mod listens to builds nothing, the settings host, the mods list and the UI step only on a change, and the script watchdog sleeps until the next deadline. - **Dev builds.** The game's Rust is kept in the object store by its inputs' key and built once per PC, beside the C compile. **What players see change** - Script mods can be installed and run (a preview: API 0.x), each asking for its permissions in the Mods tab. - The game runs confined. `HOS_SANDBOX=0` in the real environment turns that off; `longshot_env.txt` cannot. - The Insert menu has the same tabs and rows, now drawn by the menu system mod; the Mods tab holds every mod, system mods included, and Discord status moved there from Gameplay. - Cheats' switches start off once after updating: they now live in the cheats mod's settings. Needs a line in the release notes. - Start to play is about 5 s shorter: Skip title loads the newest save straight away. - The settings guide has no Graphics tab picture until the new menu has a game-free capture. **Read first:** `game/DESIGN.md`, `game/game.h`, `docs/modding/README.md`, `docs/dev/reference/builder.md`, `docs/dev/reference/sandbox.md`, `gpu/vk/vk_api.h` (`MKWVK_API_VERSION` 80). ## Testing **Tested:** Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06), on 75b9274d (the head adds docs, test fixes, `main`'s newest (a docs change) and [#2751](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2751) (the dev queue), none of it in the game), the sandbox on (Landlock ABI 9, seccomp, network closed), through the job queue: - Boot to play: all 29 system mods running with no faults, audio open, settings saved, no `[error]` line. - The control bridge through the builder: status, shot, menu keys, mods, mod logs and quit answer. - Network: a mod asking `net:https://example.org` gets the builder's question and is refused until confirmed; a development mod's fetch returns 200. - Controllers through the builder (no pad plugged in): no errors. - A forced crash (`HOS_CRASH_TEST`): a complete crash record in the game folder's `diagnostics/bug-reports`. - Cloth (`HOS_NATIVE_CLOTH=check`): 0 mismatches over every kernel. - The Insert menu and every tab, and the Mods tab: no errors. - A mod's lifecycle: a permission the player denies is refused and the mod runs on; one taken back is refused from then on (`permissions.changed` fires); a hot reload that does not compile keeps the old instance running and says why; a good one runs the new code with the grants kept; switching it off fires `stopping`, ends its timers and its settings listener. - Hooks: a profile mod observing `items.pouchAdd` built into the game (`longshot-builder build`, one site placed) and called at a pouch add; switched off it is "off at the next start" (as the docs say), and after a restart its site is called by nothing. The checks: `mise run test` on 75b9274d, then the failing ones again on the head: 15 fail, each also failing on `main` (2a146054) with the same error (compared message by message: the program-cache fixtures' `spirv_pack::Store`, the guest holes' `UploadLayoutGuard`, the video and input fixtures, `test_windows_on_linux`, `test_xinput_thread`); the Rust workspace's fmt, clippy `-D warnings` and `cargo test --release` pass. The Windows game folder cross-links with llvm-mingw; it has not run on Windows. **Still to test:** - Linux and Windows: the parity gates (`scripts/parity_gates.py`) and feature checks, expecting `main`'s results apart from "Fixed on the way" (@Beanstalk, or by hand) - Windows on the Test Farm: start with the sandbox on, expecting play inside the AppContainer, the broker running, saves committing, shots written, mods' IPC through the broker (@Beanstalk) - The menu fault on Windows reported in the comments (settings host calls), expecting none after a fix (@Beanstalk) - Windows through the Launcher's Play, the default AppContainer: switch the Insert and Mods pages repeatedly (with a restart), save and load a chosen slot, a second profile kept apart; expecting no menu faults ([the earlier report](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2434#issuecomment-85829)) (@Beanstalk or a tester) - A stopped mod's HUD and world label gone from the screen, in a windowed run (the headless shots draw the Insert menu alone, not mods' UI), and a crash reported by `longshot-builder play` at the next start (by hand) - Steam Deck and AMD (the lab PC): boot to play from `kokiri-start` with the sandbox on, expecting no sandbox refusals in the log (@Beanstalk) ## Measurements **Verdict:** fps, 1 % lows and frame-time tails level with `main` or better; start to play about 5 s shorter. The game thread does about 0.1–0.2 ms more CPU a frame (the mod runtime's own frame; accepted, closing it is a follow-up), and the process keeps about 90 MB more private memory. Setup: Linux 7.3, RTX 3090, NVIDIA 620.70.06; Hyrule Field (child), 1080p native, Upscaler Off, fixed resolution, uncapped, no player mods; `dev.py ab`, `main` (2a146054) against this PR (75b9274d), interleaved, the median of each run (the first 600 frames left out). The PC had other work on it: compare the sides, not the fps against other PRs. | Menu closed, 3 × 90 s | Before: main @ 2a146054 | After: this PR @ 75b9274d | |---|---|---| | fps (median run) | 121.7 | 121.6 | | 1 % low (median run) | 96.3 | 106.7 | | frame time median / p99 (ms) | 8.21 / 10.38 | 8.22 / 9.37 | | game thread CPU (`main_cpu_ms`) | 1.85–1.88 | 1.93–1.95 | | VRAM / process private (MB) | 7155–7475 / 2448–2459 | 7155–7379 / 2485–2562 | | launch to play (s) | 11.2–11.3 | 5.1–7.3 | On a quieter PC earlier the same day (3 × 90 s): `main_cpu_ms` 1.64–1.66 against 1.80–1.85, fps level (136.9–138.4 against 138.3–139.3). - **Insert menu open** (2 × 60 s, the clean pair): fps level (123.4 against 123.1); the game thread +0.3 ms, the menu being a script mod here. - **An active example mod** (`link-hud`, its HUD read every frame; 2 × 60 s against the PR without it): no fps or frame-time loss; the game thread +0.07 ms. - **Full build time:** not measured on this head. - **On current `main`** (1413b172): the PR side (75b9274d) already holds `main` to 01d6878b; `main`'s commits since 2a146054 are Debug-tab rows, Pause in background (off unless the window is behind), the program cache's store and the dev tools, none in a steady frame's work, so the comparison holds. The head's commits since 75b9274d change docs, tests and the dev queue only. **Switches this adds or changes, the default each ships at and why** (rows in `gpu/vk/switches.def`): Kill switches, on by default (each is the new behaviour; `=0` is the old one, for an A/B or a fallback): - `HOS_SANDBOX`: on; every run confines itself, a run the system cannot confine goes on unconfined with a player's script mods held. On for safety, not from measurements; its cost is in the table above. - `HOS_GAME_BARRIER_WAIT`: on; three parallel-for job barriers wait on their mask word instead of sleeping 20 us and polling. `=0` against unset, 2 × 60 s: 137.3 against 138.1 fps, within the spread; it ships on because it ends the polling (less CPU awake), with no cost measured. - `HOS_GAME_FIRST_NIGHT_FIX`: on; clears the first adult night's stuck time lock so the clock runs (a fix). - `HOS_MODS_WATCH`: on; mods/ and profile.json watched by the system's change notices, so folder script mods hot-reload. - `HOS_SHADOW_RES`: Highest is the game's 3072 at 16:9 and grows only past 16:9 (4512 at 21:9, 5120 at 32:9), as on `main` at 16:9. - `HOS_SHADOW_SPLITS`: cascade 0 ends at 15 m at 16:9 (12 m at 32:9), cascade 1 at 45 m. `=0` (the game's splits) against unset, 2 × 60 s: 126.1 against 131.5 fps, every `=0` run below every default run; the default costs nothing and keeps near shadows sharp. - `HOS_SYSTEM_MODS_OFF`: unset, every system mod by its own rules; for A/Bs and parity runs. - `RX_VK_DRS`: on, host dynamic resolution drives Render resolution Auto (unchanged default, the row reworded). - `RX_VK_FG_AUTO_GUARD`: on, frame generation's Auto steps down when overloaded (unchanged default, the row reworded). - `RX_VK_FX`, `RX_VK_WORLD`, `RX_VK_TEX_PACKS`: on, script mods' screen effects, world shapes and texture packs are drawn; `=0` for an A/B only. Tuning: - `RX_VK_FX_BUDGET_US`: 2000; a script mod's screen effect over 2 ms of GPU time a frame is stopped for the session. - `HOS_WIDE_MAX_PX`: 5120 x 2160 pixels, a native size already of the picture's shape keeps its own. Player and builder overrides, unset by default (unset is the normal run; the builder or launcher sets them): `HOS_AUDIO_DEVICE`, `HOS_LANGUAGE`, `HOS_MOUSE_NATIVE`, `HOS_RES_SCALE`, `HOS_NO_MODS` (the menu or saved choice applies); `LONGSHOT_SAFE_START`, `LONGSHOT_SET`, `LONGSHOT_MOD_STORE`, `LONGSHOT_SHADER_CACHE`, `LONGSHOT_GAME_MODULE` (set by `longshot-builder play`); `LONGSHOT_SHADER_STORE`, `LONGSHOT_NFC_DIR`, `RX_VK_DLSS_DIR` (the user's own folders); `LONGSHOT_PREPARE_ONLY` (off, a normal run). Set by the builder for the game it starts, never by a run: `LONGSHOT_BUILDER_CHANNEL`, `LONGSHOT_BUILDER_PIPES`, `LONGSHOT_PADS_FD`, `LONGSHOT_NUP_HANDLE`, `LONGSHOT_SANDBOX_BY_BUILDER`, `LONGSHOT_SANDBOX_NEEDS`, `LONGSHOT_SANDBOX_NOTE`, `LONGSHOT_SANDBOX_PRIVATE`, `LONGSHOT_SANDBOX_USER`. Set by the builder or the game for themselves (unset in any other run): `LONGSHOT_CONTROL_BY_BUILDER`, `LONGSHOT_CRASH_BY_BUILDER`, `LONGSHOT_CRASH_DUMP`, `LONGSHOT_LOG_PATH`, `LONGSHOT_BUILD_STAMP` (the builder's stamp the game says in its `hello`), `HOS_START_SLOT` (the profile's `start_slot`). Diagnostics and tests, off by default (no cost when unset): `HOS_CONTROL_PEER_SID` (unset: the control pipe is this user's alone), `HOS_CRASH_MINIDUMP` (off), `HOS_EVENT_STATS` (off), `LONGSHOT_WAIT_FOR_DEBUGGER` (off), `RX_VK_NOOPT` (off: the driver's optimizer on), `RX_VK_SKIP_CODE` (unset: nothing left out), the tests' own `LONGSHOT_COST_REPORT`, `LONGSHOT_TEST_GAME`, `LONGSHOT_TEST_SETTINGS_WRITE_ALONE`; `HOS_AB`, `HOS_CHAIN`, `HOS_CONTROL`, `HOS_CONTROL_EVAL`, `HOS_ENV_FILE`, `HOS_GAME_TRACE_SAVES`, `HOS_INPUT_SCRIPT`, `HOS_INPUT_SYNC` (1, with `HOS_INPUT_PLAY` only), `HOS_MOD_TESTS`, `HOS_MOD_TESTS_OUT`, `HOS_MOD_TESTS_SAVE`, `HOS_MOD_TESTS_TIMEOUT` (3600 s), `HOS_PRESENT_TRACE`, `HOS_PROFILE_DIR`, `HOS_SAMPLE_FILE`, `HOS_SYSTEM_MODS_DIR`, `HOS_WINDOW_NOACTIVATE`, `LONGSHOT_DEV_MODS`, `RX_VK_DUMP`, `RX_VK_FRAMELOG`, `RX_VK_FRAME_LOG`, `RX_VK_HANG_DUMP`, `RX_VK_LOG_TEX_HASH`, `RX_VK_MENU_SCRIPT`, `RX_VK_SHOTS`; the game-free tests' `LONGSHOT_FAKE_ASPECT`. Development tools only, not read by the game: `LONGSHOT_CACHE` (unset: the installed launcher's builder cache), `LONGSHOT_RUST_STORE_MB` (unset: 30 GB kept of the game's Rust in the object store), `LONGSHOT_CARGO_TARGET_ROOT`, `LONGSHOT_SCCACHE` (on when sccache is installed), `LONGSHOT_SHADER_STORE_DEV` (on), `LONGSHOT_HEADS`, `LONGSHOT_QUEUE_*`, `LONGSHOT_GAMESCOPE` (shared jobs only), `LONGSHOT_GAMESCOPE_SIZE` (1920x1080), `LONGSHOT_GAMESCOPE_TIMEOUT` (60 s), `LONGSHOT_FFMPEG`, `LONGSHOT_GLSLANG`, `LONGSHOT_REQUIRE_SHADERS`, `LONGSHOT_NO_CLANG`, `RX_GAME_MODULE` (build flags). Not switches (constants and enums the check matched by name): `HOS_BIND_*`, `HOS_KEY_SPRINT`, `HOS_PAD_*`, `HOS_SW_N`, `HOS_PROMPT_*`, `HOS_REBIND_*`, `HOS_RENDER_*`, `HOS_NET_*`, `HOS_LOG_*`, `HOS_OPT_*` (old option numbers, kept so input recordings replay), `HOS_T_*` (the env-line parser's kinds), `HOS_PATH_CAP`, `LONGSHOT_SANDBOX_ANYTHING` (a test's name under the sandbox's own prefix), `HOS_HUD_DEFAULT_PLACEMENT`, `HOS_WIDE_MENUS_EXTENDED`, `HOS_HEAP_BASE`, `HOS_SYSTEM_BASE`, `HOS_CONTROL_GAME_CLIENTS`/`_FLAGS`/`_JSON`, `LONGSHOT_PROFILE_SETTINGS`. Named only as removed: `HOS_GAME_CHEATS`, `HOS_GAME_PROTECT_HEARTS`, `HOS_GAME_BOOT_SAVE`/`HOS_BOOT_SAVE` (now `LONGSHOT_SET` or the Skip title mod), `HOS_GAME_TELEPORT_EVENT`, `HOS_GAME_TELEPORT_STARTER`. ## Risks - **Large:** one commit of about 2,500 files. A slip in a ported fix or hook could show in one area only; the parity gates catch that. The fallback is a revert of this one commit; there is no switch back to the C game side. - **The sandbox can refuse something a player's setup needs.** `HOS_SANDBOX=0` in the real environment turns it off (`longshot_env.txt` cannot). - **Review findings:** the three full reviews' findings are fixed on this head (the folder open by real path, the network's per-mod limits from the builder's copy, one settings writer, the log tails out of the game's reach). - **Undo is not a rollback.** A stopped mod puts back only its changes the game has not saved, and only where the game still has the mod's value; saves are never rewritten. Release notes say it that way. - **Not in this PR:** the Rust renderer's interface (its branch is on 51, this on 80) is checked on its own integration branch; VR (OpenXR) under the sandbox is a written limit: a runtime that starts its own service from the game cannot. - **After updating:** cheats off once, Discord status on the Mods tab. `longshot_options.ini`, saves, file mods and caches read the same. A renderer built for an older `MKWVK_API_VERSION` refuses to load, as it should. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. *(`main`'s newest is merged in.)* - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. *(Linux; Windows cross-linked only.)* - [x] `mise run test` passes (any failure that also fails on `main` is named). *(15 failures, each failing on `main` with the same error.)* - [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. *(The site tables hold masked signatures and addresses only.)* ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. *(`HOS_SANDBOX` ships on for safety, its cost in the table.)* - [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). *(To 80.)* - [x] The SPIR-V headers regenerated (a shader changed). *(No longer checked in: the build compiles the shaders, and `mise run test` reads what it compiled.)* - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. *(The llvm-mingw checks of `mise run test` on 75b9274d.)* - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. *(Compared on this PC, not posted: the `hyrule-field` scene's spot after its teleport, 1080p native, `main` 2a146054 and 75b9274d: the same picture, only the fireflies and Navi moved.)* - [x] Docs updated. *(`game/DESIGN.md`, `docs/dev/reference/` (sandbox, builder, broker-net, mods), the modding docs, `docs/dev/developing.md`.)* - [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)
feat(game)!: the game side and the whole mod API in Rust, with system mods and the sandbox on by default
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 28s
PR description / Title and description (pull_request_target) Successful in 47s
CI / What the change needs (pull_request) Successful in 2m21s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m48s
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
9e6b9c5782
The game side (between the C host and the lifted game) and the mod API move from C to Rust (game/crates), every game
setting and feature becomes a system mod (game/mods, Rust or TypeScript), and 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. Native C mods and wasm are removed. The Insert menu is the menu system mod. One squashed commit of the former
mod-api branch (#2434).

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]>
Author
Owner

Description from #2434 (squashed here into one commit, 9e6b9c57, the same tree as #2434's last head).

Description from #2434 (squashed here into one commit, 9e6b9c57, the same tree as #2434's last head).
Member

Possibly related, for context:

  • PR #2747 WIP: fix(sandbox): the test mode's start reads its folder in the container after the broker's file layer is in — Open Windows sandbox fix for in-game mod test startup.
  • PR #2726 WIP: fix(sandbox): Windows: a sandboxed start with a profile reaches play, its saves and the test mode's results written — Open Windows sandbox/profile-start and broker file fixes.
  • issue #2644 mod API (architecture): restart-time settings applied before the mods start, for boot-time engine callbacks — Open system-mod API proposal for boot-time settings.
Possibly related, for context: - PR #2747 WIP: fix(sandbox): the test mode's start reads its folder in the container after the broker's file layer is in — Open Windows sandbox fix for in-game mod test startup. - PR #2726 WIP: fix(sandbox): Windows: a sandboxed start with a profile reaches play, its saves and the test mode's results written — Open Windows sandbox/profile-start and broker file fixes. - issue #2644 mod API (architecture): restart-time settings applied before the mods start, for boot-time engine callbacks — Open system-mod API proposal for boot-time settings.
HumanBean force-pushed mod-api from 9e6b9c5782
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 28s
PR description / Title and description (pull_request_target) Successful in 47s
CI / What the change needs (pull_request) Successful in 2m21s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m48s
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
to eaf4a48b9e
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 39s
PR description / Title and description (pull_request_target) Successful in 53s
CI / What the change needs (pull_request) Successful in 2m17s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m41s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 18m57s
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
2026-11-29 20:55:54 +00:00
Compare
Author
Owner

Description rewritten: what main has (a C game side, file mods only, no sandbox) and what this adds; nothing about native or wasm mods, which never existed. The commit's message says the same (now eaf4a48b, the same tree).

Description rewritten: what main has (a C game side, file mods only, no sandbox) and what this adds; nothing about native or wasm mods, which never existed. The commit's message says the same (now eaf4a48b, the same tree).
Author
Owner

Tested in the game on this PC (Linux 7.3 CachyOS, RTX 3090, NVIDIA 620.70.06), on #2434's heads 75b9274d and fdab42dd (this PR's commit has the tree of #2434's last head, 696eed7f; the commits after fdab42dd changed lint, tests and docs only), the sandbox on: boot to play with all 29 system mods, the control bridge through the builder, network confirmation and a development mod's fetch, controllers through the builder, a forced crash's record, cloth parity (0 mismatches), the Insert menu's tabs and the Mods tab, a mod's lifecycle (denied and revoked permissions, a reload that does not compile, a good reload, a stop), and a mod's hook built into the game, called, and no longer called after its switch-off and a restart. Measurements against main are in the description.

Tested in the game on this PC (Linux 7.3 CachyOS, RTX 3090, NVIDIA 620.70.06), on #2434's heads 75b9274d and fdab42dd (this PR's commit has the tree of #2434's last head, 696eed7f; the commits after fdab42dd changed lint, tests and docs only), the sandbox on: boot to play with all 29 system mods, the control bridge through the builder, network confirmation and a development mod's fetch, controllers through the builder, a forced crash's record, cloth parity (0 mismatches), the Insert menu's tabs and the Mods tab, a mod's lifecycle (denied and revoked permissions, a reload that does not compile, a good reload, a stop), and a mod's hook built into the game, called, and no longer called after its switch-off and a restart. Measurements against main are in the description.
merge: main's newest into the mod API, its menu and settings changes ported to the system mods (#2822)
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 34s
PR description / Title and description (pull_request_target) Successful in 47s
CI / What the change needs (pull_request) Successful in 2m4s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m31s
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
4cc50ca122
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(vk): headless shots draw the mods' UI as a window does (#2837)
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 35s
PR description / Title and description (pull_request_target) Successful in 56s
CI / What the change needs (pull_request) Successful in 2m49s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m30s
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
816d235493
## 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
HumanBean force-pushed mod-api from 816d235493
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 35s
PR description / Title and description (pull_request_target) Successful in 56s
CI / What the change needs (pull_request) Successful in 2m49s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m30s
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
to cdbb85513d
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 22s
PR description / Title and description (pull_request_target) Successful in 38s
CI / What the change needs (pull_request) Successful in 1m34s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m28s
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
2026-11-30 00:28:41 +00:00
Compare
HumanBean force-pushed mod-api from cdbb85513d
Some checks failed
CI / Third-party parts and guide screenshots (pull_request) Successful in 22s
PR description / Title and description (pull_request_target) Successful in 38s
CI / What the change needs (pull_request) Successful in 1m34s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 1m28s
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
to c5e5b676cb
Some checks are pending
CI / Third-party parts and guide screenshots (pull_request) Successful in 1m2s
PR description / Title and description (pull_request_target) Successful in 1m12s
CI / What the change needs (pull_request) Successful in 3m44s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m54s
2026-11-30 00:38:44 +00:00
Compare
Some checks are pending
CI / Third-party parts and guide screenshots (pull_request) Successful in 1m2s
PR description / Title and description (pull_request_target) Successful in 1m12s
CI / What the change needs (pull_request) Successful in 3m44s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m54s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'mod-api:mod-api'
git switch 'mod-api'
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!2822
No description provided.