From f46e5d07f496fed4ec7883dc565074ad8d42f55c Mon Sep 17 00:00:00 2001 From: MarcelineVQ Date: Thu, 12 Mar 2026 11:29:42 -0700 Subject: [PATCH] Fix bone count read: add missing +0x130 indirection to M2 header --- src/transform44/transform44.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/transform44/transform44.zig b/src/transform44/transform44.zig index dea39d8..2232de2 100644 --- a/src/transform44/transform44.zig +++ b/src/transform44/transform44.zig @@ -105,9 +105,13 @@ fn transformDetour(this: u32, edx: u32, mat1: u32, mat2: u32, mat3: u32, mat4: u const anim_sync = hook.readMem(u32, anim_ctx + 0x10); if (sync_val == anim_sync) is_early = true; } - const model_hdr = hook.readMem(u32, this + 0x2C); - if (model_hdr != 0) { - bone_count = hook.readMem(u32, model_hdr + 0x34); + // Model header is at *(*(this+0x2C) + 0x130), bone count at +0x34 + const ptr_2c = hook.readMem(u32, this + 0x2C); + if (ptr_2c != 0) { + const model_hdr = hook.readMem(u32, ptr_2c + 0x130); + if (model_hdr != 0) { + bone_count = hook.readMem(u32, model_hdr + 0x34); + } } }