WIP: feat(builder)!: the builder in Rust (longshot-builder) replaces the old one: lift, compile, game files, assets; the game reads its RomFS from the .nup; supersedes #2272 #2286

Draft
HumanBean wants to merge 414 commits from HumanBean/Longshot:lifter-m0-decoder into main
Owner

Summary

The whole builder in Rust, replacing the old one: longshot-builder, one command that turns the player's own .nup
into a game folder (read the game files, lift, compile, assets, shaders). The old builder (nx2/make_game.py,
nx2/build.py, the Python lift, third_party/a64-kit) is deleted, and so are the standalone builders (the AppImage,
the Windows LongshotBuilder app and its setup): a release ships one self-contained longshot-builder per platform
(the builder, the sources it compiles, the assets, the prebuilt objects and the build tools packed inside), with small
deltas between releases and a manifest listed in the signed SHA256SUMS. dev.py, the release and CI run it. No
player's build needs Python. It started as the lifter rewrite (a native lifter with a typed SSA mid IR, writing LLVM
IR for the pinned clang); it is now every stage.

The names. The workspace is builder/ (it was rust/), and the command is longshot-builder (it was
longshot-build; the developers' longshot-lift is folded in as longshot-builder dev discover|sites|lift|profile|words|decode). Its release files are longshot-builder-<v>-<platform>, its per-user cache
~/.cache/longshot-builder or %LOCALAPPDATA%\Longshot\Builder, its data folder (the licences a player accepted)
~/.local/share/longshot-builder or %LOCALAPPDATA%\Longshot\Builder-data, its game folder record
longshot_builder.json. The LONGSHOT_* variables keep their names.

It supersedes #2272, which is closed: #2272's last
version (the player features on hook sites, Skip title screen on the game's own load) is folded in whole, its Python
machinery ported to the Rust sites and edits crates: anchors' of, HOS_SITE_OUTCOME, the site chain kept per
guest context, Skip title screen stopping its presses once the game loads. This pull request merges alone.

Players build with it once this merges: LongshotLauncher
#259 installs longshot-builder from a release
(by a delta from the one it has, or the full file) and runs check and build --json; it passes its settings as this
pull request's flags (--cache, --builder-exe), so the two ship together. RecompLauncher installs the release's
longshot-builder-<v>-<platform>-recomplauncher.zip and starts Longshot.exe / Longshot.x86_64. The Test Farm
builds with it after Beanstalk #143, which waits on this
one: main has no builder/ until it merges.

A clean break in what the builder looks like from outside: no make_game.py options, no @@ lines. With --json
it writes versioned JSON Lines events (stage, progress, the compile's plan and units, the time left, warnings, errors
with stable codes, done), documented in docs/dev/reference/build-events.md, with a test that keeps that list of
codes and the code in step; caches are keyed by content anew.

What is here (builder/, a README per crate; one Cargo workspace at the repository's root):

  • The lifter (a64, cfg, image, mir, sem, llvm, lift, passes, profile): the decoder (checked
    against llvm-mc), discovery (the same 294,518 functions as the old lifter), the mid IR with every integer, memory,
    atomic, system, float and SIMD form the game uses, the LLVM IR writer, the passes (shared page marks, dead state,
    giant functions split), the guest profile (branch weights, hot and never-run functions, keyed by guest code,
    committed in assets/profiles/guest.profile.xz), and a runtime of its own (builder/rt). An instruction the
    semantics do not cover is a trap where it is, never a failed build.
  • Every hook site, text patch and entry hook as an edit of the mid IR (sites, edits): no C text, nothing left to
    the old lifter. Each function's edits have a stable key, so one site's change lifts one unit again. The site tests
    run each hook as the lift lowers it (longshot-builder dev site-hooks), and tests/sitetable.py, the old C emitter's
    copy, is retired.
  • The whole lift (lift::whole): discovery, sites, the units cut by compile cost, the function table, the image
    constants and import stubs, a per-unit cache; byte for byte the same on a second lift. The units' texts are not kept:
    the compile makes each when it needs it and gives it to clang on stdin (gen/ is 26 MB, not 5.7 GB).
  • The compile (build-compile): object keys by content only (the compiler's identity, the flags, the source, the
    headers its depfile names), an object store outside the game folder, a scheduler under the memory gate, the links
    skipped when nothing they read changed, the prebuilt third-party objects. Never-run functions at -O0, hot ones at
    -O2; the game's link orders its functions with lld's hfsort.
  • The game files and the image (game-files, image): the .nup read, checked and indexed, the modules unpacked
    (LZ4, ZBIC), the mods' ExeFS patches, the image.
  • The game reads its RomFS from the player's .nup (host/romfs.{c,h}, host/romfs_index.c): the game folder
    holds a 16 MB index, not a 26 GB copy; zstd-stored files are decoded when opened and the closed copies kept (256 MB
    at most). One RomFS API in the host, with a romfs folder as its second back end, and every host and renderer reader
    moved to it. longshot-builder index --game <new.nup> --out <folder> points a built folder at its .nup moved.
  • The assets (build-assets): the button prompts (font, textures with an ASTC encoder of our own), the texts, the
    shader list, the pipeline lists, the icon; made beside the lift and the compile, each cached by its inputs.
  • The driver (build-driver, longshot-builder): build, update, check, index, share, stamps,
    perf-report, prepare, sources, and one command per stage; a launcher's settings as flags (--cache,
    --ngx-sdk, --builder-exe; the variables still read for one release); the upscalers' runtimes (DLSS, FSR 4, XeSS)
    fetched by the builder with their licences accepted on the command line; the finish swaps every file in at once, or
    none.
  • The shaders: a first build prepares them beside the compile, under the build's memory gate, its progress said
    as it goes at the shader step; the built game's --prepare-shaders runs again only when the renderer, the shader
    list, the shipped pipeline states, the level or the drivers changed (cache/longshot_prepared_key.txt; the drivers
    read with no Vulkan call). A game folder's program cache begins from the one the last preparation left.
  • The compile's giant functions: two caps on LLVM's time and a mid IR split of functions too big for the compiler, so no one unit holds up the compile (the stage times are in
    Measurements).
  • RecompLauncher's one program (src/play.rs, recomplauncher.json): the zip holds longshot-builder once, as
    Longshot.exe (a windowed program: no console) or Longshot.x86_64. Started by that name with no command (or as
    longshot-builder play), it updates Longshot/ beside it quietly and starts the game with every argument; a failed
    update starts the game the folder had. RecompLauncher's setup step builds with --progress-lines, its own line
    protocol.
  • The release (longshot-builder dev release, build-linux.yml, build-windows.yml, release.yml): one file per
    platform, its pack unpacked into the builder's cache on first use; zstd --patch-from deltas from the
    channel's last 5 releases, a manifest, and the RecompLauncher zip, made in the build
    jobs. scripts/longshot_builder.py keeps only what runs before there is a builder (building it, llvm-mingw, the
    built program's check).
  • The build tools: longshot-builder dev tools is tools.lock's one implementation (check, install, make,
    publish); scripts/tools.py is gone, and mise run tools installs this system's into the checkout.
  • dev.py and CI: bases, packs and runtimes on the new builder's stores (dev.py packs asks the builder for its
    keys); dev builds keep their cache, data and work folders in the development folder and go through the job queue,
    except the Test Farm's; dev.py bases --prune lists and removes old dev data. CI checks the workspace and builds the
    synthetic game end to end (builder/crates/synthetic-game: a small AArch64 program of its own through every stage,
    run, then one instruction changed and only its unit compiled again).
  • The root Cargo workspace (from #2411's work): the
    builder's crates and longshot-rs, the game's one Rust staticlib (empty for now), share one Cargo.toml and one
    Cargo.lock at the root; Cargo's target folder is the root's target/.
  • Docs: docs/dev/reference/builder.md (with diagrams of the stages, the lift and the cache keys), build.md
    (every variable the builder reads, by kind), build-events.md, releases.md, architecture.md, hooks.md,
    using-mods.md, and every page that named the old builder.

Tried and taken out:

  • Register calls (guest registers passed between lifted functions in machine registers, then only what each
    callee's summary reads or writes): slower or the same in every scene (Kokiri Forest -8.4 %, Hyrule Field about -4 %,
    the Market the same, the 1 % lows worse) and 20 % more compile time, measured during development on an earlier
    head. All of it is gone; builder.md's "Still to come"
    keeps the numbers.
  • image.bin mapped copy-on-write (HOS_IMAGE_MAP): file-backed pages in the guest window kept a GPU pool over the
    image from being imported as a dma-buf or a userptr on AMD, for a start-up saving too small to keep it. The image is read
    into the window again, and HOS_IMAGE_MAP is a GONE row.
  • The renderer's stage libraries and a split shader preparation: measured on this PC and the lab, no gain kept;
    the code and its notes are not in this pull request.

The first two review rounds' fixes, in brief: an untrusted .nup's and the assets' sizes, tables and offsets
bounded before use (BNTX, MSBT, fonts, PNG and JPEG, zstd frames), overflow checks on in release builds; no write
through a link, and the player's dump never deleted; the finish's swap all or nothing, and a stopped swap made whole;
one build at a time per game folder too; a panic is an internal_error event; Windows renames retried on sharing
errors; discovery's jump table bounds, setjmp slots per guest context; the lifter's key holds its compiler, its crates
and discovery's sources; the release's signing key removed however its step ends, and no CI cache holds anything
compiled.

The third review round (82 commits, lpxlqvzx..xnrvuytn):

  • The lift: a jump table's bound is no longer cut short by a shifted compare or a compare of another register; a
    devirtualised BLR compares the register with its usual address and calls the function it leads to; a vcall anchor
    takes the call's nearest write of its register; a relocation outside its own module is refused; a branch's weights
    fit LLVM's 32 bits; recomp_sj_push's context is captures(address); a setjmp owner with more than four setjmp calls
    stops the lift, naming it, instead of losing the rest; instrumentation is in each unit's key; the lifter's key reads
    the root Cargo.lock. The lifts' store keeps LONGSHOT_LIFT_STORE_KEEP lifts (3) under a lock. The semantics check
    also runs fixed edge states and random sequences of words against Unicorn.
  • The game folder and the caches: the game folder changes only at the swap (the romfs index, its note, the damaged
    list and the title staged); a romfs folder is removed only when it is the builder's own; licence notes move to a data
    folder (LONGSHOT_DATA), keyed by the record's id, the old cache notes read and moved; an update whose upscaler's
    licence is not accepted here builds without it and warns (upscaler_dropped); the cache prunes old pins, notes,
    layouts and the old builders' leftovers; a full drive is disk_full from any file's error; files installed from a
    read-only source come out writable.
  • The build's processes: no program a build starts outlives it (PR_SET_PDEATHSIG on Linux, a job object and
    CREATE_NO_WINDOW on Windows); clang runs without the variables no key holds; a unit's compile has an hour; a failed
    compile keeps the compiler's first error; the early shader preparation shares the build's memory gate, stops with a
    failed build and moves its caches across drives; a failed link drops only the objects at fault.
  • Play and the shaders: Play starts the game it had when an update fails, and says when the shaders will be
    prepared; the preparation's key holds no cache place; three translators' program cache copies are kept in the shader
    store, read and written under its lock; the program cache is locked across users on Windows with LockFileEx.
  • The host: Windows saves in %APPDATA%\Longshot, the old <game>\user moved there once (as on Linux), and
    recomplauncher.json lists that folder so RecompLauncher's backups follow; the game's path and its folder's buffers
    past 260 bytes (longPathAware); a headless game ends on SIGTERM again (SDL's signal handlers off before any
    subsystem starts); a refused setjmp push gets its thread's own buffer; RomFS reads: a file head that fails says -1,
    a .zs frame with no dictionary id falls back to its reader's, a prompts lookup near 2^64 does not wrap, a romfs
    folder is listed once a start; the builder refuses at build time the romfs index the game refuses.
  • The command line: a non-Unicode argument is a usage error, --user is recorded absolute, a non-Unicode HOME
    still finds the cache; the tools store's answer is there, missing or unreached.
  • CI and the release: the release builds restore no cache, make RecompLauncher's zip and upload dist/ before their
    checks; publish and tools-publish compile no Rust (tools-publish uploads with scripts/ci_tools_publish.py,
    Python's standard library) and get their secrets in their steps only; the tools' licence downloads pinned by SHA-256;
    dev release fetch-bases goes through RELEASE_UPLOAD_API first; the rust jobs install clang, lld and llvm-mc, and
    the tests that need them fail without them; a Cargo-only change runs the Rust jobs on CircleCI.
  • dev.py: dev builds keep the builder's cache, licence notes and work folders in the development folder, go through
    the job queue (but the Test Farm's, which runs directly), and dev.py bases --prune removes old dev data.
  • Code and tests: one path check, one link check, one SHA-256 file helper, one switch parser; more of the builder's Python source checks became Rust tests in their crates;
    the docs' nits.

Read first: builder/README.md, then builder/crates/build-driver/src/build.rs, builder/crates/lift/src/whole/,
builder/crates/mir/src/lib.rs, host/romfs.h, builder/crates/longshot-builder/src/play.rs.

Testing

Tested: CachyOS Linux 7.3, this PC (Ryzen 9 7900X, 24 threads, RTX 3090), the release build; and the lab (RX 580,
a hard drive).

On the head after the third review round (xnrvuytn 97e3f4ee, one batched queue run, this PC; the head is now mvtuxnow
02386f32 on main 8aa5ab87, with the second review's fixes, and Measurements are at it):

  • cargo fmt --check, clippy with warnings as errors on Linux and for Windows (x86_64-pc-windows-gnu), the
    workspace's tests, and the synthetic game end to end: all pass.
  • tests/run_all.py --strict: 719 passed, 109 failed, 8 skipped.
    • 91 need the Vulkan or SPIR-V headers, which this PC lacks (not found: vulkan_headers / spirv_headers).
    • 9 are main's known failures: test_crt_options, test_guest_holes, test_menu_save_atomic,
      test_menu_text_field, test_pipeline_share, test_rdna2_mesh_only, test_readback_timeout_source,
      test_target_image_reuse, test_vibration_menu.
    • 6 renderer fixture tests whose files are byte-identical to main's and are believed to fail on main:
      test_amd_subgroup_profiles, test_shader_profile_caps, test_flat_map, test_wb_spans, test_vram_compact,
      test_rumble_menu.
    • 3 failed on this branch (test_mise_build, test_dev_packs, test_log_redact), were fixed, and pass on the head.
  • A real game build from nothing (the .nup, a new cache, data folder, store and shader store; no upscaler): 318 s wall
    clock, 145 s of it the builder's stages and 171 s the wait for the shaders prepared beside the compile (shared mode;
    the timed numbers are in Measurements). The lift took 4.6 s for 294,518 functions; 903 units compiled. The early
    shader progress streamed through the wait.
  • All 132 hook sites resolved identically to the builder before this round (dev sites, no diff).
  • An update with nothing changed: 5.3 s, everything kept, the shaders kept by their key.
  • A smoke run of the built game (headless, a Kokiri save) reached play at 60 fps, no errors, no draws left out.

At 02386f32 (2026-11-24, Measurements): this PC's folders, from a cold build with and without the shaders, played
all five scenes in 15 timed runs and started to the title 3 times; the lab's folder from a cold build played the five
scenes once each, and its 3ca9b9d8 folder 15 more times: every run on the 1080p rule, no pipeline waits, no error
in the game's logs.

Earlier, on heads before this round:

  • In the game, this PC: folders built by the new builder played in the four A/B scenes against main, 3 runs a side,
    the RomFS read from the .nup through the index (those numbers are replaced by Measurements).
  • In the game, the lab (RX 580, HDD), at 27b6fbcd: a first build (741.5 s: 486 s the builder's stages, 248 s the
    wait for the shaders), an update (12.5 s) and a smoke run to play.
  • On the game's own files, on this PC (nothing of them leaves it): image.bin and image.json byte for byte the old
    builder's; every RomFS file read through the index the same as the old builder's extraction; the lift's
    294,518 functions, two lifts byte for byte the same, one site changed lifting one unit; the assets against the old
    builder's (the shader list, the pipeline list, the prompts' layouts byte for byte; the textures within the
    rasteriser's hinting).

Still to test:

  • Windows, NVIDIA and AMD: a first build, an update and a run to play, expecting what Linux shows
    (@Beanstalk once Beanstalk #143 is in; until this
    merges the farm cannot build main's side, so by hand until then).
  • Windows, by hand: RecompLauncher's start program (Longshot.exe opens no console window, the setup's progress
    streams, a failed update still starts the game), the saves moved once from <game>\user to %APPDATA%\Longshot,
    a game folder past 260 characters, and two users on one shader store (LockFileEx).
  • The 6 renderer fixture tests above, on main, expecting them to fail there too (by hand).

This is the gate before it leaves WIP.

Measurements

Verdict: on this PC a first build from nothing takes 124 s instead of 554 s without the shaders and 332 s instead of
669 s with them, with 6.1 GB of peak RAM instead of 15.6 GB and a 1.65 GB game folder instead of 28 GB; a second game
folder on the same caches takes 26 s instead of 70 s (59 s instead of 117 s with the shaders), a mod's ExeFS code patch
15 s instead of 123 s. In play fps is higher in all five scenes, clearly in three of them (Kakariko +5.5 %, Kokiri Forest
+7.6 %, Fire Temple +16 %; Hyrule Field +1.4 % and the Market +4.2 % within the runs' spread), the game's own CPU time per
frame 14 to 44 % lower and every 1 % low higher. On the AMD lab the build is 3.5 times faster (844 s instead of 2,987 s);
its play is GPU-bound and the same within the spread. The first start after a build is the same, and memory in play within 5 %.

Setup: this PC: CachyOS (Linux 7.3.3), Ryzen 9 7900X (24 threads), 31 GB of RAM (12 to 13 GB of swap in use the
whole time), RTX 3090 on NVIDIA 620.70.06, an NVMe drive (btrfs on LUKS). The lab: the same OS and kernel,
i7-9700K (8 threads, its clock swinging 0.8 to 4.7 GHz), 15 GB, RX 580 on RADV (Mesa 26.2.6), a drive the system reports as rotational (the builders warn of a hard drive).
main @ 8aa5ab87 (built from 90fae88c, the same tree but .tooling-rev) with its own nx2/make_game.py, against this
pull request @ 02386f32 (the head after the second review's fixes), 2026-11-24, unless a table says otherwise.

  • Builds (this PC through the queue in timing mode with all 24 CPUs, nothing beside them; the lab alone, nothing
    else running). Cold: every cache new for the run (main: work, lift store, object store, XDG cache, shader store;
    #2286: work, store, builder cache, data folder, shader store; both: new NVIDIA and Mesa cache folders, so the
    drivers' caches were cold); the OS page cache was not dropped (no root), so the .nup (25 GB) may have been partly
    in RAM. Hot: the same build again into a new game folder and work folder with every cache of a cold run kept
    (what a second game folder or a reinstall costs). DLSS in both sides' builds here (--upscaler dlss; main through
    LONGSHOT_NGX_SDK), none on the lab. Wall clock, CPU time (user + system of the whole process tree), peak RAM (the
    PC's used memory above where it stood at the start), bytes written to disk, from a wrapper sampling every 0.5 s; the
    stages from main's "where the time went" and #2286's build_times.json and events. Median (min-max).
  • fps: the 1080p rule (output 1920x1080, Render resolution 100 %, upscaler Off, uncapped, V-Sync Off, frame
    generation Off, preset Custom, a fresh options file each run; every run's option read-back and log checked: 30 of 30
    here and every lab run on the rule). Headless, the repository's Kokiri save, the scene's teleport, warmed until 5 s
    pass with no pipeline made or waited for (at least 20 s), then 50 s measured from the frame trace. 3 interleaved pairs
    per scene (main, #2286), the timing queue (the game on CPUs 0-5,12-17; the queue's noise check: no build outside it,
    CPU pressure at most 6 %), each side's folder its cold build with the shaders, with its own driver cache. 1 % low =
    1000 / the 99th percentile frame time, 0.1 % low the same at the 99.9th. Game CPU = the game process's CPU time over
    the stretch, in cores; GPU busy and memory from nvidia-smi each second (the lab: amdgpu's gpu_busy_percent, VRAM
    from the process's DRM fdinfo); CPU clock the mean of every core's, each second. Each cell main → #2286.

The headline numbers (medians; the tables below give each run count and spread):

This PC unless named Before: main @ 8aa5ab87 After: this PR @ 02386f32
First build, cold, without the shaders 554 s 124 s
First build, cold, with the shaders (the default) 669 s 332 s
Peak RAM of a cold build without the shaders (added) 15.6 GB 6.1 GB
Game folder 28.0 GB 1.65 GB
A second game folder on the same caches (hot), with the shaders 117 s 59 s
An update after a mod's ExeFS code patch 123 s 14.8 s
An update with nothing changed 4.7 s 4.1 s
First start to the title after a build with the shaders 8.8 s 8.5 s
fps, Hyrule Field / Market / Kakariko / Fire Temple / Kokiri Forest 132.0 / 101.7 / 108.5 / 107.1 / 135.2 133.9 / 106.0 / 114.5 / 124.4 / 145.5
1 % low, the same scenes 108.2 / 76.5 / 86.3 / 84.4 / 109.5 111.6 / 79.8 / 90.3 / 90.9 / 128.7
The lab: first build, cold, with the shaders 2,987 s 844 s
The lab: fps, Hyrule Field / Market / Kakariko (fps at 3ca9b9d8) 49.9 / 42.7 / 44.8 51.0 / 42.2 / 46.0

This PC (RTX 3090): main @ 8aa5ab87 against #2286 @ 02386f32, 2026-11-24

First builds and hot builds (main's cold runs without the shaders: two in a job at 01:37 and one at 03:00, the
same code; everything else in one job per row group, main and #2286 interleaved where both ran):

No shader preparation main, cold #2286, cold main, hot #2286, hot
Runs 3 2 3 3
Wall clock (s) 554 (428-686) 124 (123-125) 70 (57-89) 26 (26-31)
CPU time (s, user + system) 4758 (3689-5704) 2209 (2197-2221) 77 (75-77) 184 (180-190)
Peak RAM added (GB) 15.6 (15.4-15.9) 6.1 (5.9-6.3) 3.5 (2.9-3.7) 2.5 (1.6-2.5)
Written to disk (GB) 34.2 (34.2-34.2) 2.8 (2.8-2.8) 28.1 (28.0-28.1) 1.7 (1.7-1.7)
Read the game files (s) 1 (1-7) 1 (1-1) 0 (0-1) 2 (1-2)
Lift (s) 108.0 (90.0-127.0) 4.5 (4.5-4.5) 50.0 (38.0-68.0) 0.2 (0.1-0.2)
Compile and link (s) 430 (325-534) 116 (115-117) 7 (7-8) 22 (22-26)
Finish (s) 14 (12-18) 2 (2-2) 12 (12-12) 2 (2-4)
Shaders after the builder's stages (s) 0 (0-1) 0 (0-0) 0 (-0-1) 0 (0-0)
Game folder (GB) 28.00 (28.00-28.00) 1.65 (1.65-1.65) 28.00 (28.00-28.00) 1.65 (1.65-1.65)
With the shaders main, cold #2286, cold #2286, cold, LONGSHOT_PREPARE_EARLY=0 main, hot #2286, hot
Runs 2 2 1 3 3
Wall clock (s) 669 (651-687) 332 (331-332) 343 117 (117-129) 59 (58-61)
CPU time (s, user + system) 6854 (6763-6945) 5105 (5088-5123) 5069 663 (662-674) 454 (448-459)
Peak RAM added (GB) 15.0 (14.9-15.1) 10.3 (9.6-11.0) 9.7 8.3 (8.0-8.8) 8.0 (7.0-8.3)
Written to disk (GB) 41.4 (41.4-41.5) 10.2 (10.2-10.2) 10.2 30.4 (30.4-30.5) 4.3 (4.3-4.3)
Read the game files (s) 1 (1-1) 1 (1-1) 1 1 (1-1) 1 (1-3)
Lift (s) 97.5 (97.0-98.0) 4.5 (4.4-4.5) 4.5 38.0 (37.0-48.0) 0.2 (0.2-0.2)
Compile and link (s) 332 (325-340) 119 (118-119) 115 8 (8-8) 23 (20-23)
Finish (s) 12 (12-13) 3 (3-3) 2 12 (12-12) 2 (2-3)
Shaders after the builder's stages (s) 225 (216-235) 205 (204-205) 221 59 (58-60) 31 (30-37)
Game folder (GB) 30.48 (30.48-30.48) 4.14 (4.14-4.14) 4.13 30.46 (30.46-30.46) 4.12 (4.12-4.12)

#2286's lift is 4.5 s for all 294,518 functions (discovery 2.1 s of it: 17.6 million instructions, 1,474 jump tables),
about 65,000 functions a second; 386 lift units, 903 compile units, 132 hook sites placed, 99 functions edited. The
compilers' CPU time summed: #2286 2,001 to 2,065 s for the host and game and 328 to 376 s for the renderer; main 3,118 to
5,402 s and 255 to 419 s. The executable is 817 MB (.text 760 MB) against main's 612 MB (.text 548 MB); the renderer
18.5 MB on both. Caches after a cold build with the shaders: #2286 6.3 GB (store 1.1 GB, shader store 3.9 GB, NVIDIA's
1.3 GB), main 7.7 GB (lift store 1.8 GB, object store 0.9 GB, shader store 3.7 GB, NVIDIA's 1.3 GB). A hot build with
the shaders: #2286 translates no shader program again (its program cache comes from the shader store) and builds the
38,396 noted pipelines in 15 s; main translates all 46,667 again (42 s). main's cold runs spread widely (428 to 687 s):
its compile used up to 15.9 GB more RAM on a PC with 16 GB available.

What a change rebuilds (an update after each change, the run-2 folder of the cold builds without the shaders, 3
runs where the row says so; wall clock, median (min-max)):

Change main #2286 #2286: units compiled
Nothing (3) 4.7 s (4.0-6.3) 4.1 s (3.9-4.5) 0 of 903
A comment appended to host/hos_main.c (3) 5.0 s (4.5-6.6) 6.6 s (5.6-8.1) 3 (main's keys read the preprocessed text, so a comment compiles nothing new there; #2286's hold the source)
A mod's ExeFS code patch, one instruction, a different one each run (3) 123 s (116-197): the whole lift again 14.8 s (13.6-15.1): 1 to 5 of 386 lift units 1, 1, 4
A mod's ExeFS data patch into relocated words (3; the first follows the code patch's removal) 4.5 s (4.4-100.2) 4.8 s (4.8-12.0) 0
The patches removed 4.0 s 3.8 s 0
A mod's RomFS file added, then removed (3 each) 4.1 s / 4.1 s 3.7 s / 3.7 s 0
#2286: a cold build stopped 60 s into its compile (210 units done), run again 75.5 s the other 693

The first start after a build (headless 1080p, to the title screen's first frame; the timing queue's 12 CPUs):

main #2286
After a build without a preparation, NVIDIA's cache empty 380.5 s (38,809 programs translated in 106 s, the 38,021 noted pipelines built in 269 s on 10 threads) 381.0 s (the same work, 270 s)
The start after that one 5.2 s 5.2 s
After a build with the preparation (its NVIDIA cache) 8.8 s (the 38,021 noted pipelines loaded from the driver's cache in 3.8 s) 8.5 s (3.7 s)

fps (3 interleaved pairs per scene; each cell main → #2286, median (min-max)):

Scene (runs main / PR) fps 1 % low 0.1 % low frame time p50 (ms) p99 (ms)
Hyrule Field (3 / 3) 132.0 (117.9-132.7) → 133.9 (125.1-134.7) 108.2 (81.5-110.7) → 111.6 (93.6-113.2) 92.8 (42.7-101.4) → 100.6 (46.9-101.6) 7.51 (7.49-8.27) → 7.40 (7.37-7.91) 9.24 (9.03-12.27) → 8.96 (8.83-10.68)
Market (3 / 3) 101.7 (91.5-102.0) → 106.0 (95.9-108.4) 76.5 (59.1-76.8) → 79.8 (70.0-80.6) 64.6 (37.1-69.0) → 71.3 (37.2-72.9) 9.79 (9.71-10.71) → 9.21 (8.93-10.46) 13.08 (13.03-16.91) → 12.53 (12.41-14.28)
Kakariko (3 / 3) 108.5 (108.2-110.0) → 114.5 (114.2-115.6) 86.3 (81.4-89.8) → 90.3 (89.3-93.1) 64.8 (60.1-77.2) → 77.7 (60.4-78.9) 9.24 (9.11-9.36) → 8.43 (8.39-8.46) 11.59 (11.14-12.29) → 11.07 (10.74-11.20)
Fire Temple (3 / 3) 107.1 (106.9-109.2) → 124.4 (124.0-125.6) 84.4 (84.1-85.8) → 90.9 (90.4-91.9) 59.1 (58.1-59.1) → 64.3 (58.6-67.2) 9.28 (9.09-9.30) → 7.96 (7.88-7.98) 11.85 (11.65-11.89) → 11.00 (10.88-11.06)
Kokiri Forest (3 / 3) 135.2 (135.2-135.3) → 145.5 (144.9-147.9) 109.5 (108.2-109.9) → 128.7 (119.2-130.6) 99.3 (98.5-99.7) → 112.9 (107.6-122.8) 7.22 (7.21-7.24) → 6.81 (6.66-6.99) 9.13 (9.10-9.24) → 7.77 (7.66-8.39)
Scene game ms draw ms wait for the GPU (ms) wait for the main thread (ms) game CPU (cores) GPU busy % CPU clock (MHz)
Hyrule Field 6.40 (6.16-7.99) → 4.43 (4.42-6.21) 2.63 (2.62-3.04) → 2.60 (2.56-2.95) 0.55 (0.18-0.66) → 1.46 (0.80-1.49) 0.53 (0.20-0.63) → 1.43 (0.88-1.48) 3.96 (3.95-4.93) → 3.74 (3.71-4.90) 75 (67-75) → 76 (71-76) 4838 (4662-5286) → 4766 (4699-5274)
Market 7.84 (7.81-8.89) → 6.27 (6.24-6.95) 5.26 (5.26-5.88) → 5.17 (5.01-5.79) 0.93 (0.89-0.94) → 1.52 (1.44-1.62) 0.95 (0.94-0.96) → 1.54 (1.45-1.65) 4.85 (4.81-4.89) → 4.78 (4.75-4.93) 58 (52-58) → 61 (56-62) 4889 (4660-5228) → 4791 (4773-5185)
Kakariko 6.42 (6.01-6.49) → 5.07 (5.05-5.08) 4.98 (4.87-5.06) → 4.50 (4.43-4.51) 1.33 (1.30-1.57) → 1.79 (1.74-1.79) 1.33 (1.29-1.56) → 1.79 (1.74-1.80) 4.38 (4.35-4.42) → 4.24 (4.22-4.24) 69 (68-69) → 73 (73-73) 4775 (4710-4890) → 4782 (4767-4918)
Fire Temple 9.19 (9.01-9.20) → 7.86 (7.78-7.89) 2.54 (2.45-2.74) → 2.55 (2.53-2.62) 0.00 (0.00-0.01) → 0.01 (0.01-0.02) 0.03 (0.03-0.04) → 0.04 (0.04-0.06) 4.69 (4.66-4.76) → 4.93 (4.92-5.04) 51 (50-52) → 59 (59-59) 4797 (4767-4809) → 4809 (4796-4812)
Kokiri Forest 7.18 (7.17-7.19) → 4.04 (3.84-5.97) 2.34 (2.33-2.35) → 2.29 (2.18-2.33) 0.05 (0.04-0.06) → 1.32 (0.40-1.49) 0.05 (0.04-0.06) → 1.32 (0.39-1.50) 4.63 (4.62-4.64) → 3.83 (3.76-4.59) 65 (65-65) → 72 (70-74) 4781 (4705-4815) → 4749 (4685-4753)

Memory in play (at the end of each measured stretch: the game's RSS, its video memory from nvidia-smi), with the
stretch's long frames and pipeline waits:

Scene RSS (MB) VRAM (MB) frames of 50 ms or more pipeline waits
Hyrule Field 10637 (10399-10880) → 11093 (10712-11194) 7738 (7660-7818) → 8008 (7890-8048) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)
Market 11743 (11653-12034) → 11700 (11454-11980) 7869 (7861-7999) → 7777 (7715-8057) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)
Kakariko 10974 (10943-11198) → 11318 (11101-11413) 7475 (7443-7793) → 7603 (7452-7667) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)
Fire Temple 11459 (11358-11933) → 11720 (11604-11724) 8123 (8091-8225) → 8157 (8095-8189) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)
Kokiri Forest 10292 (10274-10651) → 10613 (10554-10654) 5574 (5472-5700) → 5885 (5472-5981) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)

Hyrule Field's and the Market's first pair ran slower on both sides (the first game runs of the job); the medians and
the other two pairs agree. The game ms falls 14 to 44 %; fps follows it where the frame waits on the game's threads
(Fire Temple, Kokiri Forest, Kakariko); in Hyrule Field and the Market the GPU and the renderer's side hold the frame and
fps moves within the spread.

The AMD lab (RX 580, RADV): main @ 90fae88c (= 8aa5ab87 but .tooling-rev) against #2286, 2026-11-24

Builds at 02386f32, the lab alone (main's "read the game files" is its RomFS copy onto the drive):

The lab, with the shaders main, cold #2286, cold main, hot #2286, hot
Runs 2 2 3 3
Wall clock (s) 2987 (2945-3028) 844 (836-852) 1893 (1890-1907) 265 (227-285)
CPU time (s, user + system) 8433 (8427-8440) 4871 (4870-4872) 911 (899-917) 402 (370-416)
Peak RAM added (GB) 13.0 (13.0-13.0) 6.6 (6.6-6.7) 5.9 (5.8-5.9) 6.2 (5.9-6.4)
Written to disk (GB) 40.2 (40.1-40.2) 8.5 (8.5-8.6) 29.9 (29.8-29.9) 3.3 (3.3-3.3)
Read the game files (s) 1538 (1496-1579) 6 (6-6) 1587 (1556-1589) 5 (5-6)
Lift (s) 133.5 (130.0-137.0) 8.7 (8.7-8.7) 8.0 (8.0-10.0) 0.3 (0.3-0.3)
Compile and link (s) 818 (818-819) 388 (379-398) 25 (22-25) 67 (61-67)
Finish (s) 54 (52-56) 10 (9-12) 51 (43-55) 92 (53-101)
Shaders after the builder's stages (s) 436 (435-436) 431 (427-434) 239 (226-242) 107 (102-112)
Game folder (GB) 29.38 (29.38-29.38) 3.02 (3.02-3.02) 29.38 (29.38-29.38) 3.02 (3.02-3.02)
The lab, no shader preparation main, cold #2286, cold
Runs 1 1
Wall clock (s) 2668 405
CPU time (s, user + system) 6062 2495
Peak RAM added (GB) 13.1 4.0
Written to disk (GB) 34.6 2.8
Read the game files (s) 1644 6
Lift (s) 134.0 8.7
Compile and link (s) 821 387
Finish (s) 67 3
Game folder (GB) 27.94 1.57

An update with nothing changed (3 runs, with the shaders kept by their key): main 114 s (112-141), #2286 16 s (14-26).

fps at 3ca9b9d8 (the head before the second review's fixes; its play-side changes since are small: the setjmp slot,
the program cache's lock and copy), 3 interleaved pairs per scene (Hyrule Field's and the Market's first #2286 run lost
to a teleport limit since fixed, run again as a fourth pair), main's folder the one ~/lb-2286 built at 90fae88c (with the
shaders), #2286's a build at 3ca9b9d8 with the shaders:

Scene (runs main / PR) fps 1 % low 0.1 % low frame time p50 (ms) p99 (ms)
Hyrule Field (4 / 3) 49.9 (49.5-50.5) → 51.0 (50.6-51.6) 30.4 (29.3-46.6) → 47.6 (41.7-48.9) 27.1 (26.7-27.7) → 27.8 (26.9-46.8) 19.85 (19.76-19.96) → 19.59 (19.50-19.62) 32.94 (21.44-34.15) → 21.01 (20.47-23.99)
Market (4 / 3) 42.7 (41.5-44.5) → 42.2 (41.3-44.2) 22.1 (18.5-36.7) → 24.5 (23.7-34.6) 16.5 (16.1-16.5) → 17.3 (16.4-18.7) 22.73 (21.95-23.54) → 23.31 (21.86-23.85) 45.17 (27.22-54.09) → 40.87 (28.89-42.15)
Kakariko (3 / 3) 44.8 (43.8-44.9) → 46.0 (44.9-46.0) 28.3 (24.6-39.3) → 35.8 (19.6-36.5) 18.7 (18.3-18.9) → 18.4 (17.8-18.6) 22.06 (21.91-22.39) → 21.44 (21.42-21.64) 35.30 (25.45-40.59) → 27.97 (27.41-50.94)
Fire Temple (3 / 3) 29.5 (24.6-41.2) → 32.2 (24.1-46.3) 17.1 (16.9-17.1) → 21.7 (21.1-23.3) 15.2 (14.2-16.3) → 20.3 (18.3-20.7) 27.99 (15.23-50.69) → 30.81 (19.47-41.66) 58.58 (58.36-59.01) → 46.00 (42.98-47.38)
Kokiri Forest (3 / 3) 28.6 (20.1-53.7) → 27.5 (24.0-44.2) 17.3 (17.1-49.0) → 18.7 (17.8-34.4) 16.3 (16.3-41.1) → 16.5 (16.0-28.7) 45.63 (18.63-49.63) → 38.94 (22.86-40.62) 57.91 (20.41-58.52) → 53.44 (29.05-56.18)
Scene game ms draw ms wait for the GPU (ms) wait for the main thread (ms) game CPU (cores) GPU busy % CPU clock (MHz)
Hyrule Field 6.11 (4.99-7.34) → 1.08 (0.19-1.66) 4.92 (4.59-5.08) → 4.48 (4.24-4.62) 6.79 (6.25-7.23) → 9.03 (8.79-9.25) 6.88 (6.34-7.32) → 9.25 (9.05-9.70) 2.55 (2.44-2.64) → 2.23 (2.10-2.26) 86 (84-90) → 91 (89-92) 2804 (2666-2978) → 3010 (2926-3172)
Market 8.61 (5.26-11.40) → 4.76 (2.77-6.51) 9.78 (8.55-10.77) → 10.29 (8.62-11.26) 7.08 (6.07-8.31) → 9.26 (8.69-9.62) 7.28 (6.19-8.49) → 9.53 (8.96-10.06) 3.54 (3.23-3.80) → 3.27 (3.02-3.48) 82 (76-86) → 77 (77-82) 3106 (2759-3556) → 2754 (2561-3362)
Kakariko 5.62 (4.86-7.17) → 1.02 (0.86-1.50) 8.40 (8.26-9.29) → 7.57 (7.47-8.11) 8.14 (7.63-8.51) → 9.81 (9.77-10.10) 8.22 (7.64-8.58) → 10.69 (10.59-10.72) 2.93 (2.88-3.11) → 2.55 (2.51-2.63) 86 (79-90) → 90 (89-93) 3025 (2732-3326) → 3542 (3302-3607)
Fire Temple 32.69 (18.37-38.17) → 29.71 (19.58-39.87) 9.96 (5.94-11.35) → 10.86 (7.34-14.86) 0.76 (0.14-2.69) → 0.08 (0.05-0.70) 0.80 (0.22-2.75) → 0.23 (0.13-0.76) 4.48 (4.02-4.61) → 4.73 (4.54-4.79) 51 (29-60) → 43 (38-75) 1314 (1227-2650) → 1259 (875-1865)
Kokiri Forest 28.81 (4.22-47.89) → 33.78 (14.49-39.60) 8.02 (3.98-12.14) → 10.82 (7.38-12.33) 2.61 (0.12-7.02) → 0.55 (0.06-3.75) 2.67 (0.15-7.11) → 0.58 (0.19-3.81) 3.62 (2.48-3.86) → 4.15 (3.53-4.23) 43 (29-93) → 55 (44-71) 1490 (875-2907) → 1016 (875-1587)
Scene RSS (MB) VRAM (MB) frames of 50 ms or more pipeline waits
Hyrule Field 6459 (6325-6504) → 6724 (6585-6726) 6008 (5949-6274) → 5949 (5793-6291) 0 (0-0) → 0 (0-0) 0 (0-0) → 0 (0-0)
Market 7630 (7596-7665) → 7732 (7579-7755) 5876 (5542-6102) → 5829 (5781-6177) 17 (9-37) → 12 (7-16) 0 (0-0) → 0 (0-0)
Kakariko 7019 (7005-7047) → 7080 (7061-7128) 5854 (5831-5978) → 5919 (5834-6017) 14 (9-16) → 16 (13-30) 0 (0-0) → 0 (0-0)
Fire Temple 6633 (6558-6679) → 6700 (6596-6711) 5834 (5819-6050) → 5953 (5806-6242) 417 (307-675) → 2 (0-4) 0 (0-0) → 0 (0-0)
Kokiri Forest 6276 (6272-6294) → 6399 (6381-6555) 5701 (5552-5918) → 5789 (5566-5819) 354 (0-461) → 23 (0-57) 0 (0-0) → 0 (0-0)

One confirming pair per scene at 02386f32 (its cold build's folder; single runs, the CPU's clock main → #2286 in the
last column):

Scene (runs main / PR) fps 1 % low 0.1 % low frame time p50 (ms) p99 (ms) CPU clock (MHz)
Hyrule Field (1 / 1) 50.4 → 49.6 29.5 → 28.5 27.7 → 26.0 19.58 → 19.85 33.94 → 35.14 2972 → 2854
Market (1 / 1) 44.6 → 41.0 35.9 → 18.9 16.9 → 15.9 21.95 → 23.34 27.86 → 53.06 3546 → 2648
Kakariko (1 / 1) 45.0 → 45.5 26.1 → 19.0 18.2 → 17.6 21.82 → 21.31 38.28 → 52.57 3436 → 3690
Fire Temple (1 / 1) 25.0 → 51.5 17.6 → 24.1 16.8 → 19.7 38.97 → 18.81 56.75 → 41.40 1184 → 2004
Kokiri Forest (1 / 1) 37.8 → 35.6 24.4 → 25.1 22.7 → 20.9 20.77 → 27.18 40.96 → 39.76 1702 → 1055

The lab is GPU-bound in Hyrule Field, the Market and Kakariko (77 to 93 % busy): at 3ca9b9d8 fps there is +2 %, -1 % and
+3 %, within the spread, and the 1 % lows higher in all three. The confirming pairs at 02386f32 land in the same
spread (fps within 1 % in Hyrule Field and Kakariko; the Market's #2286 run had the CPU at 2.6 GHz against main's 3.5 GHz,
and its 1 % low and Kakariko's are lower in this one pair). In the Fire Temple and Kokiri Forest the CPU's clock fell to
0.9 to 2 GHz on either side (the GPU 30 to 78 % busy), so those two scenes measure the lab's clock more than the build;
#2286 had far fewer frames of 50 ms or more there. The lab's game ms reads much lower for #2286 than for main (the frame trace's game_ms), a
larger gap than this PC shows; it is reported as logged.

Numbers measured on earlier heads (07b2046a/f14c2d29 and 0fc27a42 on this PC, 27b6fbcd and 1b0e298b on the lab) are
replaced by the tables above.

Risks

For players:

  • Every build runs the new builder once this merges; there is no old path to fall back to. The host changes reach
    every game: RomFS reads go through host/romfs.c, the prompts through prompts/*.base, the renderer's host API is
    version 47. A revert is the way back.
  • Every player lifts and compiles everything once (new keys): the first update after this takes as long as a first
    build, the shaders included.
  • The .nup must stay where it is: a game built by longshot-builder reads its RomFS from it. Moved or deleted, the
    game says so (nup_moved); longshot-builder index --game <new.nup> --out <folder> points the folder at a moved
    one (the same .nup only), and the launcher builds again.
  • Accepted licences moved to a data folder of their own (LONGSHOT_DATA, else ~/.local/share/longshot-builder or
    %LOCALAPPDATA%\Longshot\Builder-data), out of the cache a launcher or a player empties. The old notes in the cache
    are read and moved at the next build. An update whose upscaler's licence is not found builds without it and warns.
  • Windows saves move once from <game>\user to %APPDATA%\Longshot (the Longshot Launcher's place), by the same
    rules as Linux: an entry already there, or one that cannot move, keeps the old place whole.
    longshot_options.ini stays in the game folder. RecompLauncher's save list (recomplauncher.json) names the new
    folder.
  • longshot_mods.txt: The game no longer reads longshot_mods.txt, where much older builds kept the mods' order
    and switches. A game folder that still has one and never made a mods.json from it (no longshot_mods.txt.imported
    beside it) starts with every mod on, in path order; set the order and switches again once on the Mods tab.
  • A setjmp owner with more than 4 setjmp calls is now refused (the lift stops, naming it) instead of losing the
    rest; the game has none.
  • Never run on Windows: the new Windows-only code is built (llvm-mingw, -Werror) and passes clippy for Windows,
    but has not run there: the job objects and CREATE_NO_WINDOW for the build's children, the saves move, the wide
    paths past 260 characters (longPathAware), LockFileEx on the program cache, and the windowed Longshot.exe
    (its hidden console and message boxes).
  • ZBIC: game-files/src/zstd.rs decodes it in Rust, written from the format's description (no code copied; its
    table generated and checked against Atmosphere-NX's).
  • Switches: the HOS_* switches the description check names (HOS_DISCORD, HOS_FPS_MAX, ...) came with #2272's
    hook sites and keep their defaults. HOS_IMAGE_MAP is gone (a GONE row). The new builder's own environment variables
    (LONGSHOT_CACHE, LONGSHOT_DATA, LONGSHOT_STORE, LONGSHOT_JOBS, LONGSHOT_MEM_*, LONGSHOT_LIFT_STORE_KEEP)
    are the command's; HOS_GUEST_PROFILE (unset: nothing) records a profile.

For whoever merges:

  • It ships with LongshotLauncher #259, which
    passes this pull request's flags, and the Test Farm builds it after Beanstalk
    #143.
  • The release workflows changed: release builds restore and save no cache; RecompLauncher's zip is made in the
    build jobs and only checked by publish; publish and tools-publish compile no Rust on the deploy runner
    (tools-publish uploads with scripts/ci_tools_publish.py, Python's standard library), their secrets given to their
    steps only. The first nightly after the merge is their first real run. CircleCI's release stage makes no
    RecompLauncher zips yet (a TODO there).
  • CI's rust jobs now need clang, lld and llvm-mc (installed from the distribution in both CIs); compile_link and
    llvm_mc fail without them.
  • The root Cargo workspace: Cargo's target folder is the root's target/, and Cargo.toml, Cargo.lock and
    longshot-rs/ are build inputs; a checkout that built in builder/target builds again.

What still waits:

  • The Windows runs in Still to test, and the Test Farm's on Windows and AMD (Beanstalk
    #143).
  • Later, not in this pull request: the build tools' compiler built from the pinned LLVM source with only the targets
    the build needs (builder.md, "Still to come").

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). On this head: 719 passed; 91 could not
    run here (no Vulkan or SPIR-V headers on this PC), 9 are main's and named, and 6 renderer fixture tests are believed
    to fail on main but not yet run there (Testing).
  • 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.
    (third_party/ only loses a64-kit, the old lifter's, with it, and some PROVENANCE.md notes name the new builder;
    no upstream code changed.)

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • MKWVK_API_VERSION bumped (MkwVkHost or MkwVkRenderer in gpu/vk/vk_api.h changed).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built, not run on Windows: Still to test.)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested. Windows has not run.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). Windows NVIDIA and AMD not yet.
  • 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 The whole builder in Rust, replacing the old one: `longshot-builder`, one command that turns the player's own `.nup` into a game folder (read the game files, lift, compile, assets, shaders). The old builder (`nx2/make_game.py`, `nx2/build.py`, the Python lift, `third_party/a64-kit`) is deleted, and so are the standalone builders (the AppImage, the Windows LongshotBuilder app and its setup): a release ships one self-contained `longshot-builder` per platform (the builder, the sources it compiles, the assets, the prebuilt objects and the build tools packed inside), with small deltas between releases and a manifest listed in the signed `SHA256SUMS`. `dev.py`, the release and CI run it. No player's build needs Python. It started as the lifter rewrite (a native lifter with a typed SSA mid IR, writing LLVM IR for the pinned clang); it is now every stage. **The names.** The workspace is `builder/` (it was `rust/`), and the command is `longshot-builder` (it was `longshot-build`; the developers' `longshot-lift` is folded in as `longshot-builder dev discover|sites|lift|profile|words|decode`). Its release files are `longshot-builder-<v>-<platform>`, its per-user cache `~/.cache/longshot-builder` or `%LOCALAPPDATA%\Longshot\Builder`, its data folder (the licences a player accepted) `~/.local/share/longshot-builder` or `%LOCALAPPDATA%\Longshot\Builder-data`, its game folder record `longshot_builder.json`. The `LONGSHOT_*` variables keep their names. **It supersedes [#2272](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2272)**, which is closed: #2272's last version (the player features on hook sites, Skip title screen on the game's own load) is folded in whole, its Python machinery ported to the Rust `sites` and `edits` crates: anchors' `of`, `HOS_SITE_OUTCOME`, the site chain kept per guest context, Skip title screen stopping its presses once the game loads. This pull request merges alone. **Players build with it once this merges**: LongshotLauncher [#259](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/259) installs `longshot-builder` from a release (by a delta from the one it has, or the full file) and runs `check` and `build --json`; it passes its settings as this pull request's flags (`--cache`, `--builder-exe`), so the two ship together. RecompLauncher installs the release's `longshot-builder-<v>-<platform>-recomplauncher.zip` and starts `Longshot.exe` / `Longshot.x86_64`. The Test Farm builds with it after Beanstalk [#143](https://git.magicbean.dev/MagicBeanDev/Beanstalk/pulls/143), which waits on this one: `main` has no `builder/` until it merges. **A clean break** in what the builder looks like from outside: no `make_game.py` options, no `@@` lines. With `--json` it writes versioned JSON Lines events (stage, progress, the compile's plan and units, the time left, warnings, errors with stable codes, done), documented in `docs/dev/reference/build-events.md`, with a test that keeps that list of codes and the code in step; caches are keyed by content anew. What is here (`builder/`, a README per crate; one Cargo workspace at the repository's root): - **The lifter** (`a64`, `cfg`, `image`, `mir`, `sem`, `llvm`, `lift`, `passes`, `profile`): the decoder (checked against llvm-mc), discovery (the same 294,518 functions as the old lifter), the mid IR with every integer, memory, atomic, system, float and SIMD form the game uses, the LLVM IR writer, the passes (shared page marks, dead state, giant functions split), the guest profile (branch weights, hot and never-run functions, keyed by guest code, committed in `assets/profiles/guest.profile.xz`), and a runtime of its own (`builder/rt`). An instruction the semantics do not cover is a trap where it is, never a failed build. - **Every hook site, text patch and entry hook as an edit of the mid IR** (`sites`, `edits`): no C text, nothing left to the old lifter. Each function's edits have a stable key, so one site's change lifts one unit again. The site tests run each hook as the lift lowers it (`longshot-builder dev site-hooks`), and `tests/sitetable.py`, the old C emitter's copy, is retired. - **The whole lift** (`lift::whole`): discovery, sites, the units cut by compile cost, the function table, the image constants and import stubs, a per-unit cache; byte for byte the same on a second lift. The units' texts are not kept: the compile makes each when it needs it and gives it to clang on stdin (gen/ is 26 MB, not 5.7 GB). - **The compile** (`build-compile`): object keys by content only (the compiler's identity, the flags, the source, the headers its depfile names), an object store outside the game folder, a scheduler under the memory gate, the links skipped when nothing they read changed, the prebuilt third-party objects. Never-run functions at `-O0`, hot ones at `-O2`; the game's link orders its functions with lld's hfsort. - **The game files and the image** (`game-files`, `image`): the `.nup` read, checked and indexed, the modules unpacked (LZ4, ZBIC), the mods' ExeFS patches, the image. - **The game reads its RomFS from the player's `.nup`** (`host/romfs.{c,h}`, `host/romfs_index.c`): the game folder holds a 16 MB index, not a 26 GB copy; zstd-stored files are decoded when opened and the closed copies kept (256 MB at most). One RomFS API in the host, with a romfs folder as its second back end, and every host and renderer reader moved to it. `longshot-builder index --game <new.nup> --out <folder>` points a built folder at its `.nup` moved. - **The assets** (`build-assets`): the button prompts (font, textures with an ASTC encoder of our own), the texts, the shader list, the pipeline lists, the icon; made beside the lift and the compile, each cached by its inputs. - **The driver** (`build-driver`, `longshot-builder`): `build`, `update`, `check`, `index`, `share`, `stamps`, `perf-report`, `prepare`, `sources`, and one command per stage; a launcher's settings as flags (`--cache`, `--ngx-sdk`, `--builder-exe`; the variables still read for one release); the upscalers' runtimes (DLSS, FSR 4, XeSS) fetched by the builder with their licences accepted on the command line; the finish swaps every file in at once, or none. - **The shaders**: a first build prepares them beside the compile, under the build's memory gate, its progress said as it goes at the shader step; the built game's `--prepare-shaders` runs again only when the renderer, the shader list, the shipped pipeline states, the level or the drivers changed (`cache/longshot_prepared_key.txt`; the drivers read with no Vulkan call). A game folder's program cache begins from the one the last preparation left. - **The compile's giant functions**: two caps on LLVM's time and a mid IR split of functions too big for the compiler, so no one unit holds up the compile (the stage times are in Measurements). - **RecompLauncher's one program** (`src/play.rs`, `recomplauncher.json`): the zip holds `longshot-builder` once, as `Longshot.exe` (a windowed program: no console) or `Longshot.x86_64`. Started by that name with no command (or as `longshot-builder play`), it updates `Longshot/` beside it quietly and starts the game with every argument; a failed update starts the game the folder had. RecompLauncher's setup step builds with `--progress-lines`, its own line protocol. - **The release** (`longshot-builder dev release`, `build-linux.yml`, `build-windows.yml`, `release.yml`): one file per platform, its pack unpacked into the builder's cache on first use; `zstd --patch-from` deltas from the channel's last 5 releases, a manifest, and the RecompLauncher zip, made in the build jobs. `scripts/longshot_builder.py` keeps only what runs before there is a builder (building it, llvm-mingw, the built program's check). - **The build tools**: `longshot-builder dev tools` is `tools.lock`'s one implementation (check, install, make, publish); `scripts/tools.py` is gone, and `mise run tools` installs this system's into the checkout. - **dev.py and CI**: bases, packs and runtimes on the new builder's stores (`dev.py packs` asks the builder for its keys); dev builds keep their cache, data and work folders in the development folder and go through the job queue, except the Test Farm's; `dev.py bases --prune` lists and removes old dev data. CI checks the workspace and builds the synthetic game end to end (`builder/crates/synthetic-game`: a small AArch64 program of its own through every stage, run, then one instruction changed and only its unit compiled again). - **The root Cargo workspace** (from [#2411](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2411)'s work): the builder's crates and `longshot-rs`, the game's one Rust staticlib (empty for now), share one `Cargo.toml` and one `Cargo.lock` at the root; Cargo's target folder is the root's `target/`. - **Docs**: `docs/dev/reference/builder.md` (with diagrams of the stages, the lift and the cache keys), `build.md` (every variable the builder reads, by kind), `build-events.md`, `releases.md`, `architecture.md`, `hooks.md`, `using-mods.md`, and every page that named the old builder. **Tried and taken out:** - **Register calls** (guest registers passed between lifted functions in machine registers, then only what each callee's summary reads or writes): slower or the same in every scene (Kokiri Forest -8.4 %, Hyrule Field about -4 %, the Market the same, the 1 % lows worse) and 20 % more compile time, measured during development on an earlier head. All of it is gone; builder.md's "Still to come" keeps the numbers. - **`image.bin` mapped copy-on-write** (`HOS_IMAGE_MAP`): file-backed pages in the guest window kept a GPU pool over the image from being imported as a dma-buf or a userptr on AMD, for a start-up saving too small to keep it. The image is read into the window again, and `HOS_IMAGE_MAP` is a GONE row. - **The renderer's stage libraries and a split shader preparation**: measured on this PC and the lab, no gain kept; the code and its notes are not in this pull request. **The first two review rounds' fixes**, in brief: an untrusted `.nup`'s and the assets' sizes, tables and offsets bounded before use (BNTX, MSBT, fonts, PNG and JPEG, zstd frames), overflow checks on in release builds; no write through a link, and the player's dump never deleted; the finish's swap all or nothing, and a stopped swap made whole; one build at a time per game folder too; a panic is an `internal_error` event; Windows renames retried on sharing errors; discovery's jump table bounds, setjmp slots per guest context; the lifter's key holds its compiler, its crates and discovery's sources; the release's signing key removed however its step ends, and no CI cache holds anything compiled. **The third review round** (82 commits, `lpxlqvzx..xnrvuytn`): - **The lift**: a jump table's bound is no longer cut short by a shifted compare or a compare of another register; a devirtualised `BLR` compares the register with its usual address and calls the function it leads to; a vcall anchor takes the call's nearest write of its register; a relocation outside its own module is refused; a branch's weights fit LLVM's 32 bits; `recomp_sj_push`'s context is `captures(address)`; a setjmp owner with more than four setjmp calls stops the lift, naming it, instead of losing the rest; instrumentation is in each unit's key; the lifter's key reads the root `Cargo.lock`. The lifts' store keeps `LONGSHOT_LIFT_STORE_KEEP` lifts (3) under a lock. The semantics check also runs fixed edge states and random sequences of words against Unicorn. - **The game folder and the caches**: the game folder changes only at the swap (the romfs index, its note, the damaged list and the title staged); a romfs folder is removed only when it is the builder's own; licence notes move to a data folder (`LONGSHOT_DATA`), keyed by the record's id, the old cache notes read and moved; an update whose upscaler's licence is not accepted here builds without it and warns (`upscaler_dropped`); the cache prunes old pins, notes, layouts and the old builders' leftovers; a full drive is `disk_full` from any file's error; files installed from a read-only source come out writable. - **The build's processes**: no program a build starts outlives it (`PR_SET_PDEATHSIG` on Linux, a job object and `CREATE_NO_WINDOW` on Windows); clang runs without the variables no key holds; a unit's compile has an hour; a failed compile keeps the compiler's first error; the early shader preparation shares the build's memory gate, stops with a failed build and moves its caches across drives; a failed link drops only the objects at fault. - **Play and the shaders**: Play starts the game it had when an update fails, and says when the shaders will be prepared; the preparation's key holds no cache place; three translators' program cache copies are kept in the shader store, read and written under its lock; the program cache is locked across users on Windows with `LockFileEx`. - **The host**: Windows saves in `%APPDATA%\Longshot`, the old `<game>\user` moved there once (as on Linux), and `recomplauncher.json` lists that folder so RecompLauncher's backups follow; the game's path and its folder's buffers past 260 bytes (`longPathAware`); a headless game ends on SIGTERM again (SDL's signal handlers off before any subsystem starts); a refused setjmp push gets its thread's own buffer; RomFS reads: a file head that fails says -1, a `.zs` frame with no dictionary id falls back to its reader's, a prompts lookup near 2^64 does not wrap, a romfs folder is listed once a start; the builder refuses at build time the romfs index the game refuses. - **The command line**: a non-Unicode argument is a usage error, `--user` is recorded absolute, a non-Unicode HOME still finds the cache; the tools store's answer is there, missing or unreached. - **CI and the release**: the release builds restore no cache, make RecompLauncher's zip and upload `dist/` before their checks; `publish` and `tools-publish` compile no Rust (`tools-publish` uploads with `scripts/ci_tools_publish.py`, Python's standard library) and get their secrets in their steps only; the tools' licence downloads pinned by SHA-256; `dev release fetch-bases` goes through `RELEASE_UPLOAD_API` first; the rust jobs install clang, lld and llvm-mc, and the tests that need them fail without them; a Cargo-only change runs the Rust jobs on CircleCI. - **dev.py**: dev builds keep the builder's cache, licence notes and work folders in the development folder, go through the job queue (but the Test Farm's, which runs directly), and `dev.py bases --prune` removes old dev data. - **Code and tests**: one path check, one link check, one SHA-256 file helper, one switch parser; more of the builder's Python source checks became Rust tests in their crates; the docs' nits. Read first: `builder/README.md`, then `builder/crates/build-driver/src/build.rs`, `builder/crates/lift/src/whole/`, `builder/crates/mir/src/lib.rs`, `host/romfs.h`, `builder/crates/longshot-builder/src/play.rs`. ## Testing **Tested:** CachyOS Linux 7.3, this PC (Ryzen 9 7900X, 24 threads, RTX 3090), the release build; and the lab (RX 580, a hard drive). On the head after the third review round (`xnrvuytn` 97e3f4ee, one batched queue run, this PC; the head is now `mvtuxnow` 02386f32 on `main` 8aa5ab87, with the second review's fixes, and Measurements are at it): - `cargo fmt --check`, clippy with warnings as errors on Linux and for Windows (`x86_64-pc-windows-gnu`), the workspace's tests, and the synthetic game end to end: all pass. - `tests/run_all.py --strict`: 719 passed, 109 failed, 8 skipped. - 91 need the Vulkan or SPIR-V headers, which this PC lacks (`not found: vulkan_headers` / `spirv_headers`). - 9 are `main`'s known failures: `test_crt_options`, `test_guest_holes`, `test_menu_save_atomic`, `test_menu_text_field`, `test_pipeline_share`, `test_rdna2_mesh_only`, `test_readback_timeout_source`, `test_target_image_reuse`, `test_vibration_menu`. - 6 renderer fixture tests whose files are byte-identical to `main`'s and are believed to fail on `main`: `test_amd_subgroup_profiles`, `test_shader_profile_caps`, `test_flat_map`, `test_wb_spans`, `test_vram_compact`, `test_rumble_menu`. - 3 failed on this branch (`test_mise_build`, `test_dev_packs`, `test_log_redact`), were fixed, and pass on the head. - A real game build from nothing (the `.nup`, a new cache, data folder, store and shader store; no upscaler): 318 s wall clock, 145 s of it the builder's stages and 171 s the wait for the shaders prepared beside the compile (shared mode; the timed numbers are in Measurements). The lift took 4.6 s for 294,518 functions; 903 units compiled. The early shader progress streamed through the wait. - All 132 hook sites resolved identically to the builder before this round (`dev sites`, no diff). - An update with nothing changed: 5.3 s, everything kept, the shaders kept by their key. - A smoke run of the built game (headless, a Kokiri save) reached play at 60 fps, no errors, no draws left out. At `02386f32` (2026-11-24, Measurements): this PC's folders, from a cold build with and without the shaders, played all five scenes in 15 timed runs and started to the title 3 times; the lab's folder from a cold build played the five scenes once each, and its `3ca9b9d8` folder 15 more times: every run on the 1080p rule, no pipeline waits, no error in the game's logs. Earlier, on heads before this round: - **In the game, this PC:** folders built by the new builder played in the four A/B scenes against main, 3 runs a side, the RomFS read from the `.nup` through the index (those numbers are replaced by Measurements). - **In the game, the lab (RX 580, HDD), at `27b6fbcd`:** a first build (741.5 s: 486 s the builder's stages, 248 s the wait for the shaders), an update (12.5 s) and a smoke run to play. - On the game's own files, on this PC (nothing of them leaves it): `image.bin` and `image.json` byte for byte the old builder's; every RomFS file read through the index the same as the old builder's extraction; the lift's 294,518 functions, two lifts byte for byte the same, one site changed lifting one unit; the assets against the old builder's (the shader list, the pipeline list, the prompts' layouts byte for byte; the textures within the rasteriser's hinting). **Still to test:** - Windows, NVIDIA and AMD: a first build, an update and a run to play, expecting what Linux shows (`@Beanstalk` once Beanstalk [#143](https://git.magicbean.dev/MagicBeanDev/Beanstalk/pulls/143) is in; until this merges the farm cannot build main's side, so by hand until then). - Windows, by hand: RecompLauncher's start program (`Longshot.exe` opens no console window, the setup's progress streams, a failed update still starts the game), the saves moved once from `<game>\user` to `%APPDATA%\Longshot`, a game folder past 260 characters, and two users on one shader store (`LockFileEx`). - The 6 renderer fixture tests above, on `main`, expecting them to fail there too (by hand). This is the gate before it leaves WIP. ## Measurements **Verdict:** on this PC a first build from nothing takes 124 s instead of 554 s without the shaders and 332 s instead of 669 s with them, with 6.1 GB of peak RAM instead of 15.6 GB and a 1.65 GB game folder instead of 28 GB; a second game folder on the same caches takes 26 s instead of 70 s (59 s instead of 117 s with the shaders), a mod's ExeFS code patch 15 s instead of 123 s. In play fps is higher in all five scenes, clearly in three of them (Kakariko +5.5 %, Kokiri Forest +7.6 %, Fire Temple +16 %; Hyrule Field +1.4 % and the Market +4.2 % within the runs' spread), the game's own CPU time per frame 14 to 44 % lower and every 1 % low higher. On the AMD lab the build is 3.5 times faster (844 s instead of 2,987 s); its play is GPU-bound and the same within the spread. The first start after a build is the same, and memory in play within 5 %. **Setup:** this PC: CachyOS (Linux 7.3.3), Ryzen 9 7900X (24 threads), 31 GB of RAM (12 to 13 GB of swap in use the whole time), RTX 3090 on NVIDIA 620.70.06, an NVMe drive (btrfs on LUKS). The lab: the same OS and kernel, i7-9700K (8 threads, its clock swinging 0.8 to 4.7 GHz), 15 GB, RX 580 on RADV (Mesa 26.2.6), a drive the system reports as rotational (the builders warn of a hard drive). `main` @ 8aa5ab87 (built from 90fae88c, the same tree but `.tooling-rev`) with its own `nx2/make_game.py`, against this pull request @ 02386f32 (the head after the second review's fixes), 2026-11-24, unless a table says otherwise. - **Builds** (this PC through the queue in timing mode with all 24 CPUs, nothing beside them; the lab alone, nothing else running). **Cold**: every cache new for the run (main: work, lift store, object store, XDG cache, shader store; #2286: work, store, builder cache, data folder, shader store; both: new NVIDIA and Mesa cache folders, so the drivers' caches were cold); the OS page cache was not dropped (no root), so the `.nup` (25 GB) may have been partly in RAM. **Hot**: the same build again into a new game folder and work folder with every cache of a cold run kept (what a second game folder or a reinstall costs). DLSS in both sides' builds here (`--upscaler dlss`; main through `LONGSHOT_NGX_SDK`), none on the lab. Wall clock, CPU time (user + system of the whole process tree), peak RAM (the PC's used memory above where it stood at the start), bytes written to disk, from a wrapper sampling every 0.5 s; the stages from main's "where the time went" and #2286's `build_times.json` and events. Median (min-max). - **fps**: the 1080p rule (output 1920x1080, Render resolution 100 %, upscaler Off, uncapped, V-Sync Off, frame generation Off, preset Custom, a fresh options file each run; every run's option read-back and log checked: 30 of 30 here and every lab run on the rule). Headless, the repository's Kokiri save, the scene's teleport, warmed until 5 s pass with no pipeline made or waited for (at least 20 s), then 50 s measured from the frame trace. 3 interleaved pairs per scene (main, #2286), the timing queue (the game on CPUs 0-5,12-17; the queue's noise check: no build outside it, CPU pressure at most 6 %), each side's folder its cold build with the shaders, with its own driver cache. 1 % low = 1000 / the 99th percentile frame time, 0.1 % low the same at the 99.9th. Game CPU = the game process's CPU time over the stretch, in cores; GPU busy and memory from `nvidia-smi` each second (the lab: amdgpu's `gpu_busy_percent`, VRAM from the process's DRM fdinfo); CPU clock the mean of every core's, each second. Each cell main → #2286. The headline numbers (medians; the tables below give each run count and spread): | This PC unless named | Before: main @ 8aa5ab87 | After: this PR @ 02386f32 | |---|---|---| | First build, cold, without the shaders | 554 s | 124 s | | First build, cold, with the shaders (the default) | 669 s | 332 s | | Peak RAM of a cold build without the shaders (added) | 15.6 GB | 6.1 GB | | Game folder | 28.0 GB | 1.65 GB | | A second game folder on the same caches (hot), with the shaders | 117 s | 59 s | | An update after a mod's ExeFS code patch | 123 s | 14.8 s | | An update with nothing changed | 4.7 s | 4.1 s | | First start to the title after a build with the shaders | 8.8 s | 8.5 s | | fps, Hyrule Field / Market / Kakariko / Fire Temple / Kokiri Forest | 132.0 / 101.7 / 108.5 / 107.1 / 135.2 | 133.9 / 106.0 / 114.5 / 124.4 / 145.5 | | 1 % low, the same scenes | 108.2 / 76.5 / 86.3 / 84.4 / 109.5 | 111.6 / 79.8 / 90.3 / 90.9 / 128.7 | | The lab: first build, cold, with the shaders | 2,987 s | 844 s | | The lab: fps, Hyrule Field / Market / Kakariko (fps at 3ca9b9d8) | 49.9 / 42.7 / 44.8 | 51.0 / 42.2 / 46.0 | ### This PC (RTX 3090): main @ 8aa5ab87 against #2286 @ 02386f32, 2026-11-24 **First builds and hot builds** (main's cold runs without the shaders: two in a job at 01:37 and one at 03:00, the same code; everything else in one job per row group, main and #2286 interleaved where both ran): | No shader preparation | main, cold | #2286, cold | main, hot | #2286, hot | |---|---|---|---|---| | Runs | 3 | 2 | 3 | 3 | | Wall clock (s) | 554 (428-686) | 124 (123-125) | 70 (57-89) | 26 (26-31) | | CPU time (s, user + system) | 4758 (3689-5704) | 2209 (2197-2221) | 77 (75-77) | 184 (180-190) | | Peak RAM added (GB) | 15.6 (15.4-15.9) | 6.1 (5.9-6.3) | 3.5 (2.9-3.7) | 2.5 (1.6-2.5) | | Written to disk (GB) | 34.2 (34.2-34.2) | 2.8 (2.8-2.8) | 28.1 (28.0-28.1) | 1.7 (1.7-1.7) | | Read the game files (s) | 1 (1-7) | 1 (1-1) | 0 (0-1) | 2 (1-2) | | Lift (s) | 108.0 (90.0-127.0) | 4.5 (4.5-4.5) | 50.0 (38.0-68.0) | 0.2 (0.1-0.2) | | Compile and link (s) | 430 (325-534) | 116 (115-117) | 7 (7-8) | 22 (22-26) | | Finish (s) | 14 (12-18) | 2 (2-2) | 12 (12-12) | 2 (2-4) | | Shaders after the builder's stages (s) | 0 (0-1) | 0 (0-0) | 0 (-0-1) | 0 (0-0) | | Game folder (GB) | 28.00 (28.00-28.00) | 1.65 (1.65-1.65) | 28.00 (28.00-28.00) | 1.65 (1.65-1.65) | | With the shaders | main, cold | #2286, cold | #2286, cold, `LONGSHOT_PREPARE_EARLY=0` | main, hot | #2286, hot | |---|---|---|---|---|---| | Runs | 2 | 2 | 1 | 3 | 3 | | Wall clock (s) | 669 (651-687) | 332 (331-332) | 343 | 117 (117-129) | 59 (58-61) | | CPU time (s, user + system) | 6854 (6763-6945) | 5105 (5088-5123) | 5069 | 663 (662-674) | 454 (448-459) | | Peak RAM added (GB) | 15.0 (14.9-15.1) | 10.3 (9.6-11.0) | 9.7 | 8.3 (8.0-8.8) | 8.0 (7.0-8.3) | | Written to disk (GB) | 41.4 (41.4-41.5) | 10.2 (10.2-10.2) | 10.2 | 30.4 (30.4-30.5) | 4.3 (4.3-4.3) | | Read the game files (s) | 1 (1-1) | 1 (1-1) | 1 | 1 (1-1) | 1 (1-3) | | Lift (s) | 97.5 (97.0-98.0) | 4.5 (4.4-4.5) | 4.5 | 38.0 (37.0-48.0) | 0.2 (0.2-0.2) | | Compile and link (s) | 332 (325-340) | 119 (118-119) | 115 | 8 (8-8) | 23 (20-23) | | Finish (s) | 12 (12-13) | 3 (3-3) | 2 | 12 (12-12) | 2 (2-3) | | Shaders after the builder's stages (s) | 225 (216-235) | 205 (204-205) | 221 | 59 (58-60) | 31 (30-37) | | Game folder (GB) | 30.48 (30.48-30.48) | 4.14 (4.14-4.14) | 4.13 | 30.46 (30.46-30.46) | 4.12 (4.12-4.12) | #2286's lift is 4.5 s for all 294,518 functions (discovery 2.1 s of it: 17.6 million instructions, 1,474 jump tables), about 65,000 functions a second; 386 lift units, 903 compile units, 132 hook sites placed, 99 functions edited. The compilers' CPU time summed: #2286 2,001 to 2,065 s for the host and game and 328 to 376 s for the renderer; main 3,118 to 5,402 s and 255 to 419 s. The executable is 817 MB (.text 760 MB) against main's 612 MB (.text 548 MB); the renderer 18.5 MB on both. Caches after a cold build with the shaders: #2286 6.3 GB (store 1.1 GB, shader store 3.9 GB, NVIDIA's 1.3 GB), main 7.7 GB (lift store 1.8 GB, object store 0.9 GB, shader store 3.7 GB, NVIDIA's 1.3 GB). A hot build with the shaders: #2286 translates no shader program again (its program cache comes from the shader store) and builds the 38,396 noted pipelines in 15 s; main translates all 46,667 again (42 s). main's cold runs spread widely (428 to 687 s): its compile used up to 15.9 GB more RAM on a PC with 16 GB available. **What a change rebuilds** (an update after each change, the run-2 folder of the cold builds without the shaders, 3 runs where the row says so; wall clock, median (min-max)): | Change | main | #2286 | #2286: units compiled | |---|---|---|---| | Nothing (3) | 4.7 s (4.0-6.3) | 4.1 s (3.9-4.5) | 0 of 903 | | A comment appended to `host/hos_main.c` (3) | 5.0 s (4.5-6.6) | 6.6 s (5.6-8.1) | 3 (main's keys read the preprocessed text, so a comment compiles nothing new there; #2286's hold the source) | | A mod's ExeFS code patch, one instruction, a different one each run (3) | 123 s (116-197): the whole lift again | 14.8 s (13.6-15.1): 1 to 5 of 386 lift units | 1, 1, 4 | | A mod's ExeFS data patch into relocated words (3; the first follows the code patch's removal) | 4.5 s (4.4-100.2) | 4.8 s (4.8-12.0) | 0 | | The patches removed | 4.0 s | 3.8 s | 0 | | A mod's RomFS file added, then removed (3 each) | 4.1 s / 4.1 s | 3.7 s / 3.7 s | 0 | | #2286: a cold build stopped 60 s into its compile (210 units done), run again | | 75.5 s | the other 693 | **The first start after a build** (headless 1080p, to the title screen's first frame; the timing queue's 12 CPUs): | | main | #2286 | |---|---|---| | After a build without a preparation, NVIDIA's cache empty | 380.5 s (38,809 programs translated in 106 s, the 38,021 noted pipelines built in 269 s on 10 threads) | 381.0 s (the same work, 270 s) | | The start after that one | 5.2 s | 5.2 s | | After a build with the preparation (its NVIDIA cache) | 8.8 s (the 38,021 noted pipelines loaded from the driver's cache in 3.8 s) | 8.5 s (3.7 s) | **fps** (3 interleaved pairs per scene; each cell main → #2286, median (min-max)): | Scene (runs main / PR) | fps | 1 % low | 0.1 % low | frame time p50 (ms) | p99 (ms) | |---|---|---|---|---|---| | Hyrule Field (3 / 3) | 132.0 (117.9-132.7) → 133.9 (125.1-134.7) | 108.2 (81.5-110.7) → 111.6 (93.6-113.2) | 92.8 (42.7-101.4) → 100.6 (46.9-101.6) | 7.51 (7.49-8.27) → 7.40 (7.37-7.91) | 9.24 (9.03-12.27) → 8.96 (8.83-10.68) | | Market (3 / 3) | 101.7 (91.5-102.0) → 106.0 (95.9-108.4) | 76.5 (59.1-76.8) → 79.8 (70.0-80.6) | 64.6 (37.1-69.0) → 71.3 (37.2-72.9) | 9.79 (9.71-10.71) → 9.21 (8.93-10.46) | 13.08 (13.03-16.91) → 12.53 (12.41-14.28) | | Kakariko (3 / 3) | 108.5 (108.2-110.0) → 114.5 (114.2-115.6) | 86.3 (81.4-89.8) → 90.3 (89.3-93.1) | 64.8 (60.1-77.2) → 77.7 (60.4-78.9) | 9.24 (9.11-9.36) → 8.43 (8.39-8.46) | 11.59 (11.14-12.29) → 11.07 (10.74-11.20) | | Fire Temple (3 / 3) | 107.1 (106.9-109.2) → 124.4 (124.0-125.6) | 84.4 (84.1-85.8) → 90.9 (90.4-91.9) | 59.1 (58.1-59.1) → 64.3 (58.6-67.2) | 9.28 (9.09-9.30) → 7.96 (7.88-7.98) | 11.85 (11.65-11.89) → 11.00 (10.88-11.06) | | Kokiri Forest (3 / 3) | 135.2 (135.2-135.3) → 145.5 (144.9-147.9) | 109.5 (108.2-109.9) → 128.7 (119.2-130.6) | 99.3 (98.5-99.7) → 112.9 (107.6-122.8) | 7.22 (7.21-7.24) → 6.81 (6.66-6.99) | 9.13 (9.10-9.24) → 7.77 (7.66-8.39) | | Scene | game ms | draw ms | wait for the GPU (ms) | wait for the main thread (ms) | game CPU (cores) | GPU busy % | CPU clock (MHz) | |---|---|---|---|---|---|---|---| | Hyrule Field | 6.40 (6.16-7.99) → 4.43 (4.42-6.21) | 2.63 (2.62-3.04) → 2.60 (2.56-2.95) | 0.55 (0.18-0.66) → 1.46 (0.80-1.49) | 0.53 (0.20-0.63) → 1.43 (0.88-1.48) | 3.96 (3.95-4.93) → 3.74 (3.71-4.90) | 75 (67-75) → 76 (71-76) | 4838 (4662-5286) → 4766 (4699-5274) | | Market | 7.84 (7.81-8.89) → 6.27 (6.24-6.95) | 5.26 (5.26-5.88) → 5.17 (5.01-5.79) | 0.93 (0.89-0.94) → 1.52 (1.44-1.62) | 0.95 (0.94-0.96) → 1.54 (1.45-1.65) | 4.85 (4.81-4.89) → 4.78 (4.75-4.93) | 58 (52-58) → 61 (56-62) | 4889 (4660-5228) → 4791 (4773-5185) | | Kakariko | 6.42 (6.01-6.49) → 5.07 (5.05-5.08) | 4.98 (4.87-5.06) → 4.50 (4.43-4.51) | 1.33 (1.30-1.57) → 1.79 (1.74-1.79) | 1.33 (1.29-1.56) → 1.79 (1.74-1.80) | 4.38 (4.35-4.42) → 4.24 (4.22-4.24) | 69 (68-69) → 73 (73-73) | 4775 (4710-4890) → 4782 (4767-4918) | | Fire Temple | 9.19 (9.01-9.20) → 7.86 (7.78-7.89) | 2.54 (2.45-2.74) → 2.55 (2.53-2.62) | 0.00 (0.00-0.01) → 0.01 (0.01-0.02) | 0.03 (0.03-0.04) → 0.04 (0.04-0.06) | 4.69 (4.66-4.76) → 4.93 (4.92-5.04) | 51 (50-52) → 59 (59-59) | 4797 (4767-4809) → 4809 (4796-4812) | | Kokiri Forest | 7.18 (7.17-7.19) → 4.04 (3.84-5.97) | 2.34 (2.33-2.35) → 2.29 (2.18-2.33) | 0.05 (0.04-0.06) → 1.32 (0.40-1.49) | 0.05 (0.04-0.06) → 1.32 (0.39-1.50) | 4.63 (4.62-4.64) → 3.83 (3.76-4.59) | 65 (65-65) → 72 (70-74) | 4781 (4705-4815) → 4749 (4685-4753) | **Memory in play** (at the end of each measured stretch: the game's RSS, its video memory from `nvidia-smi`), with the stretch's long frames and pipeline waits: | Scene | RSS (MB) | VRAM (MB) | frames of 50 ms or more | pipeline waits | |---|---|---|---|---| | Hyrule Field | 10637 (10399-10880) → 11093 (10712-11194) | 7738 (7660-7818) → 8008 (7890-8048) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | | Market | 11743 (11653-12034) → 11700 (11454-11980) | 7869 (7861-7999) → 7777 (7715-8057) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | | Kakariko | 10974 (10943-11198) → 11318 (11101-11413) | 7475 (7443-7793) → 7603 (7452-7667) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | | Fire Temple | 11459 (11358-11933) → 11720 (11604-11724) | 8123 (8091-8225) → 8157 (8095-8189) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | | Kokiri Forest | 10292 (10274-10651) → 10613 (10554-10654) | 5574 (5472-5700) → 5885 (5472-5981) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | Hyrule Field's and the Market's first pair ran slower on both sides (the first game runs of the job); the medians and the other two pairs agree. The game ms falls 14 to 44 %; fps follows it where the frame waits on the game's threads (Fire Temple, Kokiri Forest, Kakariko); in Hyrule Field and the Market the GPU and the renderer's side hold the frame and fps moves within the spread. ### The AMD lab (RX 580, RADV): main @ 90fae88c (= 8aa5ab87 but `.tooling-rev`) against #2286, 2026-11-24 **Builds** at 02386f32, the lab alone (main's "read the game files" is its RomFS copy onto the drive): | The lab, with the shaders | main, cold | #2286, cold | main, hot | #2286, hot | |---|---|---|---|---| | Runs | 2 | 2 | 3 | 3 | | Wall clock (s) | 2987 (2945-3028) | 844 (836-852) | 1893 (1890-1907) | 265 (227-285) | | CPU time (s, user + system) | 8433 (8427-8440) | 4871 (4870-4872) | 911 (899-917) | 402 (370-416) | | Peak RAM added (GB) | 13.0 (13.0-13.0) | 6.6 (6.6-6.7) | 5.9 (5.8-5.9) | 6.2 (5.9-6.4) | | Written to disk (GB) | 40.2 (40.1-40.2) | 8.5 (8.5-8.6) | 29.9 (29.8-29.9) | 3.3 (3.3-3.3) | | Read the game files (s) | 1538 (1496-1579) | 6 (6-6) | 1587 (1556-1589) | 5 (5-6) | | Lift (s) | 133.5 (130.0-137.0) | 8.7 (8.7-8.7) | 8.0 (8.0-10.0) | 0.3 (0.3-0.3) | | Compile and link (s) | 818 (818-819) | 388 (379-398) | 25 (22-25) | 67 (61-67) | | Finish (s) | 54 (52-56) | 10 (9-12) | 51 (43-55) | 92 (53-101) | | Shaders after the builder's stages (s) | 436 (435-436) | 431 (427-434) | 239 (226-242) | 107 (102-112) | | Game folder (GB) | 29.38 (29.38-29.38) | 3.02 (3.02-3.02) | 29.38 (29.38-29.38) | 3.02 (3.02-3.02) | | The lab, no shader preparation | main, cold | #2286, cold | |---|---|---| | Runs | 1 | 1 | | Wall clock (s) | 2668 | 405 | | CPU time (s, user + system) | 6062 | 2495 | | Peak RAM added (GB) | 13.1 | 4.0 | | Written to disk (GB) | 34.6 | 2.8 | | Read the game files (s) | 1644 | 6 | | Lift (s) | 134.0 | 8.7 | | Compile and link (s) | 821 | 387 | | Finish (s) | 67 | 3 | | Game folder (GB) | 27.94 | 1.57 | An update with nothing changed (3 runs, with the shaders kept by their key): main 114 s (112-141), #2286 16 s (14-26). **fps** at 3ca9b9d8 (the head before the second review's fixes; its play-side changes since are small: the setjmp slot, the program cache's lock and copy), 3 interleaved pairs per scene (Hyrule Field's and the Market's first #2286 run lost to a teleport limit since fixed, run again as a fourth pair), main's folder the one ~/lb-2286 built at 90fae88c (with the shaders), #2286's a build at 3ca9b9d8 with the shaders: | Scene (runs main / PR) | fps | 1 % low | 0.1 % low | frame time p50 (ms) | p99 (ms) | |---|---|---|---|---|---| | Hyrule Field (4 / 3) | 49.9 (49.5-50.5) → 51.0 (50.6-51.6) | 30.4 (29.3-46.6) → 47.6 (41.7-48.9) | 27.1 (26.7-27.7) → 27.8 (26.9-46.8) | 19.85 (19.76-19.96) → 19.59 (19.50-19.62) | 32.94 (21.44-34.15) → 21.01 (20.47-23.99) | | Market (4 / 3) | 42.7 (41.5-44.5) → 42.2 (41.3-44.2) | 22.1 (18.5-36.7) → 24.5 (23.7-34.6) | 16.5 (16.1-16.5) → 17.3 (16.4-18.7) | 22.73 (21.95-23.54) → 23.31 (21.86-23.85) | 45.17 (27.22-54.09) → 40.87 (28.89-42.15) | | Kakariko (3 / 3) | 44.8 (43.8-44.9) → 46.0 (44.9-46.0) | 28.3 (24.6-39.3) → 35.8 (19.6-36.5) | 18.7 (18.3-18.9) → 18.4 (17.8-18.6) | 22.06 (21.91-22.39) → 21.44 (21.42-21.64) | 35.30 (25.45-40.59) → 27.97 (27.41-50.94) | | Fire Temple (3 / 3) | 29.5 (24.6-41.2) → 32.2 (24.1-46.3) | 17.1 (16.9-17.1) → 21.7 (21.1-23.3) | 15.2 (14.2-16.3) → 20.3 (18.3-20.7) | 27.99 (15.23-50.69) → 30.81 (19.47-41.66) | 58.58 (58.36-59.01) → 46.00 (42.98-47.38) | | Kokiri Forest (3 / 3) | 28.6 (20.1-53.7) → 27.5 (24.0-44.2) | 17.3 (17.1-49.0) → 18.7 (17.8-34.4) | 16.3 (16.3-41.1) → 16.5 (16.0-28.7) | 45.63 (18.63-49.63) → 38.94 (22.86-40.62) | 57.91 (20.41-58.52) → 53.44 (29.05-56.18) | | Scene | game ms | draw ms | wait for the GPU (ms) | wait for the main thread (ms) | game CPU (cores) | GPU busy % | CPU clock (MHz) | |---|---|---|---|---|---|---|---| | Hyrule Field | 6.11 (4.99-7.34) → 1.08 (0.19-1.66) | 4.92 (4.59-5.08) → 4.48 (4.24-4.62) | 6.79 (6.25-7.23) → 9.03 (8.79-9.25) | 6.88 (6.34-7.32) → 9.25 (9.05-9.70) | 2.55 (2.44-2.64) → 2.23 (2.10-2.26) | 86 (84-90) → 91 (89-92) | 2804 (2666-2978) → 3010 (2926-3172) | | Market | 8.61 (5.26-11.40) → 4.76 (2.77-6.51) | 9.78 (8.55-10.77) → 10.29 (8.62-11.26) | 7.08 (6.07-8.31) → 9.26 (8.69-9.62) | 7.28 (6.19-8.49) → 9.53 (8.96-10.06) | 3.54 (3.23-3.80) → 3.27 (3.02-3.48) | 82 (76-86) → 77 (77-82) | 3106 (2759-3556) → 2754 (2561-3362) | | Kakariko | 5.62 (4.86-7.17) → 1.02 (0.86-1.50) | 8.40 (8.26-9.29) → 7.57 (7.47-8.11) | 8.14 (7.63-8.51) → 9.81 (9.77-10.10) | 8.22 (7.64-8.58) → 10.69 (10.59-10.72) | 2.93 (2.88-3.11) → 2.55 (2.51-2.63) | 86 (79-90) → 90 (89-93) | 3025 (2732-3326) → 3542 (3302-3607) | | Fire Temple | 32.69 (18.37-38.17) → 29.71 (19.58-39.87) | 9.96 (5.94-11.35) → 10.86 (7.34-14.86) | 0.76 (0.14-2.69) → 0.08 (0.05-0.70) | 0.80 (0.22-2.75) → 0.23 (0.13-0.76) | 4.48 (4.02-4.61) → 4.73 (4.54-4.79) | 51 (29-60) → 43 (38-75) | 1314 (1227-2650) → 1259 (875-1865) | | Kokiri Forest | 28.81 (4.22-47.89) → 33.78 (14.49-39.60) | 8.02 (3.98-12.14) → 10.82 (7.38-12.33) | 2.61 (0.12-7.02) → 0.55 (0.06-3.75) | 2.67 (0.15-7.11) → 0.58 (0.19-3.81) | 3.62 (2.48-3.86) → 4.15 (3.53-4.23) | 43 (29-93) → 55 (44-71) | 1490 (875-2907) → 1016 (875-1587) | | Scene | RSS (MB) | VRAM (MB) | frames of 50 ms or more | pipeline waits | |---|---|---|---|---| | Hyrule Field | 6459 (6325-6504) → 6724 (6585-6726) | 6008 (5949-6274) → 5949 (5793-6291) | 0 (0-0) → 0 (0-0) | 0 (0-0) → 0 (0-0) | | Market | 7630 (7596-7665) → 7732 (7579-7755) | 5876 (5542-6102) → 5829 (5781-6177) | 17 (9-37) → 12 (7-16) | 0 (0-0) → 0 (0-0) | | Kakariko | 7019 (7005-7047) → 7080 (7061-7128) | 5854 (5831-5978) → 5919 (5834-6017) | 14 (9-16) → 16 (13-30) | 0 (0-0) → 0 (0-0) | | Fire Temple | 6633 (6558-6679) → 6700 (6596-6711) | 5834 (5819-6050) → 5953 (5806-6242) | 417 (307-675) → 2 (0-4) | 0 (0-0) → 0 (0-0) | | Kokiri Forest | 6276 (6272-6294) → 6399 (6381-6555) | 5701 (5552-5918) → 5789 (5566-5819) | 354 (0-461) → 23 (0-57) | 0 (0-0) → 0 (0-0) | One confirming pair per scene at 02386f32 (its cold build's folder; single runs, the CPU's clock main → #2286 in the last column): | Scene (runs main / PR) | fps | 1 % low | 0.1 % low | frame time p50 (ms) | p99 (ms) | CPU clock (MHz) | |---|---|---|---|---|---|---| | Hyrule Field (1 / 1) | 50.4 → 49.6 | 29.5 → 28.5 | 27.7 → 26.0 | 19.58 → 19.85 | 33.94 → 35.14 | 2972 → 2854 | | Market (1 / 1) | 44.6 → 41.0 | 35.9 → 18.9 | 16.9 → 15.9 | 21.95 → 23.34 | 27.86 → 53.06 | 3546 → 2648 | | Kakariko (1 / 1) | 45.0 → 45.5 | 26.1 → 19.0 | 18.2 → 17.6 | 21.82 → 21.31 | 38.28 → 52.57 | 3436 → 3690 | | Fire Temple (1 / 1) | 25.0 → 51.5 | 17.6 → 24.1 | 16.8 → 19.7 | 38.97 → 18.81 | 56.75 → 41.40 | 1184 → 2004 | | Kokiri Forest (1 / 1) | 37.8 → 35.6 | 24.4 → 25.1 | 22.7 → 20.9 | 20.77 → 27.18 | 40.96 → 39.76 | 1702 → 1055 | The lab is GPU-bound in Hyrule Field, the Market and Kakariko (77 to 93 % busy): at 3ca9b9d8 fps there is +2 %, -1 % and +3 %, within the spread, and the 1 % lows higher in all three. The confirming pairs at 02386f32 land in the same spread (fps within 1 % in Hyrule Field and Kakariko; the Market's #2286 run had the CPU at 2.6 GHz against main's 3.5 GHz, and its 1 % low and Kakariko's are lower in this one pair). In the Fire Temple and Kokiri Forest the CPU's clock fell to 0.9 to 2 GHz on either side (the GPU 30 to 78 % busy), so those two scenes measure the lab's clock more than the build; #2286 had far fewer frames of 50 ms or more there. The lab's game ms reads much lower for #2286 than for main (the frame trace's `game_ms`), a larger gap than this PC shows; it is reported as logged. Numbers measured on earlier heads (07b2046a/f14c2d29 and 0fc27a42 on this PC, 27b6fbcd and 1b0e298b on the lab) are replaced by the tables above. ## Risks For players: - **Every build runs the new builder** once this merges; there is no old path to fall back to. The host changes reach every game: RomFS reads go through `host/romfs.c`, the prompts through `prompts/*.base`, the renderer's host API is version 47. A revert is the way back. - **Every player lifts and compiles everything once** (new keys): the first update after this takes as long as a first build, the shaders included. - **The `.nup` must stay where it is:** a game built by `longshot-builder` reads its RomFS from it. Moved or deleted, the game says so (`nup_moved`); `longshot-builder index --game <new.nup> --out <folder>` points the folder at a moved one (the same `.nup` only), and the launcher builds again. - **Accepted licences moved** to a data folder of their own (`LONGSHOT_DATA`, else `~/.local/share/longshot-builder` or `%LOCALAPPDATA%\Longshot\Builder-data`), out of the cache a launcher or a player empties. The old notes in the cache are read and moved at the next build. An update whose upscaler's licence is not found builds without it and warns. - **Windows saves move once** from `<game>\user` to `%APPDATA%\Longshot` (the Longshot Launcher's place), by the same rules as Linux: an entry already there, or one that cannot move, keeps the old place whole. `longshot_options.ini` stays in the game folder. RecompLauncher's save list (`recomplauncher.json`) names the new folder. - **`longshot_mods.txt`:** The game no longer reads `longshot_mods.txt`, where much older builds kept the mods' order and switches. A game folder that still has one and never made a `mods.json` from it (no `longshot_mods.txt.imported` beside it) starts with every mod on, in path order; set the order and switches again once on the Mods tab. - **A setjmp owner with more than 4 setjmp calls is now refused** (the lift stops, naming it) instead of losing the rest; the game has none. - **Never run on Windows:** the new Windows-only code is built (llvm-mingw, `-Werror`) and passes clippy for Windows, but has not run there: the job objects and `CREATE_NO_WINDOW` for the build's children, the saves move, the wide paths past 260 characters (`longPathAware`), `LockFileEx` on the program cache, and the windowed `Longshot.exe` (its hidden console and message boxes). - **ZBIC:** `game-files/src/zstd.rs` decodes it in Rust, written from the format's description (no code copied; its table generated and checked against Atmosphere-NX's). - **Switches:** the `HOS_*` switches the description check names (HOS_DISCORD, HOS_FPS_MAX, ...) came with #2272's hook sites and keep their defaults. `HOS_IMAGE_MAP` is gone (a GONE row). The new builder's own environment variables (`LONGSHOT_CACHE`, `LONGSHOT_DATA`, `LONGSHOT_STORE`, `LONGSHOT_JOBS`, `LONGSHOT_MEM_*`, `LONGSHOT_LIFT_STORE_KEEP`) are the command's; `HOS_GUEST_PROFILE` (unset: nothing) records a profile. For whoever merges: - **It ships with LongshotLauncher [#259](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/259)**, which passes this pull request's flags, and the Test Farm builds it after Beanstalk [#143](https://git.magicbean.dev/MagicBeanDev/Beanstalk/pulls/143). - **The release workflows changed:** release builds restore and save no cache; RecompLauncher's zip is made in the build jobs and only checked by `publish`; `publish` and `tools-publish` compile no Rust on the deploy runner (`tools-publish` uploads with `scripts/ci_tools_publish.py`, Python's standard library), their secrets given to their steps only. The first nightly after the merge is their first real run. CircleCI's release stage makes no RecompLauncher zips yet (a TODO there). - **CI's rust jobs now need clang, lld and llvm-mc** (installed from the distribution in both CIs); `compile_link` and `llvm_mc` fail without them. - **The root Cargo workspace:** Cargo's target folder is the root's `target/`, and `Cargo.toml`, `Cargo.lock` and `longshot-rs/` are build inputs; a checkout that built in `builder/target` builds again. **What still waits:** - The Windows runs in Still to test, and the Test Farm's on Windows and AMD (Beanstalk [#143](https://git.magicbean.dev/MagicBeanDev/Beanstalk/pulls/143)). - Later, not in this pull request: the build tools' compiler built from the pinned LLVM source with only the targets the build needs (builder.md, "Still to come"). ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). On this head: 719 passed; 91 could not run here (no Vulkan or SPIR-V headers on this PC), 9 are `main`'s and named, and 6 renderer fixture tests are believed to fail on `main` but not yet run there (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. (`third_party/` only loses `a64-kit`, the old lifter's, with it, and some `PROVENANCE.md` notes name the new builder; no upstream code changed.) ### 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] `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. (Built, not run on Windows: 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. Windows has not run. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). Windows NVIDIA and AMD not yet. - [ ] 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(lifter): the new lifter's Rust workspace and its A64 decoder, checked word for word against llvm-mc
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 14s
CI / Conventional Commit title (pull_request) Successful in 17s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 25s
CI / Workflow lint (actionlint) (pull_request) Successful in 25s
Third-party parts / As their notes say (pull_request) Successful in 29s
CI / Website build and checks (pull_request) Failing after 41s
7b3d609aaf
The first step of the lifter rewrite (lifter/README.md): a Cargo workspace beside nx2, standard library only, with
crates/a64 (an instruction word to a typed Insn, and Insn::flow() for discovery) and crates/longshot-lift (the command
make_game.py will call; for now decode <hex word>). It decodes the A78C's Armv8.2-A with LSE, RCpc, FlagM, PAuth and
CRC32; the SIMD and FP data-processing groups are Insn::Simd until the float semantics.

tests/test_lifter.py runs cargo test: the decoder against llvm-mc -mcpu=cortex-a78c -M no-aliases on random words in
every encoding group (0.8 million by default, 8.3 million run here, no difference), plus unit tests. run_all finds
cargo and llvm-mc as two new placeholders. Not part of a game build yet.

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

Possibly related, for context:

  • PR #1798 test(lift): scripts/lift_parity.py, the translation of two checkouts compared byte for byte — Open full-translation parity test, adjacent to lifter rewrite safety
Possibly related, for context: - PR #1798 test(lift): scripts/lift_parity.py, the translation of two checkouts compared byte for byte — Open full-translation parity test, adjacent to lifter rewrite safety
HumanBean force-pushed lifter-m0-decoder from 7b3d609aaf
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 14s
CI / Conventional Commit title (pull_request) Successful in 17s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 25s
CI / Workflow lint (actionlint) (pull_request) Successful in 25s
Third-party parts / As their notes say (pull_request) Successful in 29s
CI / Website build and checks (pull_request) Failing after 41s
to fb5cc44d3a
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 14s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 22s
CI / Workflow lint (actionlint) (pull_request) Successful in 22s
Third-party parts / As their notes say (pull_request) Successful in 24s
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Website build and checks (pull_request) Successful in 4m6s
2026-11-22 19:08:24 +00:00
Compare
HumanBean changed title from WIP: feat(lifter): the new lifter's Rust workspace and its A64 decoder, checked word for word against llvm-mc to feat(lifter): the new lifter's Rust workspace and its A64 decoder, checked word for word against llvm-mc 2026-11-22 19:09:11 +00:00
refactor(lifter): the decoder's printer as Display, its types documented, clippy and rustfmt in the check
Some checks failed
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Website build and checks (pull_request) Successful in 3m19s
76e0011d33
An Insn now formats itself (impl Display) from small operand types that each know their syntax (a register by its
width and what 31 means, a memory operand, a shift, a prefetch), every write's result passed on with ?. The
mnemonic tables are methods of the operation enums (Shift::name, Cond::name ...). Every public item has its doc; the
enums whose variants are the architecture's own names say so once. The workspace lints forbid unsafe and warn on a
missing doc, and tests/test_lifter.py now also runs rustfmt's check and clippy with warnings as errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean force-pushed lifter-m0-decoder from 76e0011d33
Some checks failed
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Website build and checks (pull_request) Successful in 3m19s
to 4b72605c0a
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 9s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Website build and checks (pull_request) Successful in 2m28s
2026-11-23 01:48:11 +00:00
Compare
HumanBean changed title from feat(lifter): the new lifter's Rust workspace and its A64 decoder, checked word for word against llvm-mc to feat(lifter): the new lifter in Rust, writing LLVM IR beside the old one (LONGSHOT_LIFTER=mix): decoder, discovery, sites, mid IR, integer and float semantics 2026-11-23 01:48:53 +00:00
Author
Owner

Pushed the rest of the lifter work onto this branch, rebased on main at 0e32bc10 (the head was 76e0011d, M0 alone; it is 4b72605c). It now holds M1 (discovery), the hook sites in Rust, M2 (mid IR, integer semantics, LLVM IR writer, LONGSHOT_LIFTER=mix), M3 (floating point and SIMD with fast paths), the speed-ups and the guest profile. It sits on #2272's squash and merges after it, so it is WIP again: the description says what has run and what is still to run (the profiled A/B and run_all.py --strict on this head).

Pushed the rest of the lifter work onto this branch, rebased on main at 0e32bc10 (the head was 76e0011d, M0 alone; it is 4b72605c). It now holds M1 (discovery), the hook sites in Rust, M2 (mid IR, integer semantics, LLVM IR writer, `LONGSHOT_LIFTER=mix`), M3 (floating point and SIMD with fast paths), the speed-ups and the guest profile. It sits on #2272's squash and merges after it, so it is WIP again: the description says what has run and what is still to run (the profiled A/B and `run_all.py --strict` on this head).
HumanBean changed title from feat(lifter): the new lifter in Rust, writing LLVM IR beside the old one (LONGSHOT_LIFTER=mix): decoder, discovery, sites, mid IR, integer and float semantics to WIP: feat(lifter): the new lifter in Rust, writing LLVM IR beside the old one (LONGSHOT_LIFTER=mix): decoder, discovery, sites, mid IR, integer and float semantics 2026-11-23 01:48:57 +00:00
lifter/ is now rust/: it will hold the whole builder (Longshot-notes' builder-rust-plan), not only the lifter.
crates/build-core: the builder apps' protocol (@@ lines, RecompLauncher's --prepare lines) from any thread; errors as
the sentence a player reads; the job count (--jobs, LONGSHOT_JOBS); the memory gate (nx2/build.py's MemoryGate);
atomic writes, links and copies; SHA-1 keys with named parts (the Python builder's, so caches stay valid); the work
folder's lock (std's file lock). Win32 calls through windows-sys in one module (the workspace denies unsafe
elsewhere).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The builder no longer speaks make_game.py's @@ lines or RecompLauncher's --prepare lines: the launchers will be
updated. build-core's report: a build is a stream of events (stage, progress with the whole build's share, the
compile's plan, each unit, the time left, log, warning, check, error, done), written as JSON Lines with a version
field for a launcher (--json), or as text for a person. Error::Player carries a stable code a launcher can show its
own words for; every error has a code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
make_game.py, build.py, lift.py and oot_patches.py go back to #2272's state, and nx2/lift_plan.py goes: no
LONGSHOT_LIFTER, no mixed build, nothing of the new lifter in the old path. The new builder is rust/ alone, a command
of its own (longshot-build), sharing only the game's sources with the old one; either can be run and compared at any
time. host/guest_profile.c stays (the game's own code, shared; it does nothing in a build that counts nothing).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The 32 functions that call a setjmp owner were the old lifter's alone: the IR now pushes the owner's slot, takes
recomp_sj_setjmp (returns_twice) on it, calls the owner or, after a guest longjmp, runs the owner's code from the
return address it came back to, and reloads the whole guest state after. Also llvm::Module::size, a unit's text so far.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
What the IR calls and what host/ uses of a64-kit's rt/ and nx2/rtgen.py's changes, without what only the old C lift
used (suyu's helpers, the FPX headers, the inline-site macros). a64_config.h, written by the lift, carries its
choices (the window, the marks' table, the GPU page bitmap, polls) to the host's compile. a64_fp.c: the two exact
float helpers host/oot_sites.c calls, under the lifter's float model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
From the image and the repository's tables alone: discovery, the sites placed, every function lifted into units cut
by estimated compile cost at stable places (the largest 25 MB of IR, was 400 MB), the function table, the boot
constants, the import stubs and the runtime written into gen/. A key of everything skips an unchanged lift; each
function's key is exactly what lifting it reads (lift::Program::inputs), each unit's its functions', so one changed
function or site rewrites one unit, and a unit lifted to the same text is not written again. The edits (sites,
entry hooks, text patches) go through one seam, whole::edits::Edits::apply: their functions are held until the
edits crate is in. emit, the mixed build's command, is gone; rust/README.md documents gen/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Gate::enter_first reads the memory free once and lets in the first of the needs given that fits (below the floor, the
first); Gate::wait waits for a job to leave. The compile's scheduler starts the longest unit first, and while it waits
for room, the next one that fits, so the CPUs stay busy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The new builder's compile (rust/crates/build-compile), a library the driver calls: build_compile::run(&Options,
&Reporter) -> Result<Outcome>, and preview() for what it would do.

- The toolchain (clang, clang++, llvm-mingw, the sysroot, the CPU: -march=native named by the CPU it is), the
  packages (Vulkan, SPIR-V, VMA, FFmpeg, dav1d, NGX), and every unit with its flags: the lifted C and the hot pieces,
  the new lifter's .ll units, the lift's tables and runtime, host/, libopus and zstd, Tracy, the renderer as its own
  module with its third-party parts, ReShade's FX compiler, the profiles, the light passes, LONGSHOT_CHUNK_OPT.
- Keys: the compiler's identity, the normalised flags (folders named, not spelled), the source's bytes and every
  header its depfile lists, by content (ccache's direct mode, the headers kept by base in the store's manifests). No
  build-wide input: a changed unit rebuilds alone, a builder update with the same sources reuses everything.
- The store (v1 layout, outside the builder's install), safe for a stopped run and builds side by side; the
  release's prebuilt third-party set; the kept lift; the build's state (hashes by stat, measured times and memory).
- The scheduler: the longest first, under the memory gate, past a job too big for now; a unit the system stopped
  compiled again alone. The links with their records, the image's reach, the renderer's unresolved symbols,
  compile_commands.json.

Checked: a synthetic compile and link with clang (unchanged: nothing compiled or linked; one change: one unit), and
the ported generators against nx2's own functions (tests/python_parity.rs, ignored by default).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Two units of the same source and flags may place one object or write one manifest at once from two threads: each
write now has a name of its own. A manifest entry ends with its header count, so one cut short by a stopped PC is
dropped, never read as an entry with fewer headers. The crate in rust/README.md's table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- Op::HostCall (a host function by name, or through a callback slot, with the context or not), Op::HostLoad and
  Op::HostStore (volatile, thread-local where the global is): what a hook site's flag, callback and data rule need.
  A host call with the context exposes the state as an SVC does (no callee-saved registers kept: sync.rs).
- A function may be named for a wrapper (a body f_1<entry> under f_<entry>), and a wrapper counts nothing for a profile.
- A block says whether it is a guest block's start and whether its branch is the guest's: an edit's blocks and tests
  are not counted by a profile, nor weighted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A crate of its own: a small statement language for the code an edit adds (edits::code: expressions of the guest
state, guest memory, host globals and host calls; short-circuit conditions; a goto; the kept instruction), each hook
site's form over the host ABI of host/game/sites.h (site.rs), the supported build's patches as data, found by their
instructions (patches.rs: the output size's nine edits and the gameplay HUD's wrapper), and the host's entry hooks of
the SDK's functions (entry_hooks.rs). plan_edits gathers them per function, with a stable content key each, so one
site's or patch's change changes the edits of the functions it lands in alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/romfs_index.c reads longshot_romfs.idx (written by the Rust builder, format in rust/crates/game-files/src/romfs.rs):
a binary search per lookup, a positional read per file read on the .nup's one handle, no lock. The few files the .nup
keeps as zstd frames were unpacked by the builder beside the index and are opened as files. The .nup is checked at
start (its size and its TOC's SHA-256): moved or replaced, the game says so (nup_moved) before it runs.

nn_fs.c: OpenFile, ReadFile, GetFileSize, CloseFile, GetEntryType and the directory calls take a path under the RomFS
from the index when the game folder has one and no romfs folder; mods, the overlay and the stand-ins come first, as
before; a mod's entries in a listed folder are added unless the .nup has them. zs.c's whole-file and head reads (the
dictionaries, the mods' and prompts' .zs files) go through it too. A developer's unpacked romfs folder is read as
before. tests/romfs_index_test.c checks the reader against an unpacked romfs from four threads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
game-files:
- nup: the .nup read with positional reads (its tables checked: ranges, reachability, no cycles), verify (TOC hash,
  extents, SHA-256s, the .zs heads), extract with every safety rule (device names, links, a stopped run, a full disk,
  zstd-stored files told from the game's .zs files), heal; read errors in plain words (locks, drive errors).
- romfs: the romfs indexed in place (longshot_romfs.idx) instead of unpacked: zstd-stored files unpacked beside it,
  damaged .zs files found by their first bytes and given stand-ins in the index; Index reads it back.
- nso: the modules loaded (LZ4, ZBIC, DT_RELR, symbols, relocations, .eh_frame_hdr), segment hashes checked, ZBIC
  modules unpacked in place. zstd: a decoder of zstd frames with ZBIC's count tables (no C library).
- checks (the modules, the supported build, the romfs's files, links, the game folder's paths, check's answer read in
  place from the .nup), patches (the mods' ExeFS patches: mods.json's rules, IPS/IPS32/pchtxt, the classification, the
  hook-site clash refusal, the list, apply), title, disk (free space, file system, hard drive or not).

image-build: the image laid out as Eden loads it, patched, relocated, bound; image.bin and image.json the same bytes as
the old builder's (checked on the game's exefs on this PC), built in 0.14 s.

Every player error has a stable code. Crates added: ruzstd 0.8.3, lz4_flex 0.14.0, sha2 0.10.9, libc 0.2.191 (unix).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/romfs.h: ready, stat, case (any case, where a caller needs it), read, head, list, open/read-at/close, over two
backends of the same API: the .nup's index (romfs_index.c) and a romfs folder (a developer's dump). Every reader of
the RomFS goes through it: nn_fs.c's handles, prompts.c (the size tables, the font), mods.c (the game's files a mod
replaces, their case, the size table; a folder's mod-only entries checked against the RomFS, any case), audio_source.c,
oot_heart_containers.c, oot_damaged_files.c's probe, zs.c's dictionaries, and the Vulkan back end's menu font (host
API version 46: romfs_read / romfs_free; vk_game_font.h's reader takes a read function).

The index no longer needs files unpacked beside it: a zstd-stored file is decoded when it is opened (libzstd through
zs.c), one copy shared by every open of it and freed with the last close. Measured on the dump that has them (40,588
files, 2.75 GB of frames for 2.99 GB, nearly all raw blocks): libzstd about 2 GB/s, the largest (117 MB) in 30 ms. So a
game folder holds the 16 MB index and nothing of the romfs; indexing that dump took 7 s (it unpacked 3 GB before).

The builder: romfs::index writes the index alone; romfs::reuse takes another game folder's index of the same .nup;
the checks for romfs folders an old builder unpacked are gone (a damaged dump is the index's stand-ins, or the host's
table for a folder: the builder's choices are that table's, checked on the dump). zstd.rs states its provenance.
tests/romfs_test.c runs both backends against an unpacked romfs from four threads and compares their listings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
lift::Program takes the edits (edits::plan_edits) and writes them in as each function is built: before, after or in
place of an instruction, at a conditional branch, at the entry in a block of its own; a wrapped function is lifted as
its body f_1<entry> and its wrapper f_<entry> (lift::Lifted), both in its unit.

lift::whole plans the edits from the placed sites, host/'s entry hooks (with their size gate) and the patches' Rust
data, and keys each function by its edits' key (FunctionEdits::key); EDITS_SOURCES (the edits and sites crates) is
in the whole lift's key, LIFTER_SOURCES holds only the edits' lowering, so one patch's or site's change lifts again
only the units it lands in. The held mechanism is gone (held.txt, --allow-held, --patched, LiftOptions::patched,
LiftOutcome::{held, complete}): an instruction the lifter does not cover stops the lift. gen/edits.txt lists each
edited function, its key and what changes it; LiftOutcome::edited counts them. The plan's old records are no longer
read, and --check-plan compares the discovery alone.

On the supported image: 294518 functions in 495 units, 99 edited, none held; two lifts give the same bytes; one
site's table entry changed rewrites one unit. Tests: each form on synthetic functions, verified, through the passes
and compiled by clang; the forms run against a C harness of the host's side; the whole lift's cache over a site
added and its form changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The units are those units.txt lists, each keyed from the content hash the list gives while its file is the
listed size; table.c, imports.c, image.c and gen/rt's runtime are the lift's C. The host is compiled with
-I gen/rt and none of the A64_* defines (gen/rt/a64_config.h holds the lift's choices). The work folder's
layout is the caller's (Options::gen_dir, build_dir).

Removed with the old lift: the C chunks and hot pieces (lifted.rs), the kept lift (kept.rs), a64-kit's
runtime adapted (rt64.rs), the light passes, LONGSHOT_CHUNK_OPT and its parts, RX_PGO and the hot link
order, RX_MARK_BITMAP, chunk_costs.txt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
And the scheduler's test no longer races: two jobs that start together may note their starts in either
order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build-driver runs the read stage (game-files, image-build), the lift, the compile and the finish in
order, the romfs's index beside the lift and compile; each stage behind one seam (the assets' pending).
A work folder per game folder in the per-user cache, the object store and the lifts' store shared by
all of them; the game folder's files staged and swapped, its record for update. longshot-build:
build, update, check, and image, index, lift, compile one at a time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
It read the jobs' start order from inside their threads, which a loaded PC reorders (3, 0, 2, 1): it failed one run in
three under load. Job 0 now holds its room until both small jobs are in (an event, not a sleep), and the test checks
who started while job 0 held its room (0, 2 and 3) and who only after (1). 40 runs of 40 pass at 6 threads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A new library crate, rust/crates/build-assets, for the Rust builder's finish
stage (plan R4). This first part:

- romfs: the game's files behind a Romfs trait (list, read, fingerprint), so
  the stage reads the .nup's index or an unpacked folder alike;
- zs and sarc: the game's zstd frames with its dictionaries (ruzstd), SARCs;
- texts: the console's wording made the PC's, as nx2/text_assets.py; the
  output frames state their content size;
- pipelines: the shipped pipeline list merged from assets/pipeline_states,
  version 1 records converted, as nx2/pipeline_states.py (xz by lzma-rs);
- census: every shader program, as nx2/shader_census.py, read by several
  workers in a fixed order;
- cache: each output stamped with a key of exactly its inputs, file hashes
  memoised by size and time;
- raster: Pillow's resampling, blur, rank filters and mask blends, exact.

On the game's files: the shipped list and longshot_shaders.bin are byte for
byte the Python's; the 16 reworded text archives unpack to the same bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- font: an OpenType CFF font read (ttf-parser) and written again with glyphs
  added: charstrings, charset, names, metrics, a format 4 cmap; outlines moved,
  bounded, reversed and rasterised (ab_glyph_rasterizer);
- prompts::glyphs: the game's icon font with every face's Kenney icons and the
  keyboard face's keys, words and mice, as nx2/prompt_assets.py faces_font and
  nx2/prompt_draw.py keyboard_glyphs; the tables of nx2/prompt_faces.py and
  nx2/prompt_keys.py as Rust data (prompts::faces, prompts::keys);
- prompts::layout: ring.bin and hint.bin from the layout archive;
- icon: the window's icon, .ico and .res files (nx2/make_icon.py).

On the game's files: every one of the font's 2300 code points has the
Python font's glyph, advance and outline (point for point); ring.bin and the
six hint.bin are byte for byte the Python's. The .res files are byte for byte
make_icon.py's; a picture's square differs from Pillow's by the JPEG decoder
alone (at most 3 levels).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- texture: the Switch 2's block-linear BNTX read; an ASTC LDR decoder of every
  block mode and an encoder of 4x4 blocks (void extent, one or two partitions,
  one or two planes, every weight precision with the endpoints' that fits,
  least-squares endpoints, the best of each decoded); BC4 as the Python's;
- draw: Pillow's rectangles, polygons and bicubic rotation (exact), an
  ellipse and a rounded outline;
- prompts::icons, guides, textures: the faces' layers (the ocarina's notes,
  the letters, the controller picture with its tinted copy and shadow, the
  leader lines routed round the parts), hand-made pictures in their place,
  encoded into textures.bin;
- prompts::make: every prompts output, each stamped by its own inputs (the
  font; the layouts; the archive; each face's textures by its Kenney font and
  hand-made pictures), the faces drawn by several workers;
- Finish: texts, prompts, shader list (kept while its files are the same),
  pipeline lists (with the seed list), window icon; title_res for Windows.

On the game's files: every layer is the Python's but for edge pixels (the
leader lines within 0.002%, the icons within 2% of their pixels by more than
16 levels: FreeType's hinting); BC4 decodes are Pillow's exactly and ASTC
ones within one level of texture2ddecoder's. All of the prompts in 6.3 s
on 6 workers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The Assets seam takes the places it needs (AssetPlaces: the game folder, the
work folder, the tools, the workers) and gains the window's icon; FinishAssets
reads the romfs through the game folder's index (each file fingerprinted by
the index's header and its place in the .nup) or its linked folder, and calls
build_assets::Finish. On Windows the game's own name is written as
<work>/longshot_game.res before the compile links it. PendingAssets stays as
the tests' stand-in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
nx2/pipeline_share.py's port: the game folder's list checked as a list
someone sent is, the issue's template filled in from the game's last log,
its options and its mods, both in a zip (deflated, flate2) in the Downloads
folder or --out. On a test folder the template is line for line the
Python's and the zip holds the same two files byte for byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/prompts.c no longer reads prompts/Common.bntx (244 MB) and Common.blarc (9.9 MB), copies of the
game's files: it streams them from the RomFS (zs.c hos_zs_romfs_stream) and patches them as they come
(host/prompts_base.c). The builder keeps prompts/Common.bntx.base and Common.blarc.base: the game's
bytes under every run any face may write, the header and the samples the host knows the pool by,
checked against the stream (another game version is refused, the game's own served).

Game-free test: build-assets prompts::base::the_host_patches_the_stream builds host/prompts_base.c with
tests/prompts_base_test.c. tests/test_prompts_live.py, test_prompt_cache_errors.py,
test_prompts_size_table.py and test_mods_size_table.py follow (the fixture now links host/romfs.c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
refactor(prompts): the hand-made pictures move to assets/prompt_faces/, so the new builder reads nothing of nx2/
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 29s
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Website build and checks (pull_request) Successful in 4m21s
e24b41dec8
nx2/prompt_assets.py and nx2/prompt_faces.py read them there too.

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

Pushed e24b41de (was 4b72605c): the pull request is now the whole builder in Rust, longshot-build, beside the old one.

  • The lifter's mixed build (LONGSHOT_LIFTER=mix, nx2/lift_plan.py) is gone: nx2/ is the old builder alone again.
  • Every hook site, text patch and entry hook is an edit of the mid IR: the new lifter writes all 294,518 functions.
  • New stages: the compile, the game files and the image, the assets, the driver; the game reads its RomFS from the
    .nup through a 16 MB index.
  • First look, release build: the game builds from the .nup to a linked folder in 7 min at 6 jobs, and an update
    with nothing changed takes 2.2 s. No game run of this head yet; the description's Testing and Risks say what is left.
Pushed e24b41de (was 4b72605c): the pull request is now the whole builder in Rust, `longshot-build`, beside the old one. - The lifter's mixed build (`LONGSHOT_LIFTER=mix`, `nx2/lift_plan.py`) is gone: `nx2/` is the old builder alone again. - Every hook site, text patch and entry hook is an edit of the mid IR: the new lifter writes all 294,518 functions. - New stages: the compile, the game files and the image, the assets, the driver; the game reads its RomFS from the `.nup` through a 16 MB index. - First look, release build: the game builds from the `.nup` to a linked folder in 7 min at 6 jobs, and an update with nothing changed takes 2.2 s. No game run of this head yet; the description's Testing and Risks say what is left.
HumanBean changed title from WIP: feat(lifter): the new lifter in Rust, writing LLVM IR beside the old one (LONGSHOT_LIFTER=mix): decoder, discovery, sites, mid IR, integer and float semantics to WIP: feat(builder): the whole builder in Rust beside the old one (longshot-build): lift, compile, game files, assets; the game reads its RomFS from the .nup 2026-11-23 06:43:25 +00:00
The game-free renderer checks (nx2/test_coop_spirv.py and the rest) are tests of gpu/, not of the builder: they move to
tests/, and tests/run_all.py finds checks in tests/ alone. assets/addresses.ini is what longshot-build stamps into a
game folder's longshot_version.txt (and nx2/addresses.py reads for the perf sender).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The two checks of tests/test_hooks.py that read the repository's own tables (every build's locations with the
definitions, every site's host line, every engine site in a table; the host list's names once each) are a test of the
sites crate now (crates/sites/tests/repository.rs). build-compile's python_parity test, which compared the Rust
outputs with nx2/'s Python, goes with the Python; the generated headers and the sites' error name no nx2/ file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
gen/hos_image.c is gen/image.c, a64-kit's and nx2/rtgen.py's runtime is rust/rt, the entry hooks, the sites and the
supported build's patches are rust/crates/edits and rust/crates/sites, and the build's other steps are build-compile,
build-assets and game-files. No code changes: the game already builds with the new builder's gen/ as it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Tests of nx2/'s Python (the lift and its passes, the chunks, build.py's compile, link and memory gate, make_game.py's
driver, the stores, nup.py, the prompts' and texts' Python, the shader census, the stamps, discovery and the walk,
hooks.py's reader and emit) and of a64-kit's translator and runtime, with the C fixtures only they built. Their
behaviour that the new builder keeps is tested in its crates (rust/crates/game-files, build-compile, build-core,
build-assets, sites, edits, lift); the two checks of the repository's site tables moved to crates/sites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The host callbacks' checks compile each callback against a fake game that reaches it as the lifted code does at its
site. They took the tables and the hook's C from nx2/hooks.py; tests/sitetable.py now reads the tables (definitions
with a build's locations, the host list) and gives the same C for each form, standard library only (the format's every
rule is rust/crates/sites'). The checks that the old text patches were gone from nx2/oot_patches.py go with that file;
test_function_ends.py checked only the old lift's C passes and is deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Two -mllvm options on every IR unit (ir_unit_flags, with a test that they are there):
- -cgpp-huge-func=1000: CodeGenPrepare restarts its walk over a function's blocks after each change to the dominator
  tree unless the function has 10,000 blocks or more. On the game's interpreter dispatch (one function of about 4,000
  blocks, a jump table of 1,953 cases) that was 145 s of a 150 s unit, the build's critical path; with the walk going
  on, 6 s for the unit, the object byte for byte the same.
- -grow-region-complexity-budget=1000: on a player's CPU without AVX-512 (16 vector registers: most Intel desktops,
  AMD before Zen 4, -march=x86-64-v3), one float-heavy function took 23 minutes in the greedy register allocator
  (18 s with AVX-512's 32 registers); 14 s with its region growth capped.

Measured with these flags alone changed, clang 23.1.4, one unit at a time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
passes::split cuts a function whose estimated cost (its instructions, its blocks, each call's moves of the state) is
over SplitOptions::over into pieces at block boundaries, in address order, each cut where the fewest edges cross,
a loop's back edge weighing eight. An edge between pieces goes as a tail call does: the state that may differ from the
context written to it, the entry block's index put in Ctx.piece (a new 4-byte field at 860, rust/rt/a64.h asserting
it), and the other piece entered by musttail, which reloads what its entry blocks read. The function's own symbol is a
trampoline to the first piece; the pieces are <symbol>.p<n>, internal. The site caches' globals are named by the
function's symbol (two pieces of one function had the same names).

mir: Pieces, Dest::Piece, Function::entries, set_guest_start, inst_count. The writer: a piece's linkage, its entry
dispatch, the piece edge; sync.rs reloads at a piece's entry what any of its entry blocks reads. lift::whole runs it
after the passes (LiftOptions::split, in the IR options' key); longshot-lift lift --split-over N --split-piece N.

Tests: a split function's pieces verify, and twelve splits of a loop function (a piece a block to a few blocks a piece,
pieces entered at several blocks, a polled back edge across a cut) run against the whole function in a C harness and
leave the same guest state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
What a check took from nx2/build.py (a host file in ZSTD_HOST, host/game/ compiled, the exe's name, the shader stamp's
files, gpu/render left out) it reads from rust/crates/build-compile now; the runtime it compiled from a64-kit's rt/ is
rust/rt. The halves that tested the deleted Python (nup.py's stand-ins, exefs_patches.py's list reader, log_redact.py,
kit.env_on, entry_hooks.py's splice, make_game.py's copies) go with it. test_relocations.py tested a64-kit's image
writer, which rust/crates/image-build replaces with its own tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The pipeline lists' shipping, the share zip's fields, the shader stamp's files, the prepare step's messages, the
manifest, the link's libraries and the prompts' constants are read from rust/crates/build-compile, build-assets and
build-driver; the halves that tested nx2/'s Python (pipeline_share.py, translator_files.py, make_game.py's merge) go
with it. tests/run_all.py's own checks make no nx2/ folder. The switch table: HOS_FMA_FAST, read only by the old lift's
fma_soft.h, is gone; HOS_GUEST_PROFILE (host/guest_profile.c) gets its row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
rust/README.md moves into docs/dev/reference/builder.md (the crates, a build's stages, the game folder, the romfs read
in place, the lift and its caches, units, gen/, the compile, the stores, the runtime, the guest profile) and stays a
pointer. build.md is rewritten for longshot-build: commands and options, what builds again, every build switch the code
reads, the memory gate, where things are, the guest profile and how to record it, measured build times, and what to do
for each error code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
architecture.md's parts and stages are the Rust builder's: read, image, lift, compile, finish and shaders, the caches
and their keys, the mid IR and where the sites live, gen/ and the runtime, the host's RomFS API, and the game folder
without a romfs folder. hooks.md names the sites, edits and lift crates in place of nx2/hooks.py and the lifted C.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
make_game.py, nx2/build.py, the lift to C, hot lists, kept files, romfs folders and the builder's Python leave the
developer pages and the root README, CONTRIBUTING and AGENTS. Where dev.py's or the builders' new command lines are not
settled yet, the page says so in a TODO comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A first build is about 7 minutes on a 12-core desktop and needs about 10 GB, kept for quick updates; the game reads its
files from the .nup, so it stays where it was, and the game says so when it moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
nx2/make_game.py, build.py, the Python lift and every pass of it, hooks.py, the stores, nup.py and the rest of the
read stage, the prompts', texts', icons' and shaders' Python, and a64-kit (its translator, runtime, image writer and
tools) are gone: longshot-build (rust/) does all of it. nx2/ keeps four developer tools that are not the builder:
perf_report.py and addresses.py (the Launcher's performance sender), pipeline_states.py (the pipeline lists' tour and
check) and lower_test.py (now needing only a C++ compiler). TOTKPort's notice for host/'s parts moves to
host/NOTICE.TOTKPort.md. test_finish_output.py tested make_game.py's finish and goes with it; requirements.txt no
longer pulls in the prompts' Python packages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
With reg_calls each lifted function f_<entry> gets a body f_<entry>.r of LLVM's preserve_none convention taking X0-X8,
SP and X30 as arguments besides the context and returning X0 and X1; f_<entry> stays, a thunk from the context to the
body, for indirect calls, the host, the sites and the table. A direct call or tail call of a lifted function calls its
body; a function whose code takes the context (a wrapper, a split function's trampoline) gets an adapter body.

Exact by construction: a caller writes to the context before a call what it does today, so a body's arguments come as
the context holds them and it loads none; the body writes back at its exits what it changed but X0 and X1, which come
back as the call's value, newer than the context (sync.rs: RegSync). A register body's tail call of a function the host
implements is a call through the context and a return. Indirect calls, a devirtualised call's direct arm and a setjmp
owner's call stay calls through the context.

Which entries are lifted functions the module is told (Module::set_lifted); with reg_calls on that list is in every
unit's key. longshot-lift lift --reg-calls.

Test: a program of seven functions (calls, a moved SP, a host function calling back into a context entry, a BLR, tail
calls of lifted and host functions, a setjmp owner longjmped back into) leaves the same guest state with register calls
and without, at -O0 and -O2; dropping X1's return or a body's write-back fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- longshot-lift sites places the sites over the image's own discovery; its --plan and --check compared with the old
  lifter's lift_plan.txt and are gone.
- longshot-build stamps the report addresses (assets/addresses.ini) only from packaged tools, whose release is in
  their VERSION or version.txt, as the old builder did: a checkout's build sends nothing on its own.
- assets/profiles/hot_funcs.txt, the old lift's hot list, is deleted: the guest profile replaces it.
- host/hos_tracy_game.c keeps only the Tracy client's start: the game functions' zones were the old lift's wrappers,
  which the Rust lifter does not write (HOS_TRACY_GAME is gone).
- rust/rt/PROVENANCE.md says what the runtime takes from a64-kit; README.md and CONTRIBUTING.md name
  host/NOTICE.TOTKPort.md for a64-kit's notice now that third_party/a64-kit is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
compile takes what it makes from its command line (the renderer alone, the game alone, a dry run of a tools tree, the
release's third-party set), no longer from RX_VK_ONLY / RX_GAME_ONLY. build-driver's runtimes step downloads NVIDIA's
DLSS SDK, AMD's FSR 4 runtime and Intel's XeSS library at fetch.py's pins, SHA-256 checked and cached in the per-user
cache, once --accept-licenses names their vendor; --upscaler takes xess.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
LongshotBuilder.exe --cli <longshot-build's arguments> runs tools\bin\longshot-build.exe with --json, passes its events
on unchanged and says them on stderr (progress, warnings and the error by code); its own error event when the program
is missing (tools_incomplete) or stops without one (tool_failed). The zip carries tools\bin\longshot-build.exe (dist),
the third-party objects longshot-build makes, and no nx2/, scripts/ or Python. The Windows renderer checks are
longshot-build compile --only renderer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
AppRun --cli <longshot-build's arguments> runs usr/share/longshot/bin/longshot-build (static musl, dist) once
builder/linux/tools.sh has found or downloaded tools.lock's linux-x64 tools (the AppDir, the launcher's toolchains, the
builder's own), a JSON error event when one cannot be had. The image holds the tree longshot-build reads and its
third-party objects; check_player_build.sh dry-runs its compile, with and without FSR 4. deps.sh builds no Python.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
dev.py packs base/pack build the checkout's own longshot-build (cargo, mise's Rust; LONGSHOT_BUILD names another) from
the game (LONGSHOT_DEV_GAME, dev_build.json's "game", else the newest .nup in ~/Games), every build sharing the
development folder's store/ (LONGSHOT_STORE); a pack keeps the modules whose objects differ from the base's, as
before, without the kept-lift and object-linking tricks. dev.py packs run [--tree T] -- ARGS is the tree's
longshot-build (game, vk, update, mise run build). The build tools are tools.lock's, installed by tools.py on both
systems. setup.py checks Rust; fetch.py stays for developers and CI, its pins the builder's; perf, profiling, tours and
the PR check name the new tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
ci.yml: rustfmt, clippy and cargo test of rust/, and scripts/check_host_compile.py (every host unit a Windows build
plans, compiled -fsyntax-only with llvm-mingw and tools.lock's cpm against a synthetic gen/rt). .circleci mirrors the
Forgejo workflows. mise.toml pins Rust 1.99.1 (rustfmt, clippy, the musl target) and its build tasks run dev.py packs
run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A thunk's call of its body (and an adapter's of the context's function) is noinline: LLVM inlined small bodies into
their thunks, two copies of each. The lift tests' compiles() named its folder by the text's length, and two tests
whose texts came out the same length removed each other's file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
As the old builder did: assets/profiles/longshot_vk.profdata.xz is unpacked into the work folder
(longshot_vk.shipped.profdata, written only when its bytes change) and the renderer's own units are compiled with
-fprofile-instr-use, their object keys holding the profile's content, unless RX_VK_PGO says otherwise (gen, or a
developer's profile) and only when this compiler reads it (a one-line probe; one that does not builds the renderer
without it and says why). A player's build had lost the 3 to 5 % it measured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/nn_fs.c reads the RomFS through host/romfs.c now (the index or a folder): the two fixtures compile the real
romfs.c and romfs_index.c with the folder backend at their made-up romfs (no index, the zstd frame stubbed), so they
link again and exercise what the game runs. Their checks are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- game-files: mod_order (the list, the file beside it, the old list) out of collect, and an example printing it and
  parse_list's answer, so tests/test_mods_list.py compares the game's reading of mods.json with the build's again; its
  fixture builds host/romfs.c's folder backend. A number past f64's range (1e999) stopped parse_list where the game
  takes the list: such numbers read as 0 now, the grammar's rules kept.
- build-driver: the logs' redaction is the game's rule (the home folder as ~ or %USERPROFILE%, the user's name as a
  folder of any path as <user>), redact.rs, with an example tests/test_log_redact.py compares with the C and C++ rule;
  the log's last line without a line break is no longer lost.
- build-assets: a test of the shipped pipeline list's merge: the tour's list first, each pipeline once, a damaged
  source left out and the rest kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
merge: the old builder removed, its callers moved, the docs rewritten, the split and register calls
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Website build and checks (pull_request) Failing after 1m4s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 1m17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m59s
2c2fa8ca73
Author
Owner

Pushed 2c2fa8ca: the old builder is deleted and every caller runs longshot-build.

  • nx2/'s builder and third_party/a64-kit are gone (114 old tests with them; the site-table checks ported to Rust).
  • dev.py, the Windows builder, the AppImage, the release and CI run the new builder; no player's build needs Python.
  • The builder fetches the DLSS, FSR 4 and XeSS runtimes, and uses the committed renderer profile again.
  • Two LLVM caps and a giant-function split: the longest unit 171 s to 13 s, all units 2,172 to 1,821 CPU-s.
  • Register calls behind an option (off); the docs rewritten (docs/dev/reference/builder.md, architecture.md).
  • On the head: rustfmt, clippy and 295 tests pass. Still no game run of this head; Testing says what is left.
Pushed 2c2fa8ca: the old builder is deleted and every caller runs `longshot-build`. - `nx2/`'s builder and `third_party/a64-kit` are gone (114 old tests with them; the site-table checks ported to Rust). - `dev.py`, the Windows builder, the AppImage, the release and CI run the new builder; no player's build needs Python. - The builder fetches the DLSS, FSR 4 and XeSS runtimes, and uses the committed renderer profile again. - Two LLVM caps and a giant-function split: the longest unit 171 s to 13 s, all units 2,172 to 1,821 CPU-s. - Register calls behind an option (off); the docs rewritten (`docs/dev/reference/builder.md`, `architecture.md`). - On the head: rustfmt, clippy and 295 tests pass. Still no game run of this head; Testing says what is left.
HumanBean changed title from WIP: feat(builder): the whole builder in Rust beside the old one (longshot-build): lift, compile, game files, assets; the game reads its RomFS from the .nup to WIP: feat(builder)!: the builder in Rust (longshot-build) replaces the old one: lift, compile, game files, assets; the game reads its RomFS from the .nup 2026-11-23 07:48:19 +00:00
docs: the TODOs filled from the merged builder, dev.py and callers
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 13s
CI / Website build and checks (pull_request) Failing after 1m10s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 1m23s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m36s
a3603047cd
dev.py's and mise's new commands and variables, longshot-build's compile --only/--dry-run/--third-party-objects, the
upscalers' runtimes it downloads with --accept-licenses and the new error codes, the --cli command lines, the release
packages' contents, the launcher's cache and its nup_moved answer, assets/addresses.ini written only from packaged
tools, longshot-lift sites without a plan, and the giant-function split and compile caps with their measurement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
perf(host): image.bin is mapped into the guest window on Linux, copy-on-write, not read
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Website build and checks (pull_request) Failing after 1m10s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 1m22s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
61a2182080
The game read its 100 MB image into the window at the start (46-70 ms here from the page cache, more from a cold
disk) and kept a private copy of every page. On Linux it is now a private file mapping over its place in the window:
pages come from the file as they are first touched and stay shared with the page cache until the game writes them.
The rest of the window stays the memfd's; the image's range has none of its pages in the memfd, so the Vulkan back end
makes no dma-buf of it (a host-pointer import instead) and reads no memfd holes there (hos_posix_guest_private). A file
that cannot be mapped is read as before, and so is every image on Windows: a view goes into a reserved range only as a
placeholder (MapViewOfFile3), and the window is one reservation committed on first touch or in large pages.
HOS_IMAGE_MAP=0 reads it. tests/test_image_map.py checks the mapping, the copy-on-write and the memfd around it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The read stage's tests built .nup files in memory (nup::tests::Builder); another crate's tests now can too, through
the `testkit` feature (game_files::testkit::NupBuilder, zstd_frame). Moved, not changed: the read stage's own tests use
it as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
checks::check_build_in(exefs, builds) and read::read_exefs_of(..., builds): the read stage's exefs for a game of one of
these builds. The builder's own read stage asks for the supported build alone, as before (check_supported_build,
ReadStage::read_exefs); a test's stage gives its synthetic game's build id, so the player's check is never weakened.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
test(longshot-build): the builder end to end on a synthetic game
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 14s
CI / Website build and checks (pull_request) Failing after 1m0s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 1m3s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m41s
86ca3ec706
rust/crates/synthetic-game: a small AArch64 program written here (game/main.S: integer, float and memory work, indirect
calls through a relocated table, an SVC, two RomFS files read through a host import, a function big enough to be a
unit of its own), assembled and linked by the pinned clang at test time, made an NSO, packed in a .nup with a
main.npdm and a small RomFS. tests/end_to_end.rs builds it with build_driver::build::build and the builder's read
stage, lift, compile (the game alone, from a synthetic tree: the test's host with the real host/romfs.c,
host/romfs_index.c, runtime and zstd) and finish; runs the game and checks its result against the one src/lib.rs
computes; then changes one instruction of one function and checks, by the --json events, that its unit alone was
compiled again. #[ignore]d: cargo test --release -p synthetic-game -- --ignored (LONGSHOT_E2E=1: no skip).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A release's longshot-build embeds one pack (build.rs, LONGSHOT_SOURCES): the
sources, the prebuilt third-party objects and the build tools, each part a
zstd member of its own so a release with the same tools differs little.
build-driver's sources.rs unpacks it into <cache>/sources/<hash>/, every file
checked by its SHA-256, each folder renamed into place whole with a .complete
note written last; a tool is unpacked once into <cache>/tools/<name>-<hash>/
and hard-linked into each tree. Relative symlinks inside a member are kept,
any other refused. tree_root takes it after --root and LONGSHOT_ROOT; a
developer's build carries nothing and says to name a checkout.
`longshot-build sources` unpacks ahead of a build and prints the folders.
The game is always the folder's own exe (no launcher in bin/); the Windows
icon moves to assets/longshot.ico.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
sources: the tracked tree a player's build reads, VERSION, the third-party
objects, --add files and --tool/--tools folders, as deterministic zstd -19
members; build --sources embeds it; unpack reads one back as the program
does. deltas: zstd --patch-from --long=30 from each earlier full file, each
checked by applying it, and longshot-build-<v>-<p>.json listing the full
file, the deltas, their bases and SHA-256s and the stamps. fetch-bases: the
channel's last 5 releases' full files, checked against their manifests.
llvm-mingw moves here from builder_package.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A release ships longshot-build alone. Removed: builder/ (AppRun, tools.sh,
longshot-folder, LongshotBuilder, setup), scripts/linux/appimage.sh,
check_player_build.sh, builder_package.py, check_windows_files.py,
recomplauncher.json and their tests; dev.py, the profiling and coverage
tools, the docker environment and the remaining tests now name
longshot-build's own layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build-linux.yml and build-windows.yml make longshot-build-<v>-linux-x64 and
longshot-build-<v>-windows-x64.exe from tools.lock's bundle, the third-party
objects, RenHDrum's library and the sources; a player's build's dry run over
what each carries (the Linux one from an empty cache, the Windows one started
under Wine); then, for a release, the deltas from the channel's last 5
releases and the manifest. release.yml publishes them with SHA256SUMS over
every file. ci.yml: the .NET builder checks go, the e2e job runs
rust/crates/synthetic-game on every change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
ci(circleci): mirror longshot-build per platform, its release files and the e2e job
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 16s
CI / Website build and checks (pull_request) Failing after 57s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 1m1s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m29s
CI / longshot-build end to end (synthetic game) (pull_request) Successful in 2m32s
ff24900fef
The AppImage, Windows builder and builder-cli jobs go; linux-longshot-build
and windows-longshot-build mirror build-linux.yml and build-windows.yml,
each also a release job (deltas and manifest when on a channel);
release-stage checks both full files and manifests; e2e runs the synthetic
game on pull requests and main. release-checked-skip no longer fails a
commit that was never released.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
docs: one self-contained longshot-build per platform, in place of the AppImage and the Windows Builder
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 10s
f26faa32b5
The release ships longshot-build-<v>-<platform> with the sources, assets, prebuilt objects and build tools packed
inside, its zstd deltas from the channel's last five releases and a manifest; players build through the Longshot
Launcher only. The pages and the host/ and rust/ comments that described the AppImage, the Windows Builder, its setup
and --cli, the zip, recomplauncher.json and the tools' download say so now, with what the pack holds, where it unpacks,
the order the tree is found in, and the CI jobs that build it.

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

Pushed f26faa32: one self-contained longshot-build per platform, and the first game runs.

  • The AppImage, the Windows LongshotBuilder app and its setup are gone: a release ships longshot-build-<v>-linux-x64
    (162 MB) and -windows-x64.exe (99 MB) with everything packed inside, zstd deltas (760 KB for a one-file change)
    and a signed manifest; LongshotLauncher #259 installs from them.
  • Folders built by longshot-build reached gameplay four times on this PC with no trap or crash.
  • CI builds a synthetic game end to end; image.bin is mapped on Linux; the docs follow.
  • On the head: rustfmt, clippy, 300 tests and the end-to-end test pass.
Pushed f26faa32: one self-contained `longshot-build` per platform, and the first game runs. - The AppImage, the Windows LongshotBuilder app and its setup are gone: a release ships `longshot-build-<v>-linux-x64` (162 MB) and `-windows-x64.exe` (99 MB) with everything packed inside, zstd deltas (760 KB for a one-file change) and a signed manifest; LongshotLauncher #259 installs from them. - Folders built by `longshot-build` reached gameplay four times on this PC with no trap or crash. - CI builds a synthetic game end to end; `image.bin` is mapped on Linux; the docs follow. - On the head: rustfmt, clippy, 300 tests and the end-to-end test pass.
scripts/linux/deps.sh trims LLVM 23.1.5's release to clang, lld (as ld.lld), clang's headers and the builtins and
profile runtimes (96 MB, 407 MB unpacked, from emsdk's 142 MB); scripts/windows/deps.sh trims llvm-mingw 20261104 to
the x86-64 target (50 MB, 314 MB unpacked, from 191 MB), cross-builds the Windows cpm's FFmpeg and dav1d with llvm-mingw
and packs libsdl's SDL3 and sdl2-compat DLLs. tools.py pack: sorted, fixed times and owners, zstd 1.5.7 built from its
pin at -19 --long=27; repack moves the earlier zips; add --no-upload, missing and publish for the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build-driver's tools.rs: tools.lock's tools at <root>/tools/<name> named to the compile by their variables (one table:
LONGSHOT_LLVM, LONGSHOT_SYSROOT, LONGSHOT_FFMPEG, LONGSHOT_SDL2, RX_CPM; LONGSHOT_MINGW, LONGSHOT_SDL_DIR), over whatever
the PC sets; LONGSHOT_OWN_TOOLS=1 is a developer's own (the variables, EMSDK, the PATH). The builder's llvm has no
aliases: bin/clang, C++ with --driver-mode=g++, bin/ld.lld. A Windows build links llvm-mingw's FFmpeg (lib*.a) and
takes the SDL DLLs from LONGSHOT_SDL_DIR. longshot-build stamps (a stamps event) and longshot_version.txt carry the
compiler stamp (tools.lock's compiler, sysroot and cpm lines) and the shader translator's. The synthetic game's
end-to-end test compiles with the checkout's tools/ the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/ reads the RomFS through romfs.c now: the audio source's, the mods' size tables' and the virtual cores' file-open
fixtures build its folder backend (or cut index_rel from nn_fs.c), and test_vcore_fs_open also checks the new .nup
index path (no core, no save lock held, the core given back). The teleport fixture's Ctx has rust/rt's vreg[32][2],
mods.c's game_file takes its size, and test_hos_ab lets later API versions' entries follow hos_ab_frame's group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
test_ffx_sdk and test_xess_sdk checked nx2/make_game.py's licence gate and runtime placing, which longshot-build's
runtimes.rs does and tests now: they check that scripts/fetch.py and runtimes.rs pin the same files (tests/vendor_pins.py).
test_linux_update's folder launcher and bin/ tests went with the code; its sysroot check is a build-compile key test.
test_pipeline_tour reads the renderer's PGO_ENV flag in build-compile's plan; test_job_queue's Windows build outside the
queue is a longshot-build.exe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- scripts/reshade/check_fx.py takes the adapted preprocessor from build-compile (examples/reshade_preprocessor.rs, run
  with cargo) in place of nx2/reshade_fx.py.
- scripts/check_third_party.py skips a folder that holds only ignored files (a deleted part's build output left in a
  checkout), with a test of it.
- test_linux_docker_packages: every package and PPA the workflow installs is in the Dockerfile, which keeps g++-13's PPA
  for the sysroot; test_windows_on_linux skips comment lines; test_mise_build reads the Rust pin where the docs say it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The driver read the tree's assets/profiles/guest.profile or nothing; recording a profile for the new lifter needed
the lift and the compile run by hand. build --guest-profile generate lifts with every unit's counters
(lift::whole::Profiling::Generate, its gen/profile_map.txt beside them), --guest-profile <file> lifts with that
profile instead of the tree's. A build's alone: an update lifts with the tree's profile again.
(stages::profiling: the one place the choice becomes the lift's Profiling.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
gen/'s lifted_*.ll were 5.7 GB per work folder, written by the lift and read once by the compile. The per-unit key
already decides whether a unit's object is needed, so the text is made only then:

- lift::whole::Session: discovery, the edits, the profile and the units' plan with their keys, worked out once
  (run_with returns it). The lift lists each unit in units.txt by its key; a unit whose key the last list has keeps
  its content key, a new one is listed pending (content key -, size and cost estimated). No unit file is written,
  and any left in gen/ are deleted.
- lift::whole::Texts makes a unit's text on demand from that session, or from one worked out again (an unchanged
  lift whose objects the store lost), checks gen/ still holds that lift, and after the compile notes the units made
  in units.txt with their content keys: the next update knows every object's key without making a text.
- build-compile: a lifted unit with no file and no content key has its text made in its compile worker (under the
  memory gate as before), hashed, looked up in the store by that hash (a unit whose key changed but not its text
  compiles nothing: Made::Stored), else compiled from standard input (-x ir -). Its object key is its text's, as a
  file's would be. Keys::base is None for a unit whose text is not made yet.
- llvm: each unit names its file inside (source_filename), so the object's file symbol, and the whole object, are
  the same whether clang read the file or the text (checked byte for byte on a game unit, and in
  build-compile's compile_link test).
- The driver passes the lift's texts to the compile (build and the compile stage alone) and notes them after it.

LONGSHOT_KEEP_IR=1 (and longshot-lift lift, and an instrumented lift) writes the texts as before, to read or compare.
Behaviour of the game unchanged by construction: the same IR text reaches clang with the same flags, and the objects
are byte-identical to the file route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
With a guest profile, the functions it never saw run are most of the game: 223,055 of 294,518 functions, 3.7 GB of
the 5.7 GB of IR with the six scenes' profile merged with the earlier one. They now go into units of their own,
lifted_cold_<entry> (units::Sizing::cold_budget, 240,000 by default, three times a regular unit's, as -O0 compiles
the IR in a fifth of -O1's time; longshot-lift lift --cold-unit-cost N, 0 keeps them in the regular units), which
build-compile builds at RX_COLD_OPT (Kind::LiftedColdIr, -O0 by default; RX_COLD_OPT=O1 builds them as the rest).
Without a profile nothing changes: no function is cold.

Measured (Ryzen 9 7900X, clang 23.1.4):
- The cold units alone, rusage CPU time: 1,180 s at -O1, 239 s at -O0; .text 330 MB and 520 MB. Of the cheaper
  choices on 20 sample units: -O1 -fast-isel 91 % of -O1's time, -Os 133 %, -O1's middle end with -O0's code
  generation 55 % (190 % of the size), -O0 19 % (147 %).
- A first build with the profile, 23 jobs on all 24 threads, the timing queue: 124 s at -O0 against 183 s at -O1
  (the compilers' time summed 1,858 s against 3,233 s); the executable 774 MB against 590 MB, far under the 2 GB its
  code can address.
- The game, headless, a tour of ten areas each teleported to, walked 15 s and held 15 s, three interleaved runs a
  side (RTX 3090): the areas the profile was not recorded in (Zora's Domain, Jabu-Jabu's Belly, the Lost Woods, Lake
  Hylia, Gerudo Valley, the Water Temple, Death Mountain Trail) and those it was (Hyrule Field, the Fire Temple,
  Kakariko). Warm fps, p99 frame time, the 1 % low and the game's own CPU time a frame all within 1 % of -O1's in
  every area but Kakariko (109 against 113 fps, two runs against three), no more frames over 33 ms (17 against 36 in
  all). -O0's frames are about four times larger (a lifted function's median 104 bytes against 40); guest threads
  run on 64 MB host stacks.

The same IR either way: only the level its compiler is given changes (musttail, the only tail calls, holds at -O0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
docs: the first build's time and space with the new builder at its default jobs
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 52s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Successful in 56s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m2s
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / longshot-build end to end (synthetic game) (pull_request) Failing after 20m1s
7a728a771c
Measured on the development PC (Ryzen 9 7900X, 24 threads, NVMe SSD), the timing queue on all 24 threads, a fresh
work folder and stores, the split, the compile caps and no unit texts kept: a first build 180 s (lift 5 s, compile
164 s, finish 9 s), its work folder 1.7 GB (from 7.2 GB with the texts), an update with nothing changed 10 s. The
player docs said 7 minutes and 8 GB kept / 10 GB free (a 6-job build with the texts): now about 3 minutes and 2 GB
kept / 5 GB free.

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

For the Direct3D 12 back end (#2040, WIP, Windows only): two things it needs from the new builder. I'm raising them now so they can be planned rather than added afterwards.

  1. A second renderer module on Windows: longshot_d3d12.dll, built from gpu/d3d12/ beside longshot_vk.dll. It uses the same Eden and Sirit sources plus SPIRV-Cross, with its own shader stamp (gpu/d3d12/build.py). On #2040, nx2/build.py builds it and make_game.py places it. This PR deletes both files.
  2. Mesa's spirv_to_dxil.dll and its license file beside the game: Mesa 26.2.6, pinned by size and SHA-256 in third_party/mesa-spirv-to-dxil/PROVENANCE.md. The builder would fetch and place it the way this PR does with the DLSS, FSR 4 and XeSS runtimes. #2362 adds it to today's third-party archive. With #2295 and this PR that archive goes away, so the builder is where it would end up.

On #2040's side, the D3D12 menu will read its fonts through romfs_read, the way vk_imgui.cpp does here, once it is rebased onto this PR. I can write the builder side for both items once this builds on Windows, or hand over what the old path does.

For the Direct3D 12 back end (#2040, WIP, Windows only): two things it needs from the new builder. I'm raising them now so they can be planned rather than added afterwards. 1. **A second renderer module on Windows:** `longshot_d3d12.dll`, built from `gpu/d3d12/` beside `longshot_vk.dll`. It uses the same Eden and Sirit sources plus SPIRV-Cross, with its own shader stamp (`gpu/d3d12/build.py`). On #2040, `nx2/build.py` builds it and `make_game.py` places it. This PR deletes both files. 2. **Mesa's `spirv_to_dxil.dll` and its license file beside the game:** Mesa 26.2.6, pinned by size and SHA-256 in `third_party/mesa-spirv-to-dxil/PROVENANCE.md`. The builder would fetch and place it the way this PR does with the DLSS, FSR 4 and XeSS runtimes. #2362 adds it to today's third-party archive. With #2295 and this PR that archive goes away, so the builder is where it would end up. On #2040's side, the D3D12 menu will read its fonts through `romfs_read`, the way `vk_imgui.cpp` does here, once it is rebased onto this PR. I can write the builder side for both items once this builds on Windows, or hand over what the old path does.
assets/profiles/guest.profile.xz: the six scenes of the old hot list recorded with the new builder's instrumented
game (hyrule-field, hyrule-field-adult, market, kakariko, deku-tree, fire-temple: 43,333 functions ran), merged with
the earlier recording on the new lifter (boot and loading included, 71,601 functions, every one still matching this
build's code): 71,741 of the game's 294,518 functions. xz -9e, 2.8 MB (13.8 MB of text). Each of its 813,088 lines
checked to be the header, f <entry> <code hash> <entries>, b <block> <count> or t <block> <count>: addresses, hashes
and counts, no game code.

- profile::Profile::load (and Map::load) read an xz file as it is, told by its magic bytes; the lift's key holds the
  file's bytes as before. The driver's shipped profile is the .xz.
- A build without --guest-profile now lifts with it: branch weights, the hottest functions in lifted_hot_* units at
  -O2, the never-run ones in lifted_cold_* units at -O0 (RX_COLD_OPT). A function whose code hash no longer matches
  takes no counts and is neither hot nor cold (tested: profile's xz test).
- Docs: build.md (the shipped profile, its defaults, recording one again with the .xz), builder.md, and
  assets/profiles/README.md (what it holds, what it was recorded on, what it measured).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The private file mapping put file-backed pages in the window: a GPU pool overlapping the image could not be imported
as a dma-buf or a userptr on AMD, and it saved about 50 ms at the start. map_image, hos_posix_guest_private, the
Vulkan back end's host-pointer branch and hole-scan skip for it, and tests/test_image_map.py are gone;
HOS_IMAGE_MAP is a GONE row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
`--game G --out G` linked the dump's romfs over itself (link_or_copy removed the destination first) and
`--work` inside the dump made exefs/ again there. folder::check_places refuses a game or work folder that
overlaps a dump's folders (either way round) or holds the .nup, before anything is touched; fsx::link_or_copy
links or copies to a temporary beside the destination and renames it over, and leaves a destination that is
already the source alone. Temporary names are each call's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build-windows.yml, vulkan-dlss.yml and every RenHDrum cache restored the
whole unpacked toolchain (rustc included), which toolchain() trusted by its
.complete note alone, a release's build too. They now keep the .tar.xz parts
and the crates, which are checked by their SHA-256 each time they are taken;
CircleCI's RenHDrum caches likewise. toolchain()'s note names each part's
SHA-256, so a folder of another pin is made again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
longshot_build.py llvm-mingw checks the kept archive on every call and takes
an unpacked folder only when its stamp names the pinned SHA-256, written
last. Every workflow and CircleCI keep only the archive. ci.yml's
host-windows restores its caches on every run and saves them only on a push
to main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- hos_romfs_head of a zstd-stored file decodes its frame's first blocks (hos_zs_frame_head), not the whole file.
- A decoded zstd-stored file is kept after its last close, 256 MB of closed copies at most, the least recently used
  let go first; the most held at once is logged as it grows.
- hos_romfs_case finds folders too (mods.c's mod-only listing listed a mod folder the game also has twice), and the
  very spelling first (of two names that differ in case only, the other could be found).
- hos_romfs_ready says whether a RomFS is there: an index open, or a folder that exists (the beside path was set
  always).
- The index is checked at open: every entry within the .nup, sizes sane, the names in strict order (lookups are binary
  searches); else romfs_index_bad.
- Windows: the .nup's handle is overlapped, each read waiting on its thread's event (one synchronous handle served every
  thread's reads one at a time); a long path is made whole by GetFullPathNameW ("..", a relative path) and extended as
  \\?\ or \\?\UNC\; the index's path beside image.bin takes either separator and refuses one that does not fit.

tests/romfs_test.c checks each (they fail on the code before), with two names that differ in case only and damaged
indexes from the Rust side.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
folder::install moves each old file aside before its new one goes in and puts every swapped file back when one
fails, so a folder holds the old build or the new one, never half of each. A vendor's DLL or DLSS runtime was
taken for the player's own whenever its bytes were not this pin's, so a pin bump never reached a folder built
before: now one rule for DLSS, FSR 4 and XeSS, by the installed note (folder::ours): the builder's own files are
replaced, and a build without that upscaler removes only them (folder::uninstall; ngx/ was removed whole).
build-core gains fsx::rename (Windows: retried on access denied and sharing violations) and key::file_sha1;
build-compile's key::file_sha1 is now that one (build-compile/src/key.rs only).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
One block's sequences could copy gigabytes (each match up to 128 KB, tens of thousands of them), and a head's
prefix decode had no limit at all. Each sequence and the block's last literals are now checked against the
format's Block_Maximum_Size and the frame's limit before they are written; the test is a hand-made 16-byte
block of four 64 KB matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A release whose manifest cannot be read, is not JSON, names no full file or
another one, or whose full file does not download is left out and the next
taken; the release list is asked again three times, and when it still cannot
be read the release has no deltas instead of failing. Game-free test:
tests/test_longshot_build_bases.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
LONGSHOT_QUEUE_HEAVY takes wildcards and names longshot-build-* by default;
the cargo that dev.py packs run builds longshot-build with carries
LONGSHOT_HEAVY and counts as a build outside the queue. LIFT_KEY_PREFIXES is
BUILD_SWITCH_PREFIXES, what it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
packs.builder holds <dev>/cargo.lock across the cargo build and the copy
out, so another checkout's build cannot replace the program in between.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Nup::open checks every record's extent (no wrap, inside the file: an offset + size that wrapped read as an
empty file that looked whole); a record's size reserves at most 64 MB up front; a directory's children range
is added in usize. The romfs index refuses an entry past its .nup. An NSO's segments must fit a module (1 GB:
a u32 size or offset asked for gigabytes before anything was checked), and its MOD0's bss with checked
offsets (a negative one wrapped and the image's resize panicked). The le32/le64/u32_at readers of nup.rs,
romfs.rs and nso.rs are now one module (le.rs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
`mise run build` and `build-dev` ran longshot-build without the tools'
variables, the NGX SDK, dev_build.json's env or the store, which dev.py
base, pack and rt give theirs. Gone with the packaged builders:
LONGSHOT_TOOLS' drops, nx2/addresses.ini in BUILT and the bin/ layout check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A bug's panic ended the event stream with Rust's message on stderr and status 101. A hook now says it as an
error event (code internal_error, the panic's message and place, where the build log is) on stdout and in the
log, and ends the process with status 1. A debug build's panic-test command lets a test run it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The old lifter that such functions were left to is gone, so a single uncovered
word (an FP16 fused multiply-add, or data that discovery walks into by
mistake) failed the whole build. It now stops the guest at its address, as an
undefined one does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
ci.yml's rust, e2e and host-windows jobs and CircleCI's rustup command piped
sh.rustup.rs, whatever it served, into sh. scripts/ci_rust.sh installs
rustup-init 1.29.0 checked by its SHA-256 when the machine has no rustup,
then the version mise.toml pins (the one place it is written).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
parse_ips and parse_pchtxt take main's size and stop at the first write outside it (an IPS of 64 KB runs, 8
bytes each, grew the writes' map by gigabytes); a file's writes, runs counted, stop at 1 MB; a pchtxt offset
and its shift add with checked arithmetic (an overflow panicked in a debug build, wrapped in a release one);
collect reads no patch file over 4 MB (said as unsupported).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
hos_prompts_base_at finds a range inside one run, so a base with two runs that touch would not serve a range across
them; the builder (rust/crates/build-assets prompts::base) merges runs that touch or overlap and never writes one. The
parse took them (only overlapping runs were refused). The_host_patches_the_stream checks a hand-made base with two
touching runs is refused (prompts_base_test's new exit 3: the base refused); it fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
take() and compile() wrote the new stamp after placing the object but left the old one in place until then: a
run stopped between the two left object B stamped with key A, taken for up to date. Both now go through
stamped(): the old stamp removed first, the new written once the object is in. A header (or the source) written
while its compiler ran was hashed afterwards and the object stored under the new bytes' key: now such an object
is used and not stored. State::remember records a hash only when the file's stat is the one before the read.

Hunks (build-compile only): compile.rs take(), stamped() (new), compile()'s start time, its headers line and its
final rename/stamp block, changed_since() (new), depfile_headers()'s check; state.rs sha1() and remember().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Half add, subtract, multiply, divide, square root, roundings, min and max,
compares and conversions (scalar, vector, pairwise, across lanes, by element)
are lowered: each host operation on halves is done in single precision and
rounded back, which is exact (24 >= 2 x 11 + 2). The fused forms, the
estimates and the fixed-point conversions of halves stay uncovered and trap.
One gate (fpscalar::float_elem) says which.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
dry-run: a player's build's dry run over a tree, with and without AMD FSR 4,
checked (a release's program from an empty cache with --clean, or one with
--root). release: the stamps, fetch-bases and deltas for the version's
channel, nothing for a version on none. Forgejo's and CircleCI's jobs call
them instead of each carrying the same shell. build-linux.yml and
build-windows.yml are called by release.yml only (no dispatch, no
cancelling). One zstd path (the zstd program; no zstandard package for the
pack); sha256_of goes. llvm-mingw's Linux pin is read from
scripts/windows/deps.sh, where it is written, and --host windows handles
tools.lock's trimmed archive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
They decoded to Flow::Return, so the lifter made an ERET a RET to X30. At EL0
both are undefined: they are Flow::Trap now, the lifter's trap at that pc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Two builds into one game folder from two work folders swapped their files in over each other's and wrote two
romfs indexes. build-core's lock gains GameLock (`.longshot-build.lock` in the game folder, game_folder_busy),
taken by build, image and index (index took no lock at all). The places check now comes before the work and
game locks, so a refused place (a dump as the work folder) gets no folder and no lock file written into it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
DC ZVA was lowered but DCZID_EL0, which code reads before using it, was an
undefined system register: the guest stopped there. It reads 4 now (BS 4,
DZP clear).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Every command hashed the whole embedded pack (hundreds of MB) to find its tree: the tree's hash is of the
members' recorded hashes, and a member's bytes are checked only when it is unpacked. Each use marks its
folders (.used); under <cache>/sources and <cache>/tools a folder no release used for a week goes, the last
two of each kept, and a stopped unpack's .part folder goes after a day. The unpacking tests run one at a time
(they share the process's tool table).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A work folder (its lift and build: gigabytes) outlived its game folder forever. Each build notes its game
folder in the work folder (game_folder.txt); after a build, the cache's other work folders whose game folder
has no build record, unused for a day and held by no build, are removed. A work folder named with --work is
never pruned beside.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Constant shifts by the width or more; atomics (AtomicRmw, CmpXchg, atomic
Load and Store) of anything but a scalar integer of 8 to 64 bits (CmpXchg: or
i128); loads and stores of flags; exclusives of a size the monitor has not
(1, 2, 4, 8; a pair's halves 4 or 8); marks of no bytes; byte swaps of less
than whole halfwords; a switch with one address twice; an edge from a piece to
itself or to piece 0. verify_pieces checks a split function's pieces together
(every piece edge names a piece and an entry block of it); the whole lift and
the split test call it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Two builds downloading one runtime wrote the same <file>.part: each download now writes a temporary of its own
(fsx::temporary). curl gives up under 1 KB/s for a minute (--speed-limit, --speed-time), as wget's timeout
does, instead of waiting for ever. The record keeps each license with the pin its files came from
(Record::accepted): an update after a pin bump asks for the license again. runtimes' sha256_of streams the
file; build-core gains key::to_hex, used by sources.rs, runtimes.rs and game-files for their hex.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The romfs's names went unchecked into the index, and the assets write files by them (build-assets' texts):
a name such as ../outside.zs wrote outside the game folder. romfs::entries runs package_parts over every
name (nup_unsafe_path), and Index::open refuses an index holding one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
An antivirus or the search indexer opening a file just written makes Windows refuse its rename for a moment.
fsx::rename (retried with backoff on access denied and sharing violations) is now what fsx::write_atomic,
fsx::link_or_copy, the store and the unpacked tree's rename use. build-compile's store.rs drops its own
beside/write_whole/place for fsx::write_replace (unflushed, for the manifests) and fsx::link_or_copy (store.rs
only, those three functions and an import).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
enter_first let any smaller job by a first choice that did not fit, so the small ones could take its room as
fast as it came free and the longest unit ran last, alone. Once the first choice has waited PATIENCE (10 s),
nothing else is let by it: the running jobs end and its room comes (memory.rs only; the scheduler is
unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
perf.py hotlist and analyses.hotlist wrote assets/profiles/hot_funcs.txt for
the old lifter's A64_HOT_FUNCS, and cover.py --hot compared against it;
nothing reads either now. cover.py run starts the game folder's own
longshot.exe (no launcher bin/).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
pipeline_states.py, perf_report.py, lower_test.py and addresses.py are
developer tools now that longshot-build builds the game; every reader
(tests, scripts, docs, gpu/ and rust/ comments) names scripts/. The
pipeline list's docstrings name build-assets' merge instead of make_game.py.
test_dev_packs no longer checks the removed bin/ refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
assets/prompt_faces/README.md's way to draw a face by hand runs build-assets'
example (PROMPTS_DUMP) and names prompts/faces.rs and guides.rs;
assets/pipeline_states/README.md names build-assets' merge and share; the
PROVENANCE notes name build-compile and game-files instead of nx2/build.py,
zbic.py, ui_fonts.py and prompt_*.py; tests' and scripts' comments too.
test_dev_update no longer patches the gone build.windows_prebuilt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
setup.md's table says what mise run setup does (the checks' Python packages
with test-deps, Rust's check). The disk space is worked out once, in
build.md's Disk space (about 5 GB free), and README.md, setup.md and the
player pages link to it through the requirements; build.md's times are the
current ones at the default jobs, and it and builder.md say which units
each count is. ci.md lists ci.yml's rust, e2e and host-windows jobs, that
run_all runs on CircleCI only, PACKAGES_TOKEN_SEALED, the build workflows,
and that CircleCI does not make or publish the tools yet; releases.md the
dry-run and release steps, and the planned compiler of our own (about half
LLVM's release trimmed). vulkan-dlss.yml's header says it runs by hand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Nup::frame_length decoded its frame a second way: it is now decode's (which says the frame's length too).
nup.rs and checks.rs had an is_link each: one, in checks. patches::Context::from_env read HOS_MODS and
HOS_OPTIONS_FILE itself: Context::new takes the caller's environment (the driver's crate::env). Removed:
checks::check_cache_paths (only its test used it: every write into the game folder is a rename now, which
replaces a link and never writes through it) and disk::slow_disk_warning (the driver's warning is the one).
Kept: nup::read_exact (the nup example's), and the old mods list, longshot_mods.txt, which host/mods.c still
reads while there is no mods.json (the builder applies patches in the order the game shows).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
folder::old_builder_leftovers is gone (a clean break: no supported builder wrote those files into a game
folder of this one); the romfs/ folder a dump build linked is still removed for a .nup build, as the game would
read it before the index. folder::version_text takes LONGSHOT_BUILDER_EXE from the driver. The tests share one
scratch folder helper. layout.rs says the cache as it is (the store's v1, sources/, tools/, runtimes/), and the
disk estimate the 16 MB index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
scripts/perf_report.py and addresses.py move into build-driver's perf.rs:
perf-report <game folder> shows the state, --send sends what waits in
perf_pending/, --tick on|off [--keep-sent on|off] sets the tick, each
answered with a perf_report event (build-events.md). The same behaviour:
the tick and keep_sent in longshot_perf.ini, oldest first, the version and
release filled in, 48 waiting and 5 a start at most, 60 KiB a body, the
answers (sent, refused only for 400/413/415/422, busy with Retry-After or an
hour doubling to a day, later), the copies in perf_sent/, and one sender at
a time under perf_pending/.sending's renewed lease. The relay is the folder's
perf_reports= (which a release's build stamps from assets/addresses.ini), or
LONGSHOT_PERF_URL; each POST goes through curl, as runtimes.rs downloads, a
redirect never followed. Its tests run against a relay on 127.0.0.1;
tests/test_perf_report.py keeps the game's side and reads perf.rs's
MAX_BODY.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- zs.c's two once-guards around read_dicts (hos_zs_decode's and hos_zs_romfs_stream's) are one hos_zs_dict(id):
  each caller waits for the first read to end (a second one saw no dictionaries while the first read, and the two
  could both read them).
- hos_zs_romfs_stream of a .zs the .nup keeps in a zstd frame of its own (hos_romfs_open_stored) unwraps that frame as
  it streams, never the whole file decoded in memory.
- audio_source.c, oot_heart_containers.c and prompts.c read their frames through zs.c (hos_zs_read_romfs,
  hos_zs_decode), its dictionaries found by the frame's id; their own decoders, SARC readers and dictionary loads are
  gone, and so is their zstd.h (ZSTD_HOST: hos_zstd.c and zs.c).
- One writer of a frame of raw blocks (prompts_base.h hos_zs_raw_head/hos_zs_raw_block): the patch, zs.c's
  hos_zs_write, and prompts.c's served files (written beside and moved over, as hos_zs_write does).

tests/zs_test.c (game-files' the_host_streams_a_wrapped_zs) checks the stream, decoded bytes never held; it fails on
the code before. The audio, heart containers, mods sizes, mods list and damaged files fixtures follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The timer thread's writes (every 10 s, or on <path>.dump) and the one at exit wrote the same <path>.tmp at once: a
profile could come out cut or mixed, or a write fail. lsp_write takes a lock (and lsp_reset), and the write at exit is
the last. tests/test_guest_profile_write.py (tests/guest_profile_test.c: two threads writing 200 times each, then the
last) fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The host and the renderer are built together, so a host of another version never loads this renderer. init_body's
copy ladder (version 14 to 45) and every host->version guard (the Mods tab's, the A/B's, sprint's, the input movie's,
the out-of-memory call's, the load mode's version-14 rule) are gone: one check, h->version == MKWVK_API_VERSION, and
the table copied whole. The tests that read those guards in the source follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
MkwVkHost.romfs_dir, host/rx_backend.c's host_romfs_dir, vk_imgui.cpp's folder fallback and game_font::Reader's
open(dir) are gone: romfs_read serves a romfs folder as it serves the .nup's index (host/romfs.h). tests/test_game_font.cpp
opens its folders through a reader of its own, as the host's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A romfs folder was read with the host's own handles (CreateFileA, FindFirstFileA, GetFileAttributesA) and the .nup's
index through romfs.h; now every path under hos_romfs_dir is romfs.h's (romfs_rel, once index_rel), so Handle.rom is
the only RomFS handle and a folder's listing, type and reads are romfs.c's, as an index's. Paths a mod, the overlay
or a stand-in sent elsewhere are opened as before. A flush of a RomFS handle touches no host handle. The damaged
files, vcore open and save commit fixtures follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
romfs.h's hos_romfs_fold and HOS_ROMFS_PATH (1024, with its 0) in place of romfs_index.c's and romfs.c's own folds
and caps, and of the locale's tolower and MAX_PATH where mods.c and prompts.c hold or fold a RomFS path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The Tracy client's start was all that file held (the Rust lifter writes no zones of the game's functions); it is
hos_main.c's now, and the compile plan has no rule for it. zs.c's header names every reader it serves, and the damaged
files' zstd check names the Rust builder's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The lift keys all 294,518 functions (what lifting each reads, written out and hashed) before it plans the units: on
one thread that was most of a lift that writes no unit texts. Now on the lift's workers, chunked, the same keys in
the same map (the plan reads them by entry).

Measured, `longshot-build lift` on a fresh gen/ (no unit texts kept, the shipped profile), three runs each, 23 jobs:
5.66 / 5.68 / 6.16 s before, 3.77 / 3.85 / 3.85 s after (discovery 1.3 s of it).

The lift's line "N units, M kept from the last lift" counted the units listed without their text as kept; it now
says "K kept, M new".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
MRS and MSR were left out whole, though the docstring said only the system
registers but NZCV and TPIDR_EL0 were; DC ZVA (a SYS) was left out; a register
offset's index was always 0 to 0x3f, so neither the upper 32 bits UXTW and
SXTW drop nor a negative index was ever drawn; and the marks of written pages
were never looked at. Now TPIDR_EL0 is compared after each word, the index has
random upper bits and a random sign, and every 4 KB page a word changed must be
marked in a64_dirty unless it wrote through SP. The docstring lists exactly
what is left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Image::modules() said address order but kept image.json's; Image::new added
base + size and segment addr + size unchecked (a panic in debug, a wrap in
release). Both are checked now, the modules sorted by base (DT_INITs with
them).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Bit 32 of the FPCR location was kept for the deleted lifter's fast-float
regions (RECOMP_FPX_INHIBIT); nothing sets it now. MSR FPCR writes the low 32
bits (the rest is RES0) and MRS reads them back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
like() was k_like(), konst_like_mask() k_like(x, 0); lower() builds a Sem as
Sem::new does; FRECPS's infinity times zero is fp.rs's; a pair's two store paths
are one, and the space of a store one function; SDOT and UDOT, and the widening
multiplies of three-different and by-element, share their bodies; the
immediate SQSHL and UQSHL saturate as the register shifts do. mir's unused
recip_estimate export goes (sem computes it). Comments no longer speak of the
old lifter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
passes::summary: a function's reads before writes and its writes (mir::Summary, Loc::bit sets), its own code's
(local) then through its direct callees (close); an indirect call or jump, an SVC, a host call given the context, a
setjmp owner's call or a trap reads and writes everything, as does a callee that is not lifted. lift::whole summarises
every function (its IR before the passes, which only take reads and writes away) when register calls are on, and a
function's key holds its own summary and its direct callees' (in place of the whole list of lifted entries).

At a register call to G with summary (R, W): only the dirty slots in R|W are spilled, only the arguments in R|W passed
(poison for the others), X0 and X1 taken back only when G may write them, and only W but the callee-saved reloaded;
what G neither reads nor writes stays in the caller's slots, dirty if it was. An adapter stores only the arguments in
its function's R|W.

Test: the differential harness gets a function whose caller-set register its callee writes, a build with every
function split (pieces entered through adapters), and the summaries checked; three builds at -O0 and -O2 agree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Dest::Piece's code dropped the edge's poll, so a loop cut across its back edge never handed its core on (a stall, or a
deadlock with virtual cores). The writer's test that a polled piece edge loads the poll flag, and an unpolled one
does not. The lifter's tests that compile or run with clang fail when there is none (LONGSHOT_NO_CLANG=1 passes over
them), and the writer's compiles() has a folder of each call's own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
share_marks widens a group's marks to one of up to 4 KB, which can start on a page the GPU does not map and end on one
it does; the gate tested the first page only, so the GPU page went unmarked. The lifted code's mark and A64_MARK now
mark when either page is the GPU's (a mark spans two pages at most). A mark of no bytes marks nothing (the writer
took 1 from a u32 for it). Tests: the writer's text asks both pages' bits, and A64_MARK compiled against the lift's
a64_config.h marks a store from a CPU page into a GPU page, and not one on CPU pages only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Program::inputs wrote each address the function's own instructions may go to with whether it is an entry, but not
where its edits' code goes (a jump site's target, a label): an entry made there turns the goto into a tail call, and
the cached unit stayed as it was. FunctionEdits::targets gives those, and inputs writes them as the others. Wrap and
its lowering into mid IR move from edits/src/lib.rs to code.rs, the one edits file the lifter's own key hashes (a
change to the wrapper's IR kept every cached unit); its Infallible emit is unwrapped by pattern.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
llvm.threadlocal.address is memory(none) to LLVM: at -O2 it gave one address to two reads with a call between them,
and a guest thread's fiber can resume on another host thread across a call, with another copy of the global. Each
access now calls @tls.<symbol>(), a weak hidden noinline accessor (any unit's copy may be the one linked, so LLVM
neither inlines it nor infers it pure). Test: two reads around a call ask the accessor twice, and the function's own
code has no threadlocal.address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A host call without the context (mir HostArg::Ctx absent) syncs nothing: the guest state stays in the lifted
function's registers, and the context is stale. game_call(NULL) took the thread's own context then, so a host function
called that way could run guest code on stale state. Every caller passes the context it was given; a call with none is
refused (logged once, as the other refusals), and HostArg documents the contract. tests/game_call_test.c's calls pass
the context, and a call with none is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
share_marks keyed its groups by register, its one-base rule a debug assertion: a register's old value still used
after the register's next write (forwarded) joined the new value's group, and the shared mark went out from the new
base, missing the old one's pages. Groups are keyed by register and epoch (each value of it); a write no longer ends a
group, as its base value is still the one it was. Test: an old value's two stores share a mark from it, the new
value's keeps its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The review's undefined NaN constant cannot be made: mir's verifier refuses a float Op::Const (constants are integers),
and the writer defines a float NaN's bitcast and splat from the integer's bits. This guards that path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- mir: Loc::bit/from_bits/ALL_BITS and Function::succs, in place of sync.rs's LocBits and simplify.rs's Locs and their
  two successor lists; sync's dirty set has one transfer function.
- plan::Plan::callee and holders, in place of the PLT-following callee in lift, edits and sites and two holders loops.
- llvm: Module::add takes the runs (add_with gone); fresh_label in place of a temporary's name cut for a label;
  %x.lo/%x.hi only in a function with an LDXP.
- rt/a64.h: A64_POLL_CTX and a64_poll(Ctx *) (host/mkw_glue.c's too), and the g_module_base macro, 0 since every
  module is lifted at its address (host/oot_sprint.c, oot_menu.c, oot_sites.c name the addresses themselves).
- Comments that described the old lifter's ABI, its files and its asides now say what the code does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A second C harness over the lifted code: scale_f32's value 1.0 and 0 leave all of V0 (the product would clear its
upper half), note_u64 notes the register after its instruction, a replaced bl on sets X30 to its return address and
hos_site_callee to the function it calls and the callback's own call runs, memset's entry hook asks the host at
exactly 8 bytes and not at 7, a before site runs before a branch site at the same cbz, and a callback's Z is what the
b.eq after it reads. Each fails with its key line undone (checked). The lifter's clang tests fail without clang
(LONGSHOT_NO_CLANG=1 passes over them; from tnkyyzuk). tests/sitetable.py says line() and RULES are the old C contract.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
InsnKind classified words as a64-kit's lifter did, the PAuth branches (RETAA, BRAA, BLRAA) plain instructions, while
the lifted code decodes them as the return, jump and call they are: an after site on one passed placement and its
code was dropped. InsnKind::of is now the decoder's (a word that does not decode traps, as in the lifted code; its own
sign-extension copy gone). The function builder refuses code after an instruction that ended its block (a branch, a
return, a trap) instead of leaving it out. Tests: RETAA, BRAA and UDF's kinds; after code on a ret is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- plan_edits refuses an edit in a PLT stub (lifted as its jump: the code would never run), and placement a jump site
  whose target is another function's entry in a holder (the lifted code would tail-call it, not jump there).
- A test assembles each patch shape's instruction and checks the decoder prints it as the shape (Shape::Asm compares
  that text: a printer change fails there rather than finding no patch).
- Gone, kept only to compare with the old lifter: plan's file format and parser (Plan::load, parse, FORMAT, Error),
  SiteRecord and Plan::sites, Difference and compare; Placed::record; Placement::keep_flags and keep_context; Placed's
  shape, thread, in_loop and how (logs had them); longshot-lift discover's --plan, --check and --plan-inputs and lift's
  --check-plan.
- hooks.md names sites::parse_table; a lift test's name says what it checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- sites::HostList::site_lines, the one reader of the HOS_SITE lines (parse and the repository check use it; the check
  still finds an identifier named twice); tests/sitetable.py's site_lines likewise, which sitecheck.py's engine_fn
  now asks (engine_callback) instead of its own regex.
- game-files uses sites::Form::at_offset; edits takes a site's functions from Placed::functions; the site flag's two
  tests are one function.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Every build indexed the romfs again: the heads of the .nup's 186 587 files, 0.3 s with the .nup in the disk
cache and 6.5 s without (the same before this branch: measured at its base too). After a build's compile the
cache no longer holds it, so an update that changes nothing spent 7 s in finish waiting for the index.
romfs::index_or_keep keeps the game folder's index when its note (.longshot_romfs.json: RECIPE and what the
index found) is there and the index opens as one of this .nup (path, size, TOC hash); else it indexes and
writes the note after the index (and removes it before). reuse copies the note with the index.

A no-change update, the .nup evicted from the cache: 0:00:08 (finish 0:00:05-07) before, 0:00:02 (finish
0:00:01) after; warm, 0:00:02.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
romfs::RECIPE was a string to raise by hand with any change to how an index is made: easy to forget, and a
forgotten bump kept an index of other rules. It is now the format version (by hand, for format changes) and
ROMFS_SOURCES, a hash of romfs.rs, nup.rs, zstd.rs and le.rs that game-files' new build.rs makes (the files
and the hash in recipe_hash.rs, which build.rs and the test both include, as lift/build.rs does
LIFTER_SOURCES). The test checks the recipe is that hash of those files and that a byte changed in any of
them gives another.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
a64::Kind (Kind::of from the decoder's Insn::flow: PAuth branches are the branches they are, ERET, DRPS and UDF
trap, a word that does not decode traps) is the kind discovery's walk and the sites' forms both read; Insn::writes(x)
says which X registers an instruction may write (destinations, a load's Rt and pair's Rt2, an address's writeback,
BL's X30), and Insn::adr_target ADR's and ADRP's address. cfg/src/classify.rs keeps only small wrappers over them
(writes, adrp, adr, add_imm, pair_offset, bl_target); its Kind, a64-kit's masks, reads_rt_only and the sign-extension
copies (cfg's two, sites' one) are gone, and a table entry's sign extension is a cast. The hoisted-constant scan
follows a register move to its source, and a table whose index no compare bounds is bounded by what made the index
(an AND with a low mask, UBFX/UBFIZ, an ORR of two such values, a move: index_bound).

The kit's write mask was wrong for every logical shifted-register op (MOV, ORR: its pair test matches them), for
UDF (x0) and LDAPRB, and its walk went on past UDF, ERET and the other trapping words.

Discovery on the real image, before -> after:
- functions 294,518 -> 294,518; entries 295,270 and PLT stubs 9,917 unchanged; all 132 sites place;
- instructions 17,646,126 -> 17,635,231 (10,895 words after a trap that only its fall-through reaches);
- jump tables 1,475 -> 1,474, five changed: the BR at 0x818af990 has none (its base register is a moved copy of a
  loaded pointer, which the kit did not see written); 0x81843860's has 4 targets (2 before: the kit kept a bound
  across an ORR that rewrites the index; its index is (w24 & 1) | (one bit at 1)); 0x81dff940's, 0x82092ae0's and
  0x82092b38's have 4 (7, 6 and 10 before, read until a target left the function: their indexes are UBFX #4, #2 and
  AND #3), each checked against the code that makes its index.

Test: an index masked to two bits bounds its table at four.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
LIFTER_SOURCES hashed the crates that shape the lifted code but not cfg, whose discovery decides every function's
instructions, labels and jump tables: a build after a cfg change took its whole lift from the lifts' store by the
old key, with the old discovery's units.

The lists are in lift/key_crates.rs, which build.rs includes, and a test reads lift's dependency closure among the
workspace's crates (their Cargo.toml [dependencies]) and fails on one in neither CRATES nor NOT_IN_KEY (edits and
sites: EDITS_SOURCES; build-core: keys and reports, never the lifted code), with its reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The longest-first order of a first build (no measured times yet) took every C and C++ unit to be 1.3 s and every
lifted unit 1 s per MB of its cost plus 1: the renderer's big files (vk_draw.cpp 10.6 s, vk_memory.cpp 8.6 s,
vk_shader.cpp 7.8 s at 23 jobs) started after every lifted unit and ended the build alone, and the time left said
was more than twice the real one. The rates are now those a 23-job first build on the development PC showed: a
lifted unit 0.45 s per MB of cost (hot 0.65, cold 0.1), C++ 12 s per MB of source, C 2.5 s, the lift's tables 0.35 s;
measured times still win from the second build on.

Measured by replaying that build's measured unit times through the scheduler's order (23 workers, longest
estimate first): 99.5 s with the old estimates, 97.2 s with the new, the same as ordering by the measured times
(the work spread evenly is 97.1 s). Only the order and the time-left estimate change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The texts, the prompts, the shader list, the pipeline lists and the window's icon read only the romfs's index and
the tools, never the lift or the compile, yet were made after both: 7.7 s of a first build's finish. They are now
made on the romfs's thread as soon as the index is placed, on a quarter of the workers; the finish only reports how
they came out (a failure is still a warning: the game does without).

Measured, first builds through the timing queue on all 24 threads (the PC shared with other agents' work):
finish 7.7-8 s before, 1-2 s after. The whole build 168.1 and 142.4 s before (127.0 s in a quieter run), 134.0 and
128.8 s after: the compile, CPU-bound at about 92 %, takes back part of what the finish gives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build-events.md's codes missed game_folder_busy, game_files_overlap, internal_error, the vendor files'
license_not_accepted, bad_license and download_failed, extraction_link, no_romfs, pipelines_not_shared and the
prompts' warnings, and listed game_folder_link and old_romfs, which nothing says. The table now holds every code
(the builder's own and the warnings in rows of their own), says an update asks for a license again after a pin
bump, and build-driver/tests/codes.rs checks it both ways against the crates' Error::player, warn, lock and
Event::Error sites. exefs_patch_past_main could not be said (the parsers keep every write inside main): that
check is now an internal error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A cache key is anyone's to save first on the release runner, so the jobs
that make the release's files (build-linux.yml, build-windows.yml's package
job, CircleCI's linux- and windows-longshot-build with release: true) now
restore and save no cache: every download is fetched afresh and checked by
its SHA-256 into the run's own temp folder (one Rust folder for
longshot-build and RenHDrum). longshot_build.py builds in --work (default
<cache>-work) and renhdrum.py in <cache>-renhdrum-work, never inside the
cache; CircleCI's check runs copy back only *.tar.xz and crates/*.crate.
The build checks that ship nothing keep their object stores.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Each thread kept an event for its overlapped reads in a _Thread_local and never closed it: a handle leaked for every
thread that ever read the RomFS. romfs_os_read makes its event and closes it (a few microseconds against a read).
No test here: the Windows read path is not built on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
tools.py parse() refuses a line whose first two URLs are not Longshot's
store's for its name, version and SHA-256 (the sysroot's too); check
always refuses a lock without a tool a builder needs. release.yml's
version job runs check --require when nothing is missing (tools-publish
runs it after uploading, otherwise). releases.md says exactly when CI
remakes a tool. tests/test_tools_lock.py writes its lines with the store's
URLs and checks both refusals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Each link alone stayed inside the folder, but a/b -> .. then a/b/c -> ..
wrote a/b/c/x at the folder's parent. sources.rs, tools.py unpack and
longshot_build.py unpack_member now refuse a member whose path goes through
a link already there, or that is there already. Tests:
sources.rs nested_links_do_not_escape, tests/test_unpack_links.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- The finish's assets (made beside the compile since zsmqqsrx) were written straight into the game folder, so a
  build whose compile or link failed left the old game with the new build's texts and prompts. They are made into
  the work folder's finish/ (AssetPlaces::into) and swapped in with the game's other files; those made no more are
  taken out in the same swap. The seed pipeline list (the game's own cache) is placed after the swap.
- A vendor's files no longer asked for were removed before the swap, so a swap that failed after left them gone:
  folder::install takes the removals, moves them aside like the files it replaces and puts them back on failure
  (uninstall is gone); a locked file is game_running.
- install first sweeps what a stopped swap left beside every file it knows: a <name>.old whose file is missing put
  back, any other .old removed (on Windows one a running game holds is removed at the PC's restart, sys.rs's
  MoveFileExW), an orphan .new removed. A .new is opened with create_new.
- A vendor's copy is checked against its pinned SHA-256 on the staged .new itself, the bytes swapped in.
- A vendor file is the builder's when the installed note says so (read once for all of them) or when its SHA-256 is
  this pin's or an earlier pin's (EARLIER_PINS, empty: each vendor is at its first pin); the note's failed write is
  logged, not dropped.
- Downloads: curl -q first, --globoff, --proto =https --proto-redir =https; wget --no-config --https-only; Windows'
  own %SystemRoot%\System32\curl.exe by its full path; elsewhere the PATH's, relative entries and the program's and
  game folders skipped.
- builder.md: the staging, the swap, what a crash leaves, the folders' lock, game_folder.txt, the .used marks;
  Cargo.toml's lint note names disk.rs too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- hos_zs_frame_head, hos_zs_romfs_stream's decoder of the .nup's frame and of the file's own take ZSTD_d_windowLogMax
  31 (stream_ctx): zstd's streaming default refuses a window over 128 MB, so a zstd-stored file of the .nup larger
  than that would not stream (the largest known is 117 MB), and its head fell back to a whole decode.
- zs_feed keeps a frame's first bytes until its header is whole (ZSTD_getFrameHeader) before it takes the dictionary
  id: a first piece shorter than the header read no id, and a frame made with a dictionary failed.
- tests/romfs_test.c is built with zs.c as it is (HOS_ZS_ALONE), not its own copies of hos_zs_frame and
  hos_zs_frame_head, and checks a head of a frame whose window is 256 MB, decoding nothing whole; tests/zs_test.c
  includes zs.c, streams a .zs whose .nup frame asks for 256 MB, and feeds a frame made with a dictionary one byte
  first. The test .nup's codec 2 is such a frame (testkit raw_frame, wide_window_frame); text.dict and text.dict.zst
  are a 2 KB dictionary trained on the synthetic text and a frame made with it. Each fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
romfs.c kept a zstd-stored file's decoded copy by its frame's offset alone, while a handle's reads were bounded by its
own entry's size: an index (untrusted, a hand-made one) with two entries at one offset of other sizes served the
larger's reads from the smaller's copy, past its end into the guest. The index is refused at open when two entries
share an offset with another size, stored length or codec (a stand-in shares its frame whole, and stays allowed); the
copies are keyed by offset, stored length and size; and a read of a copy is bounded by the copy's size too. The
the_host_s_reader case "shared" (two zstd-stored entries made to share an offset) fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
index_romfs cut a mod's host path (and its RomFS path) that passed MAX_PATH and served the cut one: another file, or
none. It now logs the path and leaves it out (and a folder whose listing would not fit). test_mods_sizes' case long
(a RomFS path of 4,040 bytes under a mod, its host path past 4,096) fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
add_run kept realloc's result unchecked: a refusal wrote through a NULL run list. On a refusal the run is left out and
it is said once (and a list of none would start at 64). No test: an allocation refused on purpose would need an
allocator of the test's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
ci.md's website row back in the table, the paragraph after it; the Steam Deck playbook's desktop build is ~3 minutes;
build.md's game folder about 0.6 GB as build.rs says (and no link to its own section); mods.md bounds a RomFS path by
HOS_ROMFS_PATH and says a mod's file whose host path does not fit is left out; builder.md's romfs section has the
256 MB of closed copies and a head read from a frame's first blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
vk_fsr4.h (--upscaler fsr4), vk_main.cpp's preparation stops (longshot-build's driver message and its 15 minutes of
silence, build-driver shaders.rs), vk_draw.cpp's warm saves and Compile shaders, vk_menu.cpp, host/options_path.c and
.h (compile_shaders=), display_sdl.c (the window's icon), vk_shader.cpp (RX_VK_DUMP_FAILED's reader) and rust/rt/a64.h
(gen/rt/, written by the lift).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The panic hook sent its text (which can name the home folder: a path in a panic's message) unredacted, to the work
folder's log alone, and a second terminal event after done or error. It now redacts as the logs do
(log::for_log: Who::here(), and the JSON-escaped Windows form, shared with Tee), writes to every log file (--log's
too, through a Tee), and once the run's done or error was sent (report::ended) writes the logs alone and keeps that
event's status. build.rs's join of the romfs thread said a panic there as an error the hook makes unreachable: an
expect, with why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
longshot-build --root <checkout> takes the tools at <checkout>/tools/<name>
(build-driver's tools.rs), but CI installed them into a bundle beside it,
so the third-party objects' compile found no VMA headers. tools.py install
now writes into the checkout (tools/ and .tools/ are git-ignored) in
build-linux.yml, build-windows.yml and CircleCI's two jobs; the
third-party objects, the dry runs and the renderer checks take them with no
per-tool variable. A Windows build on Linux names only the Linux
llvm-mingw (LONGSHOT_MINGW), as the bundle's is Windows' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
build.md: the per-user cache is trusted once unpacked, and which variables
redirect a build (the tree, the tools, the stores, the switches): a launcher
starts longshot-build with every LONGSHOT_*, RX_* and A64_* cleared but
those it sets. ci.md and releases.md: a branch workflow on the deploy runner
can unseal the release key and the packages token, so push access is
release-signing access until the runner takes only main's and the tags'
jobs; CircleCI's contexts must be restricted in its settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
check_places compared a path that did not exist yet (a game folder a build would make) as given, so one under a
link to the dump was not seen inside the dump. compared() resolves the longest existing ancestor and appends the
rest (its .. parts taken as they come).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
prune_work called a game folder gone when its record was missing, so one on a drive not plugged in lost its work
folder (its lift and build). It is gone now only when its parent folder is there; and the work folder is emptied
while its lock is held (the lock file last), not after letting go of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
enter_first knew the first choice by its MB, so another job of the same need inherited a wait it never had and
was refused at once. It takes (job id, MB) and keys the head by the id (schedule.rs passes the jobs' indexes:
build-compile's one line).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The check compares this PC's clock at the compile's start with a file's time as its file system set it: the
resolution, another PC's clock and a time set back can hide a write. Said where it is, with what follows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- A file in perf_pending/ was sent if it was any JSON object: anyone who can write the game folder could send
  anything through the player's PC. perf/schema.rs holds the summary's keys and kinds as the game writes them
  (gpu/vk/perf_report.h summary_json and sample_json) and the histograms' bucket counts (perf_report_schema.h);
  a test checks those against the headers, and a file that does not fit is dropped unsent.
- The relay came from the game folder's longshot_version.txt; it is now the builder's own tree's
  assets/addresses.ini (a release's tree alone: perf::tree_relay), LONGSHOT_PERF_URL as before.
- curl: the Windows System32 one or a PATH entry outside the program's folder (runtimes::downloader), -q first,
  --globoff, --proto as the URL's, --proto-redir =https.
- --tick without --keep-sent keeps the folder's choice (it turned copies back on); set_tick and note_busy rename
  through fsx::rename (Windows' retries).
- Docs: profiling.md says who sends (the game as it plays, the launcher's sender what is left), who keeps what and
  where each sends; build.md's no-change update is 2 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A romfs file (the game's, or a mod's in its place) could hang the builder or run it out of memory:
- a SARC whose file is the archive itself recursed for ever: a file must start past the archive's table, SARCs nest
  three deep at most, and one file's archives unpack to 1 GB at most;
- a BNSH whose variations all name one program of nine slots of one stage copied it count x 9 times, and a BAHS's
  program heads of 0 bytes were walked up to 4 billion times: a file's stages are kept once by their place (Found),
  counts are bounded by what the data can hold (64-byte variations, 32-byte stages, 16-byte heads; a head shorter is
  refused), header offsets are added checked, and past the stages one empty program stands for all of them;
- NDVE searched the whole file for each control's pair: the pairs are found in one pass (pairs_of, find_all's places).
The list is made in the same order from the same stages (the hash still keys a stage). Tests with crafted bytes: a
SARC holding itself, four deep and past its budget, 2,000 variations of one stage, a BAHS of 0xffffffff empty heads,
and pairs_of against find_all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- Index::open refuses a zstd entry over 1 GB or whose frame is larger than host/romfs_index.c allows, and
  Index::read decodes through take(size + 1): a frame that makes more is refused, not decoded whole.
- Nup::read refuses a record over a module's most (nso::MAX_MODULE) before it decodes or reserves anything.
- check_tree: each directory and file the child of one directory at most (a shared subtree made the listing
  exponential); stopped at the first second parent.
- The header's 0x80 + strings_end and verify_toc's off + size are checked additions.
- zstd: an FSE table's counts are -1 or more and fill it exactly, and no cell is of a symbol with no count (a
  table of zeros reached high_bit(0)); ZBIC counts below -1 are refused.
- nso: the symbol table's entries are 24 bytes (DT_SYMENT 1 made a table of every byte), inside the image and at
  most MAX_SYMBOLS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- fsx::write_atomic and write_replace opened their temporary (<name>.<pid>-<n>.tmp: guessable) with
  File::create, which writes through a link someone left there: create_new. A test plants links at the next
  names and checks the file they point at keeps its bytes.
- check_writable's probe file is opened with create_new too (a stale one removed first).
- toolchain.rs: lld-link.exe was copied from lld once and then run as it was: it is checked against lld every
  build (the same file, or the same SHA-1) and placed again (a link, or a copy) when it is not (build-compile:
  lld_link and the new place_lld_link only).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
update took the vendors' licenses from longshot_build.json, which anyone who can write or copy a game folder
can change. A build notes what the player accepted in the per-user cache (<cache>/licenses/<the folder's work
id>.json); an update takes a license when both the record and this PC's note say so, for the builder's pin
(build::update_options_in, Accepted::here/note_here). build.md says so, that the launcher passes
--accept-licenses on update too, and what else an update trusts its record for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- --version printed the crate's 0.1.0: it prints the release the pack carries (its tree's VERSION, read from the
  small tree/files member alone) and the tree's hash, or says it is a developer's build.
- --help, -h and help print the usage with status 0 (they were an unknown command, status 2).
- A release's first run unpacks its pack (a minute on a hard drive) before any event: a 'tools' stage is sent
  first when sources::unpacks_now says it will (the pack's table alone). build-events.md has the stage.
- [profile.dist] strip = "debuginfo": the line tables go, the symbols stay for a panic's backtrace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- TXT2's string count is refused past what its table's bytes hold (four billion stated in 8 bytes reserved 32 GB),
  and LBL1's labels stop at as many as the data can hold (slots naming the same labels again and again made 100
  million strings); a string whose end is before its start is no room.
- texts::make checks each archive's name with game_files' package_parts, as a .nup's names are when it is read: a
  romfs folder's Mals/CON.sarc.zs would be read as an archive and written as texts/con.sarc.zs, a device on Windows.
  (build-assets now depends on game-files.)
Tests with crafted bytes: the labels' and the unsafe name's fail on the code before; the string count's passes there
on Linux too (the 32 GB reserve is only address space under overcommit), and is kept for the refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The release build wrapped silently on an arithmetic overflow, so a header's sum past its type became a small
size or place. overflow-checks = true in [profile.release], which dist inherits. Before that, the sites of the
crates this branch owns that could overflow on a file's values: nup.rs's (first + count) of u32s (now usize),
and build-compile's link.rs image_span (phoff + i * phentsize checked, vaddr + memsz saturating: link.rs
image_span only). The rest are bounded by an earlier check (game-files' tables, segments, symbols and extents).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A font (the game's icon font, or a mod's) whose em is a few units, or a glyph whose outline reaches far past it, made
the icons' picture any size before it was fitted (a billion pixels a side). Faces of under 64 units an em are not
fonts this reads, and a glyph more than 8 x size pixels wide or high at the icons' scale is no icon. The test (a
glyph 10^9 units wide) fails on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The window icon's picture (the game's, or one in its place) was given the buffer its header asked for. A PNG's size
is checked after its header (PICTURE_MOST), and zune-jpeg is told the most width and height. The tests (headers of
60,000 x 60,000) pass on the code before too here: Linux reserves 14 GB as address space only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A frame's header may state any size, and that size was reserved at once (2 GB). reserve_for takes the least of the
stated size, 64 times the frame's bytes and 256 MB (a larger file grows as it unpacks); MOST is 512 MB (the game's
largest is 244 MB). The per-file budget of the census's archives is in the census's own commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A table's index was bounded by a mask found scanning back from the BR in address order, in
index_bound and in the window's own tracking of ANDs. So a mask from a block the load's block
is not only reached from was taken (`ldrb w8, [x0]; cbnz w1, L; and w8, w8, #1; L: ...` read
2 entries of a 256-entry table). So was a mask made after the load used the index
(`ldrsw x10, [x9, x8, lsl #2]; and w8, w11, #3; ...; br` read 4).

index_bound now starts at the table's load and follows every predecessor path in the
function: its fall-through, branches and the tables found so far. Each path must end at a
write that bounds the register: an AND with a low mask, UBFM, or an ORR or MOV of bounded
values, searched the same way. The bound is the largest of them. A path that reaches an entry
(whose callers are unknown), crosses a call for a caller-saved register, or ends at any other
write gives no bound. Code no known edge reaches is reached from the function's BRs whose
tables are not found yet, this one among them. A copy that goes round a loop adds nothing of
its own (`mov w27, w17; bl; mov w17, w27`, a loop's back edge bringing it back). The window
takes no mask bound of its own any more. It keeps its compare-and-branch bounds and its MOV
copies of them.

The real image, against sqslzwzn's discovery: 294,518 functions, the same; 1,474 jump tables,
6 changed, each an over-read that stops now:
- 0x81776d90: 113 entries -> 4 (its index is `and x10, x10, #0x3`, the masked value that
  indexes the function's first table too).
- 0x817831a0 and 0x81900edc: 256 -> 4. 0x817779fc: 6 -> 4. 0x81ad3080: 10 -> 9.
  0x833d3dd4: 50 -> 46. Each is `cmp wN, #k; b.hi` on the switch value, then a copy of it
  masked with 0xff or 0xffff as the index. The mask had been taken as the bound, too wide for
  the 4,096 limit, so the table was read until an entry left the function. The compare's
  k + 1 is the bound now.
- Instructions: 17,635,231 -> 17,635,227 (code only the over-read targets reached).
The four tables checked by hand stay at 4: 0x81843860 (`(w24 & 1) | w17`, w17 a ubfiz of
one bit kept across a call in w27), 0x81dff940, 0x82092ae0 and 0x82092b38. jt_bounded
1,384 -> 1,392, jt_unbounded 58 -> 50.

The review's guard (keep the larger of the bounded and unbounded reads) is left out: the
unbounded read stops only where an entry leaves the function, so it would put back these
over-reads.

Tests: the review's two inputs (a mask only on one way into the load's block; a mask after
the load), both failing on the old code, and a mask every way into the block comes through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The slots of lifted code's setjmp owners (recomp_sj_push / recomp_sj_pop, the longjmp a
missed jump finds: hos_setjmp_return) were per host thread (_Thread_local). A guest fiber
that sets a jump on one host thread can be resumed on another (hos_thread.c fiber_switch)
and longjmp there, on its own host stack, which went with it. There the jump found no slot,
or another context's, and the first thread's slot was left behind.

Each context (a thread's or a fiber's Ctx) now has its stack, found by its address under a
lock. A slot knows its stack, so recomp_sj_pop and the lifted code's calls are unchanged.
hos_setjmp_forget lets a context's stack go when the context ends: a thread destroyed, a
fiber finalized or set up again. So a context made at the same address later starts empty.

Past 256 nested owners, a push moved every slot down one to make room. The slots the frames
below hold then named their neighbours' return addresses. Such a push is now refused (a
buffer no return address matches: a longjmp to that owner misses, as it would unwrapped),
logged once.

Tests: test_setjmp_context.py builds the slots' code with a made-up lock and log. A push on
one thread is found and popped on another, and two contexts don't share slots. 258 pushes
leave the 256 live slots where they were, the refused ones match nothing, and it logs once.
test_thread_wake_cleanup.py's fixture gains the context and a hos_setjmp_forget stub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
never_ran said a function with an entry count of 0 never ran, even when its blocks counted:
code reached by a jump into its middle (a tail call or a longjmp into it) runs with no entry.
It now also needs the function's weight (its blocks' counts) to be 0.

Test: a record with no entries but a block that ran did run; one with no counts at all did not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
An instruction lowering does not do (sem::Fault::Unsupported: the FP16 fused, estimate and
fixed-point forms) becomes a trap at its address, and the build went on in silence. A gap in
the coverage showed only as a guest's crash where the game ran it. Each lifted function now
lists those forms (Lifted::unsupported), and the lift's log says how many of each the units
lifted now have:

  lift: instructions lowering does not do, each a trap where it is (in the units lifted
  now): 2 an FP16 fused, estimate or fixed-point form

Test: an_uncovered_instruction_stops_the_guest_there also checks the trap is counted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The LIFTER key said it held the compiler that built the lifter, and it didn't. A new rustc, or
a crates.io crate's new version in Cargo.lock, can change the lifted code with the same
sources, and the lift kept its units. lift's build.rs now hashes `rustc -V` (cargo's RUSTC)
and the Cargo.lock entries of the registry crates lift is built with, its dependencies'
dependencies too (the workspace's own crates are in the key by their sources), beside the
sources. A change of the lock reruns it.

And two nits:
- edits Wrap::body_symbol asserts the entry fits 32 bits. f_1 and eight digits: a longer
  entry would make a name another entry's f_ could have.
- mir Loc::Fpcr's doc: the guest's register alone (no host bit in its upper half now).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
bntx_textures added a record's header fields unchecked and took any size: a texture of a billion pixels a side, or its
data past the file, was decoded or drawn on as it said, and the prompts' drawing at fixed places (the buttons' discs at
869, 227, ...) underflowed on a smaller one. Offsets are added checked; a texture that is not 1 to 4096 pixels a side with its last block (its
furthest) inside the file (Texture::within) is left out (the game's own has larger ones, never drawn on); decode adds
each block's end checked. The
textures the prompts draw on are checked against their known format and size (textures::KNOWN, unknown); another
(another game version, a mod's archive in the game's place) leaves the faces' textures.bin and Common.bntx.base
unmade, the game's own icons kept, with the warning prompts_textures. Tests: three crafted records left out and one that
fits read, and the known sizes' check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
layout_panes reserved the count its header said (u32) and added its tables' offsets unchecked: the count is bounded by
the layout's bytes / 8 and the offsets added checked. share::read_list unpacked the game folder's list with no limit
(an xz bomb): to SENT_MOST, as a list someone sent is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A crafted font (the game's icon font, or a mod's in its place) could panic the build or run it past its tables:
- two tables of one tag (the one ttf-parser read is not the one written) are refused, a table's end is added
  checked, and hhea, maxp and head must be as long as what is written into them (36, 6, 54 bytes);
- the CFF: an INDEX's offsets 1 to 4 bytes, the Private DICT's size and place and Subrs' place taken with get (one
  operand of two read past its operands), a table of no charstrings refused, a charset's range checked at 65535;
- a font of more than 61,439 glyphs refused (the prompts add at most 4096), the count saturates, and a write with
  more added is refused;
- the charstring writer's differences saturate (outline.rs), as overflow checks are on in release.
The tests (a crafted CFF table whole, with one Private operand, of no glyphs; Kenney's font with two tables of one tag
and hhea cut to 10 bytes) fail on the code before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
- The *_at helpers of sarc, texts, census, prompts' layout and base, the font and the texture add the field's length
  checked (overflow checks are on in release: a header field near usize's end panicked).
- prompts/base.rs: the ranges' and samples' ends saturate, and the textures' samples stay in the file's bytes.
- layout.rs: the ring's first copy taken checked, a hint pane's offset checked, and runs of a copy too near the
  archive's end left out (keep_within), as the textures' runs are against Common.bntx (face_textures).
Test: keep_within drops the runs past a file and keeps the rest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
host/romfs.c reads a zstd-stored file's head through zs.c's hos_zs_frame_head and logs the decoded copies' high-water
mark with hos_log; the synthetic game's host had neither, so the end to end test no longer linked. Its zs.c stand-in
has both (the head as zs.c's: a window up to 2 GB; the log to stderr).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
infill's w00 = 16 - fs - ft + w11 went below 0 before w11 was added when fs + ft > 16 (u32: it wrapped and came back),
which overflow checks (on in release now) stop as a panic. 16 + w11 - fs - ft is the same value and never below 0:
(16 - fs)(16 - ft) >= 0 makes w11 = (fs * ft + 8) >> 4 at least fs + ft - 16.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
The writer folds a constant splat into one u128, `acc | (e << (i * w))` over its lanes. For a
vector wider than 128 bits (`<4 x i64>`: SQRDMULH's products widened, with its rounding
1 << 30 and its shift 31 as splats; `<8 x i32>` of 15) lane 2 on shifts by 128 or more. With
overflow checks on (release and dist now) that panics: "attempt to shift left with
overflow" at lib.rs:585. Without them, Rust masks the shift, so lane 2 went to bit 0 again.

No wrong code came of it. A splat repeats every element, so the masked fold is the low 128
bits, which repeat across the vector, and the literal's lanes were read with the same masked
shift. The real lift has 2,847 such literals (1,700 `<4 x i64>` of 31, 1,116 of 1 << 30, 31
`<8 x i32>` of 15), every lane the splat's value. And this change writes every unit's text
byte for byte the same (494 units lifted, 0 written).

Now the writer does this on purpose: a splat folds its lanes in the low 128 bits only, and a
lane's bits are read at `(i * w) % 128` (lane_bits), in the literal and in the NaN check. A
Const wider than 128 bits, which no lowering makes and a u128 can't hold, is refused.

The real image lifted by a release lifter built with overflow checks
(`--config profile.release.overflow-checks=true`) runs through: no other overflow in a64,
cfg, sem, mir, passes, llvm or lift.

Test: a_splat_wider_than_128_bits_is_written_lane_by_lane (SQRDMULH's form). It panics at
the old lib.rs:585 (tests run with overflow checks) and passes now, its literals
`<i64 1073741824, x4>` and `<i64 31, x4>`, compiled by clang.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
A preparation was 13 s of every update on this PC (12 s of a 23 s no-change update on the lab's RX 580), though no
game code runs in it: its output depends on the renderer, the shader list, the shipped pipeline states, the level
and the drivers. Those are its key (cache/longshot_prepared_key.txt, written when a preparation gets to its end,
forgotten before one starts, ignored when the caches it left are gone); a file's SHA-1 is taken again only when its
size or write time moved.

The drivers, with no Vulkan call. Linux: each Vulkan driver manifest with its library's size and time, NVIDIA's
version, the GPUs' vendor and device, the cache switches. Windows, from the registry (build_core::machine_registry,
windows-sys in sys.rs): the loader's driver list and each display adapter's driver (name, device, DriverVersion,
the manifests of its VulkanDriverName), each manifest with its library's size and time, whether NVIDIA's and AMD's
shader cache folders are there, LONGSHOT_SHADER_STORE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
merge: the second review's fixes (host and build-assets, build crates, CI and release, lifter), the crates' READMEs, the shader preparation's key
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Successful in 16s
CI / rust/ (rustfmt, clippy, cargo test) (pull_request) Failing after 2m11s
CI / Website build and checks (pull_request) Failing after 1m33s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 2m13s
CI / longshot-build end to end (synthetic game) (pull_request) Successful in 3m30s
a42efca24a
With the merge's own fixes: install's staged copy keeps the source's permissions (the game's executable stayed
without its exec bit after the create_new copy), build-events.md lists prompts_textures, a test helper used only
by the Unix link test is #[cfg(unix)], and one line of rustfmt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
refactor!: the builder moves to builder/ and its command is longshot-builder
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Website build and checks (pull_request) Failing after 1m56s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 2m53s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 3m1s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m41s
6d92e2f6cf
rust/ is builder/ (the workspace, its crates, rt/ and README). The crate and
program longshot-build is longshot-builder: its release files
longshot-builder-<v>-<platform> (manifest and deltas likewise), its per-user
cache ~/.cache/longshot-builder or %LOCALAPPDATA%\Longshot\Builder, its locks
longshot-builder.lock and .longshot-builder.lock, its game folder record
longshot_builder.json. scripts/longshot_build.py is scripts/longshot_builder.py.

longshot-lift is folded into it: its commands are longshot-builder dev
discover|sites|lift|profile|words|decode (src/dev/), left out of the main
usage and listed by longshot-builder dev --help. The LONGSHOT_* variables
keep their names. The stray build logs in rust/ (cl.txt, clw.txt, e.txt,
t.txt) are dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
revert(lift): register calls with summaries are taken out: slower or the same in every scene
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 55s
CI / Website build and checks (pull_request) Failing after 1m32s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 2m19s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 2m26s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m16s
7e127f52a1
Register calls passed guest registers between lifted functions in machine registers: each
function also had a preserve_none body f_<entry>.r, and a direct call or tail call of a lifted
function called that body. From lslxmuxp, a call also spilled, passed and reloaded only what
its callee's summary (passes::summary, closed over the direct calls) read or wrote. Both were
behind LONGSHOT_LIFT_REG_CALLS=1 (`longshot-builder dev lift --reg-calls`), off by default,
to stay only if a game A/B showed about 3 % more fps beyond the spread in Hyrule Field or the
Market, with no scene's 1 % low worse.

They don't pay. CPU-bound A/B on an RTX 3090: 1080p output, the 3D at 100 %, no upscaler
(Off), uncapped, V-Sync and frame generation off. 3 interleaved 60 s pairs per scene, the
context's calls (A) against register calls with summaries (B), fps (1 % low):

- Kokiri Forest: A 129.8 (115.5), 129.2 (113.5), 127.8 (83.0); B 123.7 (75.2), 118.3
  (99.9), 113.3 (63.1). -8.4 %, every B run below every A run, the 1 % low worse.
- Hyrule Field: A 119.9 (86.3), 111.7 (76.2), 119.2 (98.2); B 109.8 (75.0), 115.2 (65.4),
  111.5 (85.8). About -4 %, the 1 % low worse.
- Market: A 95.3, 96.3, 85.2; B 95.1, 95.7, 94.6. Medians 10.0-10.3 ms on both sides: the
  same.

And the game's compile took 20 % more CPU time with them (1,843 s against 2,226 s), its .text
561 MB against 643 MB.

So all of it goes:
- llvm: regs.rs, Options::reg_calls, Module::set_summaries, the bodies, thunks and adapters,
  and the register tail calls. sync.rs is back to a call that spills every dirty slot and
  reloads what is read after it (sync::RegSync gone; Loc::bit and from_bits stay).
- passes::summary, mir::Summary, Loc::ALL_BITS.
- lift::whole: the Session's summaries and callees, locals(), the units' summary key lines.
- --reg-calls (longshot-builder dev lift), LONGSHOT_LIFT_REG_CALLS (build-driver), and the
  differential test (calls_in_registers_leave_the_state_the_context_s_calls_do).
- The READMEs and docs/dev/reference/build.md. builder.md's "Still to come" now says it was
  tried and taken out, with these numbers.

The lifted code without the switch is unchanged. The lift's key changes: the options it hashes
lose a field, so the next build lifts again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
feat(sites): #2272's update folded in: anchors' of, HOS_SITE_OUTCOME, the site chain per guest context, Skip title screen on the game's own load
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Successful in 29s
CI / Website build and checks (pull_request) Failing after 55s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m12s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 1m54s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m17s
0fc27a429e
From #2272's new squash (d1ce425a2a), over the old one this stack held (fe97600a20), in the Rust builder's terms:

- the sites (builder/crates/sites): an anchor's `of` (with `ordinal`: how many matches its slice must hold, another count
  stops the lift; jump.takeoffVelocity's point is `ordinal = 1, of = 2`); an `after` site where a `replace` site already
  is refused in either order; host/game/sites.def's new HOS_SITE_OUTCOME lines read (HostList::outcome) and checked by
  apply against the table's sites that change the outcome on a worker thread (Site::decides_on_worker);
- the host: host/game/sites.c's chain kept per guest context, not per OS thread (a fiber resumed on another thread goes
  on with it), the replace site's callee kept across a handler's calls into the game, a removed handler run by no hook
  that loaded the dispatcher before, hos_site_remove_then (done at the acquire phase's reclaim once no hook is in the
  chain), a table published again not freed, and the HOS_SITE_OUTCOME sites refused a run-time handler or callback;
- Skip title screen (host/oot_autoload.c): no more presses once the game loads after the check's A
  (hos_oot_loading, host/hos_main.c: Sequence_IsLoadingBanc seen down since the press, then up once the A is released);
  the timed fallback when no wait on the title, its list or its check is told by 45 s, until one is;
- the Voice Language option read as the game reads it (game_flag_number_as_game: an index past the count is entry 0);
- scripts/parity_gates.py: the queue's --desc, the plan's names gone, caption.sav's date and picture left out of the
  noise as gate 4 leaves them out; docs/dev/reference/parity-gates.md and hooks.md as #2272 rewrote them, in this
  builder's terms; docs/user/graphics-and-controls.md's Skip title screen;
- tests: the anchors' `of` and the after/replace refusal (sites' unit tests), the outcome lines (sites::apply's test and
  tests/repository.rs, every build's table against sites.def), the drive target's sites found once at their copies
  (tests/repository.rs: the resolver part of #2272's test_drive_target.py), the host's list in the lift's key and parity
  gate 1's game-free half (lift's whole tests), and #2272's updated Python and C checks (test_site_chain, test_skip_title,
  test_oot_voice_option, test_parity_gates, test_drive_target, test_jump_takeoff_step, test_oot_barrier,
  test_high_fps_fixes, tests/sitetable.py's Anchor.of).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
Mermaid diagrams, each in the section it explains:
- builder.md: the build's stages and what each keeps (A build); one function's way
  through the lift, decode to clang (The whole lift); what goes into the lift's, a
  function's, a unit's, an object's and a link's key, and so what one changed site,
  mod or ExeFS patch rebuilds (The lift's cache).
- architecture.md: the program, the runtime, the host and the renderer at run time
  (The parts); a game file call's way to its file: the overlay, the mods, the
  stand-ins, then romfs.h over the index, the .nup in place or a decoded copy.
- build-events.md: how a launcher installs longshot-builder (SHA256SUMS and its
  signature, the manifest, a delta or the full file) and runs check and build, the
  events and the exit status.

Docs that said otherwise than the code:
- An instruction the semantics do not cover is a trap at its address and the build
  goes on (lift/src/lib.rs); builder.md's step 2, developing.md's checks table and
  lift::whole's module docs said it stopped the lift.
- cfg's module docs named a plan::compare that is gone; lift::whole's pointed at a
  gen/ section builder/README.md does not have.
- unsafe is denied, and allowed in game-files/src/disk.rs as well as
  build-core/src/sys.rs (builder.md, standards.md).
- builder.md: the dependencies as Cargo.toml has them; the romfs's index starts
  once the exefs is read.
- build.md: game_folder_link and old_romfs, which no code says any more, gone;
  stamps and perf-report in the commands.
- architecture.md: gen/ keeps units.txt, not the units' texts; never-run units at -O0.
- common-issues.md: with the launcher, the builder's work is in the launcher's build
  files (LONGSHOT_CACHE), not ~/.cache/longshot-builder.

The two Rust files change in comments only, but the lifter's key hashes its sources'
bytes, so the next build lifts again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
feat(dev): dev.py packs --json passes the builder's events through, so the Test Farm gets its error codes
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 47s
CI / Website build and checks (pull_request) Failing after 1m16s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 3m2s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m3s
901cd29d4c
dev.py packs base|pack|rt ran longshot-builder without --json: the Test Farm got a base's or a pack's failure as
text, with no code. `dev.py packs --json <subcommand>` (or LONGSHOT_BUILD_JSON=1) runs longshot-builder with
--json and leaves its stdout, the event lines as it wrote them, as this command's; this script's own lines, cargo's
and the game's (a preparation, a warm-up's runs) go to stderr then. packs run adds --json to the builder's
arguments the same way. Without it, the output is text as before. tests/test_dev_packs.py runs longshot_builder with
a stand-in builder both ways, and checks the option and the variable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8
HumanBean changed title from WIP: feat(builder)!: the builder in Rust (longshot-build) replaces the old one: lift, compile, game files, assets; the game reads its RomFS from the .nup to WIP: feat(builder)!: the builder in Rust (longshot-builder) replaces the old one: lift, compile, game files, assets; the game reads its RomFS from the .nup; supersedes #2272 2026-11-23 20:21:56 +00:00
HumanBean force-pushed lifter-m0-decoder from 901cd29d4c
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 47s
CI / Website build and checks (pull_request) Failing after 1m16s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 3m2s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m3s
to e651934e88
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 15s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 19s
PR description / Description follows the template (pull_request_target) Successful in 21s
CI / Website build and checks (pull_request) Failing after 2m10s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 3m0s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 3m8s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m37s
2026-11-23 21:22:34 +00:00
Compare
The preparation ran after the finish: 260 s of a 426 s first build on this PC from nothing (cold NVIDIA folder, 24
threads), 320 s of 795 s on the lab's RX 580. It needs no game code (--prepare-shaders returns before the image and
the OS layer), only the renderer, the shader list and the pipeline lists.

So the renderer's units and the preparation driver's go first; both are linked as soon as they are compiled (33 s into
the compile here), and once the finish's assets are made the driver runs in <work>/prepare/, after the memory gate has
room for it (9.5 GB), while the game's units compile. The driver is the game's executable without the lifted game
(build_compile::link_prepare: the host and the lift's runtime, the 20 lifted-game symbols the host names stood in for
by zero-filled weak data), named longshot as the game is, since NVIDIA files its shader cache by the program's name.
Its cache/ is moved into the game folder's at the shader step. Only for a folder whose caches start from nothing, on
Linux; LONGSHOT_PREPARE_EARLY=0 prepares after the finish as before.

Measured (this PC, RTX 3090, one queue job, each from nothing): first build with the shaders 426.2 s after the finish,
391.9 s beside the compile (the preparation 352 s there against 260 s alone: it shares the CPUs with the compile).
The first play afterwards: the 38,021 noted pipelines loaded from NVIDIA's cache in 3.1 s, no pipeline waits, no draws
left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
perf(vk): a game folder's program cache begins from the one the last preparation left
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 19s
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Website build and checks (pull_request) Failing after 1m22s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m50s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 2m20s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m32s
ce475fa2d2
Every new game folder translated all 38,809 programs again (70 s alone on this PC, 162 s beside a compile), though the
translator and its SPIR-V store were the same. A preparation that gets to its end now copies its longshot_programs.bin
and .idx beside the shader store (spirv.pack.programs-<stamp>, spirv.idx.programs-<stamp>: the launcher's Free up
space and its count take them with the store), and a folder with no program cache of this translator begins from that
copy. disk_init's own check of the file's head still drops a copy whose store was made again. Each folder keeps its
own file and lock, so a build preparing beside a game being played still has its cache.

Measured: a second game folder's first build on the same PC, 53 s with the shaders: 0 programs translated (18 s to read
them), 14 s for the pipelines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(release): RecompLauncher installs and builds Longshot with longshot-builder (recomplauncher.json back, adapted)
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Conventional Commit title (pull_request) Successful in 21s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 32s
CI / Workflow lint (actionlint) (pull_request) Successful in 36s
Third-party parts / As their notes say (pull_request) Successful in 43s
CI / Website build and checks (pull_request) Failing after 1m17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m35s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 2m17s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m31s
193b44c2cf
#2286 deleted recomplauncher.json and its test with the AppImage and the Windows builder that carried it (cef93e9e,
"the AppImage, the Windows builder and its setup are gone"). It comes back, as main has it (with #2364: the saves are
the save folders, never Longshot's whole data folder), adapted to the new builder end to end:

- the release file: longshot-builder-<v>-<p>-recomplauncher.zip, the platform's full file (as longshot-builder, .exe on
  Windows) and recomplauncher.json, stored and deterministic (scripts/longshot_builder.py recomplauncher), made by the
  release's publish job before SHA256SUMS, which names it and the program it holds byte for byte;
- prepare: longshot-builder build --game <copy> --out <install>/Longshot --progress-lines. --progress-lines is
  RecompLauncher's own line protocol (progress <0..1> <step>, error <text>; the format has no event stream to read
  --json's), a new build-core Format::Lines; the rest stays text for the log. The ticks are --upscaler dlss/xess with
  --accept-licenses nvidia/intel, which now add up when given more than once. No --work: the per-user cache and its
  stores. No keeps_copy: the game reads the .nup in place, so the step needs it each time and it must stay there.
  done is the record, longshot_builder.json;
- start: the game the build made, Longshot/longshot (longshot.exe), no --play wrapper;
- the old builder's parts are gone from it: --cli/--prepare, make_game.py's options, the AppImage, the tools install.

What the format cannot say: where the program comes from (no download by checksum; RecompLauncher installs the zip it
is given, by hand, as before) and a structured event stream; docs/dev/reference/releases.md says so, with the flow.
tests/test_recomplauncher_json.py is main's, its old-builder checks replaced by the new flow's and the zip's;
longshot-builder's own test parses the manifest's build step with every tick. test_no_release_lookup names the old
builder's folders, not builder/ (the new one) or recomplauncher.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
HumanBean force-pushed lifter-m0-decoder from 193b44c2cf
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Conventional Commit title (pull_request) Successful in 21s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 32s
CI / Workflow lint (actionlint) (pull_request) Successful in 36s
Third-party parts / As their notes say (pull_request) Successful in 43s
CI / Website build and checks (pull_request) Failing after 1m17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m35s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Failing after 2m17s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m31s
to 266f1fb0e6
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 17s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / builder/ (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-23 21:42:32 +00:00
Compare
build(rust)!: one Cargo workspace at the root, with longshot-rs, the game's one staticlib (empty)
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Website build and checks (pull_request) Failing after 19s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m27s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 1m40s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m9s
9adf242f12
The builder's workspace (builder/Cargo.toml, its Cargo.lock and rustfmt.toml) moves to the root, so the game's crates
(game/crates) and later the host's and the renderer's join it with one Cargo.lock. longshot-rs is the one crate with
crate-type staticlib: two Rust staticlibs in one link would each carry std. The game profile (release, panic =
"abort") is what links into the game. third_party/renhdrum stays a crate of its own (excluded).

Cargo's target folder is the root's target/ now: CI's caches, the scripts and the docs that named builder/target or
builder/Cargo.lock follow; callers that run cargo in builder/ still find the workspace above it. The packs count
Cargo.toml, Cargo.lock and longshot-rs/ as build inputs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
tests/test_lifter.py runs the workspace's tests with cargo test --release, and a release longshot-builder has no
panic-test command (it is #[cfg(debug_assertions)]): it answered exit status 2, a command line it does not take, and
a_panic_is_an_internal_error_event_and_status_1 failed. The test is a debug build's, as its command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test: the sysroot's round trip unpacks a tool's archive as tools.py packs it now (its files at the top)
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Website build and checks (pull_request) Failing after 49s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
6e8a8d33fd
tests/test_linux_update.py unpacked the packed sysroot under the prefix sysroot/, as tools.lock's zips held it.
#2286's scripts/tools.py packs a tool's files at the top of a .tar.zst (prefix -), so unpack found nothing under
sysroot/ and the check failed with "has nothing under sysroot".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test(builder): the tests' scratch in cargo's target folder, never in the tracked tree; /builder/target/ ignored
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 5s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
PR description / Description follows the template (pull_request_target) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 38s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m34s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 1m40s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m0s
da2f643ab7
build-compile's testdir and sites' table tests write their folders under CARGO_TARGET_DIR when it is set, else the
workspace root's target/ (ignored): not a path of their own beside the crates, which after the move to one root
workspace was builder/target/, no longer ignored, so a VCS took the tests' files for sources. The other crates' tests
use the system's temp folder or CARGO_TARGET_TMPDIR. .gitignore leaves /builder/target/ out as a safety net for a stale
one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
perf(build-compile): the game's link orders its functions with lld's hfsort, not cdsort
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 15s
CI / Website build and checks (pull_request) Failing after 58s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m36s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m10s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m34s
27b6fbcdcf
With the guest profile's call graph in the objects, lld's default cdsort took 10.6 s of an 11.4 s link of the game,
every relink (one changed unit, one changed host file). hfsort takes 0.9 s in all.

The game is the same in play (1080p native, no upscaler, uncapped, RTX 3090, the same objects linked both ways, 3
interleaved pairs, median (min-max)): Hyrule Field 124.8 (119.4-125.0) against 124.7 (124.5-125.4) fps, 1 % low
104.2 against 104.6, game time 4.01 against 4.05 ms; the Market 109.7 (108.6-109.8) against 109.8 (109.1-111.0) fps,
1 % low 78.1 against 80.7, game time 7.46 against 7.38 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
image now builds the image (image::build, image-build's code) and reads it
back (lib.rs, the lifter's key's part: key_crates.rs takes that file alone).
To keep the crates acyclic, the clash check of a mod's ExeFS patch against
the hook sites moves from game-files to build-driver's clashes.rs, so
game-files no longer depends on sites. plan is now cfg::plan, the data
discovery gives. The parity example image-build/examples/image.rs (compare
with an image the old builder wrote) goes. READMEs merged, builder/README.md's
table and graph, builder.md, architecture.md, hooks.md and mods.md follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The game (host/mods.c) no longer imports longshot_mods.txt when there is no
mods.json, and the build (game-files patches.rs: OLD_LIST_NAME, old_list)
no longer reads it. tests/test_mods_list.py's migration check becomes
old_list_not_read: neither side reads the old file or touches it. The
launcher writes mods.json only (its Core never names longshot_mods.txt).

Stale names: the website's LongshotBuilder files, make_game.py in a test's
doc, the nup example's parity wording. The read stage's removal of a romfs
folder in the game folder stays: the builder's own dump-folder builds make
that folder, and the game reads it before the index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
scripts/tools.py (check, install, add, missing, publish, pack, repack) is
gone: build-driver's tools/ reads and checks the lock (lock.rs: the same
rules, store URLs first, REQUIRED), makes and unpacks the archives
(archive.rs: GNU tar as Python's tarfile wrote it, byte for byte; zstd -19
--long=27; the unpack's path, link and nested-link refusals; stamps) and
talks to the store with curl (store.rs: download, the package API, PUT with
RELEASE_TOKEN by stdin, FORGEJO_UPLOAD_API). `longshot-builder dev tools`
is the command (tools_cmd.rs), `make` in place of `pack`; `repack` (a
one-time move from zips) goes. The compiler stamp reads the lock through
the same parser.

CI builds the builder before it installs tools: build-linux.yml,
build-windows.yml and CircleCI move the runner's longshot-builder step
first (it needs none of the tools); release.yml's version, tools-make and
tools-publish build one with mise.toml's Rust (scripts/ci_rust.sh);
ci.yml's and CircleCI's host-C jobs and CircleCI's version use cargo run.
deps.sh packs with `dev tools make` (LONGSHOT_BUILD, else cargo run).
dev.py installs its tools-store through the checkout's builder.
longshot_builder.py llvm-mingw keeps the Linux host only (the one CI uses).
`mise run tools` installs this system's into the checkout.

Tests: tests/test_tools_lock.py and test_unpack_links.py's tool half move to
Rust (tools/lock.rs, archive.rs, store.rs, tools_cmd.rs); test_dev_build.py,
test_no_webgpu.py, test_windows_on_linux.py and test_linux_update.py follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
scripts/longshot_builder.py's release packaging moves into the builder, as
longshot-builder dev release (builder/crates/longshot-builder/src/dev/):
- release_cmd.rs: sources, unpack, dry-run, recomplauncher (the stored zip,
  written by hand with crc32fast, byte for byte Python's zipfile's);
- release_deltas.rs: fetch-bases, deltas and the manifest, and files (the
  old `release`: stamps, fetch-bases, deltas), same names (KEEP 5,
  LONG 30), the manifest written as json.dump(indent=1, sort_keys) did.
The shared parts are build-driver's: the pack's one writer now sits beside
its one reader in sources.rs (TREE, LEFT_OUT, tracked, tree_entries,
tool_entries, group, member_bytes, pack_bytes, compress at zstd -19 -T1
--check, write, unpack_into), and the release API is read with curl in
tools/store.rs (json, download_checked). The pack, the deltas, the
manifest and the zip were checked byte-identical to the Python's.

CI runs them with the runner's longshot-builder (build-linux.yml,
build-windows.yml, CircleCI's builder jobs); release.yml's publish job
builds one from the checkout (scripts/ci_rust.sh, cargo build) before its
recomplauncher zips and SHA256SUMS: the deploy runner runs nothing another
runner built.

scripts/longshot_builder.py keeps what must run before there is a
builder: build (the pinned Rust), llvm-mingw (which links the Windows
builder) and check (the built program's headers, read before anything
runs it, as build checks its own output).

Tests: test_longshot_build_bases.py and test_unpack_links.py are now Rust
tests (release_deltas.rs, sources.rs); test_recomplauncher_json.py's zip
checks are release_cmd.rs's, its workflow checks stay; test_ship_state_list's
archive check is sources.rs's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Every variable the builder reads, classified (docs/dev/reference/build.md):
- a launcher's or a player's setting, now a flag on every command:
  --cache (LONGSHOT_CACHE), --ngx-sdk (LONGSHOT_NGX_SDK), --builder-exe
  (LONGSHOT_BUILDER_EXE); beside the flags there were already (--store,
  --root, --jobs, --language, --upscaler, --no-prepare-shaders). The three
  variables are read for one more release (the launcher sets them); a flag
  wins. build_driver::set_flag puts a flag where build_driver::env reads.
- a developer's or a test's override, kept as a variable: the tools'
  (LONGSHOT_OWN_TOOLS, LONGSHOT_LLVM, LONGSHOT_MINGW, LONGSHOT_SYSROOT,
  RX_CPM, LONGSHOT_*_HEADERS, LONGSHOT_FFMPEG, LONGSHOT_SDL2,
  LONGSHOT_SDL_DIR, EMSDK, RX_TARGET, ZSTD), the compile's (RX_HOT_OPT,
  RX_COLD_OPT, RX_VK_PGO, RX_A64_RT_O2, RX_MARCH, RX_RELEASE,
  LONGSHOT_IR_LEVEL, LONGSHOT_KEEP_IR, LONGSHOT_TRACY(_FIBERS),
  LONGSHOT_FSR, LONGSHOT_THIRD_PARTY_OBJECTS, LONGSHOT_OBJ_STORE,
  LONGSHOT_VERSION, LONGSHOT_SOURCES), the memory gate's
  (LONGSHOT_MEM_GATE, _LIMIT_GB, _RESERVE_GB), the shaders'
  (LONGSHOT_NO_PREPARE, LONGSHOT_PREPARE_EARLY, LONGSHOT_PREPARE_ENTRY_S,
  LONGSHOT_SHADER_STORE), LONGSHOT_STORE, LONGSHOT_ROOT, LONGSHOT_JOBS,
  LONGSHOT_PERF_URL, RELEASE_TOKEN and FORGEJO_UPLOAD_API (dev tools), the
  tests' (LONGSHOT_E2E, LONGSHOT_NO_CLANG, CC, LLVM_MC, LIFTER_WORDS), and
  the system's or the game's own (HOME, LANGUAGE, XDG_*, HOS_MODS,
  HOS_OPTIONS_FILE).
- dead, removed: RX_VK_ONLY and RX_GAME_ONLY (compile --only is the way).

CI passes --ngx-sdk and --cache (build-windows.yml, vulkan-dlss.yml,
CircleCI); fetch.py says the flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A pack's runtime prepares again when its build's translator_stamp (the one
longshot-builder writes in longshot_version.txt) is not its base's:
packs.py's copy of shader_stamp.rs's file list (STAMP_DIRS, STAMP_FILES)
goes. The NGX SDK dev.py takes from LONGSHOT_NGX_SDK goes to the builder as
--ngx-sdk (build, update, lift, compile), as do the settings it already
gave as flags. Kept: base, pack, rt, run and warm, --json and
LONGSHOT_BUILD_JSON, the upscalers from the environment (#2402, in
base.json), the shared stores and warm runtimes. test_dev_packs.py checks
the stamp's comparison and the flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(builder): dev tools install reads zstd's output to its end
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Website build and checks (pull_request) Failing after 1m9s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m28s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m35s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m37s
b37afeb667
The tar's reader stopped at the archive's end marker and closed the pipe
while zstd could still be writing the last records: zstd died of SIGPIPE
and a whole, checked archive (tools.lock's cpm, in the queue's batched run)
was said unreadable. The rest is read and dropped before zstd is waited on.
(Item 1's, on top: the commit it fixes has other work built on it.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
#2286's kskyprqv took the host-version rule out of programs_load_decide (the renderer takes a host of its own API
version only), so the fixture's HostStub and its static host were left unused, and clang++ 23 with -Werror stopped
on "unused variable 'host'". Main still has the rule and passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test: the prepare stall check reads the builder's status 4 as the supervised preparation says it
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Successful in 16s
CI / Website build and checks (pull_request) Failing after 37s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m35s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m37s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m39s
7186a9b99c
The #2323 port made shaders::prepare match the supervisor's (status, decision); its arm for exit status 4 is
Ok((Some(4), _)), and tests/test_prepare_stall.py looked for Ok(Some(4)) word for word. It now looks for either form
with the same sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
longshot-builder dev site-hooks lifts each named hook site in a small function of its own, through the passes and the
IR writer as the whole lift does, and wraps it in int <name>(Ctx *c), whose answer says where control goes after the
hook. tests/sitehooks.py builds that IR into an object a test links with its fixture; test_oot_jitter.py runs the
jitter sites' callbacks through it instead of tests/sitetable.py's copy of the old C.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
tests/sitehooks.py's line(x) is the C at a site's place in a fixture, calling a wrapper of its own that
longshot-builder dev site-hooks lowers; objects() links the IR clang made of the wrappers a fixture names. A
replaced call with no callee (a blr) is now a spec of its own (<site>@<pc>:). tests/sitecheck.py reads the
tables (sitetable.py's reader moved there). run_all gains {clang}: clang on every OS, for the checks that link
that object (its TLS is native, which mingw's gcc does not link with).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Where a check only read the tables, or looked for "return;" in the old C, it now reads tests/sitecheck.py and the
site's own form (can_return): the lowering of each form is run by the hook tests and dev site-hooks' own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Each fixture puts tests/sitehooks.py's line(x) at the site, links the wrappers' object and is compiled by clang
({clang}, {cargo} from run_all); fixtures' flags and slots have external linkage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The side-by-side checks against main's text patches stay; the hooks-off controls now go through the real
lowering too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
widesites.py and whole_sites.py write each hook with tests/sitehooks.py; their tests link the wrappers' object.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The fixture's context has the lifted layout (the vector registers at 272, asserted); the rule's being inline is
read from the table (no slot in sites.def).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Each solver site gets its own flag and slot, both holding the one callback, instead of renaming one site's
ident in the text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test(sites): retire tests/sitetable.py, the old C emitter's copy; docs for dev site-hooks
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
PR description / Description follows the template (pull_request_target) Successful in 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 56s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m57s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m0s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m26s
7896a3dfa2
Every site test runs its hooks as the lift lowers them now (tests/sitehooks.py), and the tables' reader is
tests/sitecheck.py's, so the frozen line()/RULES/call_replaced copy is gone. The docs say how a hook site's
callback is tested, what dev site-hooks makes, and list run_all's {clang}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(builder): the early shader preparation's progress said as it goes at the shader step
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 13s
CI / Website build and checks (pull_request) Failing after 1m0s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m6s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m18s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m31s
PR description / Description follows the template (pull_request_target) Successful in 50s
c03643593c
Early::finish joined the preparation's thread blind: its lines waited in a list
until it ended and its @@progress lines were dropped, so a launcher saw the
shader step stuck with no event for as long as the wait (247 s on the AMD lab).
Its lines now go through a channel: kept until the build's shader step (its
progress would show as the compile's), said there at once (log in order, then
the latest progress), and from then on said as they come until it ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
docs(switches): the stage libraries and a split shader preparation, measured and not kept
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 19s
CI / Website build and checks (pull_request) Failing after 1m4s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m15s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m21s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m26s
e068fd4daa
RX_VK_GPL gets a row, and a section says what was measured on 2026-11-23 on an RTX 3090 (NVIDIA 620.70) and an RX 580
(RADV, Mesa 26.2): the stage libraries first saved no preparation time (395 s against 378; 455 s against 422) and nothing
in play, and a split preparation (4,000 notes before play) took 153 s against 378 but left draws out and long frames in
later areas. The code that measured them is not kept. The gpl_wanted comment points there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A headless run (HOS_HEADLESS=1) starts SDL's sound first, for the Insert
menu's list of outputs, before the controllers that turn SDL's signal
handlers off. SDL's handlers then turn a timeout's SIGTERM into a quit
event nobody reads. hos_sdl_load and hos_sdl_init run against a stand-in
SDL that installs its handlers when its events first start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(sdl): a headless game ends on SIGTERM again: SDL's signal handlers off before any subsystem starts
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 28s
CI / Website build and checks (pull_request) Failing after 1m39s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m44s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m55s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m7s
3fdf7d4391
A headless run (HOS_HEADLESS=1) starts SDL's sound first: the Insert
menu's list of outputs at the renderer's start (vk_menu.cpp menu_init,
through hos_sdl_output_count). SDL's sound starts its events, and its
events install SDL's SIGINT/SIGTERM handlers, reading
SDL_NO_SIGNAL_HANDLERS only then. pads_start set that hint later, when
the game first read its controllers, so a timeout's SIGTERM became a
quit event nobody reads and the run went on until SIGKILL (83 minutes
under timeout 150, holding the PC's job queue).

hos_sdl_load sets the hint as soon as SDL is loaded, when headless,
before any hos_sdl_init can run. pads_start no longer sets it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(recomplauncher): one program players start, Longshot.exe / Longshot.x86_64, that updates the game and starts it
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Website build and checks (pull_request) Failing after 1m1s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m6s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m8s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m16s
b8e09c026a
RecompLauncher's Recomp Standards ask for one program, the one players start, that builds the game when
it must and then runs it, never named a builder: with Easy Setup off, and from shortcuts and Steam
entries, RecompLauncher starts the release's program with no arguments.

- The zip holds longshot-builder once, as Longshot.exe (Windows, its PE subsystem made a windowed one's:
  no console) or Longshot.x86_64 (Linux; Longshot is the game folder's name beside it). start and
  prepare both run it.
- By those names with no command (or as longshot-builder play) it plays (src/play.rs): update of
  Longshot/ beside it, quietly, logged in Longshot/logs/longshot_update.log, then the game in its
  folder with every argument, its exit status the game's. --game <copy> builds first. Never built and
  no copy: exit 120; a failed build, update or start: 121, said in a message box (zenity or kdialog
  on Linux) except in Big Picture mode; exit_codes explain both, folders.logs is the game's logs/.
- build-core: hidden_console (Windows: what a windowed Longshot.exe starts shares a hidden console,
  its standard handles kept) and message_box.
- prepare.done stays longshot_builder.json, the record every finished build writes last.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Every child of a build (the compilers, the linkers, the shader
preparation, zstd, curl, pkg-config, jj and git) is started through
build_core:🧒 on Linux it gets PR_SET_PDEATHSIG (SIGKILL when the
thread that started it ends), on Windows it goes into a job object the
builder never closes (JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) and opens no
console window (CREATE_NO_WINDOW, a safety net beside hidden_console).

Every run of clang goes through toolchain::clang, which also drops the
variables no key holds (CCC_OVERRIDE_OPTIONS, COMPILER_PATH,
LIBRARY_PATH, CPATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, SDKROOT).

A unit's compile has an hour (compile::UNIT_LIMIT): past it the
compiler is killed and the build stops naming the unit, not retried
alone.

Also: MOVEFILE_DELAY_UNTIL_REBOOT works only for an administrator, so
delete_at_restart says whether Windows took it, and the comments that
promised removal at restart now say the next build's sweep removes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- One gate for the build (build.rs): the compile's jobs and the early
  preparation wait in the same build_core::memory::Gate, so
  LONGSHOT_MEM_LIMIT_GB is one limit for both. The preparation goes in
  with Gate::enter_beside: when 9.5 GB (at most the limit) fits beside
  the compilers running, or the gate is empty; it counts in the room but
  not toward the compile's floor, so the compile goes on while it runs.
- A build that returns an error before its shader step stops the
  preparation (Early::stop, from a guard in build()): its game killed,
  its waits for the assets or the gate ended, its thread joined, its
  staging folder removed. run_once looks at the game every 200 ms
  (try_wait beside the lines' channel), so a helper process holding its
  pipes no longer keeps the build waiting.
- Early::finish moves each entry of the preparation's cache/ beside its
  place first (renamed, or copied on EXDEV and then removed), and only
  then removes the old one and renames the new one in. One that can't be
  moved returns None, so the build prepares in the game folder instead of
  ending with shaders_not_prepared.
- The preparation's key names the game's own renderer:
  longshot_vk.dll for a Windows game, longshot_vk.so for a Linux one.
- A failed game link drops the lift's key and the game's objects only
  when the link failed on them (an undefined symbol, an object it can't
  read: build::objects_at_fault); a killed linker or a full disk keeps
  everything.

Docs: builder.md and build.md (the gate, the early preparation, the
compile's environment, its time limit, the children tied to the build).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Anchors::name found a folder in a to_lowercase copy and cut the text at
that copy's byte offsets: İ lower-cases to two characters and the
Kelvin sign to one byte, so a path under C:\Users\İsmail was cut in
the wrong place (or panicked on a char boundary). Both sides now fold
ASCII letters only (key::fold, which keeps every byte where it is), and
each anchor keeps its folder as given, which resolve() returns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- build_core::fsx::relative_ok, link_inside and through_link replace the
  copies in sources.rs and tools/archive.rs (and tools.lock's path_ok is
  relative_ok plus its own characters). Where the rules differed the
  strict one is kept: a link target with a '..' in its middle, an empty
  part or a ':' is refused by both unpackers now; the character rule
  stays tools.lock's own (the carried tree has a font with '&' in its
  name).
- build_driver::sha256_file replaces folder.rs's, runtimes.rs's and
  tools/archive.rs's.
- build_core::switch is the on/off words the game reads; build-compile's
  on() (unknown words on), RX_A64_RT_O2 (unset on) and perf.rs's
  env_switch (unknown words the default) keep their own defaults over it.
  perf's switches now take a set-but-empty value as off, the game's
  rule, where they took it as unset.
- tools.lock: a line is trimmed before its '#' is looked for, so an
  indented comment is a comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- A .nup's romfs index, its note (.longshot_romfs.json), the damaged
  files' list and the game's name and icon are written into the work
  folder's finish/ and go into the game folder with folder::install, in
  the swap; the assets read the staged index. The first build that
  stages them takes the game folder's own index (romfs::reuse), so it
  indexes nothing again.
- A romfs/ folder in a .nup's game folder is removed after the swap, and
  only when it is the builder's: the installed note names it ('romfs/',
  written when a build links a dump's in), or every file in it is a hard
  link of the dump the folder's record names. A player's own stays, and
  the build says so (romfs_folder_kept): the game reads it before the
  .nup (host/hos_main.c), so a stale dump's folder would win.
- After the swap the builder's own files this build has none of go (an
  old damaged list; a dump's build's index and note), and so do the old
  builders' leftovers: bin/'s game files (bin/ once empty),
  .longshot_exefs/, .longshot_romfs* but the index's note.
- The installed note's names are checked with fsx::relative_ok: one
  naming a place outside the game folder is not read.
- 'longshot-builder index --game <new.nup> --out <folder>' points a
  built folder at its .nup moved: the .nup's size and TOC hash must be
  the ones its index names (not_the_same_nup otherwise), then the index
  is made again and the record names the new place. The nup_moved
  message names the command.

Docs: builder.md, build.md, build-events.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build_core::is_disk_full knows ENOSPC and EDQUOT (Unix) and
ERROR_DISK_FULL (112) and ERROR_HANDLE_DISK_FULL (39) (Windows).
longshot-builder's drive_error says any such Io error as disk_full, and
folder::install says a staged copy that ran out of room as disk_full,
not stage_failed. game-files' .nup extraction uses the same check (it
missed EDQUOT).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- main reads std::env::args_os: an argument that is not valid Unicode
  (std::env::args panicked on it) is a command line it does not take,
  exit status 2, said on stderr and, with --json, as an error event
  (usage). A usage error from parse() sends the same event.
- --user is made absolute before the build records it, so an update run
  from another folder reads the same mods.json.
- layout::cache_root takes the variables as the system has them
  (build_driver::env_os, var_os): a home folder whose name is not UTF-8
  is still where the cache is.

Docs: build-events.md (usage, exit status 2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
store::exists returns InStore (There, Missing, Unreached), asking up to
three times as store::json does: a 404 or a list without the file is
missing, anything else (not reached, a server error, a body that is not
the list) is unreached. 'dev tools missing' exits 1 when a line is
unreached (it printed it as missing, so the release would remake and
upload it), and when the sysroot is missing ('upload it by hand':
tools.lock and deps.sh say it can't be made the same twice).
'dev tools check --require' says which lines it could not ask about.

The store's curl runs start with runtimes::CURL_SAFE (download takes the
whole of runtimes::CURL), one option set.

Docs: releases.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build.rs read builder/Cargo.lock, gone with the root workspace, and took
a missing file as empty: LIFTER_SOURCES held no dependency versions, so
a dependency bump left lifts keyed as before. It reads <repo>/Cargo.lock
now, and the build stops when that file is missing or has no lift
package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- layout::prune_work renames a work folder aside (.gone-<name>-<pid>)
  while it holds its lock, so a build starting in it meanwhile finds no
  folder rather than one being removed under it; on Windows, which
  refuses to move a folder with the lock's file open in it, the folder
  is emptied while held and moved once let go (not at all if a build
  took it in between). Leftover .gone-* folders are removed.
- tools/archive.rs: a pax record whose length does not cover its own
  digits and space, or runs past the data, is refused: no slice past a
  char boundary, no endless loop on a 0 length.
- dev release dry-run --clean on Windows keeps SystemRoot, windir,
  SystemDrive, TEMP, TMP, ComSpec, LOCALAPPDATA, USERPROFILE and APPDATA,
  with Windows' own PATH (System32 first); its runs are tied children.
- Doc comments no longer name the old builder's files (nx2/, a64-kit,
  build.py, the Python builder); the switches' test is
  the_switches_read_from_the_environment.
- build-driver's unit tests make their folders under
  <target>/test-scratch, not the system's temporary folder (memory on
  some PCs); its integration tests and the synthetic game's already use
  CARGO_TARGET_TMPDIR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
save, prune and restore hold <store>/.lock (waited for), so two builds
of two game folders sharing the store no longer prune or replace a lift
under each other. A save writes <key>.<pid>.part and sweeps every other
.part (under the lock, a save that stopped). LONGSHOT_LIFT_STORE_KEEP
(1 or more; dev.py used 6) sets how many lifts are kept, 3 by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- play: an update that fails in a folder that has its game says why,
  then starts that game (the swap puts in all of a build or none), not
  exit 121. A folder never built, or a build from --game, still stops.
- play shows its box for an update that will prepare the shaders again
  (shaders::would_prepare: the key moved, read with no Vulkan call), not
  only for a first build or a new release.
- The preparation's Linux driver key no longer holds where the drivers
  keep their caches (__GL_SHADER_DISK_CACHE_PATH, MESA_SHADER_CACHE_DIR,
  XDG_CACHE_HOME): a key of what made the caches, not of their place.
  LONGSHOT_SHADER_STORE stays (it is what the game reads its pipelines
  from).

Docs: releases.md (Play), builder.md (the key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- The licenses accepted for a game folder are noted in the per-user data
  folder (layout::data_root: LONGSHOT_DATA, else
  %LOCALAPPDATA%\Longshot\Builder-data, /longshot-builder
  or ~/.local/share/longshot-builder), not the cache a launcher or a
  player empties, as <data>/licenses/<id>.json: <id> is the folder's own
  (Record::id, made at its first build and kept). The note counts for
  the folder it was written for, or for one whose old place no longer
  has the record (moved, or reached by a link); a record copied while
  the first is still there accepts none. An earlier builder's note in
  <cache>/licenses/ is read, and moved at the next build.
- An update whose upscaler's license is not accepted here (the note
  lost, a vendor's new pin) builds without it and warns
  (upscaler_dropped), so RecompLauncher's Play no longer exits 121 on
  it. A build that asks for it still stops (license_not_accepted).
- The game folder is taken by its real place (layout::game_folder:
  absolute, links resolved on Linux) in Places and update_options, so a
  launcher's --out through a link and play from the folder are one
  folder with one work folder and one license note.
- After a build: vendor files no pin names (runtimes::prune), license
  notes of folders gone for a month (Accepted::prune), the object
  store's earlier layouts (Store::prune_layouts: v0, unversioned; never
  a newer one), and, in the builder's own cache only, the old builders'
  leftovers by name (sa/, objcache/, exefs/, image/ beside work/;
  ~/.cache/longshot-builder-windows; %LOCALAPPDATA%\LongshotBuilder),
  each logged with what it freed. A work folder whose game folder's
  parent has not been there for a month goes too.

Docs: build.md (where things are, the data folder, LONGSHOT_DATA,
LONGSHOT_LIFT_STORE_KEEP), builder.md (the cache tree, the clean-ups:
the 'never deleted' line that contradicted the tree is gone),
build-events.md (upscaler_dropped).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The host's slot (host/hos_setjmp.c SjSlot.rets) holds four return addresses; the lift copied the first four and
dropped the others, so a longjmp to a fifth would miss. mir::SETJMP_RETS names the bound.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
host/hos_setjmp.c stack_of stores the context's address in its owners table and later only compares it. Every other
runtime declaration checked against its C definition: none keeps its pointer past the call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The profile's counters are not atomic, so a run can record a branch taken more often than its block ran; weights()
scaled by the block's count alone then wrote a taken weight past i32. Profile::parse and Map::read_raw clamp each
taken count to its block's (Function::clamp_taken), and weights() clamps too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A usual target that is a PLT stub was compared after being followed to its function, so the direct call never hit
when the register held the stub's address. mir::Usual carries both: the address compared, the function called.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
CMP's immediate was read without its lsl #12, and a masked index took the window's last compare, which may be on
another register, over its mask. Either read too few entries, and a case past them went to the switch's default, an
indirect jump to no function. The general bound now takes the larger of itself and what made the index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
`ldr x8, [x0, #slot]; mov x8, x9; blr x8` calls what x9 holds, but was counted as the slot's call, so an anchor
could count it or point at it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The builder's index checks were weaker than host/romfs_index.c's: a raw
file at offset 0 was never bounds-checked, entries sharing an offset
with other sizes were accepted, and a .nup path of 1024 bytes or more
was written though the game refuses it. romfs.rs's refused() now makes
entries_sane's checks one for one; encode refuses with nup_damaged or
nup_path_too_long (documented), Index::open with bad_data. The C check
leaves empty files out of its offset sort, so one sorted between two
mismatched entries no longer hides them. One set of damaged indexes is
fed to both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
host/zs.c picks a frame's dictionary by its id, and decodes a frame of
id 0 plainly. The sound archives and the boss maps used to name theirs
(zs.zsdic, bcett.byml.zsdic); a frame made with one but without its id
(zstd can leave it out) would now fail. zs.c keeps each dictionary's
SARC name (raw-content ones too) and hos_zs_decode_named /
hos_zs_read_romfs_named try the named one when such a frame is no plain
frame; audio_source.c and oot_heart_containers.c pass their old names.
audio_source.c logs how many sound classes were found and how many
archives were read, so a run shows whether the sounds work.

tests/zs_test.c: a frame with its id cut out, read only by name, from a
SARC of named dictionaries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
hos_romfs_head turned a failed read into 0 bytes, so oot_damaged_files.c
took a texture its drive failed to read for a damaged one (no zstd
magic) and read its stand-in in its place. It now returns -1, which
starts_as_zstd already leaves to the open. tests/romfs_test.c makes the
.nup's reads fail and checks the -1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
#2286 drops the game's one-time import of longshot_mods.txt, the list
of builds before mods.json. A player who never started a build that
imported it starts with every mod on, in path order: using-mods.md says
so and how to set the list again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
hos_prompts_base_at checked off + n <= o + len, which wraps for an off
near 2^64 and copied from outside the run. The check is now
n <= len && off - o <= len - n; tests/prompts_base_test.c asks for one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
hos_romfs_dir stayed unset for a start with an image and no --romfs, so
longshot_romfs.idx beside image.bin was never opened. The folder now
defaults to romfs beside the image, as a start with nothing has it
beside the executable (hos_romfs_dir_beside, tested in romfs_test.c),
and the index opens when that folder is not there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
In folder mode hos_romfs_case listed each folder of a path at every
call, and host/mods.c asks for every file of every mod: its files times
the folder's size. romfs.c now keeps each folder's names, sorted folded,
the first time it is asked for, and finds a part by a binary search (the
very spelling still wins over another case). romfs_test.c checks a file
put there after the listing is not found by it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Image::relocate checked a relocation's word against the whole image
only, so a damaged NSO's offset past its module's end wrote into the
next module, and base + offset could overflow. Each word is now checked
inside its own module with checked arithmetic, and a relative address
that wraps is refused; both say the NSO is damaged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Every push past the slots' depth shared one static slot, so two threads
refused at once had recomp_sj_setjmp write their registers into one
buffer together. The slot is now _Thread_local; recomp_sj_pop knows a
refused one by its NULL stack rather than its address, so a fiber that
pops it on another thread still drops nothing. test_setjmp_context.py
refuses on two threads at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
disk_init copied the store's copy of a prepared program cache and then
its index, while another Longshot's program_cache_publish could replace
both between the two: a cache of one preparation with the index of
another. Both now run under the store's lock (Store::with_lock, the lock
on spirv.lock), and spirv_pack_test.cpp checks a second with_lock waits
for the first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Saves: a Windows game started without --user (RecompLauncher, a
shortcut) kept them in <game>\user, so a rebuilt folder or the Longshot
Launcher's builds did not see them. saves_dir now runs on Windows too:
%APPDATA%\Longshot, the launcher's --user (LongshotLauncher Core/Saves.cs
LongshotRoot), with the old user\ moved there once by the same rules as
Linux (an entry already there, or one that cannot go, keeps the old
place whole). A link or junction is not made again on Windows: user\
that is one is used as it is, and one inside keeps the old place.
longshot_options.ini stays in the game folder (RecompLauncher writes it).
recomplauncher.json lists {config}/Longshot/save (RecompLauncher's
AppData\Roaming) too, so its backups and cloud saves follow the move.

Paths: hos_game_path_a was GetModuleFileNameA into MAX_PATH (260)
bytes; it is now hos_game_path_w converted to UTF-8, and the game
folder's buffers in hos_paths.h, hos_main.c, options_path.c and
game_layout.c hold HOS_PATH_CAP (4096) bytes. The manifest adds
longPathAware (test_utf8_paths.py checks it). The Windows saves code is
built with llvm-mingw, -Werror; not run on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Shader store: program_cache_publish wrote one spirv.{pack,idx}.programs-
<stamp> pair per translator, hundreds of MB each, and never removed one.
spirv_pack::prune_program_copies, run under the store's lock after the
copy, keeps this stamp's pair and the two newest others and removes the
rest (spirv_pack_test.cpp). spirv.pack itself is still append-only: a
TODO there says why compacting it is not done here.

Program cache lock: Windows used a Local\ named mutex, the session's, so
another user or session (or another spelling of the folder) took the
same cache under the first. It is now LockFileEx on
longshot_programs.bin.lock beside the cache, as Linux's flock; the
handle is held until the process ends. Built with llvm-mingw, not run on
Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The release's bases (the channel's last 5 full files, up to hundreds of MB each) came through Cloudflare even where the
runner reaches the server directly. fetch-bases and files now try FORGEJO_UPLOAD_API's server first for every request on
the public server's address (its scheme and host, as Tooling's release.py download() does), http there allowed, a
redirect to https only, then the public address. Fewer bases than KEEP while more of the channel's releases have the
platform's files, or a release list that stopped answering, is a :⚠️: in CI: launchers on those releases download
the full file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build-linux.yml and build-windows.yml run only in a release, yet the Linux job restored the back end's object store before
the release's own longshot-builder ran again and dist/ was uploaded, and the Windows vulkan job (in the same run as the
package job, whose artifact any job of the run can upload over) restored llvm-mingw's archive, the Rust downloads and
its object store, keys other workflows can save. Now neither job restores or saves a cache: the build checks compile
into an object store of the run's own, as CircleCI's release mode does, and the Linux job uploads dist/ before them. The
vulkan job uploads nothing.

Each package job also makes RecompLauncher's longshot-builder-<v>-<p>-recomplauncher.zip with its own Linux
longshot-builder, right after dev release files, into dist/: it travels with the artifacts and SHA256SUMS names it, so
publish, on the deploy runner, needs no Rust. The deltas step passes RELEASE_UPLOAD_API for the bases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Both ran scripts/ci_rust.sh and cargo build on the deploy runner, with /magicbean-secrets mounted and RELEASE_TOKEN (the
job's token) or SEALED (the packages token, sealed) in the job's env: every build script and proc macro of the checkout
ran where the seal.key is. publish now takes RecompLauncher's zips from the build jobs (they are in their dist/) and only
checks they are there; tools-publish uploads with scripts/ci_tools_publish.py, Python's standard library, which checks
each archive's size and SHA-256 against its tools.lock line before any upload and then that every line's copy is in the
store, as dev tools check --require does. RELEASE_TOKEN and SEALED move from the jobs' env to the steps that use them.

The version job decides the version first and builds its longshot-builder and reads tools.lock only when there is one:
a nightly with nothing new compiles nothing.

tests/test_release_workflow.py checks these (no Rust or job-level secret on the deploy runner, no cache in the builds,
dist/ uploaded before the checks, the version first) and the upload script's refusals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
mapping.conf named builder/ but not the workspace's Cargo.toml and Cargo.lock, longshot-rs/ or third_party/renhdrum/: a
pull request that only bumped a crate ran none of the Rust jobs or builder builds. Cargo.(toml|lock) now turns
everything on, longshot-rs/ the tests area (the rust jobs) and third_party/renhdrum/ the linux and windows builds.

CircleCI's release-stage makes no RecompLauncher zips, which Forgejo's builds now make and its publish requires: a TODO
there points at release.yml so the migration's cutover does not drop them. Nothing else of it changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
scripts/windows/deps.sh (and scripts/linux/deps.sh, the same two lines and dav1d's) downloaded FFmpeg's and dav1d's
licences into the tools' archives unchecked: a change upstream, or a cut download, made an archive other than its
tools.lock line, which tools-publish then refuses. They go through fetch now, by the SHA-256 of their files at the
versions' tags (pinned in scripts/linux/deps.sh beside FFMPEG_SHA256, which windows/deps.sh reads). The Windows script
reused any earlier llvm-mingw-linux/ with a bin/clang; it now reuses one only when its stamp names this pin's archive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
common.LAYOUT still listed builder, the folder dev.py kept the build tools in before tools-store/, so `dev.py paths`
showed a part nothing uses and `dev.py paths tools-store` was refused. It lists tools-store now. `dev.py migrate` says
when the development folder still has builder/ (downloads only) and that it can go once no checkout is that old; it is
not deleted, since an older dev.py still installs there.

`dev.py packs run --tree OTHER` built OTHER's longshot-builder with --root OTHER but gave it the tools of this checkout's
tools.lock: toolchain() and environment() take the tree, and packs run passes its own. Game-free tests for both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- longshot-builder's per-user cache: no dev path set LONGSHOT_CACHE, so dev builds put runtimes and licence notes in the
  player's ~/.cache/longshot-builder. build.environment() sets it to the development folder's builder-cache/ (yours wins).
- A work folder per checkout: dev_home/work was one folder for every checkout on the PC, so two agents' builds collided.
  common.work_dir(tree) is work/<checkout>-<hash> (work-windows/ for RX_TARGET=windows), and packs run gives it to an
  update too, which before got a work folder in the player's cache.
- The queue: longshot-builder's cargo build ran outside the job queue (toolchain() and packs run call packs.builder before
  any queued step), and `mise run build`/`build-dev` ran their builds outside it. The cargo build and packs run's build,
  update, lift or compile are now jobs of mode build (run directly inside a job, as dev.py base/pack/vk's are).
- Windows: a longshot-builder.exe that is running can't be replaced; it is renamed aside first, and the old one deleted
  at a later replace.
- A runtime refreshed over a base that moved, or whose build's shader translator changed, kept the old build's caches
  (cmd_rt never compared dev_packs.json's base): they are dropped and the base's seeded.
- `dev.py bases --prune` lists, with sizes, what nothing reads any more (an older dev.py's bases, builder/, stores/,
  ~/.cache/longshot-objects and -lifts); `--prune --yes` removes them with no job in the queue, a base only when its lock
  is free.
- The lift store's keep: a TODO where packs run and the base builds would pass it, for when longshot-builder takes one.

Docs (build.md's Where dev data lives, mise.toml's tasks) and game-free tests for each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
ruukwlyq made longshot-builder's compile and packs run's builds queue jobs, which needs a queue folder this process can
write: the Test Farm (Beanstalk) runs dev.py packs in a sandbox with none, and every farm job would have stopped there.
packs.build_job queues only when why_direct finds no reason not to: inside a job already, --no-queue (dev.py packs
--no-queue) or LONGSHOT_QUEUE=0, the Test Farm's environment (LONGSHOT_BUILD, its own program, with
LONGSHOT_BUILD_JSON=1, as Beanstalk's WorkspaceBuilder.BuilderEnv sets with LONGSHOT_STORE and LONGSHOT_CACHE), or a queue
folder it can't write (jobqueue.writable, which never exits). Otherwise it runs the command directly, as before #2286's
queue change. Game-free tests for each case, the farm's packs run included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build-compile's compile_link test compiles and links with clang and ld.lld, and a64's llvm_mc test compares the decoder
with llvm-mc; both now fail when their tool is missing unless LONGSHOT_NO_CLANG=1, which CI never sets. Forgejo's ci.yml
rust job and CircleCI's rust job install the distribution's clang, lld and llvm (tools.lock's llvm is trimmed to the
compile's tools and has no llvm-mc), check each runs, and set LLVM_MC. CircleCI's e2e job runs only the synthetic game,
which already has clang and lld. ci.yml's header and the rust job's comment no longer speak of the game's crates: the
workspace is longshot-builder's crates and longshot-rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
They returned early and passed when the tool was missing, so a PC or CI job without it passed them
unchecked. They now panic unless LONGSHOT_NO_CLANG=1, the rule lift's, llvm's and site_hooks' tests
already follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_mods_list and test_log_redact skipped their build half when cargo was missing and
passed; run_all now passes --cargo {cargo} (skipped, or a failure with --strict, without it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_prepare_stall matched shaders.rs's text for the arm; build-driver's shaders_outcome_tests
runs the preparation with a stand-in game ending 3 and 4, and checks the reason and the warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_utf8_paths and test_mods_list each copied res.rs's .res writer and read MANIFEST out of
the source; they now link the bytes the example writes. That exe_resources links the
manifest (with and without the icon) is build-compile's exe_resources_tests, not a
substring check of lib.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_game_phases and test_driver_cache_folder matched plan.rs's and lib.rs's text. The host's
file list is host_sources and the exe's name game_exe_name (both pub(crate)), each with a test
in build-compile; the Python checks are dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- test_switches_removed: A64_WRITE_TRACK 1 in a64_config.h is lift's tests/config_h.rs, for
  each of the lift's options;
- test_target_reuse_memory: that the VMA taken declares vmaGetAllocationInfo2 when vk_vma.cpp
  calls it is build-compile's packages_tests (a too-old VMA refused was already tested);
- test_recomplauncher_json: release_cmd.rs's text; the command as the release workflow runs it
  is longshot-builder's tests/release_recomplauncher.rs, the zip's members already tested;
- test_ship_state_list: sources.rs's text, which its own
  the_tree_carries_the_pipeline_state_lists_and_its_version already tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_free_view_anchor, test_menu_hooks, test_player_update_sites, test_movement_speed and test_mouse_native
matched each callback's text by substring. They now build each site's hook with sitehooks.line and its object
(sitehooks.objects), with the callback cut from host/oot_sites.c and its slot, run it over known registers against
stub hos_oot_* / hos_prompts_* / hos_mouse_camera that record their arguments, and check what each is handed, that
the function goes on, and that the site off calls nothing. tests/sitecheck.py gains run(), looks() and hands() for
that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The test ran hos_oot_trace_save on its own and matched the callback by substring. It now runs the site's hook as
the lift lowers it (an entry that can return) with its callback and the real hos_oot_trace_save: a dropped request
leaves the function at once with x0 = 0, every other goes on with x0 as it was, and with the site off every request
goes on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The fixture called hos_site_camera_turn_speed directly. It now runs each of the four sites' hooks (sitehooks.line,
sitehooks.objects) with the callback and slots, side by side with main's text patch, and checks a site off leaves
the register as the game left it. The sites.def substring count becomes engine_fn per site.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Each of the 28 site tests that runs its hooks side by side with main's text patch (nx2/oot_patches.py's lines,
nx2/oot_wide.py's for test_wide_sites) says in its docstring that the kept C is a transition check, to be removed
once a deliberate behaviour change needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Only the compiler's last 4,000 bytes were kept (1,500 in the log), so the error: line it stopped on was cut when notes followed it, and the player's message named only the file. Now the text keeps its first error: line (else its first line) and its end, and the message ends with that error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
PE and ELF images each side of IMAGE_LIMIT, a file that is neither, and nm -D --undefined-only output with @GLIBC, @CXXABI, @GLIBCXX and @GCC imports, a weak one and Tracy's C API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A stamped file's code moves it; its comments, indentation and CRLF line ends do not; vk_menu.cpp, not stamped, does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Ported from nx2/test_version.py and more: LONGSHOT_VERSION, then VERSION, then version.txt, then a checkout's version tag (dirty too), else unknown; the fingerprint ignores line ends, other files, caches and build folders, and moves with a source's bytes or name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A tree whose every file is past Windows' 260 characters gives the shallow tree's fingerprint and stamp, and no file is left out (#1115, ported from nx2/test_version_long_paths.py).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A .nup that is not there, a game folder under a file or read-only (and one that takes files, its probe gone), and a full drive during an extraction (ENOSPC; ERROR_DISK_FULL, ERROR_HANDLE_DISK_FULL) against other refused writes. The last is a unit test in its own file, nup_tests.rs, out_of_space being private.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
In a file of its own (drive_error_tests.rs), the mapping as it is now: EIO on Unix, ERROR_CRC, ERROR_IO_DEVICE, ERROR_FILE_CORRUPT and ERROR_DISK_CORRUPT on Windows; not found, access denied and a full drive stay I/O errors. A change to the mapping updates this file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A Rust test of list_text's lines as host/mods.c exefs_status reads them (mod, file, FNV-1a, kind, note; an off mod's files left out, a tab in a note made a space). game-files' mods example gains exefs-list, and tests/test_mods_sizes.py gives its game the list made there (--cargo, required) instead of a line of its own, so a change of the lines' shape on either side fails it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
folder::install gave each file its source's permissions, read-only among them: from a Nix store or a packaged install the game folder's files were read-only, so the player could not edit them and on Windows a later build could not replace them. The mode is kept (an executable stays one) with the owner's write bit added (Windows: the read-only attribute cleared). The check main's tests/test_copy_writable.py made of make_game's copies, as a Rust test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The synthetic module's GOT and PLT relocations had no addend, so a relocate that dropped it passed. Bound to another module's export with an addend, each writes S + A, as Horizon's rtld (main's tests/test_relocations.py checked it). The check is in its own file, build_tests.rs; the synthetic module's helpers are pub(super) for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Fixed states for SDIV and UDIV of the most negative number by -1 and 0, signed-edge CMP, CMN, CCMP and CCMN under
every condition, TBL and TBX at and past the table's end (and wrapping from V31), EXT at every position. Sequences
of 2 to 8 covered words lifted as one function, each word's result the next one's input; runs whose accesses leave
the page in Unicorn are not made in the lifted code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
This reverts commit uxntkyox: the RX_VK_GPL row, the measurement section in switches.md and the gpl_wanted comment
pointer in vk_draw.cpp are off-topic for this pull request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build-assets uses game-files; game-files is used by build-assets; sites is not used by game-files (build-driver's
clashes.rs refuses a clashing patch). The graph has passes' test edge to sem (and through it a64). The stale pointers
to nx2/ and the Python builder's tests go: sites' README, build-core's and build-assets', memory.rs,
test_coverage_report.py and test_jump_takeoff_step.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
builder/README.md is now an index; its sections moved to builder.md. Each pointer names builder.md and the section
(the gen/ folder, the guest profile, floating point, what a release carries, building and checking the builder). The
root Cargo.toml and longshot-rs/Cargo.toml no longer name game/crates or game/README.md, which do not exist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
longshot-builder's README lists `prepare`, `dev site-hooks` (site_hooks.rs, run by the site tests) and tests/cli.rs;
builder.md's parts and build.md's dev commands add site-hooks, tools and release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
- builder.md: the cache tree has licenses/ (what the player accepted, per game folder) and the compile store's v1/;
  image/ holds no exefs_patches.json (the list is exefs_patches.txt, in the game folder); mise.toml is the Rust pin.
- developing.md: the carried tools are unpacked in the `tools` stage, not `read`; `build --sources <pack>`.
- releases.md: longshot_env.txt is the player's, not a file a build writes.
- CONTRIBUTING.md: the folder `--cache` names, rather than LONGSHOT_CACHE alone.
- setup.md: longshot-rs/ in the repository layout.
- sem/README.md: the semantics check goes through the queue with `--mode build`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
run_all.py found dotnet for a placeholder no test uses; it goes from the runner, its docstring, the declarations test
and developing.md's list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test_guest_profile_write skips Windows by RUN_ALL_SKIP (and takes {cc}) instead of passing there with a SKIP line.
test_lifter runs the same three steps as CI's rust job and `mise run rust`; its docstring now says so, and why it is
kept: tests/run_all.py runs it with llvm-mc named (the decoder's llvm-mc check runs, not skips) and in release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The prepare run publishes the program cache at its end since the shader store's seed (vk_progcache.cpp), but the
fixture had no stand-in for it, so it did not compile: the test failed on #2286's head for that alone. The code is
right; the test now records the call and checks it comes after the pipeline cache's save and before the skipped
list goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
index_only already checks the .nup against the folder's index (its size and TOC hash, not_the_same_nup) and points the
record's game at the new place; no test held either. This one indexes a folder from one .nup, refuses another .nup
without indexing or touching the record, then takes a copy moved elsewhere and checks the record names it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The builder now keeps the licences a player accepted in a data folder of its own (LONGSHOT_DATA, else
~/.local/share/longshot-builder or %LOCALAPPDATA%\Longshot\Builder-data), apart from its cache. dev.py gave dev builds
a cache of their own (builder-cache/) but no data folder, so a dev build with --accept-licenses wrote the player's
notes. build.environment() now sets LONGSHOT_DATA to the development folder's builder-data/ as well; dev.py paths
names it, and build.md's table lists it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The review's nits in builder.md turned "Rust 1.99.1, as scripts/renhdrum.py pins it" into "Rust 1.99.1, as mise.toml
pins it (scripts/renhdrum.py's RUST_VERSION pins the same ...)"; test_rust_is_pinned still looked for the old words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
exe_resources_tests.rs makes an assets/ folder in a scratch tree of its own, and the check took that for a tree path
the build reads. A module's tests in a file beside it (#[path = "..._tests.rs"]) are tests, as tests/ and tests.rs are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
test(log): the builder's redact example is found where cargo put it, CARGO_TARGET_DIR's target too
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Failing after 1m29s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m11s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m51s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 3m5s
PR description / Description follows the template (pull_request_target) Successful in 35s
97e3f4eed7
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Contributor

Reviewed 97e3f4ee as a draft: the a64 decoder, game-files (.nup, NSO, ZBIC/zstd, romfs index), image, and the panic path.

Untrusted input: no memory-unsafety, and no defect in decode(w). decode(u32) -> Option<Insn> is total over all 2^32 words, every shift and table index taken from the word is masked or bounded by its field width, and the parsers contain no unsafe (the builder's only two are disk.rs's statvfs and build-core/src/sys.rs). Two holes remain on the exefs path, both in the "sizes bounded before use" family the description says is closed:

  • image/src/build.rs:89 — eden_size adds the NSO header's bss_size (nso.rs:268), the only module-size field with no MAX_MODULE check; :101 then resizes to it, ~4 GiB a module. That is an allocation abort, which main.rs:466's hook cannot report as internal_error.
  • game-files/src/nso.rs:357 and :394 — (start..start + size) from DT_RELA(SZ), DT_JMPREL(SZ) and DT_RELR(SZ), unchecked, so overflow-checks = true turns a damaged module into a panic and internal_error rather than bad_data; :296 (start + 8 * i over DT_INIT_ARRAYSZ / 8) is the same shape, and unbounded in length.

The gap that matters most before leaving draft: CI's Rust job is red on this head (run 52346, job 90210) — a64's matches_llvm_mc fails 2206 of 1 800 000 words: ldapr/ldaprb/ldaprh accepted where llvm-mc -mcpu=cortex-a78c says (invalid) (614), and prfm/prfum named (pldslckeep) where -M no-aliases prints #6. Testing says the workspace's tests pass, so either the local LLVM differs (CI apt-installs an unpinned llvm) or RCpc is decoded without feature gating; the oracle needs pinning either way.

To leave draft: that job green, the Still-to-test runs (Windows, Test Farm), the six renderer fixtures actually run on main, and an answer to the #2040 builder question already raised above before nx2/build.py goes.

Reviewed `97e3f4ee` as a draft: the `a64` decoder, `game-files` (`.nup`, NSO, ZBIC/zstd, romfs index), `image`, and the panic path. **Untrusted input: no memory-unsafety, and no defect in `decode(w)`.** `decode(u32) -> Option<Insn>` is total over all 2^32 words, every shift and table index taken from the word is masked or bounded by its field width, and the parsers contain no `unsafe` (the builder's only two are `disk.rs`'s `statvfs` and `build-core/src/sys.rs`). Two holes remain on the exefs path, both in the "sizes bounded before use" family the description says is closed: - `image/src/build.rs:89` — `eden_size` adds the NSO header's `bss_size` (`nso.rs:268`), the only module-size field with no `MAX_MODULE` check; `:101` then resizes to it, ~4 GiB a module. That is an allocation abort, which `main.rs:466`'s hook cannot report as `internal_error`. - `game-files/src/nso.rs:357` and `:394` — `(start..start + size)` from `DT_RELA(SZ)`, `DT_JMPREL(SZ)` and `DT_RELR(SZ)`, unchecked, so `overflow-checks = true` turns a damaged module into a panic and `internal_error` rather than `bad_data`; `:296` (`start + 8 * i` over `DT_INIT_ARRAYSZ / 8`) is the same shape, and unbounded in length. **The gap that matters most before leaving draft: CI's Rust job is red on this head** (run 52346, job 90210) — `a64`'s `matches_llvm_mc` fails 2206 of 1 800 000 words: `ldapr`/`ldaprb`/`ldaprh` accepted where llvm-mc `-mcpu=cortex-a78c` says `(invalid)` (614), and `prfm`/`prfum` named (`pldslckeep`) where `-M no-aliases` prints `#6`. Testing says the workspace's tests pass, so either the local LLVM differs (CI apt-installs an unpinned `llvm`) or RCpc is decoded without feature gating; the oracle needs pinning either way. To leave draft: that job green, the Still-to-test runs (Windows, Test Farm), the six renderer fixtures actually run on `main`, and an answer to the #2040 builder question already raised above before `nx2/build.py` goes.
HumanBean force-pushed lifter-m0-decoder from 97e3f4eed7
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Failing after 1m29s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m11s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m51s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 3m5s
PR description / Description follows the template (pull_request_target) Successful in 35s
to 3ca9b9d875
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 17s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Website build and checks (pull_request) Failing after 51s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m3s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m21s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m21s
2026-11-24 06:35:18 +00:00
Compare
A copy of a game folder kept its record's id. The copy's update found no license (the note named the first folder,
still there), and then wrote the shared note over with its empty list, so both folders lost DLSS for good. Now
Record::id_for gives a new id when the id's note was written for another folder that still holds that id, and
note_here never writes over such a note. The note's folder is compared without case on Windows (c:\games is
C:\Games), or as the same folder by the file system; a record id that is not hex names no note.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A build from an unpacked dump linked the dump's romfs over out/romfs whatever was there, then noted the whole folder
as the builder's: the player's own files in it were written over, and the next .nup build removed the folder. Now a
non-empty romfs/ the builder did not make is refused with romfs_folder_theirs, nothing touched; the note is written
only when the builder makes the folder from nothing (before the first link, so a stopped build's folder stays known).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
`longshot-builder index` ran the whole after_swap, whose old-builder sweep deletes make_game's game in bin/, in a
folder where nothing new was installed: the folder was left with no game. after_swap is split: index_removals (the
damaged list, the dump's romfs/) is all index does; sweep_old_builders runs only after a build's install. The builder
reference says both rules (and romfs_folder_theirs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The preparation beside the compile entered the memory gate and never called Ticket::started, so the gate kept its
whole 9.5 GB need owed on top of the memory free, which already lacked what the game held: the compile's room was
cut twice and its jobs waited. supervised/run_once now give each run's game pid to a callback, which the early
preparation points at its ticket. Tests: the pid reaches the callback; a started ticket whose game holds its need
owes nothing more.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
put used CURL_SAFE's --proto =https, so curl refused an http:// upload API before asking ("HTTP 000"). An http
target now gets --proto =http,https --proto-redir =https, as dev release's plain_curl does; the store keeps HTTPS
alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Windows: the builder puts itself in its job at its start, so every child is in the job from its creation, with what
it starts (llvm-mingw's clang and ld.lld wrappers start the real tool at once, which a child adopted after its start
could leave out). The job allows a break away, which play.rs's game asks for (CREATE_BREAKAWAY_FROM_JOB, started in
the job where a job around the builder's refuses it). Each child is still adopted when the builder could not join.
child.rs's doc says so. Linux: the pid before the fork is kept, and a child whose parent changed by the time
PR_SET_PDEATHSIG is set exits at once (the parent ended in between: the signal would never come).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
objects_at_fault knows "duplicate symbol" (lld) and "multiple definition" (ld.bfd): two objects of different lifts
define one function. upscaler_dropped names the first of the upscaler's vendors whose license is not accepted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A *.tmp goes only a day old (another build may be downloading it); a DLSS SDK folder of another commit only after
two weeks unread (another builder release on the same cache may compile with it), each build that reads one marking
it (.used).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A staging folder that could not be made now gives None (the shader step prepares in the game folder, as without the
early preparation), not "not prepared". move_into renames an old folder aside, renames the new one in, and only then
removes the old one; a refused rename puts the old one back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
layout.rs's prune comment says a build meeting the held lock is refused, not made to wait. release_cmd.rs and
release_deltas.rs start curl, the program under test and its stamps through build_core::child (tied to the builder,
in its job on Windows). setup.md: a PC's own clang must be LLVM 21 or later (the lifted IR's captures(address)).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
saves_dir renamed or copied each entry straight to its name, then deleted the old copies: a start cut part way left
a half-copied entry under its own name (the next start took it for the new place's own and kept the old place for
good) or deleted some old entries with the old place still in use. Now each entry is copied whole under
.moving-<name>, the move's names written (.moving-names), each copy renamed in, and the move committed by renaming
the list .moved-names; only then are the old entries deleted. At start, .moved-names means: the new place, finish the
deletion (a delete that fails is tried again next time); .moving-names means: take its copies back out (the old place
has them all); stale .moving-* go. Linux and Windows share the code.

tests/test_linux_saves_move.py runs the real saves_dir cut at each of its steps (here and from another drive) and
with a delete that fails, and compiles the Windows branch with llvm-mingw when it is on the PATH. The saves docs give
the real rule: any entry of the same name keeps the old place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
packs.builder took the shared cargo target's lock, then queued the compile and waited for a slot: a running job that
built longshot-builder itself (directly, inside the job) waited on that lock while this waited for its slot, and
neither went on (packs base/pack, build.py's toolchain). Now the queued job is `dev.py packs builder`, which takes
the lock itself once it runs; run directly, the compile holds it as before. Tested: the lock is free while the job
waits, and held by the direct compile.

Also: a runtime refreshed over a base that only moved keeps its warm caches (dropped only on a translator_stamp
change; the docstring says so), every `packs run` command gets the development folder's builder-cache/ and
builder-data/, and build.md names why_direct's exceptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A push refused past the slots' depth returned a _Thread_local buffer, and a fiber resumed on another host thread
popped it there: after the first thread had ended, recomp_sj_pop read its freed TLS. The buffer is one for the
process again (only ever written: no longjmp goes to it, its target stays 0), and recomp_sj_pop knows it by its
address. The test pops both threads' refused pushes after the threads have ended, instead of popping freed TLS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
hos_game_path_a gives the A functions UTF-8, which only the manifest's activeCodePage (Windows 10 1903 on) makes their
code page. On 1809 LTSC a path the ANSI code page spells (Zelda with an accent on a Western Windows) passed
narrow_paths_ok, then every file named from the UTF-8 path was missing. narrow_paths_ok now also needs GetACP() to be
UTF-8 for any path that is not plain ASCII, and says why as before. (CP_ACP stays out of the source:
tests/test_utf8_paths.py's rule.) utf8_paths_test.c defines HOS_PATH_CAP, which narrow_paths_ok's buffers take: the
probe did not compile with llvm-mingw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The host's paths are HOS_PATH_CAP (4096) bytes since longPathAware, but the renderer still read the game folder into
MAX_PATH buffers (vk_paths.h, the FSR 4 and XeSS library folders, language.txt, the build's compile_shaders, the
pipeline list's game folder) and host/mods.c kept its folders in MAX_PATH ones: a folder past 260 bytes was cut or
not found. vk_paths.h has kPathCap and game_module_string / exe_module_string, which the callers use; mods.c's
buffers are HOS_PATH_CAP (the RomFS-relative keys stay MAX_PATH, as its walk recurses). vk_shader.cpp's beside_exe is
left: that file is in the translator stamp, and a change there would make every player prepare their shaders again.
The fixtures that paste mods.c define HOS_PATH_CAP as host/hos_paths.h does on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
disk_init and program_cache_publish copied hundreds of MB while they held the shader store's lock, so another
Longshot's start waited for it. Now disk_init opens the copy and its index under the lock (shared for delete, so a
publish can rename over them) and copies out after; publish copies to names of its own process's beside the store's
copies, and takes the lock only to rename the pair in and prune. The prune also removes a copy's temporary a stopped
Longshot left (*.programs-*.new*, an hour old). The folder's lock file on Windows no longer shares delete, and one
that can't be opened counts as free, as on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
ci(release): a release file must not be empty, not only there (test -s)
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Failing after 42s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m40s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 2m13s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m17s
02386f328f
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Contributor

Re-checked the three holes at this head (02386f32, pushed after the review above read 97e3f4ee); all three are still open at the current code:

  • builder/crates/game-files/src/nso.rs:268 still takes bss_size from the header (u32_at(raw, 0x3C)) with no MAX_MODULE bound — still the one module-size field without one. builder/crates/image/src/build.rs:90 adds it in eden_size and :104 resizes to it, so a header can still ask for ~4 GiB and abort on allocation rather than be refused as bad_data.
  • nso.rs:357 and nso.rs:394 still walk (start..start + size) over DT_RELA(SZ) / DT_JMPREL(DT_PLTRELSZ) and DT_RELR(SZ) unchecked, and nso.rs:296 still builds start + 8 * i over DT_INIT_ARRAYSZ / 8 unbounded: with overflow-checks = true a damaged module panics instead of being refused.

CI at this head is unchanged in kind: Rust (rustfmt, clippy, cargo test) fails on a64 --test llvm_mc alone — 2206 of 1 800 000 words, ldapr 309 / ldaprb 143 / ldaprh 162 printed where llvm-mc says (invalid), and prfm 1586 / prfum 6 under alias names where -M no-aliases prints #N. Website build and checks and Guide screenshots also fail.

Nothing was changed here: this only records that the three holes and the oracle question are still open at 02386f32, rather than fixed by the commits since 97e3f4ee.

Re-checked the three holes at this head (`02386f32`, pushed after the review above read `97e3f4ee`); all three are still open at the current code: - `builder/crates/game-files/src/nso.rs:268` still takes `bss_size` from the header (`u32_at(raw, 0x3C)`) with no `MAX_MODULE` bound — still the one module-size field without one. `builder/crates/image/src/build.rs:90` adds it in `eden_size` and `:104` resizes to it, so a header can still ask for ~4 GiB and abort on allocation rather than be refused as `bad_data`. - `nso.rs:357` and `nso.rs:394` still walk `(start..start + size)` over DT_RELA(SZ) / DT_JMPREL(DT_PLTRELSZ) and DT_RELR(SZ) unchecked, and `nso.rs:296` still builds `start + 8 * i` over `DT_INIT_ARRAYSZ / 8` unbounded: with `overflow-checks = true` a damaged module panics instead of being refused. CI at this head is unchanged in kind: `Rust (rustfmt, clippy, cargo test)` fails on `a64 --test llvm_mc` alone — 2206 of 1 800 000 words, `ldapr` 309 / `ldaprb` 143 / `ldaprh` 162 printed where llvm-mc says `(invalid)`, and `prfm` 1586 / `prfum` 6 under alias names where `-M no-aliases` prints `#N`. `Website build and checks` and `Guide screenshots` also fail. Nothing was changed here: this only records that the three holes and the oracle question are still open at `02386f32`, rather than fixed by the commits since `97e3f4ee`.
Contributor

Bounds fix ready to cherry-pick onto lifter-m0-decoder

builder/crates/ does not exist on main, so this is a branch rather than a PR: fix/nso-untrusted-bounds in dazemc/Longshot, head 2dd1a976a4f708af3a74f219fecf54d3eae7ca37 (two commits: test 76ce7a8aa50ba00f6e4b786dfeaa04a05effeddb, fix 2dd1a976a4f708af3a74f219fecf54d3eae7ca37).

I could not open a PR against HumanBean/Longshot:lifter-m0-decoder: HumanBean/Longshot refuses dazemc write access, and Forgejo refuses the cross-fork PR because dazemc/Longshot is a fork of MagicBeanDev/Longshot, not of HumanBean/Longshot.

git diff --stat (base 02386f32)

 builder/crates/game-files/src/nso.rs | 90 ++++++++++++++++++++++++++++++++----
 builder/crates/image/src/build.rs    |  2 +-
 2 files changed, 82 insertions(+), 10 deletions(-)

The four holes, each refused instead of a panic or an allocation

  1. bss size (header 0x3C): the whole image (the segments' end plus bss_size) is checked_added and refused over MAX_MODULE, before image/build.rs allocates it.
  2. RELA/JMPREL range (DT_RELA/DT_RELASZ, DT_JMPREL/DT_PLTRELSZ): checked_add plus inside image.len().
  3. RELR cursor (relr_offsets): e + 8, cursor + 8 * i and cursor += 63 * 8 are checked_added; the table range is bounded by image.len().
  4. init array (init_array_offsets): returns Result, bounds start + size by image.len(), and image/build.rs propagates it with ?.

No new error type or constant: Error::format / Err(String), MAX_MODULE for the image, image.len() for table ranges.

Tests

  • nso::tests::an_untrusted_bss_size_is_bounded
  • nso::tests::an_untrusted_relocation_table_range_is_refused
  • nso::tests::an_untrusted_relr_entry_is_refused
  • nso::tests::an_untrusted_init_array_is_refused

Red on the test commit: all four fail for the bug's reason (an assertion that parse wrongly succeeded, and overflow panics at nso.rs:296:58, :357:31, :398:26). Green after the fix:

test result: ok. 53 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.36s

cargo test -p image: test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s. cargo clippy -p game-files -p image --all-targets -- -D warnings clean. cargo fmt -- --check clean.

Not run in game — N/A, Rust decoder bounds and its unit tests only, no game behaviour change.

Refs #2286

## Bounds fix ready to cherry-pick onto `lifter-m0-decoder` `builder/crates/` does not exist on `main`, so this is a branch rather than a PR: **`fix/nso-untrusted-bounds` in `dazemc/Longshot`**, head `2dd1a976a4f708af3a74f219fecf54d3eae7ca37` (two commits: test `76ce7a8aa50ba00f6e4b786dfeaa04a05effeddb`, fix `2dd1a976a4f708af3a74f219fecf54d3eae7ca37`). I could not open a PR against `HumanBean/Longshot:lifter-m0-decoder`: `HumanBean/Longshot` refuses `dazemc` write access, and Forgejo refuses the cross-fork PR because `dazemc/Longshot` is a fork of `MagicBeanDev/Longshot`, not of `HumanBean/Longshot`. ### `git diff --stat` (base `02386f32`) ``` builder/crates/game-files/src/nso.rs | 90 ++++++++++++++++++++++++++++++++---- builder/crates/image/src/build.rs | 2 +- 2 files changed, 82 insertions(+), 10 deletions(-) ``` ### The four holes, each refused instead of a panic or an allocation 1. **bss size** (header 0x3C): the whole image (the segments' end plus `bss_size`) is `checked_add`ed and refused over `MAX_MODULE`, before `image/build.rs` allocates it. 2. **RELA/JMPREL range** (`DT_RELA`/`DT_RELASZ`, `DT_JMPREL`/`DT_PLTRELSZ`): `checked_add` plus inside `image.len()`. 3. **RELR cursor** (`relr_offsets`): `e + 8`, `cursor + 8 * i` and `cursor += 63 * 8` are `checked_add`ed; the table range is bounded by `image.len()`. 4. **init array** (`init_array_offsets`): returns `Result`, bounds `start + size` by `image.len()`, and `image/build.rs` propagates it with `?`. No new error type or constant: `Error::format` / `Err(String)`, `MAX_MODULE` for the image, `image.len()` for table ranges. ### Tests - `nso::tests::an_untrusted_bss_size_is_bounded` - `nso::tests::an_untrusted_relocation_table_range_is_refused` - `nso::tests::an_untrusted_relr_entry_is_refused` - `nso::tests::an_untrusted_init_array_is_refused` Red on the test commit: all four fail for the bug's reason (an assertion that parse wrongly succeeded, and overflow panics at `nso.rs:296:58`, `:357:31`, `:398:26`). Green after the fix: ``` test result: ok. 53 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.36s ``` `cargo test -p image`: `test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s`. `cargo clippy -p game-files -p image --all-targets -- -D warnings` clean. `cargo fmt -- --check` clean. Not run in game — N/A, Rust decoder bounds and its unit tests only, no game behaviour change. Refs #2286
fix(dev): a process inside a queue job never queues again, whatever environment reached it
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 23s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 23s
Third-party parts / As their notes say (pull_request) Successful in 24s
CI / Website build and checks (pull_request) Failing after 1m44s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m46s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m6s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Failing after 3m15s
PR description / Description follows the template (pull_request_target) Successful in 13s
d0b38bdb55
grsp-v1, a build job, ran `dev.py vk` (env SNAP=... sh verify.sh). build.environment() drops the
queue's LONGSHOT_JOB*, and jobqueue.run's in-job branch ran `dev.py packs run` directly in that
environment, so packs' why_direct found no marker and queued longshot-builder's compile (and its
compile step) as tickets of their own. They waited behind a queued timed run (meas2286-b3), which
waited for grsp-v1 to end: a deadlock.

- jobqueue.job_here: inside a job by any marker a queue ever set (LONGSHOT_JOB, _NAME, _MODE,
  OOT_STATUS_LOCK), in this process's environment or the one it gives its command, else by a
  running job's ticket (any version's, main's too) whose runner or command is above this process
  (procs.ancestors); unsure (a job runs, the parents can't be read) counts as inside.
- run() and packs' why_direct use it, and what they run directly gets the job's markers back.
- Tests: every marker; a job above by its runner or command, not a reused pid or another pid
  namespace, not a waiting ticket; unsure; run() inside carries the markers and writes no
  ticket; a real `env -i ... sh -c 'dev.py queue run'` under a main-style ticket with a timed
  run waiting (deadlocked before); dev.py vk inside a job and packs under a job with no marker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(builder): the Rust checks pass with Ubuntu 24.04's LLVM 18, as CI runs them
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 21s
PR description / Description follows the template (pull_request_target) Successful in 25s
Third-party parts / As their notes say (pull_request) Successful in 22s
CI / Website build and checks (pull_request) Failing after 2m20s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 3m32s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m42s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 4m16s
03b5cba7c7
CI's Rust job installs the distribution's clang, lld and llvm (18 on ubuntu-24.04); this PC's are 23.

- a64's llvm_mc test: llvm-mc 18 names PRFM's SLC operations (pldslckeep) only with -mattr=+prfm-slc-target,
  so the test passes it (LLVM 23 reads the same either way). Two readings stay where LLVM 18 is behind newer LLVM and
  this decoder agrees with the newer one, tolerated by older_llvm: LDAPR, LDAPRB and LDAPRH whose should-be-one Rs bits
  are not all ones (LLVM 18: invalid), and PRFM's IR operation (LLVM 18: #24).
- recomp_sj_push's context is declared plain ptr: captures(address) is LLVM 21+ syntax, so clang 18 refused the lifted
  IR (lift's a_call_of_a_setjmp_owner_takes_a_host_setjmp, which CI never reached behind the llvm_mc failure). Plain
  ptr claims nothing, as the C prototype (Ctx *c, no noescape) does, and keeps qourkwlu's point: not nocapture. The
  setup page's "LLVM 21 or later" for a PC's own clang goes with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): a nightly also has a delta from the latest stable
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 20s
PR description / Description follows the template (pull_request_target) Successful in 21s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
bc547917bd
A player on a stable who switches to nightlies now gets a delta: a nightly's
bases are its channel's last 5 and the latest stable with the platform's
file (fetch-bases' also, also_of). Stables keep their last 5 stables only.
The latest stable's file that cannot be had is a warning; no stable with
the platform's file yet is not. The manifest's format is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(release): the Windows builder's check takes user32.dll, Windows' own, which its message box (MessageBoxW) imports
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 17s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 21s
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Website build and checks (pull_request) Failing after 4m37s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 6m9s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 5m40s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 6m49s
b64f842895
scripts/longshot_builder.py check refused the dist build of #2286's longshot-builder.exe: "needs user32.dll, which
is not part of Windows". build-core's sys.rs message_box calls MessageBoxW (RecompLauncher's Longshot.exe says
why it stops), so the program imports user32.dll, present on every Windows 10 and 11. build-windows.yml's package
job stopped there, before the program was written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The lent runner fetched each commit's whole tree (26 MB at depth 1) from
git.magicbean.dev through Cloudflare in 2 to 4.5 minutes, of jobs of 3 to 7
(#2286's rust, e2e, host-windows and website checks, four at once sharing the
server's upload). Each runner now keeps main's tree in its cache (git-base,
written by a push to main only); the job's workspace borrows its objects
before actions/checkout, which keeps a repository with its own origin and
fetches only what the commit adds (#2286's head: 9.7 s, a small pull request:
1.5 s, against 60 to 75 s for the whole tree from a PC here). After the
checkout every object is copied in and checked against its name (git fsck).
Anything missing or wrong, and checkout starts afresh as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
ci: the Rust checks cache the registry crates alone, once per lock
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 15s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 35s
CI / Website build and checks (pull_request) Failing after 1m54s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 3m9s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m13s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 3m38s
da3596b847
The rust and e2e caches were keyed on every .rs file, so each push to main
that changed one saved the whole target folder again (with target/tmp, the
tests' scratch), a new entry each time on the lent runner's disk. Yet a
checkout gives every file a new time, so cargo builds the workspace's crates
again whatever the cache holds: only the registry crates are reused.
scripts/ci_cargo_prune.py now takes the workspace's outputs and target/tmp
out before the save (a 3.4 GB target came down to 244 MB here), and the key
is Cargo.lock and mise.toml's (the Rust), written once when missing.
host-windows, which builds longshot-builder with no cache, reads the rust
job's. Its two download caches are saved only when missing, not on every
push. ci.yml's jobs build with CARGO_INCREMENTAL=0 (incremental state is
only written in CI) and no debug info in the dev profile (faster links, a
smaller cache; a failing test still names its file and line).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
scripts/linux/deps.sh and scripts/windows/deps.sh (and dav1d.sh, docker.sh, the
Dockerfile) made every tools.lock archive in two scripts that read each other's
pins. They are now builder/tools/: pins.sh holds every upstream pin, lib.sh the
checked downloads and the pinned zstd and nasm, one recipe per tool
(linux-x64/{llvm,sysroot,ffmpeg,sdl2,cpm}.sh, windows-x64/{llvm-mingw,cpm,sdl}.sh,
with dav1d.sh), and make.sh runs them and packs each with `dev tools make`
(<out>/<system>/<name>.tar.zst, its version beside it, add.sh's lines; --check
makes each twice). The recipes keep the same commands, flags and work folders,
so the archives are the same bytes: linux-x64/cpm and windows-x64/sdl, made
twice here, are tools.lock's (5e930ba1..., ea35e9e0...).

Using the tools is unchanged and needs none of this: mise run tools.
scripts/longshot_builder.py reads llvm-mingw's Linux pin from pins.sh; run_all.py
looks for headers, dav1d and llvm-mingw in the checkout's tools/ (mise run tools),
not deps.sh's old folders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
.forgejo/workflows/tools.yml, started by hand with the tools to make
(<system>/<name> ... or all): its make job runs builder/tools/make.sh --check
in Ubuntu 22.04 (each archive made, made again from nothing but the downloads,
and refused unless the two are the same bytes, or when tools.lock names its
version with other bytes); its publish job, on main only and on the deploy
runner, opens PACKAGES_TOKEN_SEALED (the seal broker's seal.key, or the
mounted one), uploads the archives with scripts/ci_tools_publish.py (Python's
standard library), checks them in the store and gives tools.lock with their
lines (the run's summary, the artifact tools-lock) for a pull request.

release.yml loses tools-make and tools-publish: the version job runs
`dev tools check --require` and stops on a line whose archive is not in the
store, naming the Make tools workflow. `dev tools missing` and
`dev tools publish`, which only those jobs ran, are gone. The sysroot, made
twice in one job, goes through the workflow too: no upload by hand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
build-windows.yml's back-end check and vulkan-dlss.yml compiled against
Vulkan-Headers, SPIRV-Headers and VMA fetched by commit, a second pin of
tools.lock's cpm: they install tools.lock's windows-x64 cpm with the job's own
longshot-builder now, what a player's Windows build compiles with. ci.yml's
actionlint took its version and SHA-256 from the step: it reads mise.lock's
(mise.toml's actionlint). The Node a job in ubuntu:22.04 installs for its
actions is written in build-linux.yml and tools.yml, before the checkout that
needs it: a check keeps the two the same. build-windows.yml's Wine step says
why its $1 is single-quoted (shellcheck's SC2016), so actionlint passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
chore(scripts): helpers.py's zip writer, file walk and git ls-files go: nothing calls them
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
Third-party parts / As their notes say (pull_request) Successful in 16s
PR description / Description follows the template (pull_request_target) Successful in 27s
CI / Website build and checks (pull_request) Failing after 1m36s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m28s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m56s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 3m24s
5d9f71f6b6
write_zip, walk_files and git_files (and ZIP_DATE) were the old packaging's,
which made the builder's zips: no script, test or workflow calls them now
(searched the whole tree). checks.sh names builder/tools/docker.sh, where
docker.sh is now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
`longshot-builder verify --out <game folder> [--repair] [--json]` checks every file the build put in the game folder
against the installed note (`.longshot_installed.json`), which now holds each file's SHA-256 and size, written at the
swap: missing and changed files are `game_file_missing` / `game_file_changed` warnings, then one `verify` event lists
them with the extra files (neither the builder's nor the player's) and the player's data it excluded (saves, settings,
mods, logs, the caches the game writes), which it never reads nor touches. A plain verify only reads.

`--repair` holds the game folder and puts each damaged file back from the work folder (finish/, build/, image/) when
a copy there still has the noted SHA-256; the rest by an update, which copies in every file not as the note says.

The note's hash moves from SHA-1 to SHA-256: sha2's SHA-256 (the CPU's SHA instructions) hashes a game folder's
1.6 GB in 0.6 s against sha1_smol's 1.6 s, so the finish, which hashes every file it would copy, gets faster. A
note of an older builder is read (its SHA-1s match nothing: each file copied in once more at the next update) and
`verify` says its files are not checked until then (`game_files_unchecked`). The finish also notes
longshot_version.txt and exefs_patches.txt. On a real folder (119 files, 1.57 GB) verify takes 0.43 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): the lifts' store keeps the lifts used in the last two weeks within 1 GB, not the newest three
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 18s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 22s
Third-party parts / As their notes say (pull_request) Successful in 21s
CI / Website build and checks (pull_request) Failing after 58s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m0s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m33s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 2m44s
b9ef733ee3
With several profiles whose code mods differ, and a version switched back to, a fixed count of three churned: each
switch lifted again (about 5 s, and the units that changed compiled again). The store now keeps lifts as the object
store keeps objects: every lift used in the last 14 days (`complete`'s time, made new when one is taken or saved
again), within a size cap, the least recently used let go first; never the newest, the one just saved, nor one a
build is using. A build holds `<store>/<key>.use` shared from its lift's key on, so another build's prune between its
look and its take leaves that lift. A lift's size counts each file once (the files a lift left unchanged are links of
the last one's).

`LONGSHOT_LIFT_STORE_MB` (1024; a lift's gen/ is about 26 MB) replaces `LONGSHOT_LIFT_STORE_KEEP`. Tests: the
window, the cap's least-recently-used order (a lift taken again counts as new), the newest and in-use lifts kept past
both, a shared file counted once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A release's check and index said "Unpacking the builder's tools (once for this release)" and unpacked nothing (seen
under Wine: no %LOCALAPPDATA%\Longshot after `check --game`), so every check before a first build said it again.
The stage is now said only by the commands that take the tree the program carries (build, update, image, lift,
compile, stamps, perf-report: layout::tree_root), and not when --root or LONGSHOT_ROOT names another tree, which
unpacks nothing either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
default_work hashed the game folder's path in lower case on Windows but kept its readable part as typed, so
`update c:\GAMES\Jösé\LONGSHOT` used ...\work\LONGSHOT-cab829522a and `update C:\games\Jösé\Longshot`
...\work\Longshot-cab829522a: one folder on Windows, two texts in every link's command. Under Wine (#2286's
Windows builder) the update typed in another case linked both again (nothing compiled), the renderer came out with
other bytes and the shaders were prepared again (about a minute here, minutes on most PCs). The readable part is now
in lower case on Windows too; an existing work folder is still found (the file system ignores case), and links once
more under its new spelling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(builder): a Windows link of the same inputs makes the same bytes (/Brepro)
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Successful in 18s
CI / Website build and checks (pull_request) Failing after 1m6s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m10s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m23s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 2m57s
9501433b38
lld wrote the time of the link into every Windows image. Under Wine (#2286's Windows builder) an update that linked
again with nothing changed (the game folder typed in another case, another --jobs: the link's command is in its key)
gave longshot_vk.dll other bytes (PE time stamps 10:54:30/10:54:35 against the last link's), and the shader
preparation, keyed by the renderer's SHA-1, ran again: about a minute here, minutes on most PCs. Both Windows links
(llvm-mingw's driver through -Xlink, and the MSVC route) now pass lld's /Brepro: the stamp is a hash of the image.
Nothing reads the time stamp. Each game folder links once more at its next update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A record of an earlier name (longshot_builder.json, or longshot.json, which
the record was for a while) is read when longshot_build.json is missing, and
removed at the next write when it is a record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
host/longshot_exit.h: LONGSHOT_EXIT_REBUILD (122), the game's exit status
when it needs a build, which the builder that started it answers with an
update and a new start; LONGSHOT_PROFILE, the profile the builder gives the
game, whose saves/ is the game's user folder (save/, save-work/, the
settings) unless --user names another; and the hand-over: a game started by
itself in <version>/builds/<build>/, the builder two folders up and no
LONGSHOT_STARTED_BY, becomes (Linux) or starts (Windows) `<builder> play --
<its arguments>`. Anywhere else, and for --prepare-shaders, it runs as
before. tests/test_longshot_exit.py checks both by behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): the program players start: a version folder, a profile, a fast check, --output
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 17s
Third-party parts / As their notes say (pull_request) Successful in 20s
PR description / Description follows the template (pull_request_target) Successful in 24s
CI / Website build and checks (pull_request) Failing after 1m16s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m28s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m42s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 2m59s
ec23ce8baa
The builder is the program players start. A version folder holds it
(Longshot.exe, Longshot.x86_64), its game folders (builds/default, or
builds/<the Mod API's code mods stamp>) and, for a release's program, its
cache (cache/: portable by default; --cache, LONGSHOT_CACHE and a
developer's build keep theirs). A profile (--profile, else profile/ beside
it) holds the player's copy and upscalers in profile.json (two keys of the
Mod API's file, every other key kept) and the saves (saves/); the game is
given LONGSHOT_PROFILE alone.

Started with no arguments in a version folder, by a play name, or as play,
it reads the profile, runs the fast check (a stamp each build for a profile
writes in the record: the builder, the profile's copy and upscalers, the
copy's size/time/inode, the mods stamp hook, then the shaders' key), updates
only when it says so, starts the game and waits for it; the game's 122 is an
update and a new start, three times in a row at most. A first run takes
--game. Earlier saves are copied into an empty profile once. build/update
--profile write the profile and build for it; --launcher is kept in the
record.

--output json|text|user|recomplauncher replaces --json and --progress-lines:
user shows the build to a person through one seam (UserUi: stderr and error
boxes for now, the builder's own windows later); without it, user only when
no terminal, a display and no job, CI, headless or Big Picture. dev.py
passes --output text, or json where it reads the events.

RecompLauncher: prepare is build --game --profile {config}/Longshot
--output recomplauncher, start passes the same --profile, the game folder is
builds/default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A second start for the same profile starts no second game writing the same saves. Under --output user it brings the
running game's window to the front (Windows) and exits 0; under text, json and recomplauncher it says so (an error
event, profile_in_use, with json and recomplauncher) and exits 123, which recomplauncher.json's exit_codes explain.
Other profiles have their own lock and play at once. The lock is an OS file lock (build_core:🔒:ProfileLock),
gone with the builder however it ends; the holder's pid is noted beside it in .longshot.pid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
longshot-builder steam-shortcut [--profile <dir>] [--name <text>] [--remove] [--quit-steam] writes the tile Steam's
own Add a Non-Steam Game writes into the signed-in account's shortcuts.vdf, pointing at this program with
--profile "<dir>" in its launch options when given, and Longshot's icon in Steam's grid folder. It is the Longshot
Launcher's Core/SteamShortcuts.cs ported to a new crate, builder/crates/steam: the binary VDF read and written back
byte for byte (a file cut short refused, never rewritten), Steam's id rule, its own tile only (a tile of that name it
did not make is left alone: steam_name_taken; a moved version folder keeps its tile and id through a note beside the
library), the library kept once as it was before the first change, art only into empty slots. Steam is found on
Linux (XDG, ~/.steam, Flatpak, Snap) and Windows (the registry's SteamPath). With Steam running it writes anyway and
warns (steam_running), as the launcher does; --quit-steam asks Steam to quit first. The launcher's capsule art lives
in the LongshotLauncher repository alone, so only the icon is written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): doctor checks what could stop Longshot here, each with a plain fix
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 11s
PR description / Description follows the template (pull_request_target) Successful in 22s
CI / Workflow lint (actionlint) (pull_request) Successful in 23s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 23s
Third-party parts / As their notes say (pull_request) Successful in 24s
CI / Website build and checks (pull_request) Failing after 43s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
e251164464
longshot-builder doctor [--profile <dir>] [--output text|json|user] reads, and changes no setting:
- vulkan, gpu, driver: the game's own start rule (a Vulkan 1.3 loader and a 1.3 GPU, the one pick_device picks),
  asked in a process of its own (doctor --vulkan-probe; build_core::vulkan opens the loader at run time) so a
  driver that crashes or hangs is said; no GPU on Linux said by longshot_no_gpu.h's causes, ported; a software
  renderer alone fails, one GPU listed by two drivers warns. The tree has no list of drivers the game refuses;
- disk_space: build.md's needs where the cache, the game folder and the profile are, added up per drive;
- game_copy: the profile's copy there and the supported version (check's answer);
- folders: the cache, the game folder and the profile writable;
- long_paths and defender (Windows): LongPathsEnabled and how near the deepest path comes to 260; Defender's
  real-time protection on the cache, read from the registry, with how to add the exclusion and why;
- game_running: the profile's lock.
With --output json it is one doctor event; exit status 1 when a check fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(builder): Longshot.exe verify verifies: verify is in play's COMMANDS, and a test keeps the list whole
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 11s
PR description / Description follows the template (pull_request_target) Successful in 24s
CI / Workflow lint (actionlint) (pull_request) Successful in 30s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 41s
CI / Website build and checks (pull_request) Failing after 47s
Third-party parts / As their notes say (pull_request) Successful in 54s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m55s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m6s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 2m30s
6fe1490551
Under a play name (Longshot.exe, Longshot.x86_64) a first word that is not in play.rs's COMMANDS starts the game
with it, and verify was missing there, so Longshot.exe verify --out <folder> played. A test now reads parse's
command match in main.rs and main's own answers (dev, --version, help) and checks each is in COMMANDS and is run,
not played, and that COMMANDS holds no command parse does not take.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The game's crash helper (host/hos_crash_dialog.c) ported to Rust, for the builder, which now starts the game and
waits for it: every decision of host/hos_crash_dialog.h (the verdict, when and why, the messages), the report
Report automatically posts (build_report: every field cleaned and capped, the 4000-character settings), the
manual report and the issue link, the release flag, posting with the system's curl (--disable, --proto =https, no
redirects, 10 s to connect, 25 s in all; System32's curl on Windows), bug-reports/sent/ and shown.txt,
longshot_crash.ini's send=1, and a record nobody showed shown at the next start. A run's marker left by the
game is made into its unclean record as the game's next start would. Not crashes: exit 122 (a rebuild), exit 3
with its "start refused:" line, a quit.

The redaction is longshot_redact.h's rule byte for byte; its tests are the C's answers on the same inputs. Also
the build reports LongshotLauncher sent (Core/BuildReports.cs and Privacy.Scrub, client longshot-builder) and the
diagnostics bundle (a zip of the redacted logs, the build's record and profile.json, never a save).

The decision tests of tests/test_crash_dialog.py move here (facts/tests.rs, tests/after_run.rs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The windows a person sees under --output user: a build's progress (its step, how far, a bar, Cancel, which ends
the build as Ctrl-C does), a page (an error; the crash window and each of its pages, through crash::flow::Pages),
and the first run's picker of the game's .nup (a path box, Browse with rfd's chooser: Windows' own, the XDG
desktop portal on Linux, zenity when there is none; no GTK).

Slint 1.18 with only its winit back end and its software renderer (no Qt, no FemtoVG or Skia, no GPU: a crash may
have been the GPU's), in the Longshot Launcher's look: its palette, Inter (OFL, embedded), cards, primary and
secondary buttons, the build page's bar. The windows live on a thread of their own running Slint's event loop;
Ui is a handle any thread calls. Nothing opens until needed: the progress window shows only once a build has run
0.5 s, and closes as soon as the game starts (done). A page ignores key repeats and any key or click in its
first 0.4 s. No window (no display, winit fails): NoWindow, and the caller says it in text.

examples/shots.rs shows each window with made-up content, for a look or a screenshot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The builder's windows (builder/crates/ui: Slint's winit) load X11 or Wayland at run time, which a static musl
program can't. The Linux release is now x86_64-unknown-linux-gnu, linked against tools.lock's sysroot (Ubuntu
22.04's glibc 2.35, the game's own floor) by the bundle's clang and lld: scripts/longshot_builder.py build
--sysroot (or LONGSHOT_SYSROOT); without it, the system's glibc (CI's runner build, in Ubuntu 22.04).

Its check now asks for glibc's libraries only (renhdrum.SYSTEM_NEEDED: X11, Wayland and xkbcommon are dlopen'd,
never linked), a program interpreter, and no GLIBC_ symbol newer than 2.35; the Windows check also takes the DLLs
of Windows the windows import. mise's Rust carries the Windows target instead of musl, for clippy --target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The builder starts the game (longshot-builder play) and waits for it, so it
decides after the run whether the game crashed and shows the crash window
(builder/crates/crash, builder/crates/ui). The game keeps writing its crash
records and has no helper or window of its own any more.

- Gone: the --crash-watch helper and --crash-show (hos_crash_helper_main,
  hos_crash_watch_start), host/hos_crash_dialog.c/.h, gpu/vk/vk_crash_window.cpp,
  gpu/vk/crash_window_api.h, and vk_crash_window.cpp in the build's ImGui users.
- HOS_CRASH_WATCH is a GONE row; HOS_CRASH_TEST stays, in host/hos_crash_test.c.
- hos_crash_record: the helper's entry points (run/log/dir, recover, marker)
  removed; its comments say the builder reads the records.
- Comments that named the old window point at builder/crates/crash.
- Tests: test_crash_dialog.py removed (its decisions are Rust tests now);
  test_crash_window_moved.py checks the game has no helper or window;
  test_no_gpu_start.py and test_log_redact.py check the Rust side's text when
  builder/crates/crash is in the tree.
- Docs: crash-window.md rewritten for the builder; developing.md's crash
  records; build-events.md's crash event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The wiring of the crash and ui crates into play, in after.rs, with a few lines in play.rs and progress.rs:

- --output user: progress.rs's UserUi on the builder's windows (the progress window once a build has run 0.5 s,
  none for a quick update, closed as the game starts), the error window (Send report with the report shown in full
  first, Open the log folder, Save diagnostics), the first run's .nup picker, and the crash window after a game
  that crashed, ended uncleanly or could not start. No window: said on stderr, the record kept for the next start.
- --output text and recomplauncher: what happened and where its record is, on stderr; json: a crash event, and a
  build_report event for a failed build (build-events.md). send=1 in longshot_crash.ini sends with no window.
- Not crashes: exit 122 (play's rebuild), exit 3 with its start refused: line, a quit.
- At play's start, a record nobody showed (builds/*). --send-build-statistics (a launcher passes the player's yes;
  never on by default) sends every build's end on its own, no log, as client longshot-builder.
- longshot-builder diagnostics --out <zip> [--profile <dir>] [--folder <dir>]: the diagnostics bundle.

build-core: run_game_with tells the game's process id once started (its records are found by it; on Linux its
cgroup's out-of-memory count is read then, and the builder leaves the game's scope); the crash and build_report
events.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
fix(game): the builder's two variables have switch rows, and the hand-over exit is a clean end
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Failing after 13s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 23s
CI / Workflow lint (actionlint) (pull_request) Successful in 24s
Third-party parts / As their notes say (pull_request) Successful in 26s
CI / Website build and checks (pull_request) Failing after 1m0s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m18s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 3m32s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 4m35s
e0fa7934c1
LONGSHOT_PROFILE and LONGSHOT_STARTED_BY (host/longshot_exit.h), which longshot-builder play sets for the game,
get their rows in gpu/vk/switches.def (player: set by the builder, not for a run to set), as test_switch_table
asks of every variable the game reads. The game's hand-over to its builder (hos_main.c hand_over, Windows) exits
with hos_crash_clean_end() first, as every normal exit does (test_crash_record's inventory): before the record
starts it clears nothing, but the exit is classified as the clean end it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The profile crate from the Mod API stack's zrtukyzp ("feat(profile): launcher-profile, a launcher profile's folder"),
its profile basics only, as builder/crates/launcher-profile (builder/crates/profile is the guest profile's):

- profile.json v1 read and written (src/file.rs): one JSON object, its keys in the file's order, each value kept as
  its text, so every key it does not know (the launcher's, the Mod API's "mods", a newer one's) is written back as it
  was, in its place; no key twice; "v" 1 or none, a newer one refused and never written over; written whole
  (profile.json.new, flushed, moved over). The known keys: name, color, version, game, upscalers, start_slot (slot_NN,
  "N" or N, 0-99), last_played, copy_of; put/remove for a key of another's.
- The folder's layout (src/lib.rs): LONGSHOT_PROFILE, profile.json, settings.ini, saves/.
- Dependencies: serde and serde_json alone (thiserror dropped), so the game may link it later.
- Moved tests: the_known_keys_are_read, a_round_trip_keeps_unknown_keys_and_their_order, not_a_profile,
  start_slots, written_whole_and_read_back, the_layout (minus mods and trust); their scratch under the target
  folder, never the system's temporary one.

Left to the Mod API's layer on top: ModEntry, the strict "mods" rules, mods()/set_mods(), the trust file, the stamp,
expand and the switches it sets.

build_driver::play::Profile reads and writes the file through it alone: the copy and the upscalers typed, the file
as read beside them, put in only when they changed, so a profile written again keeps every other key as it was
written (the serde_json::Map before sorted them). Two profiles are equal when they would write the same file.

Ported from zrtukyzp (061f315dd); the Mod API stack drops the crate from it on rebase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue
The save folder and the refused start from the Mod API stack, their #2286 parts only:

- host/save_dir.h (qrokwrko, with ovmtsstq's SAVE_DIR_MAX = HOS_PATH_CAP and vymzrkvw's share paths on Windows):
  HOS_SAVE_DIR=<folder> (a whole path, environment only) is checked, made with its save/ and save-work/ and written
  to once. modstore/ (tsvwosyp) stays the Mod API's: it makes its own.
- host/nn_fs.c (qrokwrko): the run's choice, made once (hos_save_dir_choose, _refused, _chosen) and every save path
  from hos_saves_root(): the mounts, IsSaveDataExisting, the journal's syncs, and so the control bridge's save root.
  The C skip title's newest save is looked for there too (host/oot_autoload.c, #2286's side of qrokwrko's skip_title).
- host/hos_main.c (tsvwosyp): refuse_start(code, why): the log line "start refused: <code>: <why>", stderr's
  "longshot: <code>: <why>", a plain message unless HOS_HEADLESS, the clean end and exit code 3, no crash record. An
  unusable save folder is "save_dir_unusable". Exit 3 is not unique (hos_thread.c's fatal error ends with 3 and a
  record), so a launcher and the builder key on the code and the line together.
- The bridge's start_session copies a --save or --repo-save into the run's HOS_SAVE_DIR (qrokwrko).
- The switch's row, switches.md, the user docs' saves page.

Tests: test_fs_save_commit (the saves and work copies in the folder, none in the user folder, the bridge's root;
refused when relative, unmakeable or unwritable), test_longshot_ctl (a copied save lands there), test_crash_record
(the exit inventory; refuse_start writes no record, logs its line and ends clean, and the builder's crash crate keys on
the same line and exit 3: test_crash_dialog's checks, that file gone with the crash window's move), test_skip_title's
stand-in for hos_saves_root.

Ported from qrokwrko (61ed032c5), tsvwosyp (2be6e7674), ovmtsstq (4f2d79733) and vymzrkvw (7f24d9346), the hunks
the hand-over list moves; the Mod API stack keeps their sandbox, host-sys, modstore and Rust skip-title hunks and
drops these on rebase. Not ported: the two (void)hos_save_dir_choose() calls before the sandbox (theirs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue
The profile's layout as decided with the Mod API, and its game side in C (the Mod API does it in Rust, zqxvvuzy):

    <profile>/profile.json   which profile it is (launcher-profile)
    <profile>/settings.ini   the game's settings (longshot_options.ini's lines)
    <profile>/saves/         the saves alone: save/, save-work/ (the Mod API adds modstore/)

Before, <profile>/saves was the game's whole user folder (its settings, recordings, mouse sensitivity and cache
storage beside the saves). Now:
- host/longshot_profile.h: LONGSHOT_PROFILE and the profile's paths (longshot_profile_saves, _settings, _file, moved
  out of longshot_exit.h, which includes it), and profile.json's start_slot read by launcher_profile's rule without a
  JSON library (longshot_profile_start_slot). The Mod API's sandbox takes the same paths from it.
- The saves: the profile's saves/ is the run's save folder (host/nn_fs.c, host/save_dir.h: made, checked, refused as
  save_dir_unusable when unusable), unless HOS_SAVE_DIR is set or --user names a folder (hos_user_named).
- The settings: the profile's settings.ini (host/options_path.c), unless HOS_OPTIONS_FILE or --user; mods.json is
  beside it, and the builder's ExeFS patches read it there (play::options).
- The start slot: start_slot handed on as HOS_START_SLOT (0-99) right after longshot_env.txt, unless set already; a
  value that is no slot, or a file it can't read, is a log line and no slot. The pressing is the Mod API's Skip title
  mod's.
- The rest stays where it is without a profile: the logs and caches in the game folder (builds/<build>/logs/,
  cache/), the recordings, mouse sensitivity and cache storage in the per-user user folder. --user still wins
  over the profile (a developer's run).
- play.rs: carry_saves copies an earlier save/ into saves/ and its longshot_options.ini as settings.ini when the
  profile has none (no more mouse_sens.txt: it stays in the user folder); SAVES and SETTINGS are launcher-profile's.
- The crash files (longshot-builder after.rs): the run's options file is the profile's settings.ini.
- recomplauncher.json: config is {config}/Longshot/settings.ini, and saves/mouse_sens.txt left the saves.
- switches.def: HOS_START_SLOT, and LONGSHOT_PROFILE's and LONGSHOT_STARTED_BY's rows reworded for the layout; hos_main.c's
  env_line_allowed refuses LONGSHOT_PROFILE from longshot_env.txt (zqxvvuzy).
- Docs: profiles.md (sqqtokxm's, minus its mods, trust, sandbox, stamp and cheats sections, rewritten for the C host,
  with the refused start's line), the index link, switches.md's LONGSHOT_PROFILE and HOS_START_SLOT rows, build.md's
  play, releases.md, the dev and user saves pages, updates-and-saves.

Tests: test_longshot_exit (the paths, start_slot by launcher_profile's cases, the sources), test_options_path (the
profile's settings.ini, --user and HOS_OPTIONS_FILE over it, the copy), test_fs_save_commit (the profile's saves/,
refused when unwritable, a --user named keeps the user folder's), test_recomplauncher_json, play.rs's carry.

Ports the profile basics of zqxvvuzy (249ae3edf: the switch's row, env_line_allowed) and sqqtokxm (c7007ee68:
profiles.md, the index link, the LONGSHOT_PROFILE row), and vukowssp's (b890ec8f8) HOS_START_SLOT row reworded for
what this side does; the Mod API stack drops those hunks on rebase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue
feat(builder): the game folder lists what the game can do, in longshot_version.txt's features=
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
CI / Workflow lint (actionlint) (pull_request) Successful in 19s
PR description / Description follows the template (pull_request_target) Successful in 23s
Third-party parts / As their notes say (pull_request) Successful in 21s
CI / Website build and checks (pull_request) Failing after 36s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m7s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 3m23s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 4m34s
72beb78641
A launcher needs to know whether a game folder keeps its saves where it is told and plays a profile without running
the game, and a version number says nothing a fork or a dev build keeps. The tree lists what its game can do in
game/features.txt, one name a line; the builder copies them into longshot_version.txt as
`features=<name>,<name>` for the game it built from that tree (folder.rs features_line, build.rs), and the sources'
pack carries the file (sources::TREE). The names here: save_dir (HOS_SAVE_DIR) and profile (LONGSHOT_PROFILE: its
saves/, settings.ini and start_slot). Launchers read them (LongshotLauncher's SaveDir.Supported, StartSlot.Has).

start_slot is not listed: this side hands the slot on, and nothing presses it until the Mod API's Skip title mod,
whose stack adds the name with it.

Ported from tzrsplvm (14c6b2fb7), with the features.txt lines of qrokwrko (save_dir) and zqxvvuzy (profile); the
Mod API stack drops them on rebase and adds start_slot back with its Skip title mod.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue
txznotur removed the Windows main's crash-helper lines with the #ifdef _WIN32 that opened its start, leaving a stray
#endif: host/hos_main.c compiled on no platform. The #ifdef is back, so the Windows main does its own start (Tracy,
narrow paths, the hand-over, the layout, longshot_env.txt, the profile's start slot, HOS_PROFILE) and Linux's main below
does its own, as before txznotur.

- The comments that still named the crash window's helper or host/hos_crash_dialog.h now name the builder's crash
  verdict (builder/crates/crash/src/facts.rs), so test_crash_window_moved finds no hos_crash_dialog left.
- test_display_startup_failure: its harness stubs hand_over and profile_start_slot, which Linux's main now calls.
- test_profiling_mode: HOS_PROFILE=1 is read after longshot_env.txt in both mains, with the profile's start slot
  (lwxoxvoz) allowed between them, as test_longshot_exit requires it right after the file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
The record (longshot_build.json) kept the launcher that built the folder (--launcher on build and update) and the user
folder the mods' list was read from. A launcher and the game both use the builder and nothing points back, so the builder
knows nothing of launchers: no --launcher on any command, no launcher type, no variable naming one for the game. What it
does for a launcher comes from the generic flags it passes (--output json, --cache, --send-build-statistics).

The user folder goes because the profile replaced it: a play's mods' list is the profile's (BuildOptions.user, set by
play::options), --user stays for a build or an update without one, and an update from a bare folder follows the game
folder's note. Records an earlier builder wrote with either key still read (unknown keys are ignored); the format stays
1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): the builder's windows in the launcher's brand look (#2286)
Some checks failed
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 17s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 20s
CI / Website build and checks (pull_request) Failing after 1m14s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 2m37s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 2m43s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 3m41s
4963326aab
Go-green for the button that starts the build, Noto Sans Black headings, 14 px cards, the four brand stripes across each window's top, gold focus ring, the brand's colours as tokens. Noto Sans Black and its OFL licence are embedded beside Inter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
A player's PC builds a pull request's head or main's newest commit into a working version folder, as a release
is made in CI: the commit's archive by its full hash (checked: it names that commit, plain files inside its
folder only), the Rust its scripts/renhdrum.py pins (each part by its SHA-256), the crates its Cargo.lock pins,
the build tools its tools.lock names (the running builder's own when the same), RenHDrum and the third-party
objects, the pack, and its longshot-builder compiled in the dist profile with the pack inside, at a low
priority. The result is <out>/Longshot.x86_64 (Longshot.exe) and source.json (the commit, unsigned).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
docs(builder): a builder from source: the command, what it keeps, costs and trusts; how pull requests' and main's builds are made
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
PR description / Description follows the template (pull_request_target) Failing after 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 15s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 16s
CI / Website build and checks (pull_request) Failing after 1m54s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m41s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 4m30s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 6m2s
c392532240
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
builder/crates/release: the forge's release list through git-cdn first, a
release's SHA256SUMS checked against the release key (ECDSA P-256, p256),
the manifest, the single delta from a kept program, a chain of up to 5
deltas within a look-back of 20 releases (and a nightly's latest stable),
deltas applied as zstd --patch-from --long=30 by ruzstd, the full file as
the fall back, the program put in place atomically, and the running
program swapped (Windows: renamed aside, deleted at the next start).

Ported from LongshotLauncher's Core/LongshotBuildRelease.cs, Releases.cs,
ReleaseTrust.cs, ReleaseManifest.cs, CdnFetcher.cs, SelfUpdate.cs and
App/ZstdPatcher.cs, with their checks as tests against a fake forge and
zstd-made fixtures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
feat(builder): fetch, self-update and info, so the launcher reads and installs nothing itself (#2286)
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 17s
PR description / Description follows the template (pull_request_target) Successful in 47s
CI / Website build and checks (pull_request) Failing after 2m25s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m57s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 5m12s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 6m30s
b6c4495856
- longshot-builder fetch <tag|stable|nightly> --out <version folder>
  [--from <version folder> ...]: a release installed into a version folder
  as Longshot.exe (windowed) or Longshot.x86_64, with longshot_release.json
  beside it; fetch_progress, fetched and error events. A make_game.py
  release is refused with no_builder_in_release.
- longshot-builder self-update [--channel]: a copy no launcher manages
  updates itself, asked once under --output user (longshot_self_update.json);
  play checks at most once a day in the background, never with
  --no-self-update (a launcher's versions).
- longshot-builder info [--profile]: the version, capabilities (the
  builder's, and the game's from the build record's new features list),
  the profile's known keys, its game folder and the fast check's answer.
- The build record keeps the game's features (game/features.txt);
  longshot_version.txt's features= line stays until the launcher reads info.
- Docs: build.md (fetch, self-update, info), releases.md (deltas applied by
  the builder), build-events.md (the events and codes), builder.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016o1k1SkKpc592GgxftLP8o
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 17s
PR description / Description follows the template (pull_request_target) Successful in 47s
CI / Website build and checks (pull_request) Failing after 2m25s
CI / longshot-builder end to end (synthetic game) (pull_request) Successful in 3m57s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 5m12s
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Successful in 6m30s
This pull request has changes conflicting with the target branch.
  • .forgejo/workflows/release.yml
  • docs/dev/reference/ci.md
  • tests/test_appimage_package_retry.py
  • tests/test_dev_packs.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'lifter-m0-decoder:HumanBean-lifter-m0-decoder'
git switch 'HumanBean-lifter-m0-decoder'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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!2286
No description provided.