Commit Graph
2 Commits
Author SHA1 Message Date
YourWishesandClaude Sonnet 5 a0294aae98 Load duskscript files through the asset system, not the real filesystem
scriptLoadHandler used fopen/fread directly, but every .ds a script include()s
is packed into dusk.dsk (compiled to .dsb) like every other asset now, not a
loose file next to the binary - raw filesystem reads never found them outside
a dev checkout. It now goes through assetFileInit/Open/Read/Close like the
rest of the engine's asset loaders, failing the load the same way (returning
SCRIPT_LOAD_FAILED) for a missing entry or one bigger than capacity.

test_duskscript's fixtures moved to their own assets/ subfolder and pack into
a small test.dsk with the same tools.asset.pack used for the real dusk.dsk,
and the test opens that archive straight into ASSET.zip (skipping the full
assetInit()/assetInitPlatform(), which expects a launched engine) so the
tests exercise the real compile -> pack -> asset -> runtime pipeline instead
of a filesystem shortcut around it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-10-14 22:33:46 -05:00
YourWishesandClaude Sonnet 5 c1d6a97293 Port the duskscript language into the engine as src/dusk/script + duskscriptcc
Brings over the duskscript VM and compiler from dusk-vm: the runtime
(core/vm) lives under src/dusk/script, gated by DUSK_SCRIPT and wired into
the engine lifecycle with print()/consolePrint() routed to the console; the
standalone duskscriptcc compiler stays a lean host tool (linux/knulli only).

Collapses int/fixed/bignum into a single float-backed SCRIPT_VALUE_NUMBER
throughout the lexer, compiler, bytecode format and VM, removing the old
int16-rollover fast paths and the type-conversion builtins they needed.

Fixes a real big-endian bug in the bytecode's 32-bit number reader (found
while adding GameCube/Wii endian support via util/endian.h) and converts
src/dusk/script and duskscriptcc to dusk's memory/string/assert utilities,
which surfaced two more latent bugs: a conservative GC stack scan reading
its own local variable's address, and an uninitialized path buffer in
scriptReadScript when the caller path has no directory component.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-10-14 12:59:46 -05:00