mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 14:11:48 +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; }
|
public bool Ready { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Load()
|
public void Load() => this.Ready = true;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Draw()
|
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 (ImGui.Checkbox("Track Network Packets"u8, ref this.trackNetwork))
|
||||||
{
|
{
|
||||||
if (this.trackNetwork)
|
if (this.trackNetwork)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue