WIP: Temporary V35 Retail build #5
+7
-3
@@ -225,11 +225,16 @@ pub fn unitGUID(unit_id: [*:0]const u8) u64 {
|
|||||||
/// Resolve a GUID → object pointer via the object manager hash table.
|
/// Resolve a GUID → object pointer via the object manager hash table.
|
||||||
pub fn getObjectByGUID(guid: u64) u32 {
|
pub fn getObjectByGUID(guid: u64) u32 {
|
||||||
if (guid == 0) return 0;
|
if (guid == 0) return 0;
|
||||||
if (hook.readMem(u32, o.OBJECT_MANAGER_PTR) == 0) return 0;
|
|
||||||
const lo: u32 = @truncate(guid);
|
const lo: u32 = @truncate(guid);
|
||||||
const hi: u32 = @truncate(guid >> 32);
|
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 });
|
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;
|
if (result != 0 and !isValidPtr(result)) return 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -237,7 +242,6 @@ pub fn getObjectByGUID(guid: u64) u32 {
|
|||||||
/// Split-GUID variant for callers that already have lo/hi parts.
|
/// Split-GUID variant for callers that already have lo/hi parts.
|
||||||
pub fn getObjectByGUIDSplit(guid_lo: u32, guid_hi: u32) u32 {
|
pub fn getObjectByGUIDSplit(guid_lo: u32, guid_hi: u32) u32 {
|
||||||
if (guid_lo == 0 and guid_hi == 0) return 0;
|
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 });
|
return hook.call(fn (u32, u32) callconv(hook.cc.stdcall) u32, o.FN_GET_OBJECT_BY_GUID, .{ guid_lo, guid_hi });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user