mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Use AgentLobbys OnLogout vfunc (#2395)
This commit is contained in:
parent
852b1289e2
commit
7f3fc5aac1
1 changed files with 4 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
private readonly ClientStateAddressResolver address;
|
private readonly ClientStateAddressResolver address;
|
||||||
private readonly Hook<EventFramework.Delegates.SetTerritoryTypeId> setupTerritoryTypeHook;
|
private readonly Hook<EventFramework.Delegates.SetTerritoryTypeId> setupTerritoryTypeHook;
|
||||||
private readonly Hook<UIModule.Delegates.HandlePacket> uiModuleHandlePacketHook;
|
private readonly Hook<UIModule.Delegates.HandlePacket> uiModuleHandlePacketHook;
|
||||||
private readonly Hook<LogoutCallbackInterface.Delegates.OnLogout> onLogoutHook;
|
private Hook<LogoutCallbackInterface.Delegates.OnLogout> onLogoutHook;
|
||||||
|
|
||||||
[ServiceManager.ServiceDependency]
|
[ServiceManager.ServiceDependency]
|
||||||
private readonly Framework framework = Service<Framework>.Get();
|
private readonly Framework framework = Service<Framework>.Get();
|
||||||
|
|
@ -64,14 +64,12 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
|
|
||||||
this.setupTerritoryTypeHook = Hook<EventFramework.Delegates.SetTerritoryTypeId>.FromAddress(setTerritoryTypeAddr, this.SetupTerritoryTypeDetour);
|
this.setupTerritoryTypeHook = Hook<EventFramework.Delegates.SetTerritoryTypeId>.FromAddress(setTerritoryTypeAddr, this.SetupTerritoryTypeDetour);
|
||||||
this.uiModuleHandlePacketHook = Hook<UIModule.Delegates.HandlePacket>.FromAddress((nint)UIModule.StaticVirtualTablePointer->HandlePacket, this.UIModuleHandlePacketDetour);
|
this.uiModuleHandlePacketHook = Hook<UIModule.Delegates.HandlePacket>.FromAddress((nint)UIModule.StaticVirtualTablePointer->HandlePacket, this.UIModuleHandlePacketDetour);
|
||||||
this.onLogoutHook = Hook<LogoutCallbackInterface.Delegates.OnLogout>.FromAddress((nint)LogoutCallbackInterface.StaticVirtualTablePointer->OnLogout, this.OnLogoutDetour);
|
|
||||||
|
|
||||||
this.framework.Update += this.FrameworkOnOnUpdateEvent;
|
this.framework.Update += this.FrameworkOnOnUpdateEvent;
|
||||||
this.networkHandlers.CfPop += this.NetworkHandlersOnCfPop;
|
this.networkHandlers.CfPop += this.NetworkHandlersOnCfPop;
|
||||||
|
|
||||||
this.setupTerritoryTypeHook.Enable();
|
this.setupTerritoryTypeHook.Enable();
|
||||||
this.uiModuleHandlePacketHook.Enable();
|
this.uiModuleHandlePacketHook.Enable();
|
||||||
this.onLogoutHook.Enable();
|
|
||||||
|
|
||||||
this.framework.RunOnTick(this.Setup);
|
this.framework.RunOnTick(this.Setup);
|
||||||
}
|
}
|
||||||
|
|
@ -184,6 +182,9 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
|
|
||||||
private unsafe void Setup()
|
private unsafe void Setup()
|
||||||
{
|
{
|
||||||
|
this.onLogoutHook = Hook<LogoutCallbackInterface.Delegates.OnLogout>.FromAddress((nint)AgentLobby.Instance()->LogoutCallbackInterface.VirtualTable->OnLogout, this.OnLogoutDetour);
|
||||||
|
this.onLogoutHook.Enable();
|
||||||
|
|
||||||
this.TerritoryType = (ushort)GameMain.Instance()->CurrentTerritoryTypeId;
|
this.TerritoryType = (ushort)GameMain.Instance()->CurrentTerritoryTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue