From d2e1f804cecb6cae321b0e31ac97a8a61e78159c Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Tue, 29 Sep 2026 18:28:11 +0300 Subject: [PATCH] render3d: the bake and tile magics are "LBAK" and "LTT2" (they were "LAAK" and "LDT2") Both constants were worked out by hand and a byte off each: the tiles' bake wrote "LAAK" and "LDT2", which ludic bake --check refuses, and r3d_baked_read, holding the same wrong constant, would have refused ludic.base's correct files (the sun's shadow among them) while accepting its own. Now 0x4B41424C and 0x3254544C, checked against the strings; the unused LTT1 constant is gone. A re-bake is needed. Co-Authored-By: Claude Opus 5.5 --- packages/ludic.render3d/bake_parts.ludic | 2 +- packages/ludic.render3d/terrain_ltt2_write.ludic | 2 +- packages/ludic.render3d/terrain_tiles_cut.ludic | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/ludic.render3d/bake_parts.ludic b/packages/ludic.render3d/bake_parts.ludic index 75967b4d..1e501c63 100644 --- a/packages/ludic.render3d/bake_parts.ludic +++ b/packages/ludic.render3d/bake_parts.ludic @@ -112,7 +112,7 @@ function sky_ibl_from_bytes(render3d_st: mut Render3dState, data: []byte) -> boo # ---- reading a bake's file (ludic.base's format; render3d cannot import ludic.base) ---- # "LBAK" | u32 format 1 | u32 version | u32 payload offset | u64 inputs hash | u64 payload length | key -const BAKE_MAGIC: int = 1262567756 # "LBAK", little-endian +const BAKE_MAGIC: int = 1262568012 # "LBAK" read as a little-endian u32: 0x4B41424C # the payload of the bake at `path` when its key and version are these, else null (missing, stale, torn) @alloc_ok("a bake read once at load") diff --git a/packages/ludic.render3d/terrain_ltt2_write.ludic b/packages/ludic.render3d/terrain_ltt2_write.ludic index 75dca194..3409753a 100644 --- a/packages/ludic.render3d/terrain_ltt2_write.ludic +++ b/packages/ludic.render3d/terrain_ltt2_write.ludic @@ -4,7 +4,7 @@ # by the cut; either way the whole copy is put back to the quantized values, so the build's own # queries, the physics, the placements' bake and every machine read the same numbers. -const LT_MAGIC: int = 844383308 # "LTT2" +const LT_MAGIC: int = 844387404 # "LTT2" read as a little-endian u32: 0x3254544C const LT_VERSION: int = 1 const LT_HEAD: int = 128 # 32 words diff --git a/packages/ludic.render3d/terrain_tiles_cut.ludic b/packages/ludic.render3d/terrain_tiles_cut.ludic index 3a099a5c..51a49894 100644 --- a/packages/ludic.render3d/terrain_tiles_cut.ludic +++ b/packages/ludic.render3d/terrain_tiles_cut.ludic @@ -3,7 +3,6 @@ # start, so no older generator's tiles are ever read; its header goes in last, so a start that died # writing it leaves a file whose magic is not there rather than one that looks whole. -const TT_MAGIC: int = 1415074892 # "LTTT" const TT_VERSION: int = 1 const TT_HEAD: int = 64 # bytes: 16 words