diff --git a/.github/workflows/rollup.yml b/.github/workflows/rollup.yml index 5452d998e..49b3d8c1d 100644 --- a/.github/workflows/rollup.yml +++ b/.github/workflows/rollup.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: branches: - - api11 + - net9 defaults: run: diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 364466cce..4ab69b391 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -38,11 +38,16 @@ internal sealed class ClientState : IInternalDisposableService, IClientState private readonly ClientStateAddressResolver address; private readonly Hook setupTerritoryTypeHook; private readonly Hook uiModuleHandlePacketHook; - private readonly Hook processPacketPlayerSetupHook; private readonly Hook onLogoutHook; + [ServiceManager.ServiceDependency] + private readonly Framework framework = Service.Get(); + [ServiceManager.ServiceDependency] private readonly NetworkHandlers networkHandlers = Service.Get(); + + private bool lastConditionNone = true; + [ServiceManager.ServiceConstructor] private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLifecycle lifecycle) @@ -60,14 +65,13 @@ internal sealed class ClientState : IInternalDisposableService, IClientState this.setupTerritoryTypeHook = Hook.FromAddress(setTerritoryTypeAddr, this.SetupTerritoryTypeDetour); this.uiModuleHandlePacketHook = Hook.FromAddress((nint)UIModule.StaticVirtualTablePointer->HandlePacket, this.UIModuleHandlePacketDetour); - this.processPacketPlayerSetupHook = Hook.FromAddress(this.address.ProcessPacketPlayerSetup, this.ProcessPacketPlayerSetupDetour); 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.processPacketPlayerSetupHook.Enable(); this.onLogoutHook.Enable(); } @@ -171,8 +175,9 @@ internal sealed class ClientState : IInternalDisposableService, IClientState { this.setupTerritoryTypeHook.Dispose(); this.uiModuleHandlePacketHook.Dispose(); - this.processPacketPlayerSetupHook.Dispose(); this.onLogoutHook.Dispose(); + + this.framework.Update -= this.FrameworkOnOnUpdateEvent; this.networkHandlers.CfPop -= this.NetworkHandlersOnCfPop; } @@ -255,24 +260,24 @@ internal sealed class ClientState : IInternalDisposableService, IClientState } } - private unsafe void ProcessPacketPlayerSetupDetour(nint a1, nint packet) + private void FrameworkOnOnUpdateEvent(IFramework framework1) { - // Call original first, so everything is set up. - this.processPacketPlayerSetupHook.Original(a1, packet); - + var condition = Service.GetNullable(); var gameGui = Service.GetNullable(); + var data = Service.GetNullable(); - try + if (condition == null || gameGui == null || data == null) + return; + + if (condition.Any() && this.lastConditionNone && this.LocalPlayer != null) { - Log.Debug("Login"); + Log.Debug("Is login"); + this.lastConditionNone = false; this.Login?.InvokeSafely(); - gameGui?.ResetUiHideState(); + gameGui.ResetUiHideState(); + this.lifecycle.ResetLogout(); } - catch (Exception ex) - { - Log.Error(ex, "Exception during ProcessPacketPlayerSetupDetour"); - } } private unsafe void OnLogoutDetour(LogoutCallbackInterface* thisPtr, LogoutCallbackInterface.LogoutParams* logoutParams) @@ -304,6 +309,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState } gameGui?.ResetUiHideState(); + this.lastConditionNone = true; // unblock login flag this.lifecycle.SetLogout(); } diff --git a/Dalamud/Game/ClientState/GamePad/GamepadInput.cs b/Dalamud/Game/ClientState/GamePad/GamepadInput.cs index 32439cd08..d9dcea60f 100644 --- a/Dalamud/Game/ClientState/GamePad/GamepadInput.cs +++ b/Dalamud/Game/ClientState/GamePad/GamepadInput.cs @@ -16,25 +16,25 @@ public struct GamepadInput /// /// Left analogue stick's horizontal value, -99 for left, 99 for right. /// - [FieldOffset(0x88)] + [FieldOffset(0x78)] public int LeftStickX; /// /// Left analogue stick's vertical value, -99 for down, 99 for up. /// - [FieldOffset(0x8C)] + [FieldOffset(0x7C)] public int LeftStickY; /// /// Right analogue stick's horizontal value, -99 for left, 99 for right. /// - [FieldOffset(0x90)] + [FieldOffset(0x80)] public int RightStickX; /// /// Right analogue stick's vertical value, -99 for down, 99 for up. /// - [FieldOffset(0x94)] + [FieldOffset(0x84)] public int RightStickY; /// @@ -43,7 +43,7 @@ public struct GamepadInput /// /// This is a bitfield. /// - [FieldOffset(0x98)] + [FieldOffset(0x88)] public ushort ButtonsRaw; /// @@ -52,7 +52,7 @@ public struct GamepadInput /// /// This is a bitfield. /// - [FieldOffset(0x9C)] + [FieldOffset(0x8C)] public ushort ButtonsPressed; /// @@ -61,7 +61,7 @@ public struct GamepadInput /// /// This is a bitfield. /// - [FieldOffset(0xA0)] + [FieldOffset(0x90)] public ushort ButtonsReleased; /// @@ -70,6 +70,6 @@ public struct GamepadInput /// /// This is a bitfield. /// - [FieldOffset(0xA4)] + [FieldOffset(0x94)] public ushort ButtonsRepeat; } diff --git a/Dalamud/Game/ClientState/JobGauge/JobGauges.cs b/Dalamud/Game/ClientState/JobGauge/JobGauges.cs index 5a734ed87..e47bead36 100644 --- a/Dalamud/Game/ClientState/JobGauge/JobGauges.cs +++ b/Dalamud/Game/ClientState/JobGauge/JobGauges.cs @@ -28,7 +28,7 @@ internal class JobGauges : IServiceType, IJobGauges } /// - public unsafe IntPtr Address => (nint)(&CSJobGaugeManager.Instance()->CurrentGauge); + public unsafe IntPtr Address => (nint)(CSJobGaugeManager.Instance()->CurrentGauge); /// public T Get() where T : JobGaugeBase diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 679b5353c..fca10adca 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 679b5353cd61baa03b26d95efcac059f8e29b141 +Subproject commit fca10adcab3911c1be79cb0753987a2a02b7e058