mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Merge remote-tracking branch 'origin/master' into net9-rollup
This commit is contained in:
commit
605c3019f6
5 changed files with 32 additions and 26 deletions
2
.github/workflows/rollup.yml
vendored
2
.github/workflows/rollup.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
branches:
|
||||
- api11
|
||||
- net9
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
|
|
|||
|
|
@ -38,12 +38,17 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
private readonly ClientStateAddressResolver address;
|
||||
private readonly Hook<EventFramework.Delegates.SetTerritoryTypeId> setupTerritoryTypeHook;
|
||||
private readonly Hook<UIModule.Delegates.HandlePacket> uiModuleHandlePacketHook;
|
||||
private readonly Hook<ProcessPacketPlayerSetupDelegate> processPacketPlayerSetupHook;
|
||||
private readonly Hook<LogoutCallbackInterface.Delegates.OnLogout> onLogoutHook;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly Framework framework = Service<Framework>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly NetworkHandlers networkHandlers = Service<NetworkHandlers>.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<EventFramework.Delegates.SetTerritoryTypeId>.FromAddress(setTerritoryTypeAddr, this.SetupTerritoryTypeDetour);
|
||||
this.uiModuleHandlePacketHook = Hook<UIModule.Delegates.HandlePacket>.FromAddress((nint)UIModule.StaticVirtualTablePointer->HandlePacket, this.UIModuleHandlePacketDetour);
|
||||
this.processPacketPlayerSetupHook = Hook<ProcessPacketPlayerSetupDelegate>.FromAddress(this.address.ProcessPacketPlayerSetup, this.ProcessPacketPlayerSetupDetour);
|
||||
this.onLogoutHook = Hook<LogoutCallbackInterface.Delegates.OnLogout>.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<Conditions.Condition>.GetNullable();
|
||||
var gameGui = Service<GameGui>.GetNullable();
|
||||
var data = Service<DataManager>.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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,25 +16,25 @@ public struct GamepadInput
|
|||
/// <summary>
|
||||
/// Left analogue stick's horizontal value, -99 for left, 99 for right.
|
||||
/// </summary>
|
||||
[FieldOffset(0x88)]
|
||||
[FieldOffset(0x78)]
|
||||
public int LeftStickX;
|
||||
|
||||
/// <summary>
|
||||
/// Left analogue stick's vertical value, -99 for down, 99 for up.
|
||||
/// </summary>
|
||||
[FieldOffset(0x8C)]
|
||||
[FieldOffset(0x7C)]
|
||||
public int LeftStickY;
|
||||
|
||||
/// <summary>
|
||||
/// Right analogue stick's horizontal value, -99 for left, 99 for right.
|
||||
/// </summary>
|
||||
[FieldOffset(0x90)]
|
||||
[FieldOffset(0x80)]
|
||||
public int RightStickX;
|
||||
|
||||
/// <summary>
|
||||
/// Right analogue stick's vertical value, -99 for down, 99 for up.
|
||||
/// </summary>
|
||||
[FieldOffset(0x94)]
|
||||
[FieldOffset(0x84)]
|
||||
public int RightStickY;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -43,7 +43,7 @@ public struct GamepadInput
|
|||
/// <remarks>
|
||||
/// This is a bitfield.
|
||||
/// </remarks>
|
||||
[FieldOffset(0x98)]
|
||||
[FieldOffset(0x88)]
|
||||
public ushort ButtonsRaw;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -52,7 +52,7 @@ public struct GamepadInput
|
|||
/// <remarks>
|
||||
/// This is a bitfield.
|
||||
/// </remarks>
|
||||
[FieldOffset(0x9C)]
|
||||
[FieldOffset(0x8C)]
|
||||
public ushort ButtonsPressed;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -61,7 +61,7 @@ public struct GamepadInput
|
|||
/// <remarks>
|
||||
/// This is a bitfield.
|
||||
/// </remarks>
|
||||
[FieldOffset(0xA0)]
|
||||
[FieldOffset(0x90)]
|
||||
public ushort ButtonsReleased;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -70,6 +70,6 @@ public struct GamepadInput
|
|||
/// <remarks>
|
||||
/// This is a bitfield.
|
||||
/// </remarks>
|
||||
[FieldOffset(0xA4)]
|
||||
[FieldOffset(0x94)]
|
||||
public ushort ButtonsRepeat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ internal class JobGauges : IServiceType, IJobGauges
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public unsafe IntPtr Address => (nint)(&CSJobGaugeManager.Instance()->CurrentGauge);
|
||||
public unsafe IntPtr Address => (nint)(CSJobGaugeManager.Instance()->CurrentGauge);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public T Get<T>() where T : JobGaugeBase
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 679b5353cd61baa03b26d95efcac059f8e29b141
|
||||
Subproject commit fca10adcab3911c1be79cb0753987a2a02b7e058
|
||||
Loading…
Add table
Add a link
Reference in a new issue