dpslog: fix handler table swaps not surviving relog

InitializeGameEngine re-registers all packet handlers on every login,
overwriting our swaps. The NetClient pointer may be reused so comparing
it doesn't detect re-registration. Fix: unconditionally reset swap_count
and re-install all swaps whenever InitializeGameEngine fires.
This commit is contained in:
MarcelineVQ
2026-03-18 18:43:40 -07:00
parent 34bb70dc8b
commit 60ee3ae1d1
+3 -1
View File
@@ -869,7 +869,9 @@ fn createEventsDetour(param1: u32, max_event_id: u32) callconv(hook.cc.fastcall)
}
fn installHandlerSwaps() void {
if (swap_count > 0) return; // already installed
// Always re-install — InitializeGameEngine re-registers all handlers,
// overwriting any previous swaps (even if NetClient pointer is the same).
swap_count = 0;
// Packet handler table swaps (no code patching, heap pointer writes only)
if (!swapHandler(0x250, @intFromPtr(&spellNonMeleeDmgLogDetour)))
log.print("FAILED to swap SPELLNONMELEEDAMAGELOG (0x250)\n")