wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 3eda72e8c2
commit 5ffe50ed02
463 changed files with 72045 additions and 67421 deletions

View file

@ -2,23 +2,25 @@
# bottoms out in AVAudioPlayer), not the pack-aware file_open every other asset arrives through: in a
# bundle every clip loads as 0 while Fs.exists, which IS pack-aware, says it is there. So try the
# runtime's path, and on 0 lift the bytes out of the pack into the cache directory and load that.
var tried: int = 0
var live: int = 0
export function aud_load(audio_st: mut AudioState, path: string) -> int {
audio_st.tried += 1
export function aud_load(path: string) -> int {
tried += 1
if not is_windowed() { return 0 }
var h = Audio.load(path)
if h == 0 {
let out = aud_unpack(path, base_name(path))
if out != null { h = Audio.load(out) }
}
if h != 0 { audio_st.live += 1 }
if h != 0 { live += 1 }
return h
}
# how many clips were asked for and how many loaded: a silent game looks exactly like a working one
# unless something says so
export function aud_tried(audio_st: AudioState) -> int { return audio_st.tried }
export function aud_live(audio_st: AudioState) -> int { return audio_st.live }
export function aud_tried() -> int { return tried }
export function aud_live() -> int { return live }
# One packed file out to the cache, or null. A cached copy is trusted only if it is as long as the
# packed one: a write interrupted halfway would otherwise play truncated for ever.