WIP: feat(host): the sandbox reaches the active OpenXR runtime with the Headset row on #2600
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2600
Loading…
Reference in a new issue
No description provided.
Delete branch "SqueezyLemonade/Longshot:openxr-sandbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Stacked on #2595 (OpenXR stage A), which is stacked on #2434; review from the first commit after
f971453d(one commit).Written as HumanBean asked on #2595, since he has no headset on his dev machine.
With #2434's sandbox on, a headset could not be reached: the OpenXR loader was refused the active runtime's manifest when
it is in the home folder (a per-user
active_runtime.json,XR_RUNTIME_JSON), then the runtime's library when that is inthe home folder, and Monado's and WiVRn's clients would then be refused their service's socket in
$XDG_RUNTIME_DIR. Theplayer saw one warn line ("no OpenXR runtime is active, or the sandbox keeps it out") and only the window.
This adds one narrow rule, only when the Headset row is on (
headset=1in the settings file, read before the lockdownas
vk_headset.cpp'sasked()reads it, and never for the Builder's shader preparation). With the row off not a rulechanges (tested, and measured below). With it on,
host/sandbox_linux.copenxr_runtimefinds the active runtime as theOpenXR loader's
manifest_file.cppdoes on Linux and gives:XR_RUNTIME_JSONalone when set; else the firstopenxr/1of$XDG_CONFIG_HOME, each$XDG_CONFIG_DIRSfolder and/etcwithactive_runtime.<arch>.jsonoractive_runtime.json, both when both are there; a link followed to its target, as the loader does), only a file with alibrary_path(a folder named there is never given)library_path(relative: against the manifest's real folder, as the loader does)sbx_folder_narrow); a bare name is the system's search, read alreadysbx_openxr_socket), when it is therelibopenxr_monado.so)$XDG_RUNTIME_DIR/monado_comp_ipcsrc/xrt/ipc/client/ipc_client_connection.c(a pathname socket atu_file_get_path_in_runtime_dir(XRT_IPC_MSG_SOCK_FILENAME); the name's default in itsCMakeLists.txt)libopenxr_wivrn.so)$XDG_RUNTIME_DIR/wivrn/comp_ipcserver/CMakeLists.txt(set(XRT_IPC_MSG_SOCK_FILENAME "wivrn/comp_ipc" ...)before Monado is added); the same string is in the shipped client libraryEach grant writes its
sandbox: allowed ...line ending(Headset); below ABI 9 (every kernel before 7.1) the socket showsas its
sandbox: bound backline instead. What is not given writes onesandbox: Headset: ...line saying why (no runtimefound, a manifest, library or socket not there, a manifest that is not a file with a
library_path, a library folder toowide).
With the sandbox on, the row takes a quit and a new start, not a restart from the Insert menu: a restart keeps the rules of
the run before.
What it does not give:
$XDG_RUNTIME_DIR: the socket file alone, notwivrn/./dev/shm: Monado's service makes its shared memory withshm_openand unlinks it at once; the client gets the fd over thesocket (
ipc_client_setup_shm,instance_get_shm_fd) and only maps it.~/.local/share/openxr/1/api_layers, ...): a layer in the home is not seen.under HKLM; but a runtime in a Steam library is not granted, and the runtimes' services are reached through their own named
objects, which an AppContainer with no capability cannot open unless the runtime lets ALL APPLICATION PACKAGES in. Not
written, not run: a later change, when someone can run it.
Read first:
host/sandbox_linux.c(headset_on,openxr_runtime, the call besidevulkan_libs),host/sandbox_plan.h(
sbx_openxr_socket, the threeSbxInputfields, their rules at the end ofsbx_rules_build),docs/dev/reference/sandbox.md("A headset", and the Windows paragraph).
json_lib_dir's parsing oflibrary_pathmoved intojson_libraryfor both,unchanged for the Vulkan files.
The code was written with Claude (Anthropic's model); I read it and tested it. The commit carries a
Co-Authored-Bytrailer.Testing
Tested: Linux Mint (Cinnamon, X11), kernel 7.0 (Landlock ABI 8, the private folders on), RTX 4070, NVIDIA 595.99.02; this
branch on #2595 @
f971453d. Headless (no window), the sandbox on, with a stand-in OpenXR runtime (a library loaded by thesystem's OpenXR loader 1.0.20 from its manifest, 90 Hz, in the home folder; it runs in the game's process, so it has no socket):
f971453d),XR_RUNTIME_JSONnaming the stand-in's manifest in the home folder: refused at the manifest (theloader's "failed to open .../standin.json. Does it exist?", then ours: "no OpenXR runtime is active, or the sandbox keeps it
out (-51): off this run").
sandbox: allowed r .../standin.json (the active OpenXR runtime's manifest (Headset))andallowed rxof its library's folder; the runtime loaded, session states 1-5, 900-901 frames ended per 10 s with a layer each,quit in 0.26 s, exit 0.
sandbox: allowed r .../openxr_wivrn.json (the active OpenXR runtime's manifest (Headset)),allowed rx .../lib/wivrn (the OpenXR runtime's library (Headset))andsandbox: bound back /run/user/<uid>/wivrn/comp_ipc(ABI 8: the socket through the private folders); WiVRn 26.9 reached,2064x2162 an eye, session states 1-5 and at the quit 4 3 6 1 8; the game shown on the screen in the room. On this setup the
manifest and library are under
/var/lib/flatpak, which the system rules read already, so the headset run proves thesocket alone; a manifest and library in the home folder are proven by the stand-in runs. The window opened only through a
test-only
LD_PRELOADshim (Risks): #2434's sandbox cannot open an X11 window on this PC.XR_RUNTIME_JSON: the manifest as$XDG_CONFIG_HOME/openxr/1/active_runtime.json, a file and then a link to themanifest elsewhere: the file, then the link's target granted; 900-901 frames per 10 s each, exit 0.
headset=0), the stand-in still named: the same 109sandbox:lines as #2595 @f971453d(its own run folders aside),no
Headsetline, no headset started, exit 0.tests/test_sandbox_linux.py: new rows for the rules (the manifest read alone, the library's folder read and run, the socketreach alone, nothing else of the runtime folder or the home, three rules more and the rest the same, no socket right before
ABI 9, the socket table) and for
sandbox_linux.cover made-up folders (an absolute and a relativelibrary_path, alinked
active_runtime.json,XR_RUNTIME_JSONalone, a manifest not there, a folder as the manifest (byXR_RUNTIME_JSONand by a link: the home's
.sshnot read), a manifest with nolibrary_path, a bare library name, a runtime found in$XDG_CONFIG_DIRS, a library in the home itself, a socket not there, both names in one folder, the socket bound back belowABI 9,
headset=0, the shader preparation, and the row off byte for byte against no runtime at all), and a source check thatthe rule is called only behind
headset_on. Each part was broken on purpose once (the gate, the link, the relative base, thesocket's check, the narrow folder, the socket's rule, the manifest's rights, the manifest's file check, the table, the key's
reading): every one fails a row.
tests/run_all.py --changed f971453d: 40 pass, 5 fail, the same 5 onf971453dwithout this change (dev_ab, release_workflow,windows_on_linux, job_queue, settings_table; settings_table also on plain #2434 @
038beefa). Lint: every pre-commit hook ranon the commit and passed (end-of-file, whitespace, gitleaks, ruff, the Conventional commit message).
Still to test:
monado_comp_ipc(by hand)RESOLVE_UNIXinstead of the bind (by hand)HOS_SANDBOX=0there for now (by hand, later change)Measurements
Nothing to measure: the rule changes what the sandbox lets through at the start, never a frame; with the row off the rules
and the log are the same as before (above).
Risks
bar #2434 keeps for
HOS_SANDBOXitself). What that run gets is still bounded: only the active runtime the player installed(the manifest is chosen by the real environment and the user's config, which the game cannot write), and its socket only
while its service runs. If you want it tighter, the alternative is a switch from the real environment or the launcher (as
HOS_SANDBOXis) instead of the menu row: your call, and a small change either way.OpenXR calls, and the service's own control messages, such as Monado's client list and focus), and the service is not
confined; the docs' "What stays open" says so. The library's folder is read and run, never written: a game taken over can read what else is
in it (for a self-built runtime in the home, that build folder), as with the Vulkan layers' folders today.
libxcb's connect fail with EPERM, and libxcb falls back to the path socket only on ENOENT/ECONNREFUSED: reported to #2434
separately). The headset test ran with a test-only
LD_PRELOADshim that maps that EPERM to ECONNREFUSED; it is not part ofthis PR and not in the tree.
Checklist
Ready for review
main; the title is a Conventional Commit. (One topic and the title: yes. On #2595, not main)mise run testpasses (any failure that also fails onmainis named). (run_all.py --changed: the 5 that fail on the base are named)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.#ifdef __linux__; no Windows toolchain here)Assisted-by:/Co-Authored-By:trailers.The mod API's game services of host/game/{camera,pad,player,rays,state, texts,watch}.c, typed: the camera's last view and override under sequence counts, the pad over the host's publish, Link and the game's state read bounded, the rays' lock-free slots, the texts' pool and the watches of maps, saves and flags. Fixed on the way: a build naming no actors.vtable took any actor whose first word is 0 for Link; a NaN replacement stick was undefined behaviour; the texts' reads of the screen and names are bounded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e3nBDxBnhodLguFyEthost/game/{items,rewards,rules,skips,songs}.c, typed: the items' watch on its own sites, give, take and the pouch's counts; the placement drops, event gifts, shop prices and bottle fills; the damage, actor-life and scale rules with their tables laid out as the C's; the mods' skipped events and the song names. Caller gains stack_pointer, for the bindings that build a frame below the caller's stack; travel takes the pouch's counts as the service now gives them. Fixed on the way: a build naming no life vtable took a component reading 0 named Player for Link; the song list read before the RomFS index was ready stayed empty for the run; the items' sinks are told after the poll lets go of its state, so a sink that gives an item no longer deadlocks; the damage and actor-life tables are published both or neither. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e3nBDxBnhodLguFyEthost/game/{actors,spawn,queries}.c, typed: the actors.update site's lock-free record, the list and its generations, the mods' writes with their tickets and lit bombs, spawning and despawning with #68's gate and the respawn flags, and the answers to the behaviour-tree queries. Their tables keep the C's layout; longshot-game exports the hos_* functions the lifted rule C calls around the safe Rust. Fixed on the way: a build naming no controller method or no actors.vtable matched a slot or first word of 0; a write its site marked dropped was counted as made; a list slot's generation could wrap to 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e3nBDxBnhodLguFyEthos_rules_*, hos_rewards_*, hos_actor_{writes,binds,lights} and hos_query_answer: each casts the table the site loaded back to oot's and calls its safe function; a null table leaves the game's value. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e3nBDxBnhodLguFyEthost-sys fpe::{fma32, div32} over builder/rt's recomp_fpe_fma32/div32 (the stand-in host: the host's own float ops); GuestCtx::fpe_fma32/fpe_div32 take and give a float's bits as u32. oot's steer rate passed them as u64: now u32. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueGuestPtr<u8|u16|u32|u64>::{load_atomic, store_atomic, compare_exchange, fetch_or}: checked as read and write are, sequentially consistent, a write's pages marked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puefeatures::{mouse_camera, prompts_text_draw, prompts_text_layout, prompts_glyph, jitter_clip} over mouse_native.c, prompts.c and rx_backend.c; sites::{zstd_stream, zstd_frames, scene_format, dynres_*, fixed_scale_*} as function pointers for Handler::C (hos_zstd.c's decodes, oot_sites.c's renderer callbacks); no-op callbacks under fake. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puemem::sys_alloc (hos_sys_alloc), romfs::{head, read_zs} (hos_romfs_head, zs.c's hos_zs_read_romfs), files::{romfs_rel, resolve_read} (nn_fs.c), info::main_image (the generated image.c's hos_main_*), each with the stand-in host's. On the way: romfs::stat answered a folder as a file of size 0, and romfs::list took an empty folder for none and a missing one for an empty one (hos_romfs_stat gives 2 for a folder, hos_romfs_list -1 for none). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueinput::{flight_axes, free_camera_axes, move_stick_held, stick, drag, clear_toggles} over nn_hid.c; movie::{active, playing, action, action_taken, link, clock, menu, menu_take, menu_done, MenuChoice} over input_movie.c; mouse::{game_menu, game_menu_gone, game_pointer, wheel_take, left_held} over display.c. Two small C stand-ins declared in hos.h where the host had no function: hos_input_movie_clock (input_movie.c's static movie_clock, -1 with no recording) and hos_mouse_left_held (oot_menu.c's own GetAsyncKeyState test). The stand-in host keeps each as a test sets it and records what the code gave. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puesync::{available, wait_on, wake_all} and sched::{vcore_away, vcore_back, chain, note_slept, Chain}; paths::ab_value (hos_ab_side_now, hos_ab_value_at) and control::on (hos_control_on), the host's flags read as atomics. C stand-ins in hos_thread.c, declared in hos.h, where the host had none: hos_wait_bound, hos_wait_on, hos_wake_all (oot_barrier.c's WaitOnAddress binding, for any caller) and hos_note_slept (the thread-local Breakdown counter, which Rust cannot reach). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe Debug tools asked for "Page Up" and "Page Down", which are no keybind's names ("PageUp", "PageDown"): the host's key table knows neither, so the keys read up and the free camera and the flight could not climb or sink by the keyboard, as game/oot_tools.c's VK_PRIOR and VK_NEXT did. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueDeleted, each replaced by the Rust game/DESIGN.md's map names: - oot_tools.c (hos_main.c's game half: the Debug tab's tools, the bridge's game commands, the opening's skip, the save trace, Link's pose, game_init), oot_teleport_check.h: oot::{travel, session, debug, player} and longshot-game's control, input, cheats and perf (game_current_map, game_state, game_destination, game_teleport_*, game_age_ask, game_flight_shortcut_ready, game_live_action, hos_perf_info, hos_perf_tracking, game_init) - game_layout.c/h: longshot-game::layout (hos_game_layout, hos_game_layout_log) - flags.c/h: oot::flags Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puelongshot-game's host.rs declared hos_zs_read, hos_fs_save_root/_end, hos_mem_region, hos_game_language, hos_movie_stats and hos_wide_keep_mask itself; host-sys binds them now (files::zs_read, files::save_root, mem::region, info::{game_language, movie_stats, wide_keep_mask}), each with its fake branch, and game_host.h declares the save root's and the language's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puegame_host.h's hos_zs_content_size, hos_zs_romfs_content_size, hos_zs_write, hos_romfs_case and hos_prompts_font_entry, which the size table's fit needs: host_sys::files::{zs_content_size, zs_write}, host_sys::romfs::{zs_content_size, case} and host_sys::prompts::font_entry, each with its stand-in host's answer. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueGameMemory::copy_out read the guest window directly: on Windows a read of a heap page the game had not touched, or had given back, faulted and committed it. It is refused, as the C's memory.read refused it ("unmapped"). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puehost_sys::net binds game_host.h's hos_net_* (available, grant, open, send, close, poll -> Poll::{Event, None, Gone}), its fake an in-memory engine a test scripts (fake::net); the stand-in that answered every open "no engine" goes. host_sys::run binds hos_switch_set, hos_quit and hos_thread_background. has("net") and has("ipc") ask the engine for their own kind. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueaudio_mix as audio_mix.c: a sound loaded { stream: true } keeps its Ogg file's bytes, each voice of it gets a decoder of its own (the new AudioStreams and StreamDecoder traits) and a ring of 1.5 s, which the decoding thread opens and tops up 4096 frames at a time with no lock held, rewinding a looping one; the mixer reads the ring by the frame's number, silent and counted on an underrun. Limits: a streamed file 32 MB, 8 streamed voices a mod, 64 in all. The mixer's stand-ins go: each voice is resampled once from its sound's rate by its pitch, its gains ramped across the audio frame (a change, a placed voice's gain, a stop's fade), through its biquad low pass and into its mod's audio_dsp.h reverb, which rings out its tail with the mixer's gate open. Nothing is allocated or freed on the mixer thread. The game's groups move as audio_groups.c's. On the way: a file that cannot be read makes a failed sound, as the guide says, instead of an ArgumentError; voice.moveTo places a voice of play() from then on; setEffects past the mods' 8 reverbs is a LimitError; a call of more than 1024 frames is mixed whole (the C cut it short). longshot-game gives no decoder yet (the next commit). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue{"cmd":"mod_reload","mod":id} answers {} once Watch::request queued the reload (made at the next frame's end), or refused: no such mod, no folder script mod (a package, a system mod), or 32 waiting. The watch is taken from the loader at the bridge's first frame. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueSettlements queue Settled::{Whole, Part}: Settlements::part (and Promise::part) take an answer in parts from any thread, pending_bytes counts the parts not yet handed to the mods, and set_hooks tells a reader of a promise let go (its mod stopped) and of a settle that took answers. The engine parses each part in the mod's runtime and defines its members on the promise's array (one settlement of the frame's 64 each); the last resolves it, a rejection drops the parts, and a part that does not fit in the mod's heap rejects it with LimitError. content.read's reader thread sends what ContentReader::read_parts makes through a PartSink that waits while more than 8 MiB wait to be handed and stops a read whose promise was let go. longshot-game's reader sends a map's placements in parts of about 64 KiB (the C did; the whole answer was past what a value holds for a large map). Unit tests: the queue's bytes and hooks, the parts in order, a rejection after parts, and dev.keep's held object read back. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueQuickJS-ng 0.18 loads and resolves a module's imports while it compiles it, so realmModule's compile asked for every import before link() had given a linker, and any module with an import failed ("this context links only in link()"). realmModule now checks the syntax with oxc (Node's constructor throws a SyntaxError at once) and keeps the source; link() compiles it with the linker set, and a module it imports is compiled as it is loaded. The unused Context::resolve_module goes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe sandbox lets the game write only its own folders and the control socket's (host/sandbox_plan.h control_dir, which says shots go there), but the client asked for shots in the run's shots/ folder or wherever the caller named: with the sandbox on, as by default, every shot failed ("the PNG could not be written"). The client library asks the game to write a shot into the socket's folder under a name of its own, then moves it to the asked path itself, reading it through no link (the game can write that folder) and at most 256 MB. Game-free tests: the fake game refuses a path outside its socket's folder, as the sandbox does, and a session's shot still lands; a link left in the stage is not followed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueA player's fallback build of the game's Rust reads the tree the builder copies (build-driver's TREE), which has no assets/modding/docs; api's build.rs loads the schema, and the load refuses a module whose guide page is missing, so the fallback build stops ("guide assets/modding/docs/ui.md is missing"). This loads a small schema with a shipped JavaScript module and no docs folder; it fails now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe old recorder wrote the renderer's answers for HOS_OPT_* 32, 33, 35, 36 and 55: 36 Link's speed in percent (100 to 300), 32 and 33 -1 while untouched or the tools off. The port hands them to menu::set as row values, so every recording's first line ({"cmd":"option","id":36,"v":100}) becomes choice 100, clamped to 3x, and -1 turns heart protection and flight on; a replay also wrote the player's settings and needed the replaying run's Debug tools. This checks the five at the first frame and changes after, with the tools off, and that a recording takes the same values back; it fails now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puecurl_common pinned the checked address with CURLOPT_RESOLVE only when its list entry could be made: out of memory, the pin was skipped and libcurl looked the host up itself, past the private-address rule. curl_common now says when it could not pin the address, and the fetch or WebSocket fails ("out of memory") instead of connecting. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueTexture packs (gfx.textures) were gone from the Rust tree: no game side read a pack, the renderer had no override, and has("gfx.textures") was false. api::textures::start runs in game_init after the layers are published: each mod that loads and lists gfx.textures (Loader::texture_packs, a minimal hook beside romfs_root) has its recipe.json read and its textures/ named from the texture index (made once from the RomFS's .bntx.zs headers through the host's new zs stream binding), a later pack winning; each replaced texture's numbers come from the file the game is served, kept in modcache/texture_hashes.txt. An upscale recipe's job is written on an lsmod-upscale thread (the pictures decoded by the renderer's mkwvk_texture_decode, given the game as hos_texture_decode), and a done job's images serve the mod under its own. longshot-game exports game_texture_replacement*, which MkwVkHost version 54 hands the renderer. The renderer's half is the C era's: gpu/vk/texture_pack.h's two-stage lookup at a first whole upload, the override image used by sampled views of the whole texture, dropped when the GPU writes the texture or its storage changes, the resolved views and reused descriptor sets stale by texture_pack_generation; texture_decode.cpp decodes block-linear plain, BC1-BC5, BC7 and ASTC level 0. has("gfx.textures") is true. Game-free tests: api::textures's (ported from tests/test_texture_packs_host.py), tests/test_texture_pack.py and tests/test_texture_decode.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe stage's writer refused bwav: outputs ("the BWAV writer is not ported") and made bntx: from a PNG alone. It now makes each recipe with the content crate's makers: bntx: with recipe::make_bntx (PNG or KTX2), bwav: by decoding the mod's WAV or Ogg Vorbis (the audio service's decode, given the stage's Ogg decoder), reading the game's stream it replaces for its channels and loop, and writing the BWAV with bwav::from_sound. A game-free test makes a mod's mono WAV a stereo, looping stream served in the game's place. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueAfter a kept callback returned, its result was converted (its toJSON run, its getters read) with the deadline the call put back, none: the mod's code in toJSON ran with nothing to stop it but the stray-poll guard, and nothing said why. A callback returning `{ toJSON() { for (;;) {} } }` was cut only by that guard, silently. Both conversions (bind's callback_call and the engine's Runtime::call) now run under DESCRIBE_NS, as a filter's draft is read back and an export's answer is; a conversion the interrupt cut is the mod's OverBudget fault. The test needs the stand-in host's clock to move while the script runs (it stands still between a test's moves, so no deadline could pass): host_sys::fake::set_tick makes each read of it move it on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueA text a mod sets (content.texts, its patches) was refused only for a NUL. U+000E and U+000F went into the message file as they were, and the game's MSBT reader takes them as a tag's header: it reads a group, a type and a size from the text after, and reads past the text's end. The C0 controls but tab, line feed and carriage return are now refused (text.control), naming the character; a tag is written {...}, which the game's files decode to. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puecamera.override(rig) took only { fov }; the spec's rig (an eye attached to Link, a look by input, pitch limits, a blend) was never built, and first person (10.5) needs it. A rig is now data oot::camera's view hook works out each time the game builds its view, so a view on Link has no frame of delay: attach "player" puts the eye at Link's feet plus an offset turned by his facing (his actor's position and rotation, bounded reads), look "input" or "fixed" looks along a yaw and pitch (the right stick turns an input rig at the acquire phase, 120 and 90 degrees a second, held to pitchMin and pitchMax), look "target" at setTarget's point, and blendSeconds eases in from the game's view. The handle gets setOffset, setAngles and angles(); a setter that does not fit the rig is a ContextError. bone, near, collide and drivePlayerFacing need what the game side cannot reach without new sites or layouts (game/README.md's Stand-ins says which). Tests: the rig on Link (his feet, facing, absent), its look by angles or point, the blend; the API's defaults, refusals and the stick's turn within the limits. The fake game draws a rig on game.player. Docs: camera.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puelongshotCheckout and trustedCheckout told a checkout by its scripts/dev.py and host/modapi/. The mod API moved to game/modapi/ with the game side's port to Rust, and host/modapi/ is gone, so no folder was a checkout any more: `longshot-mod test --game` on a mod inside the checkout (or with LONGSHOT_CHECKOUT set) no longer went through the checkout's dev.py, and longshotCheckout(HERE) returned null. The mod tools' tests 67 ("the game in its test mode, or dev.py game-tests inside a checkout") failed on its assert that the checkout is found, and 68 (audit N12) on path.join(null) when it set LONGSHOT_CHECKOUT to that checkout. The marker is now game/modapi/. Test 68's stranger repository makes an empty game/modapi/ in place of host/modapi/, so it still looks like a checkout and the audit N12 case (a dev.py found by walking up is never run) is still the one tested. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe game's test runner (game/modapi/testing/runner.js, copied for the fake game into lib/testing-runtime.js) lists in FAKE_ONLY the FakeGame members a test may use only in the fake game, so that the real game refuses them with FakeOnlyError. It still listed "native", the fake game's stand-in for native C mods, which was removed with them (feat(mods)!: native C mods removed): FakeGame has no native member. The mod tools' test 63 ("the fake game's helpers the real game refuses are the fake game's own") failed on it: "native is in the runner's FAKE_ONLY but not a FakeGame member". The list was wrong, not the test. "native" is out of FAKE_ONLY in runner.js, and lib/testing-runtime.js is written again from it by cargo run -p schema-gen. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueNothing ran assets/modding/packages/mod-tools/test/*.test.mjs: not tests/run_all.py, not a mise task, not the Forgejo or CircleCI workflows. The C era's tests/test_mod_tools.py did, and the test files still say it runs them, but it did not come over to this tree. So they broke unseen when the system mods moved to game/mods/, the mod API to game/modapi/ and the native C mods went (four of 92 failing). tests/test_mod_tools.py runs them with node --experimental-vm-modules --test and fails when node fails, any test fails or is cancelled, none passed, or the Node is older than 22 (the package's engines). Node is PATH's (or --node); with none it prints "SKIP: node not installed" and exits 0, the tests/ convention for a skip found at run time. It declares no {tool} placeholder on purpose: run_all.py's --strict fails any check whose declared tool is missing, and no CI image has Node yet. Its docstring says CI should install the Node release pinned in the file (NODE_VERSION v24.22.3 and its NODE_SHA256, release.yml's) once CI's migration is done. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe built-in registries (keybinds, hud, markers, commands) were lists mods shared with nothing in the game reading them: no keybind conflicts, no command palette, no marker layer, no way to move or hide a mod's HUD. services/shared.rs is the engine's side of them: - keybinds: every running mod's keybind settings (and its debug page's key), with the "keybinds" entries for keys bound another way, as one list; two that share a key (any case) or a chord (its buttons as a set, a setting's Switch labels read as PadButton's names) clash. - commands: { id, label, help?, args? } entries, each argument a toggle, a choice, a number or text with a default. Services::command_run checks the player's arguments against the entry as the mod gave it now and delivers "command" to its mod at the next together step; longshot/mods' command(entry, run) adds the entry and hears it. - hud: each mod's HUD roots by key (a <Hud id>, which Hud now takes with a title, else "#n" by mount order), labelled by the mod's "hud" entries; the player's place (another region, or hidden) is kept in the mod's store ($hudLayout, a host setting never on its page) and applied as the UI's snapshot is built. - markers: { x, y?, z, map?, label?, color? } entries of running mods on this map, as world-layer shapes (a ring, a line up, the label), published with the mods' own shapes by gfx.rs; made again only when the entries or the map change. The Mods tab's snapshot carries the view (TabSnapshot::shared), and its edits run a command (Edit::Command) and move a HUD root (Edit::Hud). A malformed entry stays in the registry and is left out of what the game resolves, counted. Tests: chords, clashes, the strict reading of commands and markers, the HUD layout's text; a command run reaches its mod once with its arguments; the keybinds list and its clashes across two mods; the marker layer by map; a HUD root moved and hidden in the snapshot and kept in the store. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueIcon was the built-in vector set alone, so a tracker could not show the game's item pictures (the Ship of Harkinian item tracker's case). Icon takes `item`, an item's name ("Item_Bomb", a mod's new item's too). The mod's image set reads it as a source of its own beside the mod's PNGs: on the images' thread, the host's ItemIcons (longshot-game's textures.rs) reads the file the game is served for UI/Tex/Icon/<item>.bntx.zs, takes its first plain 2D texture and has the renderer's decoder make level 0 RGBA8. The pixels go to the UI snapshot alone (the renderer draws them in the Icon's square, tinted only when the Icon gives a colour); no script sees them and nothing is kept or written. An item with no icon, or one the decoder does not take, is drawn as an empty place, said once in the log. The image set's sources are now a file, an item's icon, or a thumbnail's src (`capture:<n>`, for longshot/capture next, which fails until then), all under its caps (64 images, 16 MiB). The types and the fake game take `item`, and the Hud's `id` and `title` that the HUD layout page goes by. Tests: an item's icon through a reader of made-up icons, one it has not, the name's check, and an Icon's image in the snapshot. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe enemy editor's thumbnails (spec 18) had no way in: longshot/capture was named in spec 9's table and not built. capture.toml: thumbnail({ rect?, size? }) gives a Thumbnail handle (src(), state(), failure(), save(name), release()); load(name), saved() and remove(name) give back the ones a mod kept. Permission ui.window. A handle has no read: its src (capture:<n>) is what an <Image> (or a Canvas's image command) shows, and only the mod's own src resolves. The game side (services/capture.rs) lists each ask in the mods' UI snapshot, version 11 (MkwVkUiSnapshot.captures: an id, the part of the picture as fractions, the size 16 to 256 a side) until the renderer answers. The renderer (vk_modui.cpp thumbs_tick, vk_replay.cpp thumb_ask) copies the part at the present's point the control bridge's shots are taken from (the scene, no overlay, no menu, no mod UI), blitted into a 256 x 256 image of its own, reads it back once the GPU is past it and posts MKWVK_UI_EVENT_CAPTURED with the RGBA8 rows (MKWVK_UI_VALUE_PIXELS), or none when it could not. longshot-game's game_ui_post keeps such an answer apart from the mods' events (8 at most) and the next frame's start takes it (capture_frame); an ask unanswered for 4 s fails. The pixels stay with the service and the mod's image set (counted in its caps). save() writes a PNG under <user>/modstore/captures/<mod>/, which no mod's file API reads. MkwVkHost is unchanged; rx_backend.c's and ui.rs's layout checks hold the snapshot's new size. Caps: 16 thumbnails a mod, 4 pending; 64 saved. has("capture") is the host's. The fake game takes a thumbnail at the frame after it was asked (or fails it, game.captureFails) and keeps saved ones in game.thumbnailsSaved. Tests: the ask's checks; a thumbnail asked in the snapshot, answered through the sink, shown, released; one unanswered failing and the pending cap; one saved to the game's folder and loaded again; the C block's captures and the answer's checks; the image set's thumbnail source. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue`camera.override({ near })` sets the gameplay projection's near plane, 0.01 to 10 metres, so a view inside Link's head does not draw the inside of his face. It is written at `camera.lens`, where x20 is the camera's sead::PerspectiveProjection (the site's next instruction stores the angle at its +0xa0): the near plane at +0x98 and the dirty byte at +0x8, which agree with the ratio at +0xb0 and the dirty store `wide.cameraRatio` already read. The game's own near plane is kept and put back at the first update with none; a projection other than the one written is never written back (its camera may be gone). `has("camera.override.near")` follows `camera.lens` being placed; a rig giving `near` on a build without it is a NotAvailableError, in the game and in the fake game. Read from the code, not yet seen in a run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue`camera.override({ drivePlayerFacing: true })` turns the game's own player camera with the mod's view, so the left stick walks Link where the view looks and the game's camera is behind him when the override ends. At `camera.update`, the player camera's update's entry, the core's callback now sets the camera's yaw (+0x1a4, the field host/mouse_native.c turns, in oot::layout::camera) in place of the mouse look for that update: one of the two turns it, never both. The mouse look starts again from the camera's own angles after an update it missed, instead of putting back where the mouse had left them. The view's yaw less the player camera's is not assumed: the view site compares the game's own view with the yaw the camera had at its update and takes the nearest multiple of 90 degrees (within 20), so the rig drives the yaw once the game has built one view of its own. Only while the camera is the view (its state 3 or 4, its angles a camera's). `has("camera.override.drivePlayerFacing")` follows `camera.update` and `camera.view` being placed; a NotAvailableError otherwise, in the game and in the fake game. Read from the code, not yet seen in a run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue`camera.override({ collide: true })` keeps the eye out of the walls between it and its pivot (Link at the offset's height on a rig on Link, the target on a "target" rig in the world; another rig is an ArgumentError), 0.2 m in front of what a ray from the pivot hits and at least 0.1 m from it. The ray cannot be cast at the view site: the game's query takes the physics world's lock, which the step holds while it waits on job batches (oot::rays). So the camera service asks one ray a frame through oot::rays, from the pivot to the eye as the rig puts it and a clearance beyond, takes its answer the next frame as the rig's reach, and the view site pulls the eye in along the line to the pivot within it. A wall is felt a frame or two after the eye reaches it. A ray not cast in 4 frames is asked again; releasing the override cancels it. `has("camera.override.collide")` is false while `world.ray` is (Preview: no run has shown the game's rays), like it through the same casts; the fake game has it once a test gives a world to cast against (allowRay), and casts at once. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4puegfx.model(path) reads a mod's .glb/.gltf on a reader thread of its own (api::services::models, over content::assets::gltf; files beside it in the mod's folder only, never through a link) and settles with a Model handle once it is held; a mod's models hold at most 64 MB once read (charged while a handle, a shape or a published list holds them) and 4 read at once. gfx.world.model(model, at, options?) draws it as a WorldShape: yaw, pitch, roll, scale, a tint, occlusion and distances; setRotation and setScale; follow(actor) moves and turns it with the actor. A mod's model shapes draw at most 200,000 triangles. has("gfx.model") and has("gfx.world.model") follow Drawn.models. The game side publishes the models as their own list with the shapes (game_world_models, GameWorldModel and GameModelMesh in game.h; MkwVkHost version 56). The renderer copies and checks each mesh once by its id (gpu/vk/world_models.h: every index, part and texture in range, a bad mesh never drawn), uploads it once into a buffer and images, and draws the models before the shapes in a pass of their own (draw_models; shaders/model.vert, model.frag): vertices pulled by the index buffer, a depth image of the picture's size so the parts hide each other, opaque and masked parts then blended ones, both sides lit by one light from above, each fragment tested against the scene's depth as the shapes are. The mod tools' fake game checks a model's path and that it is glTF 2.0. Not done: skinning and animation, the other PBR inputs, JPEG textures, bone attachment, the scene's sun direction (one fixed light), sorting blended parts. Not run in the game yet: the checks a run must make are in assets/modding/docs/world.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue`camera.follow(view, actor)`, also `view.follow(actor)`, puts the override's eye on any actor in Link's place: its feet plus the rig's offset, turned with its facing, worked out where the game builds its view, as `attach: "player"` is on Link. An Actor is a handle, which an options record cannot hold, so it is a method of the override (the camera namespace's, as `actors.attach` is the actors'), with its own feature `camera.follow`. The view site reads the actor at the address the main thread published, checked as a game actor each time; the main thread marks it gone once the actors' list drops it, and the game's view is drawn from then on. It returns false for an actor the list does not have now. A view on a bone goes through it: attach a hidden actor to the bone with `actors.attach` and follow that actor (assets/modding/docs/camera.md has the recipe, for Link's "Head"). A rig's own bone, read at a site after the skeleton's update with no frame of delay, stays a later improvement, and hiding a part of Link's model a leftover; game/README.md records both. `has("camera.follow")` follows the actors' list and the game's state; the fake game follows its listed actors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe loader reads mods only from LONGSHOT_PROFILE: its profile.json is the one list ("on"), its trust.json the one trust file, its mods/ the manual mods ({id, path: "mods/<name>", on}). A source mod ({id, version, hash, on}) is read through loader::source's ModStore/ModFiles, which the modtool's mod-store implements later; this build has NoStore, so one is logged as not readable yet and its entry kept. LONGSHOT_DEV_MODS (mod run, and now the test mode's tested mods) adds development mods, never written into the list. No profile: the system mods alone. Gone: HOS_MODS, HOS_MODS_LIST, HOS_MOD_TESTS_ONLY, HOS_MOD_TESTS_PLAYER_LIST (GONE rows), mods.json and its "enabled", <stem>-trust.json and the game folder's user/ trust rule, the carry of mods.json into the user folder, modcache/mods_json.txt, longshot-game's profile.rs and profile_mods::expand. The sandboxes (Linux, Windows) and the broker take the list, trust file, mods/ and the development mods from the same variables. Hot reload follows the profile: <profile>/mods/ and profile.json by notices, LONGSHOT_DEV_MODS folders walked (scripts, served files, shape). A profile.json change applies its switches while the game runs (the Mods tab's own write changes nothing, so it logs nothing); a code change re-checks the mods' code against the build (Restart to apply). The builder channel's profile_changed is not read: the game side has no event reader. Also: the Mods tab's Has row lists what a mod has (script, hook sites, ExeFS patches, code modules, RomFS files, patches/, textures, content module), the code warning names what the mod brings and drops Rebuild for mods, and a confined game with no builder channel sends the player to the launcher or Longshot.exe mod to accept code (a trust_request hook is left for the channel's request_trust). mod-tools' mod run plays <game>/dev as a profile. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueSetting a BINDING to an input another control uses no longer takes it silently. renderer_setting_text(key, value | MKWVK_BIND_ASK) is the question ("F7 is used by Jump.", translated; "" when no other control uses it); a set of such an input returns -3 and changes nothing, and value | MKWVK_BIND_SWAP is the player's Swap: each control that used the input gets the slot's old input in its place. The host's rebind_control learns three flags for it: HOS_REBIND_PROBE (report the conflicts only), HOS_REBIND_SWAP and HOS_REBIND_ONE_KEY (a key binds that slot alone, where the Controls grid's one key cell clears the second). The Settings mod asks the question as a dialog, Swap chosen first, Cancel beside it (sysmod-settings' a_binding_asks_before_it_takes_another_controls_input); tests/test_settings_decls.py checks the flags are the same bits on both sides and that binding_take takes an input in use only with Swap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueprofile.rs: profile.json's "mods" (each {id, on} with a source's version and content hash, or a manual mod's path in the profile's mods/; every other key kept as written, in its place), read strictly and written whole (profile.json.new moved over); add, move and remove a pin, a new order with switches; trust.json beside it in the loader's trust format, written in place through api::loader::trust; a mod's files (a manual one's folder or .lsmod, a source one's from the store: a hook for the store crate), its manifest, content hash and code hash; every known profile's source pins for the store's clean-up. The edit lock is one function, a minimal stand-in of #2286's launcher_profile::edit_lock until that crate is here. Co-Authored-By: Claude Opus 5.5 <[email protected]>mod check [folder] [--types]: the mod as the game would take it, without running it. The manifest by api's reader; lib/lint.js's rules ported (lint.rs): permissions the source uses against those declared, read with the game compiler's parser (scan.rs: oxc's module record and tokens, so a comment or a string is never code), API modules, mod: imports against dependencies, JSON imports and literal longshot/files paths by the files service's own path rule, net origins, the game's own formats outside romfs/, mod data's output anywhere in the folder, budget hints. Every shipped module compiled by script::ts (JavaScript parsed), and linked from the entry and the content module as script::modules resolves imports; PNGs and glTF models by content's readers; sites.toml by the builder's sites::modsites. --types writes the API types and runs TypeScript 7's tsgo when installed (exit 77 when not). Findings are lines, and {file, line?, col?, severity, code, text} in --output json's result, which a failure now keeps too. mod types: types/longshot.d.ts (schema-gen's, built in) and types/longshot-env.d.ts (the mod's required features and settings). mod init: mod.json and src/main.ts from the template, tsconfig.json for tsgo, .gitignore, README, the types; no Node or npm. api::services::files::path_ok and script::modules::content_module are pub for the check; oxc_syntax is a workspace dependency (the module record's import names). Co-Authored-By: Claude Opus 5.5 <[email protected]>saveGame, loadSlot, reload, deleteSlot and copySlot: the world keeps each slot's flags as the game's save does (a load puts them back, the Bool64 container with them); the items' and longshot/game's watches hear the save request and the save.load site, and the mods' stores hear the notes the game's file system sends (held until the mod has started, as the game starts its mods before the player loads). seedStorage writes a store's file on the fake disk; storedData(scope, slot) reads a slot's file. game.fresh({ strict }) starts the game again for the same mod, its disk kept: save-tally and misbehaving use it in place of a second FakeGame. check-gift checks a place again through a load of a save from before its check; its save and load are a frame apart. echo-client's long line comes from the server: the broker stops the socket (1009). Co-Authored-By: Claude Opus 5.5 <[email protected]>A mod's system/ dependencies run beside it, as the game runs the ones its build ships (from system_mods/ beside the game, else this checkout's game/mods): started first with every permission they list, linked while switched off (game.systemMod(name, { off: true })) so an optional import of one still resolves, their settings and logs reached through game.systemMod(name). game.discord() is a fake Discord app at an IPC endpoint, played in Rust over the network engine (the broker's "nothing listens there" when none): it answers the handshake with READY, each command, each ping, and keeps what it was sent. discord-status uses it in place of system/discord's fake-discord.js, its frames a tenth of a second (a whole second each way is longer than system/discord's handshake wait). turnOff() stops the mod as the Mods tab does; longshot/time's gameStarted() is the fake game's fixed 1700000000. copySlot's comment cites the launcher's slot copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>The game's Bool setter (flags.setBool) is a fake function that queues the value, made at the frame's end as the game makes it at its next update; the fake game holds every container (Enum and UInt too), setFlag takes { kind }, and a switch reads 0 or 1 as flags.get gives it. game.writes is the writes service's own trace of the mod's attempts. A test's setters refuse a non-finite number before it becomes JSON. A restart reaps the old session's mod at once, so its stop is not the new one's. misbehaving expects the real wording of the Timeout, has() and flags.has() faults. Co-Authored-By: Claude Opus 5.5 <[email protected]>A profile entry {"id", "version", "hash"} is read from the builder's mod store (HOS_MOD_STORE, set by the builder's play) at a folder in no disk: api::store_disk::StoreDisk lays each pin's record over the files the game reads (Store::check_pin, RecordFiles), and the RomFS layers serve the blobs themselves (Disk::host_path). A pin the store lacks whole is said and left out. The sandbox reads the store's blobs/ and versions/ (Landlock, the AppContainer). The loader takes a list sink, so with a channel the profile is the builder's to write. Co-Authored-By: Claude Opus 5.5 <[email protected]>host/control.c passes mods and mod_* requests to game_control_mods (a new mods hook of HosControlGame) and replies with its answer's fields, or its {code, why} refusal as the bridge's error. The game had the commands (longshot-game::control_mods) but nothing routed them. The protocol's mods section documents them. Co-Authored-By: Claude Opus 5.5 <[email protected]>game/mods/fov/mod.json, in the player's format, declares the mod (its id, version, description, hooks.unsafe, the camera.lens site it handles) and its Field of view setting with its place on the Gameplay tab; the crate reads it at compile time ("rust": "sysmod-fov") in place of the Manifest it built in code, and a test checks that it parses and that its setting's key is the code's. camera.lens stays the core's site: its core callback serves the mods' cameras too (oot::sysmods::fov keeps the shared lens). test_oot_fov.py reads the manifest; test_menu_i18n.py takes a built-in Rust mod's texts from its mod.json. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe Insert menu's settings (the renderer's declarations, rows, texts, set/press/text and bindings) and the Mods tab's data and edits (the list with each mod's page, cheats, keybinds, commands, HUD roots, the permission prompt; setMods, edit, restartToApply) as two schema modules behind the system-only permissions settings.host and mods.host, so the menu can be drawn by TypeScript system mods while Rust keeps the data. state() is { channel, why, ops }; errors SettingsHostError and ModsHostError { code, text }; events only to holders; every API Promise now carries its call number. longshot-game gives the tab's host part (mods_host.rs). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe renderer answers @fx:<mod id> with a mod's screen effects as it runs them (point, the mod's and the player's switches, state, GPU time, why), read-only but for the player's switch; longshot/mods-host gives them as each page's effects and sets the switch with edit("effect"). The TS Mods tab lists them as toggles, and shows a mod's own settings page in place with ModPage. Read-only on gfx: vk_effects' fx_effects_of and fx_player_set only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYlongshot/gfx's gfx.outputEffect (extension 1 of the built-in mods' audit): a mod's effect of 1 to 8 fragment passes at present, after the game's HUD, frame generation's made frames and the window's scaling, before Longshot's overlays. Each pass draws an image of a size and format the mod chooses ({ scale } or { lines, maxScale }, rgba16f or rgba8; the last draws the output) and samples up to four inputs (the pass before's, the picture, an earlier pass's), nearest or linear, clamped or black outside. The renderer fills the params named SourceSize, OutputSize, FinalViewportSize (libretro's names), hdr, paperWhite and peakNits. On the SDR picture the passes see it as the display shows it; with hdr: true, while the game presents HDR, linear nits (Rec. 2020): the HDR pass grades into an RGBA16F image first (hdr_encode.comp's HDR_NITS), the effects run over it, and hdr_pq.comp encodes their image. An effect without hdr runs before the expansion, and is bypassed (unsupported, saying so) while the game presents its own HDR. The template's check (fx_spirv.h, api::spirv) takes up to four samplers and reports them (inputs); gfx.effect's keep the picture alone. Built-in mods reach the same code through ModApi::gfx over the shaders they carry. The fake game lists an output effect's passes, images, inputs and fills, and EffectInfo.reason says why one is not drawn here. game.h's GamePass carries an output effect's passes (GAME_PASS_OUTPUT_FX at GAME_PASS_PRESENT, GameOutStep): MKWVK_API_VERSION 58. The modding API's version stays 0.1 (bumped when the release is cut: api-schema.md). Example: assets/modding/examples/scanlines. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueExtension 2 of the built-in mods' audit: each present tells the output effects whether the game drew its 3D world (vk_draw.cpp's world_drawn_at in the last 3 presents, the fact the ultrawide menu sides use, kept in wide_sides_tick's world_now for frame generation's display thread too). A pass reads it as the param worldDrawn the renderer fills (1 or 0), and an effect's when ("always", "world", "noWorld") draws it only in frames with or without the world: in the others it costs nothing and is waiting. GamePass.when and GAME_FILL_WORLD_DRAWN: MKWVK_API_VERSION 59. The fake game lists each output effect's when. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueExtension 3 of the built-in mods' audit: gfx.renderer() answers { tier, hdr, nativeHdr, menuOpen }: the memory and quality tier the Quality preset or Auto picked (1 to 5, null before it is known), whether the renderer presents HDR10, whether that is the game's own HDR picture (Native HDR, where an output effect without hdr is bypassed), and whether the Insert menu is open. The renderer answers one new option, HOS_OPT_RENDER_STATE (its bits), beside HOS_OPT_MEMORY_TIER, read through the post sink when a mod asks; built-in mods reach it through ModApi::gfx. The fake game's game.gfx.setRenderer sets what it answers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueThe CRT system mod draws the filter itself through the public longshot/gfx (ModApi::gfx, the code a script mod's gfx.outputEffect reaches): game/mods/crt/effects/downsample.glsl into a raster of the mod's size ({ lines: 240/480/720, maxScale: 0.5 }, RGBA8), then lottes.glsl, hyllian.glsl or zfast.glsl at the output's size, sampled nearest (zfast linear) with a black edge. The four are the renderer's compute adapters ported to fragment passes with the same math (the pixel centre is gl_FragCoord, SourceSize and OutputSize the renderer's params, style a float param; the box's loops counted, 32 texels each way, the same sums in the same order), compiled beside them by Longshot.exe mod shaders and carried in the mod's code. The effect takes the SDR picture only, so the renderer runs it before an HDR expansion and bypasses it on Native HDR as before; the mod reads gfx.renderer() each frame and sets the filter row's hints to the "Bypassed: ... Native HDR" line (ModSettings::set_hints, a native choice row's hints changed at run time). crt_filter and crt_lines keep their keys. It stays a Rust mod: a script mod's settings have no options-file line or Insert-menu place. Gone from the renderer: crt_policy.h, the four crt_*.comp and their headers, vk_framegen.cpp's CRT pass, the CRT decoding and hint in menu/game_rows.cpp, GAME_PASS_CRT and PostKind::Crt, scripts/shaders.py's crt set. tests/test_crt_policy.py checks the output effects' lines size is the old raster for every output size, test_crt_shaders.py the fragment ports against the pinned upstream math and their .spv's sources, test_upscale_independent.py the scaler's routing into the output effects, test_gfx_effects.py the renderer's taking of an output effect's passes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pueA release lists its dependencies as its mod.json writes them (a repo's release says so, a single mod's are read from its manifest; checked by the manifest's own reader), and details gives them for each release. install plans first: the release asked for, then every required dependency (and theirs) the profile does not have at a version it takes, each the newest release its source lists that it takes; the plan installs what is needed before what needs it, and a dependency no source can give stops the install before anything is fetched. --plan (the op's "plan": true) only answers {plan: [{id, version, sha256, source, needed_by}], missing: [{id, needs, range, why}]}. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYmod pin <id> <version> installs the mod at that release when the profile has another, then pins it there ("pinned": true in its profile.json entry); updates, check_updates and installed's update offer then leave it, and an update named for it is refused saying so. mod unpin <id> lets it move again. installed gives "pinned": the version it is pinned at, or null. Neither op is the game's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYtags (the op and mod tags [--source URL]) counts, over every mod the sources offer (each once, as search has it), its tags and its categories, folded to lower case: {tags: [{name, mods}], categories: [{name, mods}]}, by name. The game may ask it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYmod add replaced a mod of the profile with the same id without a word and kept what the player had granted it. Now a replace is refused without --replace (the op's "replace": true), and one whose files are not the same (another content hash) drops the mod's grants: its profile.json entry's granted and its trust.json acceptance and unsafe grants, so the player is asked again. --plan ("plan": true) only answers what it would add: {id, version, sha256, replaces, same_content, code, permissions}. The answer says {id, version, sha256, replaced, grants_dropped, code, restart}. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe launcher's ModsEmulators.Scan, in the builder: Eden and its forks (one emulator where they share a data folder), yuzu, suyu, sudachi, citron, torzu and Ryujinx, by their data folders on Linux and Windows; each one's mods for this game's title id (yuzu's family: load/ or its qt-config.ini's load_directory, and sdmc's atmosphere contents; Ryujinx: mods/contents and sdcard's), with the emulator's switch (DisabledAddOns, Ryujinx's mods.json; null when not known) and whether it holds code (exefs). Read only, no link followed. Answers {emulators: [{name, data_folder, mod_folders, problem}], mods: [{emulator, name, folder, source, enabled, code}], looked}. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYenable/disable (the ops; mod enable <id>, mod disable <id>) set a mod's "on" in profile.json in place, under the profile's edit lock, the rest of the file as it was. The answer: {id, on, changed, code, restart} (code: a code mod's switch changed, which the next start builds in). Not the game's: its Mods tab has its own switch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYrequest_trust's confirmed (mod allow <id> --yes --sha256 HASH [--permissions a,b]) records trust with no window, exactly as the window's Accept does: the mod's code accepted, the unsafe tier it requires granted, and only permissions its mod.json declares (bad_args for one the schema lacks, refused for one it does not declare). It needs the content hash the player was shown and refuses with content_changed when the files are not it now; the game can never send it (refused). The answer is the op's {accepted}. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYorder (the op; mod order <id> --up|--down|--to N) moves one mod in profile.json, in place under the profile's edit lock, every other key kept. System mods stay first and in their place (system_mod for one; nothing moves before them); a mod that is not there is not_found; one of up, down, to (bad_args otherwise). The answer: {id, from, to, order} (places from 1, order the ids as they now are). Not the game's: its Mods tab moves them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYremove of a path (mods/<name>, a full path in the profile's mods/, or a bare name) that is not an installed id deletes that folder or file, by the rules of a mod of one's own: only a name directly in mods/, no link followed, read-only bits cleared. One that profile.json names is refused (remove it by its id); one that is not there is not_found. The answer: {id: null, path, profiles: [], deleted}. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe feature `runtime` (on by default) is the whole API. Without it, api is json, manifest, settings::decl and mods::{Enabled, Manifest}, and its bindings are their permissions' part alone (schema::emit::rust_permissions, $OUT_DIR/permissions.rs), with serde_json and thiserror as its only dependencies. A build script can then check a built-in mod's mod.json with the game's own reader (api::manifest::native) without compiling the game's crates for the build: longshot-game's registry of native mods, next. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYA pure move, nothing in the files changed: assets/modding/docs/ is docs/modding/, assets/modding/examples/ is docs/modding/examples/, and assets/modding/templates/new-mod/ is docs/modding/template/ (beside the examples, not among them: every examples walker would take its {{id}} placeholders for a mod). None of them is shipped by a build, so assets/ keeps only what one does. The paths that point at them follow in the next commits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe hosted page's help box had an empty title ("", not none) and the focused control's help alone: a row with no help text drew an empty box, and no row was named in it as the menu's own rows are. The box's title is now the focused control's name (its label, its title, or a Button's words: modui_settings_title), then its help and the hint; with none of them, as on a tab's strip, the box is not drawn. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe renderer's layout took the room of a row too wide back from every child without a width of its own, in proportion: a Slider, which takes the whole room it is given, and the Tune Button beside it both shrank, and the Button showed "T...". The menu's fixed width={96} did not help: 96 virtual px is less than the word and the Button's padding. The inputs that fill their room (Toggle, Choice, Slider, TextInput, Keybind) now give it up first, down to kInputMinW, and only then does the rest give up its share. The menu's Tune and Done lose their fixed width. tests/test_modui_row.py lays out that line with the real layout (gpu/vk/modui_layout.cpp) at the menu column's widths; it fails before this change. The fake game's tests passed because the fake game lays nothing out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYl4mf-1: modtool's menu test ("closed, the menu reads nothing a frame") failed on the declarations' read started at the menu's start; the read is the menu's first opening's again, and costs that opening 1.2 ms now (3.0 before), its answer written off the script's thread. And the stateChanged condition wrapped as cargo fmt wants it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYA setting's "native" object is gone: its fields are the setting's own and any mod's, read by the one reader (manifest::setting::read): store ("options": kept in longshot_options.ini under its id, which may hold a -; "run": for the run alone; in place of scope), place (its row in the Insert menu), presetExempt, shownIf (one of the mod's own settings, or <mod id>:<id>), hints (a line an option) and defaultText. A built-in Rust mod's settings are made SettingDecls from the same SettingSpecs (settings::decl::decl_of); a script mod's are declared into the settings service at its start and leave at its stop, so they are kept where their store says and their rows with a place join the menu's, told to the mod by settings.changed. A mod whose options key another mod's setting holds, or (a player's mod) one of the renderer's own rows, does not start (Settings::refused). What only a system mod may have: a "button", and legacyOption and legacyId until input movies name settings by key (the clean break removes both). New: settings.setHints(id, hints | null), a choice's hints in place of its declaration's (the CRT filter's "bypassed" lines), and the fake game's menuRow(id), optionsLine(key) and setOptionsLine(key, text) (its longshot_options.ini). The schema, the shared vectors, settings.md, system-mods.md and DESIGN.md say the same; the built-in mods' mod.json files are flattened, their keys unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYFormat 3, read by site-table for every owner: the core's game/sites/sites.toml, each built-in mod's game/mods/<name>/sites.toml and a player's unsafe mod's sites.toml. A row is the site: its definition, what finds it in any build (signature, signature_offset, guards, offset), and an entry for each supported build, builds.<id> = { fn = "f_...", ... }, keyed by the build id's first 8 or more hex digits, holding where it is there and what of the rest differs (an offset, an anchor, a vslot's slot, or the arguments in other registers: the same names and types, checked). Long entries are a [site.builds.<id>] table of the row. The anchor key in becomes within (in is no key now). hot = true marks the sites known to be reached many times a frame (the UI's per-pane sites, anim.loopStep*, actors.update, heap.*, barrier.*): metadata only, to be confirmed by a hit-count run. game/sites/<build>/locations.toml is gone: every site's entry moved into its owner's row (the mods' into their own files), and the named locations are [[location]] tables of the core's file with builds entries too. For each site the builder uses its entry for the build (its signature checked there), else its signature alone (sites::find_unlocated), else: a built-in mod's required site leaves that mod out with why (logged, never a stop), an optional site is not placed, and a required core site makes the build unsupported when no core site names it and stops it when one does. The HOS_SITE_OUTCOME check reads every owner's rows, so a mod left out does not trip it. A player's mod reads the same rows with the mods' rules on top (its entries hold fn, offset, signature, signature_offset, guards and args; old format 1 tables are refused saying so), its list rows carry the build's registers. game-sites' build.rs reads the tables with site-table: the forms, the mods' slots, and PLACED, each supported build's placed sites by its key (the same left-out rule). The lift's key holds every owner's file. The supported build's sites, their order and owners (site_owners.txt) are unchanged, so the lifted output is the same. New repository tests: a supported build's every site placed by its entry, none left out; a mod uses only the core's sites and its own (its mod.json and sources); only game/mods/text names its site. tests/sitecheck.py reads the new rows; the site-event example is converted. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYLongshot.exe mod sites port reads a mod's sites.toml (a player's, or a built-in mod's in game/mods/<name>) with the tables' reader and, for the --to build: says which sites already have an entry; finds each other one by its own signature, else by another build's entry's (the --from build's first, its offset, signature and guards carried into the new entry), else with --from by that build's code grown into a longer signature; and lists the ones it cannot find. --write adds each found one's builds.<id> = { fn = ... } line to its row, before any subtable of it, with a key no other of the row's starts, and reads the file back first. The search is the lift's own (sites::modsites::find_one, now public) rather than a copy. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYA mod's texts in the player's language: its folder's strings/<lang>.json (a language code each, en.json, pt-BR.json; a JSON object of texts by key, nested objects joined with '.'), looked up with t(key, vars?) in the menu's language (renderer_setting_text("menu_language", LANG_CODE): the Menu language row, Auto worked out to the game's), then the language's first part, then English, then the key itself (said once when the mod's en.json lacks it too). '{name}' is filled from vars. lang() and langs() say the language now and the ones strings/ has. No permission; the files are read at a mod's first lookup and again when it starts again. Longshot.exe mod check checks strings/ as the game reads it (a language code's .json, an object of texts); a mod test sets the language with game.menu.setLang(code). settings-host's texts are documented as English, which the menu mod translates. docs/modding/i18n.md; schema-gen outputs. Tests: lookup and fallback, placeholders, the file and code rules, mod check's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe renderer gives every text in English now (vk_menu_i18n.cpp's tr is the text itself; it keeps the Menu language row's list and the game's language), and the menu system mod shows each in the menu's language through longshot/i18n: game/mods/menu/strings/<lang>.json, the 13 languages of gpu/vk/menu_i18n.h moved as they were (each keyed by its English text), and src/tr.ts, which also translates a text made from a printf format ("3 of 9" from "%d of %d", src/formats.ts) through the format's translation, as the C++ lookup did. src/host.ts is settings-host with its texts translated as they are read; the menu's own words (Tune, Done, Cancel, Swap, Loading) are translated too, with new entries for the four the tables lacked. What the renderer draws itself, the FPS counter and the start-up screen, is English now. tests/test_menu_i18n.py reads the strings files (every language of the row has one, every text is the menu's, conversions kept); test_menu_i18n_count and test_share_message_i18n, which compiled the C++ tables, go; test_framegen_by_row reads the strings files. A mod test checks a label and a made text in French. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe TS menu reads every row's state at the start (renderer_setting_state, menu_decl_state). Its hint line is made as std::string(hint(v, -1)), and most hints give nullptr for a value with no line: libstdc++ throws std::logic_error ("basic_string: construction from null is not valid") and the renderer stops the game at start. The check cuts those lines out of menu_decl_state and runs them with the real modules and model over each row's every value, the restart tag on and off. Fails here: the fix follows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYmenu_decl_state made a row's hint line as std::string(hint(v, -1)); most hints give nullptr for a value with no line, so libstdc++ threw std::logic_error ("basic_string: construction from null is not valid") when the TS menu read every row's state at the start, and the renderer stopped the game ("vk: FATAL: std::logic_error came out of renderer_setting_state"). Came with mwurlplr (the restart tag in the declarations). The hint is now taken only when there is one; DeclList::keep takes a nullptr text as "" too, for the declarations' other texts. tests/test_menu_decl_state_hint.py passes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe installed operation (the game's channel, mod serve) answers the same {format: 1, game, mods} document as the command line, so the game's Mods tab and the launcher read one thing; its service tests read it by id. mod resolve --on ID --off ID gives the resolution as if those mods were switched so (the profile's list read through an overlay with those switches, an entry added for a mod it does not name; nothing written), for the launcher's "switch on what it needs", with its tests. modtool reads the stamp rule, the system table and the packages from their one place. tools.md says why settings --set refuses while the game runs: the game's own Mods tab edits them live. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYinstalled gains list {state: profile | none | not-a-list, path, old_lists (the game folder's mods.json or longshot_mods.txt, read by nobody)}, skipped [{path, why}], and per mod in_profile and content {romfs_files, romfs_more, cheats, exefs_patches, modules} for the launcher's kind chips. mod settings gives every setting its text, read-only: a choice's value is its option's index, and --set takes the index, never the label. tools.md says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe C++ menu drew the microphone test's levels in its help box; that drawing went. The Audio tab has a Microphone level line after Test microphone, shown while the test runs: a line declaration with a range (0 to 1000) whose state is its level (after the gain) and the meter's text ("Testing: 12% -> 24%", then what the test hears). The menu system mod draws any line with a range as a meter, its text and a Progress bar: a generic piece, read through settings-host like every row. The test stopped at once with the TS menu: it ran only while the C++ menu's tab was Audio, and that tab no longer moved. menu_on_tab is now the page whose rows the menu mod read in the last half second (menu_decl_state notes it; the mod reads only the page it shows). Tests: a mod test of the meter line; test_microphone_test_gain checks the line and the page-read rule (stale, another page). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYt(key, { name }) left every {name} as it was from a script: a variadic value reaches the service as the object's JSON text, which vars_of did not read. And a mod keyed by its English words (no en.json) got its key back unfilled. Both are filled now; a test covers the text form. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe tab's own words (the list's lines, a mod's page, Permissions, Keybinds, Commands, HUD layout, the permission prompt, Safe start, About, the switch's states and the help) go through longshot/i18n, keyed by their English, their parts as {name}s; game/mods/mods-tab/strings/<lang>.json has the 13 languages of the menu. What the loader says (a mod's detail, note, state, warning) stays its own. A mod test checks the tab in French, a filled-in part included. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe Mods tab now says its texts through t() (its strings/ in 13 languages), so test_gfx_effects no longer found <Section title="Screen effects"> or the GPU time's English line. It looks for the section and the line as they are written now, t("Screen effects") and t("{ms} ms of the GPU a frame.", ...). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe user's decision on observe-only mods. A mod is observe-only when its code is its sites.toml alone and it asks for hooks.observe and neither hooks.change nor hooks.unsafe (nor exefs). Its sites can then only name the game's own (the build leaves out a site of its own without hooks.unsafe), and the game lets it hear only events and their arguments (a filter needs hooks.change; a field or string capture stays hooks.unsafe). Such a mod is taken with no acceptance by code hash: no warning, nothing written to the trust file, and no new question when it is updated. Its low-risk permission is shown at install as any mod's. The warning ("its own code changes the game's code") is left for hooks.change, hooks.unsafe and ExeFS code. One rule, mods_stamp::observe_only, asked by both sides: the stamp takes such a mod's sites without an acceptance and leaves it out of the trust set; game_files::code_mods and build-driver's modsites::collect take its sites; api::loader's code_status neither asks nor warns (Row::observe_only), and so neither does the Mods tab; mod installed's trust says observe_only. Docs: unsafe.md, hooks.md, tools.md. Tests in mods-stamp, build-driver, api's loader and modtool's installed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYDamage taken's port needs two things the API lacked. A scale that comes after the other mods' damage rules, as the native mod's did. And a way for a script to see the Cheats mod's Debug tools, which gate it. - DamageRule's last (rules.damageTaken / damageDealt add({ ..., last: true })). A last rule takes the hit the other rules made (the game's when none matched), and the last rules combine among themselves as the others do: scales multiplied and rounded to a quarter heart (halves up), then adds, then min and max. oot::rules::apply_hit runs the two passes; LifeRule gains last in its padding (size 80 kept). - player.lifeWrite, the game's other compare-and-swap of a life (add w12, w11, w10), never saw the mods' rules; only the native Damage taken scaled it. The core's engine callback there now applies Link's last rules over the hit that write takes off (oot::rules::life_last). It reads the published rules.life table with its reader count (game_sites::rules::with_live, the C's enter and leave), then heart protection as before. Both sites log the first 32 writes that lower Link's life, so a game run shows which write a hit goes through. - A parity test runs a last rule at each Damage taken scale (0.5, 2, 4) against the native scaled_life on the same written hits at both writes: lives to 20 hearts, hits to 25 hearts, alone and after other mods' rules (147,258 hits). - mod.json's reads ("<mod>:<id>", at most 32, only with a runtime) under the new permission settings.read (low risk, read only; each needs the other). settings.get("<mod>:<id>") gives the value of a setting reads lists, or null while that mod does not run; any other is UnknownNameError. settings.changed tells its changes with that id. The prompt's and the Mods page's permission rows carry the names (Asked/PermissionRow names, modsHost's names), and mod check prints them. Drawing them in the TS Mods tab is the UI2 helper's. The fake game puts the system mods a mod reads in its game, as it does its dependencies: systemMod(name).setSetting is what the mod reads. - The schema (types.toml, api.toml, settings.toml, modsHost.toml), the generated reference, permissions and scripting pages, the website's mod.schema.json, and 4 new cases in tests/mod_vectors/manifest.json (the Launcher's reader needs reads to pass them). Docs: rules.md, settings.md, manifest.md, actors.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYA launcher asks the builder for a profile's mods and sources before the player has set up the game. With the builder's flags before `mod`, as docs/modding/tools.md writes the line, `--profile` first was taken for a play, which stopped with exit 120 ("Longshot isn't set up yet") for installed, resolve, source list, emulators and tags. - main.rs: --profile/--output/--cache before `mod` run the mod tools (mod_line), never a play. - installed/resolve/build-state: `game` is null while the profile's profile.json names no game files. - installed: while no game folder is built, every built-in mod is listed from the build's own table (api::system::table, the native registry) with the new state `not-built` ("not built yet"), no load order. - build-state, the one answer that needs a build, fails with `no_game`. - Tests: modtool's state tests on a profile not set up, and CLI tests (tests/mod_no_game.rs) of each command, flags before and after `mod`. - docs/modding/tools.md: the null `game`, `not-built`, `no_game`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uY- romfs.load(path, { zstd?, dictionary? }): a file whole on a reader thread of Longshot's (lsmod-romfs), its Promise settled at a later frame; with zstd, decoded with the game's dictionaries, a frame that names none with the dictionary named (bcett.byml.zsdic for a map file). At most 64 MiB, 8 loads of a mod waiting. A mod's layer is read and decoded there too (host_sys::romfs::zs_decode_named over host/zs.c's hos_zs_decode_named); the host's index through host_sys::romfs::Later, which the stand-in host serves from the bytes it had at the call (its RomFS is the test thread's). - game.flags.placement(id): a placement's Bool64bitKey flag by its 64-bit id, null when the game data has none; where each was found kept (64 ids), so a read after the first is one entry. - player.provideStat("heartContainers", n | null): a mod gives the core a count it cannot read alone. The last given wins, the one before comes back when that mod stops; oot::travel's map refresh makes the pieces of heart from it (set_heart_containers_taken). The native mod's fn source stays beside it until that mod is ported. - The fake game: romfs.add and romfs.remove (typed already, never there), game.stats (what the mods gave). - The reference, the permission table and the guide regenerated; unsafe.md tells load. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYThe eight dungeons' map files are read once, the first time Link is in play, with romfs.load (zstd, bcett.byml.zsdic for a frame that names no dictionary) on Longshot's reader thread; src/byml.ts, the native BYML reader line for line, finds each Obj_Heart_Container's placement id; their flags are read with game.flags.placement every 2 s and the count given with player.provideStat("heartContainers"), which oot::travel's map refresh makes the pieces of heart from (its native fn source goes). The log line is the native one's. Its parity: test/parity.test.ts, the native tests' cases and fixture (test/map-file.ts is its map_file), answered as the native code answered them; test/heart-containers.test.ts runs it on the fake game. The crate sysmod-heart-containers goes from the workspace and longshot-game; DESIGN.md and system-mods.md say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYIts rules named one capture "screen" at both menu.buttonWait and menu.buttonWaitNoDecideAnim, and longshot/hooks refuses a capture name used twice: in the game the mod did not start ("setRules(): rule 2: the capture screen is named twice"). Each site has its own now (CAPTURES: screen_a, screen_b), read the first site's then the second's each frame. Tests: each rule's capture name is its own, and with the row on at the start the mod takes its rules and runs with no fault. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8dyKi9X9AgqbaPS28uYTested in game: Linux Mint (Cinnamon, X11), kernel 7.0 (Landlock ABI 8, the private folders on), RTX 4070, NVIDIA 595.99.02, Meta Quest 3 on WiVRn 26.9 (Flatpak), the sandbox ON, the window opened through a test-only LD_PRELOAD shim for #2434's X11 abstract-socket bug (not in this PR). Headset row On (26 Nov): the log gives the runtime's manifest and library ("(Headset)" lines) and binds back WiVRn's socket; WiVRn reached, 2064x2162 an eye, session states 1-5; the game shown on the screen in the room in the headset.
Combined into #2595 as HumanBean asked.
Pull request closed