render3d: terrain_tiles_bake pads its key as ludic.base does (a zero after it) and makes its directory
baked_open refuses a header whose key is not followed by a zero byte; a key a multiple of 8 long got none. Now the payload starts at 32 + ((len(key) + 1 + 7) / 8) * 8, as bake_write writes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
82de673ce7
commit
199109f1ae
1 changed files with 3 additions and 1 deletions
|
|
@ -124,9 +124,11 @@ function ltt2_gpu_coarse(render3d_st: mut Render3dState) -> void {
|
|||
@alloc_ok("a bake: once, at build time")
|
||||
export function terrain_tiles_bake(render3d_st: mut Render3dState, path: string, key: string, version: int, inputs_hash: long) -> bool {
|
||||
if render3d_st.ter_heights == null or render3d_st.ter_ortho_px == null or render3d_st.ter_normal_tex == 0 { return false }
|
||||
Fs.mkdir(Path.dir(path))
|
||||
let f = file_open(path, "wb")
|
||||
if f == null { return false }
|
||||
let base = 32 + (len(key) + 7) / 8 * 8
|
||||
# the key and at least one zero after it, padded to 8: ludic.base's bake_write and baked_open
|
||||
let base = 32 + (len(key) + 1 + 7) / 8 * 8
|
||||
let head = buffer(base)
|
||||
for i in 0 .. base { head[i] = 0 }
|
||||
file_write(f, data_of(head), base)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue