From 134e5a37f9918905c33beda47f21005998461c32 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Fri, 28 Aug 2026 18:21:59 +0200 Subject: [PATCH] Allow GUID resolution when legacy object manager global is zero --- src/wow.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wow.zig b/src/wow.zig index 99d0877..756e15a 100644 --- a/src/wow.zig +++ b/src/wow.zig @@ -225,11 +225,16 @@ pub fn unitGUID(unit_id: [*:0]const u8) u64 { /// Resolve a GUID → object pointer via the object manager hash table. pub fn getObjectByGUID(guid: u64) u32 { if (guid == 0) return 0; - if (hook.readMem(u32, o.OBJECT_MANAGER_PTR) == 0) return 0; const lo: u32 = @truncate(guid); const hi: u32 = @truncate(guid >> 32); + + // Do not gate this call on OBJECT_MANAGER_PTR. Nampower uses WoW's + // GetObjectPtr at 0x464870 directly, and on this modified client the + // legacy OBJECT_MANAGER_PTR global remains 0 even while the game is live. + // The stdcall(u64) ABI is equivalent on x86 to pushing lo + hi as two u32s. const result = hook.call(fn (u32, u32) callconv(hook.cc.stdcall) u32, o.FN_GET_OBJECT_BY_GUID, .{ lo, hi }); - // Guard: hash table can return stale/invalid pointers for destroyed objects + + // Guard: hash table can return stale/invalid pointers for destroyed objects. if (result != 0 and !isValidPtr(result)) return 0; return result; } @@ -237,7 +242,6 @@ pub fn getObjectByGUID(guid: u64) u32 { /// Split-GUID variant for callers that already have lo/hi parts. pub fn getObjectByGUIDSplit(guid_lo: u32, guid_hi: u32) u32 { if (guid_lo == 0 and guid_hi == 0) return 0; - if (hook.readMem(u32, o.OBJECT_MANAGER_PTR) == 0) return 0; return hook.call(fn (u32, u32) callconv(hook.cc.stdcall) u32, o.FN_GET_OBJECT_BY_GUID, .{ guid_lo, guid_hi }); }