map packs: Fs.mount / Fs.unmount at run time, and a map's bakes under assets/baked/maps/<map>/

Maps ship outside the game, each one a content-addressed pack (.lmap: the .lpak format) downloaded to
the save root. The runtime already served reads from packs mounted at boot (packs.index); now one can
come and go while the game runs:

- Fs.mount(path) -> bool maps a pack over the ones mounted before it (searched first, as a later
  packs.index line is); Fs.unmount(path) -> bool gives the mapping back (munmap, UnmapViewOfFile on
  Windows) and closes the gap in the search order. Each slot keeps its length and path for it. A
  FILE* still open over one of its entries (a baked_open_range) is closed first. Still 8 packs at most.
- baked_path(map, file) is assets/baked/maps/<map>/<file> for a map's bake - what its .lmap carries
  and the game's own pack never does - and assets/baked/<file> for the rest.

The IR assembles for macOS and Windows (llvm-as). Compile-only: nothing mounted or run here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 17:27:06 +03:00
parent c883687ace
commit e1585de9b6
6 changed files with 39541 additions and 39098 deletions

View file

@ -10,10 +10,11 @@ export state BakeState {
said: []string = new []string # the keys a dev build has said it made at run time
}
# assets/baked/<map>/<file>, or assets/baked/<file> for no map
# a map's bake: assets/baked/maps/<map>/<file>, which ships in that map's own pack (.lmap), never the
# game's; anything else: assets/baked/<file>, in the game's pack
export function baked_path(map: string, file: string) -> string {
if len(map) == 0 { return "assets/baked/" + file }
return "assets/baked/" + map + "/" + file
return "assets/baked/maps/" + map + "/" + file
}
# the payload of a baked file that is this bake at this version, or null (missing, not a baked file,