mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 06:01:49 +01:00
Lazy-init the hooks
This commit is contained in:
parent
36493ec886
commit
80cffaa21f
1 changed files with 9 additions and 12 deletions
|
|
@ -55,22 +55,19 @@ internal unsafe class NetworkMonitorWidget : IDataWindowWidget
|
|||
public bool Ready { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Load()
|
||||
{
|
||||
this.hookDown = Hook<PacketDispatcher.Delegates.OnReceivePacket>.FromAddress(
|
||||
(nint)PacketDispatcher.StaticVirtualTablePointer->OnReceivePacket,
|
||||
this.OnReceivePacketDetour);
|
||||
|
||||
this.hookUp = Hook<ZoneClient.Delegates.SendPacket>.FromAddress(
|
||||
(nint)ZoneClient.MemberFunctionPointers.SendPacket,
|
||||
this.SendPacketDetour);
|
||||
|
||||
this.Ready = true;
|
||||
}
|
||||
public void Load() => this.Ready = true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Draw()
|
||||
{
|
||||
this.hookDown ??= Hook<PacketDispatcher.Delegates.OnReceivePacket>.FromAddress(
|
||||
(nint)PacketDispatcher.StaticVirtualTablePointer->OnReceivePacket,
|
||||
this.OnReceivePacketDetour);
|
||||
|
||||
this.hookUp ??= Hook<ZoneClient.Delegates.SendPacket>.FromAddress(
|
||||
(nint)ZoneClient.MemberFunctionPointers.SendPacket,
|
||||
this.SendPacketDetour);
|
||||
|
||||
if (ImGui.Checkbox("Track Network Packets"u8, ref this.trackNetwork))
|
||||
{
|
||||
if (this.trackNetwork)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue