WIP: feat(game)!: the game side and the whole mod API in Rust, with system mods and the sandbox on by default #2434
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2434
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:feat/game-rs"
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 #2411. Review from the first commit after
fefe58d7(#2411's head). This merges after #2411 and#2286.
What it does. The game side and the whole mod API are now Rust. The host's C is still there, and the renderer is
unchanged apart from the menu's link to the game side.
game/crates:guest,host-sys,oot,game-sites,api,content,script,schema,mod-formatandlongshot-game.longshot-rslinks them into the game as one static library.game/mods, one Rust crate each:title, sprint and walk, text, voice language, widescreen.
system_mods/by the build andtrusted only when their files hash to the build's table.
Mod), with typed settings and state,thiserrorerrors, and one undojournal. A mod's stop puts back whatever it changed.
the mods' network and IPC, crash reports, and the links and folders the game opens.
mod.jsonthat asks fornativeis refused with a messagesaying why. See
game/DESIGN.md, "What was removed".What players see change
of them, no longer a Gameplay tab row).
mods.json("cheats"), so switches saved by an older buildare not carried over. This needs a line in the release notes.
HOS_SKIP_OPENINGstill takesprecedence over it.
tests/test_menu_ini_keys.py's FROZEN list is kept, so aplayer's
longshot_options.inireads the same. The old option numbers are kept only so older input recordings stillreplay.
game/DESIGN.md, "Fixed on the way" (51 entries), with whatthe C did and why it was wrong. Otherwise, what players see is unchanged.
Read first
game/DESIGN.md: the design, the crates, threads, site chains, theModtrait, the undo journal, settings and thescript engine.
game/game.h: the line between the C host and the Rust game side.gpu/vk/vk_api.h:MKWVK_API_VERSION49 to 53 (the game's rows, the Mods tab, the broker, the mods' UI, a gamerow's default).
Testing
Tested: On Linux (CachyOS, Linux 7.3, RTX 3090, NVIDIA 620.70.06, Ryzen 9 7900X), three headless runs through the
job queue, each booting the repository save
kokiri-start.not installed". Fixed: the build installs them in
system_mods/, with a test.HOS_SAMPLE_ALL). gdb could not attach:Yama's ptrace scope is 1.
gmd::SaveDataMgr. It callednn::fs::Commitwithout end: each commit failedsyncing the user folder's parent folder, which the sandbox does not let the game open.
before it confines the game.
tests/test_fs_save_commit.pyhas a case that fails without the fix.client moves them, with tests in
tests/test_longshot_ctl.py.[error]lines.mod, so it correctly did not start.
fs: save: published 1 files), with no retries.HOS_DISCORD=0unless thecaller asks otherwise, with a test.
The checks
-D warningsclean for Linux and for Windows (x86_64-pc-windows-gnullvm).cargo test --workspace: 1616 passed, 0 failed, 1 ignored.tests/run_all.py): 659 passed, 17 failed, 99 skipped.fefe58d7, the base:test_amd_subgroup_profiles,test_flat_map,test_guest_holes,test_menu_save_atomic,test_menu_text_field,test_pipeline_share,test_prepare_cache_save,test_rdna2_mesh_only,test_readback_timeout_source,test_rumble_menu,test_shader_profile_caps,test_target_image_reuse,test_vibration_menu,test_vram_compact,test_wb_spans.test_mise_buildfails on the base too: this PC's mise lists atoolstask.test_lifterfailed on a formatting slip, since fixed; formatting is clean now.test_longshot_ctl,test_fs_save_commit,test_bug_report_defaults, thetest_menu_i18npair, thetest_sandbox_*checks,test_switch_table,test_menu_ini_keys,test_pipeline_tour,test_dev_abandtest_parity_gates.longshot.exe,longshot_vk.dll, the SDL DLLs andsystem_mods/.sandbox_windows.c(the AppContainer),broker_windows.c,broker_net.c,pad_mods.c,mod_watch.candhos_crash_dialog.c.Still to test:
(
scripts/parity_gates.py) and the feature checks. Expecting the same results as #2411's head, apart from theentries in "Fixed on the way". (@Beanstalk, or by hand)
with the broker running, saves committing, shots written, and mods' IPC working through the broker. (@Beanstalk)
mods' UI, run by hand with the example mods. Expecting every mod to start, stop and undo its changes as
game/DESIGN.mdsays. (by hand)kokiri-startwith the sandbox on. Expecting play, savescommitting, and no sandbox refusals in the log. (@Beanstalk)
Measurements
Not measured yet. This is a port: the renderer and the lifted game code are unchanged. But the per-frame hooks
(frame-time step, barriers, OCB hold, texture compaction) now run in Rust instead of C. An fps and frame-time A/B
against #2411 in Kokiri Forest, Hyrule Field and the Market, at 1080p, native and uncapped, is still to be done before
this leaves WIP.
Risks
area of the game. The parity gates and feature checks above are what catch that. The fallback is a revert of the
whole stack; there is no switch back to the C game side.
HOS_SANDBOX=0, set in the real environment, turns it off for debugging;longshot_env.txtcannot.longshot_options.ini, saves and caches read the same.MKWVK_API_VERSIONis 53: a renderer built for an older version refuses to load, as it should.Checklist
Ready for review
main; the title is a Conventional Commit. (Not onmain: stacked on #2411 and mergesafter it and #2286. The title is a Conventional Commit.)
only, and is in Still to test.)
mise run testpasses (any failure that also fails onmainis named). (The 15 failures, plustest_mise_build, also fail onfefe58d7, #2411's head; they are named in Testing.)main, or Measurements says why there is nothing to measure. (The A/B against #2411 is still tobe done.)
third_party/untouched; nothing GPL-incompatible.(The site tables hold masked signatures and addresses only.)
When it applies
mainand passes here. (Each fix made after a run has one; for the savecommit,
test_fs_save_commit's new case fails on the old source.)gpu/vk/switches.def.(The sandbox ships on by default for safety, not from measurements; its cost is not measured yet.)
tests/that reads changed source is updated, not weakened.MKWVK_API_VERSIONbumped (MkwVkHostorMkwVkRendereringpu/vk/vk_api.hchanged). (49 to 53.)mainand here, for a change that shows on screen. (Only this side's shot ofKokiri Forest so far; the #2411 side comes with the parity gates.)
game/DESIGN.md,docs/dev/reference/for the architecture, the control bridge and thesandbox, and the modding docs.)
Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Op::Checked { fast, slow, helper, args }: the fast value unless slow holds, then a helper's. A Helper is a pure function a function carries (one block of pure ops over Op::Param, ending in a return), written once per module by its name: internal, noinline, cold, memory(none). The writer lowers the op as a branch weighted unlikely around the call and a phi. Op::IsSubnormal (llvm.is.fpclass), FBinOp::Maximum/Minimum (llvm.maximum/minimum) and Reduce::Or for the fast paths' checks. The verifier checks the new ops and every helper; sync.rs syncs nothing for one. words --count-checks counts the fast paths' runs and slow ones, for the semantics check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017vw8e2TsN4jgNUFQPfkAq8lift::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- 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_017vw8e2TsN4jgNUFQPfkAq8The line between the generic host and renderer and the game, as two headers: - host/game_host.h: what the host gives the game. The host's own headers the game's C used (the paths, hos.h's guest memory and Ctx, game_call, the RomFS, the size tables, the settings file, env_on, the picture's size, the input recordings, the control bridge's watches), and the host's functions and values the game declared one by one where it used them. Every game/ file includes it in place of its host includes. - game/game.h: what the game gives the host and the renderer: game_init (the start's read of HOS_OOT_PROTECT_HEARTS, out of hos_main.c), the frame's and input's hooks, the control bridge's and the input recordings' game commands, the Mods and Cheats pages, the performance summary, the files mods replace, the Debug tab's inventory items. The host's files and vk_menu.cpp include it in place of the game's headers and their own prototypes. - game/options.h: the game's option ids (Field of view, Damage taken, the cheats, the HUD's layout...), out of gpu/vk/vk_api.h, which includes it; every value as it was (longshot_options.ini and the recordings hold them). The names the host used that were the game's become generic: hos_oot_{state,current_map,destination,teleport_*, age_ask,sample*,watch,poll,live_action,flight_shortcut_ready,autoload_input} are game_*, HosControlGame's oot_* fields game_*, HosControlOotWatch HosControlGameWatch. No behaviour changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>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_016o1k1PPtvLKUijhrMa4pueTested in game: CachyOS Linux 7.3, this PC (Ryzen 7900X, NVIDIA), headless: kokiri-start booted to play in Kokiri Forest (run 3, c52a3fa3's tree less the Discord test-run switch): all 14 native system mods and the Discord script mod started, sandbox confined, settings from the profile's options file, one save commit (66 ms, no retries), ~60 s in play with stick moves, clean quit, no errors. Runs 1-2 hung at the save load (the sandbox refused syncing the user folder's parent), fixed with a game-free test. Not yet: the comparison against #2411, Windows (cross-linked only), Phase 5 in game.
Possibly related, for context:
New head
57469dd5:HOS_START_SLOT=<n>starts a run on a chosen save slot through the Skip title mod (unset: as before; a missing or empty slot leaves the file list to the player, never a new game or another slot), andlongshot_version.txtgainsfeatures=start_slotso the launcher can tell which games take it. Game-free tests and clippy pass; the save list's order is not yet confirmed in the game.New head
8aa8522b:HOS_SAVE_DIR=<folder>keeps a run's saves (save/<uid>/,save-work/) in a launcher profile's folder; everything that finds saves follows it (nn_fs, the commit's syncs, the bridge's save root, Skip title's newest save andHOS_START_SLOT), the sandbox grants only that folder's save trees, and an unusable folder stops the start (exit 3,save_dir_unusable) rather than falling back to the shared saves. Advertised assave_dirinlongshot_version.txt'sfeatures=. Game-free tests pass (cargo 1627; the sandbox, fs and bridge checks); not yet run in the game.New head
56ace9f0: withHOS_SAVE_DIRset, mods' per-save data lives in<HOS_SAVE_DIR>/modstore/save/<uid>/slot_NN(two profiles never share it; granted by both sandboxes), and an unusable save folder is a plain refused start (exit 3,start refused: save_dir_unusable, a message box unless headless) with no crash record or crash window. cargo 1629 passed; the crash and sandbox checks pass; Windows cross-links.Two follow-ups to HOS_SAVE_DIR: - The mods' per-save data (modstore/save/<uid>/slot_NN) stayed in the user folder, so two profiles sharing it shared a mod's data for their slot 0. With HOS_SAVE_DIR it goes to <HOS_SAVE_DIR>/modstore/save/<uid>/slot_NN (api's storage save_root, longshot-game's runtime save_storage_root); the global and profile stores stay in the user folder. The folder's modstore/ is made with save/ and save-work/, and both sandboxes grant it as they do those. Unset, as before. - An unusable HOS_SAVE_DIR went through hos_fatal, whose crash record made the crash window say "Longshot closed unexpectedly" and offer a crash report. It is now refused as a start set up wrong (hos_main.c refuse_start): a log line ("start refused: save_dir_unusable: ..."), the reason on stderr, a plain message unless headless, then the clean end and exit code 3, with no crash record; the window says nothing. Tests: api's storage (the per-save stores under the profile's folder, never shared, unset as before), longshot-game's runtime, test_sandbox_linux, test_sandbox_windows and test_sandbox_save_folders (modstore/ granted), test_fs_save_commit (made), test_crash_dialog (a refused start is no crash; refuse_start writes no record and ends clean), test_crash_record's exit inventory. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016o1k1PPtvLKUijhrMa4pue56ace9f092231d650dedNew head
231d650d, rebased onto #2411's59a7b1f8(on #2286's02386f32). It takes in the full self-review of the earlier head (11 blocking, 25 should-fix, 43 nits), each blocking fix with a game-free test shown failing first, plus an overflow sweep of every parser of mod input. Spec gaps closed since: has() honest; the 27 unplaced mod-API sites placed (19 rule sites through new lift rules in builder/crates/edits); the content stage and typed patches run in the game (romfs_merge port, plan cache, content.sound via BWAV); texture packs and render-target recipes; save profiles, pad gyro and device kind, camera rigs; mods_api= in longshot_version.txt; the sandbox closes the session bus on kernels below Landlock ABI 9 with a private mount namespace (player scripts held only where user namespaces are blocked). Checks: fmt clean; clippy -D warnings clean on Linux and Windows; cargo test passes; Python 665 passed, 14 failed (13 fail identically on59a7b1f8, the 14th fixed since); the Linux game build and the Windows cross-build (longshot.exe, longshot_vk.dll) link. Not yet run in the game; the Mods tab's per-mod page and the unsafe tier's code modules land next.New head
54e28eb5(541 commits on #2411's59a7b1f8): the Mods tab's per-mod page (the permission prompt, settings, permissions, the debug page and frame times, , and a click on a mod window no longer reaches the game); the content stage's follow-up (archives of several mods made one, skins and model checks, the AINB schema, the modcache sweep, hot reload rebuilding the layers); and the unsafe tier's build side (mods' own sites, a manifest's exefs/, data switches without a build, vslot thunks, code modules built in). Checks: fmt clean; clippy -D warnings clean on Linux and Windows; cargo test passes; schema outputs current; Python 666 passed, 13 failed exactly as on59a7b1f8; Linux and Windows builds link. Still not run in the game. Next: the mods' world layer and shader effects, the registries' engine side, and longshot/capture.231d650ded54e28eb5aelongshotCheckout 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_016o1k1PPtvLKUijhrMa4pueNew head
f2c624a2(559 commits on #2411's59a7b1f8). Added: the mods' screen effects and world layer drawn by the renderer (MKWVK_API_VERSION 55; has() says yes to gfx.effect and gfx.world); the engine side of the registries with the Mods tab's Keybinds, Commands and HUD layout pages; ; longshot/capture; the mod-tools node tests fixed and run by tests/, and dev.py game-tests ported (game runs through the queue); the mods stamp (game/crates/mods-stamp, the build record's "mods" key, the game's stamp equal to the builder's) and Restart to apply (exit 122 when LONGSHOT_STARTED_BY=builder). Checks: fmt; clippy -D warnings on Linux and Windows; schema-gen --check; cargo test; Python 672 passed, 13 failed exactly as on59a7b1f8; the Linux build (renderer linked) and the Windows cross-build link. Still not run in the game.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.