From 7f3fc5aac162696c48522fa2324bec8e2753f513 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Tue, 2 Sep 2025 14:01:12 +0200 Subject: [PATCH] Use AgentLobbys OnLogout vfunc (#2395) --- Dalamud/Game/ClientState/ClientState.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 13b75bda0..407b54060 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -38,7 +38,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState private readonly ClientStateAddressResolver address; private readonly Hook setupTerritoryTypeHook; private readonly Hook uiModuleHandlePacketHook; - private readonly Hook onLogoutHook; + private Hook onLogoutHook; [ServiceManager.ServiceDependency] private readonly Framework framework = Service.Get(); @@ -64,14 +64,12 @@ internal sealed class ClientState : IInternalDisposableService, IClientState this.setupTerritoryTypeHook = Hook.FromAddress(setTerritoryTypeAddr, this.SetupTerritoryTypeDetour); this.uiModuleHandlePacketHook = Hook.FromAddress((nint)UIModule.StaticVirtualTablePointer->HandlePacket, this.UIModuleHandlePacketDetour); - this.onLogoutHook = Hook.FromAddress((nint)LogoutCallbackInterface.StaticVirtualTablePointer->OnLogout, this.OnLogoutDetour); this.framework.Update += this.FrameworkOnOnUpdateEvent; this.networkHandlers.CfPop += this.NetworkHandlersOnCfPop; this.setupTerritoryTypeHook.Enable(); this.uiModuleHandlePacketHook.Enable(); - this.onLogoutHook.Enable(); this.framework.RunOnTick(this.Setup); } @@ -184,6 +182,9 @@ internal sealed class ClientState : IInternalDisposableService, IClientState private unsafe void Setup() { + this.onLogoutHook = Hook.FromAddress((nint)AgentLobby.Instance()->LogoutCallbackInterface.VirtualTable->OnLogout, this.OnLogoutDetour); + this.onLogoutHook.Enable(); + this.TerritoryType = (ushort)GameMain.Instance()->CurrentTerritoryTypeId; }