6.4 Patch Rollup (#1206)

Fix Dalamud for 6.4, hopefully.
This commit is contained in:
KazWolfe 2023-05-23 11:41:59 -07:00 committed by GitHub
parent 71bf9fdcf2
commit dd1586d5d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 52 additions and 107 deletions

View file

@ -1,10 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Serilog;
namespace Dalamud.Game.ClientState.Aetherytes;
@ -15,28 +14,23 @@ namespace Dalamud.Game.ClientState.Aetherytes;
[PluginInterface]
[InterfaceVersion("1.0")]
[ServiceManager.BlockingEarlyLoadedService]
public sealed partial class AetheryteList : IServiceType
public sealed unsafe partial class AetheryteList : IServiceType
{
[ServiceManager.ServiceDependency]
private readonly ClientState clientState = Service<ClientState>.Get();
private readonly ClientStateAddressResolver address;
private readonly UpdateAetheryteListDelegate updateAetheryteListFunc;
private readonly Telepo* telepoInstance = Telepo.Instance();
[ServiceManager.ServiceConstructor]
private AetheryteList()
{
this.address = this.clientState.AddressResolver;
this.updateAetheryteListFunc = Marshal.GetDelegateForFunctionPointer<UpdateAetheryteListDelegate>(this.address.UpdateAetheryteList);
Log.Verbose($"Teleport address 0x{this.address.Telepo.ToInt64():X}");
Log.Verbose($"Teleport address 0x{((nint)this.telepoInstance).ToInt64():X}");
}
private delegate void UpdateAetheryteListDelegate(IntPtr telepo, byte arg1);
/// <summary>
/// Gets the amount of Aetherytes the local player has unlocked.
/// </summary>
public unsafe int Length
public int Length
{
get
{
@ -45,21 +39,19 @@ public sealed partial class AetheryteList : IServiceType
this.Update();
if (TelepoStruct->TeleportList.First == TelepoStruct->TeleportList.Last)
if (this.telepoInstance->TeleportList.First == this.telepoInstance->TeleportList.Last)
return 0;
return (int)TelepoStruct->TeleportList.Size();
return (int)this.telepoInstance->TeleportList.Size();
}
}
private unsafe FFXIVClientStructs.FFXIV.Client.Game.UI.Telepo* TelepoStruct => (FFXIVClientStructs.FFXIV.Client.Game.UI.Telepo*)this.address.Telepo;
/// <summary>
/// Gets a Aetheryte Entry at the specified index.
/// </summary>
/// <param name="index">Index.</param>
/// <returns>A <see cref="AetheryteEntry"/> at the specified index.</returns>
public unsafe AetheryteEntry? this[int index]
public AetheryteEntry? this[int index]
{
get
{
@ -71,7 +63,7 @@ public sealed partial class AetheryteList : IServiceType
if (this.clientState.LocalPlayer == null)
return null;
return new AetheryteEntry(TelepoStruct->TeleportList.Get((ulong)index));
return new AetheryteEntry(this.telepoInstance->TeleportList.Get((ulong)index));
}
}
@ -81,7 +73,7 @@ public sealed partial class AetheryteList : IServiceType
if (this.clientState.LocalPlayer == null)
return;
this.updateAetheryteListFunc(this.address.Telepo, 0);
this.telepoInstance->UpdateAetheryteList();
}
}