use CS TargetSystem for TargetManager service

- Remove address from service, as it's no longer necessary
This commit is contained in:
Kaz Wolfe 2024-06-28 10:09:24 -07:00
parent d0ced2ed63
commit d95befe96e
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4
3 changed files with 5 additions and 24 deletions

View file

@ -50,11 +50,6 @@ internal sealed class ClientStateAddressResolver : BaseAddressResolver
/// </summary>
public IntPtr KeyboardStateIndexArray { get; private set; }
/// <summary>
/// Gets the address of the target manager.
/// </summary>
public IntPtr TargetManager { get; private set; }
/// <summary>
/// Gets the address of the condition flag array.
/// </summary>
@ -99,9 +94,7 @@ internal sealed class ClientStateAddressResolver : BaseAddressResolver
this.KeyboardStateIndexArray = sig.ScanText("0F B6 94 33 ?? ?? ?? ?? 84 D2") + 0x4;
this.ConditionFlags = sig.GetStaticAddressFromSig("48 8D 0D ?? ?? ?? ?? 8B D3 E8 ?? ?? ?? ?? 32 C0 48 83 C4 20");
this.TargetManager = sig.GetStaticAddressFromSig("41 89 44 24 ?? 48 8B 05 ?? ?? ?? ??", 8);
this.GamepadPoll = sig.ScanText("40 55 53 57 41 54 41 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 44 0F 29 B4 24");
}
}

View file

@ -2,6 +2,8 @@ using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using FFXIVClientStructs.FFXIV.Client.Game.Control;
#pragma warning disable CS0618
namespace Dalamud.Game.ClientState.Objects;
@ -16,23 +18,14 @@ namespace Dalamud.Game.ClientState.Objects;
#pragma warning restore SA1015
internal sealed unsafe class TargetManager : IServiceType, ITargetManager
{
[ServiceManager.ServiceDependency]
private readonly ClientState clientState = Service<ClientState>.Get();
[ServiceManager.ServiceDependency]
private readonly ObjectTable objectTable = Service<ObjectTable>.Get();
private readonly ClientStateAddressResolver address;
[ServiceManager.ServiceConstructor]
private TargetManager()
{
this.address = this.clientState.AddressResolver;
}
/// <inheritdoc/>
public IntPtr Address => this.address.TargetManager;
/// <inheritdoc/>
public GameObject? Target
{
@ -82,5 +75,5 @@ internal sealed unsafe class TargetManager : IServiceType, ITargetManager
set => Struct->MouseOverNameplateTarget = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)value?.Address;
}
private FFXIVClientStructs.FFXIV.Client.Game.Control.TargetSystem* Struct => (FFXIVClientStructs.FFXIV.Client.Game.Control.TargetSystem*)this.Address;
private TargetSystem* Struct => TargetSystem.Instance();
}

View file

@ -7,11 +7,6 @@ namespace Dalamud.Game.ClientState.Objects;
/// </summary>
public interface ITargetManager
{
/// <summary>
/// Gets the address of the target manager.
/// </summary>
public nint Address { get; }
/// <summary>
/// Gets or sets the current target.
/// Set to null to clear the target.