From 80cffaa21fc5a221172716af82a03139ca669ff5 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Wed, 28 Jan 2026 13:17:04 +0100 Subject: [PATCH] Lazy-init the hooks --- .../Data/Widgets/NetworkMonitorWidget.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs index 6fe05e23f..4460a9f9a 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/NetworkMonitorWidget.cs @@ -55,22 +55,19 @@ internal unsafe class NetworkMonitorWidget : IDataWindowWidget public bool Ready { get; set; } /// - public void Load() - { - this.hookDown = Hook.FromAddress( - (nint)PacketDispatcher.StaticVirtualTablePointer->OnReceivePacket, - this.OnReceivePacketDetour); - - this.hookUp = Hook.FromAddress( - (nint)ZoneClient.MemberFunctionPointers.SendPacket, - this.SendPacketDetour); - - this.Ready = true; - } + public void Load() => this.Ready = true; /// public void Draw() { + this.hookDown ??= Hook.FromAddress( + (nint)PacketDispatcher.StaticVirtualTablePointer->OnReceivePacket, + this.OnReceivePacketDetour); + + this.hookUp ??= Hook.FromAddress( + (nint)ZoneClient.MemberFunctionPointers.SendPacket, + this.SendPacketDetour); + if (ImGui.Checkbox("Track Network Packets"u8, ref this.trackNetwork)) { if (this.trackNetwork)