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:
parent
c883687ace
commit
e1585de9b6
6 changed files with 39541 additions and 39098 deletions
|
|
@ -39,6 +39,7 @@ function is_fs_ns(meth: pointer) -> bool {
|
|||
if (meth == "exists") or (meth == "is_dir") or (meth == "read_text") { return true }
|
||||
if (meth == "write_text") or (meth == "append_text") or (meth == "remove") { return true }
|
||||
if (meth == "size") or (meth == "mkdir") or (meth == "copy") or (meth == "list") { return true }
|
||||
if (meth == "mount") or (meth == "unmount") { return true }
|
||||
return false
|
||||
}
|
||||
function is_path_ns(meth: pointer) -> bool {
|
||||
|
|
@ -55,6 +56,9 @@ function emit_fs_ns(meth: pointer, e: Node) -> Val {
|
|||
use_pak()
|
||||
let a = emit_expr(e.kids[0])
|
||||
if (meth == "exists") { return val(emit_bind(`call i32 @lp_fs_exists(ptr {a.code})`), "bool") }
|
||||
# a pack (.lpak / .lmap) mounted at run time over the packs.index ones, searched first; and let go
|
||||
if (meth == "mount") { return val(emit_bind(`call i32 @lp_pak_mount(ptr {a.code})`), "bool") }
|
||||
if (meth == "unmount") { return val(emit_bind(`call i32 @lp_pak_unmount(ptr {a.code})`), "bool") }
|
||||
if (meth == "is_dir") { return val(emit_bind(`call i32 @lp_fs_is_dir(ptr {a.code})`), "bool") }
|
||||
if (meth == "read_text") { return val(emit_bind(`call ptr @lp_fs_read_text(ptr {a.code})`), "string") }
|
||||
if (meth == "remove") { return val(emit_bind(`call i32 @lp_fs_remove(ptr {a.code})`), "bool") }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue