From d823db793010c672978a78b860667cc68d95724e Mon Sep 17 00:00:00 2001 From: aers Date: Fri, 31 May 2024 09:09:28 -0700 Subject: [PATCH] [apiX] first pass update for new clientstructs (#1818) * first pass update for new clientstructs * track latest clientstructs & fix compilation errors * fix GameInventory hook bug rename Appartment --- Dalamud.sln | 14 +++++++++++++ Dalamud/Dalamud.cs | 6 ++++-- Dalamud/Game/Addon/Events/AddonEventEntry.cs | 4 ++-- .../Game/Addon/Events/AddonEventListener.cs | 10 +++++----- .../Addon/Events/PluginEventController.cs | 2 +- .../Lifecycle/AddonArgTypes/AddonArgs.cs | 17 +++++++++++----- .../Game/Addon/Lifecycle/AddonLifecycle.cs | 6 +++--- .../AddonLifecycleReceiveEventListener.cs | 2 +- .../ClientState/Aetherytes/AetheryteEntry.cs | 4 ++-- .../ClientState/Aetherytes/AetheryteList.cs | 4 ++-- Dalamud/Game/ClientState/Buddy/BuddyList.cs | 7 ++++--- Dalamud/Game/ClientState/Buddy/BuddyMember.cs | 4 ++-- Dalamud/Game/ClientState/Fates/FateTable.cs | 4 ++-- .../Objects/SubKinds/PlayerCharacter.cs | 2 +- .../ClientState/Objects/Types/BattleChara.cs | 18 ++++++++--------- .../ClientState/Objects/Types/Character.cs | 6 ++++-- .../ClientState/Objects/Types/GameObject.cs | 9 +++++---- Dalamud/Game/ClientState/Party/PartyList.cs | 5 +++-- Dalamud/Game/ClientState/Party/PartyMember.cs | 4 ++-- Dalamud/Game/ClientState/Statuses/Status.cs | 6 +++--- .../Game/ClientState/Statuses/StatusList.cs | 9 +++++---- Dalamud/Game/Config/GameConfig.cs | 2 +- Dalamud/Game/Gui/ContextMenu/ContextMenu.cs | 3 ++- Dalamud/Game/Gui/ContextMenu/MenuArgs.cs | 2 +- .../Gui/ContextMenu/MenuItemClickedArgs.cs | 1 + .../Game/Gui/ContextMenu/MenuOpenedArgs.cs | 1 + Dalamud/Game/Gui/Dtr/DtrBar.cs | 18 ++++++++--------- Dalamud/Game/Gui/GameGui.cs | 5 +++-- Dalamud/Game/Inventory/GameInventory.cs | 2 +- Dalamud/Game/Inventory/GameInventoryItem.cs | 10 +++++----- .../Structures/InfoProxy/CharacterData.cs | 4 ++-- .../Interface/Internal/DalamudInterface.cs | 2 +- Dalamud/Interface/Internal/UiDebug.cs | 20 +++++++++---------- .../Windows/Data/Widgets/AddonWidget.cs | 2 +- .../Windows/Data/Widgets/AetherytesWidget.cs | 2 +- lib/FFXIVClientStructs | 2 +- 36 files changed, 126 insertions(+), 93 deletions(-) diff --git a/Dalamud.sln b/Dalamud.sln index 2d22932dd..d8a8d1d50 100644 --- a/Dalamud.sln +++ b/Dalamud.sln @@ -42,6 +42,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dalamud.Common", "Dalamud.C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dalamud.LocExporter", "tools\Dalamud.LocExporter\Dalamud.LocExporter.csproj", "{A568929D-6FF6-4DFA-9D14-5D7DC08FA5E0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InteropGenerator", "lib\FFXIVClientStructs\InteropGenerator\InteropGenerator.csproj", "{3620414C-7DFC-423E-929F-310E19F5D930}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InteropGenerator.Runtime", "lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj", "{A6AA1C3F-9470-4922-9D3F-D4549657AB22}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -108,6 +112,14 @@ Global {A568929D-6FF6-4DFA-9D14-5D7DC08FA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {A568929D-6FF6-4DFA-9D14-5D7DC08FA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {A568929D-6FF6-4DFA-9D14-5D7DC08FA5E0}.Release|Any CPU.Build.0 = Release|Any CPU + {3620414C-7DFC-423E-929F-310E19F5D930}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3620414C-7DFC-423E-929F-310E19F5D930}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3620414C-7DFC-423E-929F-310E19F5D930}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3620414C-7DFC-423E-929F-310E19F5D930}.Release|Any CPU.Build.0 = Release|Any CPU + {A6AA1C3F-9470-4922-9D3F-D4549657AB22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6AA1C3F-9470-4922-9D3F-D4549657AB22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6AA1C3F-9470-4922-9D3F-D4549657AB22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6AA1C3F-9470-4922-9D3F-D4549657AB22}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -118,6 +130,8 @@ Global {2F7FF0A8-B619-4572-86C7-71E46FE22FB8} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} {C9B87BD7-AF49-41C3-91F1-D550ADEB7833} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} {05AB2F46-268B-4915-806F-DDF813E2D59D} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} + {3620414C-7DFC-423E-929F-310E19F5D930} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} + {A6AA1C3F-9470-4922-9D3F-D4549657AB22} = {E15BDA6D-E881-4482-94BA-BE5527E917FF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599} diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index e44016dc6..1c9e14e6d 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -211,8 +211,10 @@ internal sealed class Dalamud : IServiceType { using (Timings.Start("CS Resolver Init")) { - FFXIVClientStructs.Interop.Resolver.GetInstance.SetupSearchSpace(Service.Get().SearchBase, new FileInfo(Path.Combine(cacheDir.FullName, $"{this.StartInfo.GameVersion}_cs.json"))); - FFXIVClientStructs.Interop.Resolver.GetInstance.Resolve(); + // the resolver tracks version as a field in the json + InteropGenerator.Runtime.Resolver.GetInstance.Setup(Service.Get().SearchBase, $"{this.StartInfo.GameVersion}", new FileInfo(Path.Combine(cacheDir.FullName, "cs.json"))); + FFXIVClientStructs.Interop.Generated.Addresses.Register(); + InteropGenerator.Runtime.Resolver.GetInstance.Resolve(); } } } diff --git a/Dalamud/Game/Addon/Events/AddonEventEntry.cs b/Dalamud/Game/Addon/Events/AddonEventEntry.cs index a7430acf0..cf160bf6c 100644 --- a/Dalamud/Game/Addon/Events/AddonEventEntry.cs +++ b/Dalamud/Game/Addon/Events/AddonEventEntry.cs @@ -21,11 +21,11 @@ internal unsafe class AddonEventEntry /// Gets the pointer to the addons AtkUnitBase. /// required public nint Addon { get; init; } - + /// /// Gets the name of the addon this args referrers to. /// - public string AddonName => this.Addon == nint.Zero ? InvalidAddonName : this.addonName ??= MemoryHelper.ReadString((nint)((AtkUnitBase*)this.Addon)->Name, 0x20); + public string AddonName => this.Addon == nint.Zero ? InvalidAddonName : this.addonName ??= ((AtkUnitBase*)this.Addon)->NameString; /// /// Gets the pointer to the event source. diff --git a/Dalamud/Game/Addon/Events/AddonEventListener.cs b/Dalamud/Game/Addon/Events/AddonEventListener.cs index a2498d5a7..15c33e0ab 100644 --- a/Dalamud/Game/Addon/Events/AddonEventListener.cs +++ b/Dalamud/Game/Addon/Events/AddonEventListener.cs @@ -23,10 +23,10 @@ internal unsafe class AddonEventListener : IDisposable this.receiveEventDelegate = eventHandler; this.eventListener = (AtkEventListener*)Marshal.AllocHGlobal(sizeof(AtkEventListener)); - this.eventListener->vtbl = (void*)Marshal.AllocHGlobal(sizeof(void*) * 3); - this.eventListener->vfunc[0] = (delegate* unmanaged)&NullSub; - this.eventListener->vfunc[1] = (delegate* unmanaged)&NullSub; - this.eventListener->vfunc[2] = (void*)Marshal.GetFunctionPointerForDelegate(this.receiveEventDelegate); + this.eventListener->VirtualTable = (AtkEventListener.AtkEventListenerVirtualTable*)Marshal.AllocHGlobal(sizeof(void*) * 3); + this.eventListener->VirtualTable->Dtor = (delegate* unmanaged)(delegate* unmanaged)&NullSub; + this.eventListener->VirtualTable->ReceiveGlobalEvent = (delegate* unmanaged)(delegate* unmanaged)&NullSub; + this.eventListener->VirtualTable->ReceiveEvent = (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.receiveEventDelegate); } /// @@ -49,7 +49,7 @@ internal unsafe class AddonEventListener : IDisposable { if (this.eventListener is null) return; - Marshal.FreeHGlobal((nint)this.eventListener->vtbl); + Marshal.FreeHGlobal((nint)this.eventListener->VirtualTable); Marshal.FreeHGlobal((nint)this.eventListener); this.eventListener = null; diff --git a/Dalamud/Game/Addon/Events/PluginEventController.cs b/Dalamud/Game/Addon/Events/PluginEventController.cs index 4c125cec3..a0461ea99 100644 --- a/Dalamud/Game/Addon/Events/PluginEventController.cs +++ b/Dalamud/Game/Addon/Events/PluginEventController.cs @@ -47,7 +47,7 @@ internal unsafe class PluginEventController : IDisposable var eventHandle = new AddonEventHandle { - AddonName = MemoryHelper.ReadStringNullTerminated((nint)addon->Name), + AddonName = addon->NameString, ParamKey = eventId, EventType = atkEventType, EventGuid = eventGuid, diff --git a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs index 1095202cc..36083337e 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonArgTypes/AddonArgs.cs @@ -1,4 +1,6 @@ -using Dalamud.Memory; +using System.Runtime.CompilerServices; + +using Dalamud.Memory; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -64,9 +66,14 @@ public abstract unsafe class AddonArgs return false; var addonPointer = (AtkUnitBase*)this.Addon; - if (addonPointer->Name is null) return false; + if (addonPointer->Name[0] == 0) return false; - return MemoryHelper.EqualsZeroTerminatedString(name, (nint)addonPointer->Name, null, 0x20); + // note: might want to rewrite this to just compare to NameString + return MemoryHelper.EqualsZeroTerminatedString( + name, + (nint)Unsafe.AsPointer(ref addonPointer->Name[0]), + null, + 0x20); } /// @@ -78,8 +85,8 @@ public abstract unsafe class AddonArgs if (this.Addon == nint.Zero) return InvalidAddon; var addonPointer = (AtkUnitBase*)this.Addon; - if (addonPointer->Name is null) return InvalidAddon; + if (addonPointer->Name[0] == 0) return InvalidAddon; - return this.addonName ??= MemoryHelper.ReadString((nint)addonPointer->Name, 0x20); + return this.addonName ??= addonPointer->NameString; } } diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs index 70e7b7f9d..169851519 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycle.cs @@ -194,8 +194,8 @@ internal unsafe class AddonLifecycle : IInternalDisposableService { // Hook the addon's ReceiveEvent function here, but only enable the hook if we have an active listener. // Disallows hooking the core internal event handler. - var addonName = MemoryHelper.ReadStringNullTerminated((nint)addon->Name); - var receiveEventAddress = (nint)addon->VTable->ReceiveEvent; + var addonName = addon->NameString; + var receiveEventAddress = (nint)addon->VirtualTable->ReceiveEvent; if (receiveEventAddress != this.disallowedReceiveEventAddress) { // If we have a ReceiveEvent listener already made for this hook address, add this addon's name to that handler. @@ -275,7 +275,7 @@ internal unsafe class AddonLifecycle : IInternalDisposableService { try { - var addonName = MemoryHelper.ReadStringNullTerminated((nint)atkUnitBase[0]->Name); + var addonName = atkUnitBase[0]->NameString; this.UnregisterReceiveEventHook(addonName); } catch (Exception e) diff --git a/Dalamud/Game/Addon/Lifecycle/AddonLifecycleReceiveEventListener.cs b/Dalamud/Game/Addon/Lifecycle/AddonLifecycleReceiveEventListener.cs index 7953ea27a..90a8eb844 100644 --- a/Dalamud/Game/Addon/Lifecycle/AddonLifecycleReceiveEventListener.cs +++ b/Dalamud/Game/Addon/Lifecycle/AddonLifecycleReceiveEventListener.cs @@ -72,7 +72,7 @@ internal unsafe class AddonLifecycleReceiveEventListener : IDisposable private void OnReceiveEvent(AtkUnitBase* addon, AtkEventType eventType, int eventParam, AtkEvent* atkEvent, nint data) { // Check that we didn't get here through a call to another addons handler. - var addonName = MemoryHelper.ReadString((nint)addon->Name, 0x20); + var addonName = addon->NameString; if (!this.AddonNames.Contains(addonName)) { this.Hook!.Original(addon, eventType, eventParam, atkEvent, data); diff --git a/Dalamud/Game/ClientState/Aetherytes/AetheryteEntry.cs b/Dalamud/Game/ClientState/Aetherytes/AetheryteEntry.cs index 8113e0593..1c169d37a 100644 --- a/Dalamud/Game/ClientState/Aetherytes/AetheryteEntry.cs +++ b/Dalamud/Game/ClientState/Aetherytes/AetheryteEntry.cs @@ -60,9 +60,9 @@ public sealed class AetheryteEntry public bool IsSharedHouse => this.data.IsSharedHouse; /// - /// Gets a value indicating whether this Aetheryte is an Appartment or not. + /// Gets a value indicating whether this Aetheryte is an Apartment or not. /// - public bool IsAppartment => this.data.IsAppartment; + public bool IsApartment => this.data.IsApartment; /// /// Gets the Aetheryte data related to this aetheryte. diff --git a/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs b/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs index b3bfe3f06..4793bcea5 100644 --- a/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs +++ b/Dalamud/Game/ClientState/Aetherytes/AetheryteList.cs @@ -45,7 +45,7 @@ internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteLis if (this.telepoInstance->TeleportList.First == this.telepoInstance->TeleportList.Last) return 0; - return (int)this.telepoInstance->TeleportList.Size(); + return this.telepoInstance->TeleportList.Count; } } @@ -62,7 +62,7 @@ internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteLis if (this.clientState.LocalPlayer == null) return null; - return new AetheryteEntry(this.telepoInstance->TeleportList.Get((ulong)index)); + return new AetheryteEntry(this.telepoInstance->TeleportList[index]); } } diff --git a/Dalamud/Game/ClientState/Buddy/BuddyList.cs b/Dalamud/Game/ClientState/Buddy/BuddyList.cs index 91a201090..9719b0cb3 100644 --- a/Dalamud/Game/ClientState/Buddy/BuddyList.cs +++ b/Dalamud/Game/ClientState/Buddy/BuddyList.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Dalamud.IoC; @@ -97,13 +98,13 @@ internal sealed partial class BuddyList : IServiceType, IBuddyList /// public unsafe IntPtr GetCompanionBuddyMemberAddress() { - return (IntPtr)(&this.BuddyListStruct->Companion); + return (IntPtr)this.BuddyListStruct->CompanionInfo.Companion; } /// public unsafe IntPtr GetPetBuddyMemberAddress() { - return (IntPtr)(&this.BuddyListStruct->Pet); + return (IntPtr)this.BuddyListStruct->PetInfo.Pet; } /// @@ -112,7 +113,7 @@ internal sealed partial class BuddyList : IServiceType, IBuddyList if (index < 0 || index >= 3) return IntPtr.Zero; - return (IntPtr)(this.BuddyListStruct->BattleBuddies + (index * BuddyMemberSize)); + return (IntPtr)Unsafe.AsPointer(ref this.BuddyListStruct->BattleBuddies[index]); } /// diff --git a/Dalamud/Game/ClientState/Buddy/BuddyMember.cs b/Dalamud/Game/ClientState/Buddy/BuddyMember.cs index b075b0453..571a0ecd9 100644 --- a/Dalamud/Game/ClientState/Buddy/BuddyMember.cs +++ b/Dalamud/Game/ClientState/Buddy/BuddyMember.cs @@ -29,7 +29,7 @@ public unsafe class BuddyMember /// /// Gets the object ID of this buddy. /// - public uint ObjectId => this.Struct->ObjectID; + public uint ObjectId => this.Struct->ObjectId; /// /// Gets the actor associated with this buddy. @@ -52,7 +52,7 @@ public unsafe class BuddyMember /// /// Gets the data ID of this buddy. /// - public uint DataID => this.Struct->DataID; + public uint DataID => this.Struct->DataId; /// /// Gets the Mount data related to this buddy. It should only be used with companion buddies. diff --git a/Dalamud/Game/ClientState/Fates/FateTable.cs b/Dalamud/Game/ClientState/Fates/FateTable.cs index 288bcb947..0f8693d4d 100644 --- a/Dalamud/Game/ClientState/Fates/FateTable.cs +++ b/Dalamud/Game/ClientState/Fates/FateTable.cs @@ -49,7 +49,7 @@ internal sealed partial class FateTable : IServiceType, IFateTable if (Struct->Fates.First == null || Struct->Fates.Last == null) return 0; - return (int)Struct->Fates.Size(); + return Struct->Fates.Count; } } @@ -89,7 +89,7 @@ internal sealed partial class FateTable : IServiceType, IFateTable if (fateTable == IntPtr.Zero) return IntPtr.Zero; - return (IntPtr)this.Struct->Fates.Get((ulong)index).Value; + return (IntPtr)this.Struct->Fates[index].Value; } /// diff --git a/Dalamud/Game/ClientState/Objects/SubKinds/PlayerCharacter.cs b/Dalamud/Game/ClientState/Objects/SubKinds/PlayerCharacter.cs index 407aada26..5c1061e7d 100644 --- a/Dalamud/Game/ClientState/Objects/SubKinds/PlayerCharacter.cs +++ b/Dalamud/Game/ClientState/Objects/SubKinds/PlayerCharacter.cs @@ -31,5 +31,5 @@ public unsafe class PlayerCharacter : BattleChara /// /// Gets the target actor ID of the PlayerCharacter. /// - public override ulong TargetObjectId => this.Struct->Character.Gaze.Controller.GazesSpan[0].TargetInfo.TargetId; + public override ulong TargetObjectId => this.Struct->Character.Gaze.Controller.Gazes[0].TargetInfo.TargetId; } diff --git a/Dalamud/Game/ClientState/Objects/Types/BattleChara.cs b/Dalamud/Game/ClientState/Objects/Types/BattleChara.cs index a95d32da0..49863b0f9 100644 --- a/Dalamud/Game/ClientState/Objects/Types/BattleChara.cs +++ b/Dalamud/Game/ClientState/Objects/Types/BattleChara.cs @@ -21,37 +21,37 @@ public unsafe class BattleChara : Character /// /// Gets the current status effects. /// - public StatusList StatusList => new(this.Struct->GetStatusManager); + public StatusList StatusList => new(this.Struct->GetStatusManager()); /// /// Gets a value indicating whether the chara is currently casting. /// - public bool IsCasting => this.Struct->GetCastInfo->IsCasting > 0; + public bool IsCasting => this.Struct->GetCastInfo()->IsCasting > 0; /// /// Gets a value indicating whether the cast is interruptible. /// - public bool IsCastInterruptible => this.Struct->GetCastInfo->Interruptible > 0; + public bool IsCastInterruptible => this.Struct->GetCastInfo()->Interruptible > 0; /// /// Gets the spell action type of the spell being cast by the actor. /// - public byte CastActionType => (byte)this.Struct->GetCastInfo->ActionType; + public byte CastActionType => (byte)this.Struct->GetCastInfo()->ActionType; /// /// Gets the spell action ID of the spell being cast by the actor. /// - public uint CastActionId => this.Struct->GetCastInfo->ActionID; + public uint CastActionId => this.Struct->GetCastInfo()->ActionId; /// /// Gets the object ID of the target currently being cast at by the chara. /// - public uint CastTargetObjectId => this.Struct->GetCastInfo->CastTargetID; + public uint CastTargetObjectId => this.Struct->GetCastInfo()->CastTargetId; /// /// Gets the current casting time of the spell being cast by the chara. /// - public float CurrentCastTime => this.Struct->GetCastInfo->CurrentCastTime; + public float CurrentCastTime => this.Struct->GetCastInfo()->CurrentCastTime; /// /// Gets the total casting time of the spell being cast by the chara. @@ -61,7 +61,7 @@ public unsafe class BattleChara : Character /// Use AdjustedTotalCastTime if you always need the total cast time. /// [Api10ToDo("Rename so it is not confused with AdjustedTotalCastTime")] - public float TotalCastTime => this.Struct->GetCastInfo->TotalCastTime; + public float TotalCastTime => this.Struct->GetCastInfo()->TotalCastTime; /// /// Gets the plus any adjustments from the game, such as Action offset 2B. Used for display purposes. @@ -70,7 +70,7 @@ public unsafe class BattleChara : Character /// This is the actual total cast time for all actions. /// [Api10ToDo("Rename so it is not confused with TotalCastTime")] - public float AdjustedTotalCastTime => this.Struct->GetCastInfo->AdjustedTotalCastTime; + public float AdjustedTotalCastTime => this.Struct->GetCastInfo()->AdjustedTotalCastTime; /// /// Gets the underlying structure. diff --git a/Dalamud/Game/ClientState/Objects/Types/Character.cs b/Dalamud/Game/ClientState/Objects/Types/Character.cs index ac11bcdd0..ea90aac5f 100644 --- a/Dalamud/Game/ClientState/Objects/Types/Character.cs +++ b/Dalamud/Game/ClientState/Objects/Types/Character.cs @@ -1,3 +1,5 @@ +using System.Runtime.CompilerServices; + using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Resolvers; using Dalamud.Game.Text.SeStringHandling; @@ -85,7 +87,7 @@ public unsafe class Character : GameObject /// /// Gets the Free Company tag of this chara. /// - public SeString CompanyTag => MemoryHelper.ReadSeString((IntPtr)this.Struct->FreeCompanyTag, 6); + public SeString CompanyTag => MemoryHelper.ReadSeString((nint)Unsafe.AsPointer(ref this.Struct->FreeCompanyTag[0]), 6); /// /// Gets the target object ID of the character. @@ -95,7 +97,7 @@ public unsafe class Character : GameObject /// /// Gets the name ID of the character. /// - public uint NameId => this.Struct->NameID; + public uint NameId => this.Struct->NameId; /// /// Gets the current online status of the character. diff --git a/Dalamud/Game/ClientState/Objects/Types/GameObject.cs b/Dalamud/Game/ClientState/Objects/Types/GameObject.cs index 5ec2be758..8e0eae83d 100644 --- a/Dalamud/Game/ClientState/Objects/Types/GameObject.cs +++ b/Dalamud/Game/ClientState/Objects/Types/GameObject.cs @@ -1,4 +1,5 @@ using System.Numerics; +using System.Runtime.CompilerServices; using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.Text.SeStringHandling; @@ -95,22 +96,22 @@ public unsafe partial class GameObject /// /// Gets the name of this . /// - public SeString Name => MemoryHelper.ReadSeString((IntPtr)this.Struct->Name, 64); + public SeString Name => MemoryHelper.ReadSeString((nint)Unsafe.AsPointer(ref this.Struct->Name[0]), 64); /// /// Gets the object ID of this . /// - public uint ObjectId => this.Struct->ObjectID; + public uint ObjectId => this.Struct->EntityId; /// /// Gets the data ID for linking to other respective game data. /// - public uint DataId => this.Struct->DataID; + public uint DataId => this.Struct->BaseId; /// /// Gets the ID of this GameObject's owner. /// - public uint OwnerId => this.Struct->OwnerID; + public uint OwnerId => this.Struct->OwnerId; /// /// Gets the index of this object in the object table. diff --git a/Dalamud/Game/ClientState/Party/PartyList.cs b/Dalamud/Game/ClientState/Party/PartyList.cs index 53e3d2a4e..835a84865 100644 --- a/Dalamud/Game/ClientState/Party/PartyList.cs +++ b/Dalamud/Game/ClientState/Party/PartyList.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Dalamud.IoC; @@ -50,10 +51,10 @@ internal sealed unsafe partial class PartyList : IServiceType, IPartyList public IntPtr GroupManagerAddress => this.address.GroupManager; /// - public IntPtr GroupListAddress => (IntPtr)GroupManagerStruct->PartyMembers; + public IntPtr GroupListAddress => (IntPtr)Unsafe.AsPointer(ref GroupManagerStruct->PartyMembers[0]); /// - public IntPtr AllianceListAddress => (IntPtr)this.GroupManagerStruct->AllianceMembers; + public IntPtr AllianceListAddress => (IntPtr)Unsafe.AsPointer(ref this.GroupManagerStruct->AllianceMembers[0]); /// public long PartyId => this.GroupManagerStruct->PartyId; diff --git a/Dalamud/Game/ClientState/Party/PartyMember.cs b/Dalamud/Game/ClientState/Party/PartyMember.cs index 9da2e2539..fac8d55b3 100644 --- a/Dalamud/Game/ClientState/Party/PartyMember.cs +++ b/Dalamud/Game/ClientState/Party/PartyMember.cs @@ -41,12 +41,12 @@ public unsafe class PartyMember /// /// Gets the content ID of the party member. /// - public long ContentId => this.Struct->ContentID; + public long ContentId => this.Struct->ContentId; /// /// Gets the actor ID of this party member. /// - public uint ObjectId => this.Struct->ObjectID; + public uint ObjectId => this.Struct->ObjectId; /// /// Gets the actor associated with this buddy. diff --git a/Dalamud/Game/ClientState/Statuses/Status.cs b/Dalamud/Game/ClientState/Statuses/Status.cs index b40786fe9..3c405601e 100644 --- a/Dalamud/Game/ClientState/Statuses/Status.cs +++ b/Dalamud/Game/ClientState/Statuses/Status.cs @@ -26,12 +26,12 @@ public unsafe class Status /// /// Gets the status ID of this status. /// - public uint StatusId => this.Struct->StatusID; + public uint StatusId => this.Struct->StatusId; /// /// Gets the GameData associated with this status. /// - public Lumina.Excel.GeneratedSheets.Status GameData => new ExcelResolver(this.Struct->StatusID).GameData; + public Lumina.Excel.GeneratedSheets.Status GameData => new ExcelResolver(this.Struct->StatusId).GameData; /// /// Gets the parameter value of the status. @@ -51,7 +51,7 @@ public unsafe class Status /// /// Gets the source ID of this status. /// - public uint SourceId => this.Struct->SourceID; + public uint SourceId => this.Struct->SourceId; /// /// Gets the source actor associated with this status. diff --git a/Dalamud/Game/ClientState/Statuses/StatusList.cs b/Dalamud/Game/ClientState/Statuses/StatusList.cs index aac35948e..a38e45ea3 100644 --- a/Dalamud/Game/ClientState/Statuses/StatusList.cs +++ b/Dalamud/Game/ClientState/Statuses/StatusList.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Dalamud.Game.ClientState.Statuses; @@ -98,16 +99,16 @@ public sealed unsafe partial class StatusList } /// - /// Gets the address of the party member at the specified index of the party list. + /// Gets the address of the status at the specific index in the status list. /// - /// The index of the party member. - /// The memory address of the party member. + /// The index of the status. + /// The memory address of the status. public IntPtr GetStatusAddress(int index) { if (index < 0 || index >= this.Length) return IntPtr.Zero; - return (IntPtr)(this.Struct->Status + (index * StatusSize)); + return (IntPtr)Unsafe.AsPointer(ref this.Struct->Status[index]); } } diff --git a/Dalamud/Game/Config/GameConfig.cs b/Dalamud/Game/Config/GameConfig.cs index 7bcb8ba2b..b45a1ee7b 100644 --- a/Dalamud/Game/Config/GameConfig.cs +++ b/Dalamud/Game/Config/GameConfig.cs @@ -34,7 +34,7 @@ internal sealed class GameConfig : IInternalDisposableService, IGameConfig { Log.Verbose("[GameConfig] Initializing"); var csFramework = FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance(); - var commonConfig = &csFramework->SystemConfig.CommonSystemConfig; + var commonConfig = &csFramework->SystemConfig.SystemConfigBase; this.tcsSystem.SetResult(new("System", framework, &commonConfig->ConfigBase)); this.tcsUiConfig.SetResult(new("UiConfig", framework, &commonConfig->UiConfig)); this.tcsUiControl.SetResult( diff --git a/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs b/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs index 1bd8ce882..17578bdfe 100644 --- a/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs +++ b/Dalamud/Game/Gui/ContextMenu/ContextMenu.cs @@ -17,6 +17,7 @@ using FFXIVClientStructs.FFXIV.Client.System.Memory; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; +using FFXIVClientStructs.FFXIV.Component.GUI.AtkModuleInterface; using FFXIVClientStructs.Interop; using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; @@ -40,7 +41,7 @@ internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextM private ContextMenu() { this.raptureAtkModuleOpenAddonByAgentHook = Hook.FromAddress((nint)RaptureAtkModule.Addresses.OpenAddonByAgent.Value, this.RaptureAtkModuleOpenAddonByAgentDetour); - this.addonContextMenuOnMenuSelectedHook = Hook.FromAddress((nint)AddonContextMenu.StaticVTable.OnMenuSelected, this.AddonContextMenuOnMenuSelectedDetour); + this.addonContextMenuOnMenuSelectedHook = Hook.FromAddress((nint)AddonContextMenu.StaticVirtualTablePointer->OnMenuSelected, this.AddonContextMenuOnMenuSelectedDetour); this.raptureAtkModuleOpenAddon = Marshal.GetDelegateForFunctionPointer((nint)RaptureAtkModule.Addresses.OpenAddon.Value); this.raptureAtkModuleOpenAddonByAgentHook.Enable(); diff --git a/Dalamud/Game/Gui/ContextMenu/MenuArgs.cs b/Dalamud/Game/Gui/ContextMenu/MenuArgs.cs index cc58a839b..4691f9dd2 100644 --- a/Dalamud/Game/Gui/ContextMenu/MenuArgs.cs +++ b/Dalamud/Game/Gui/ContextMenu/MenuArgs.cs @@ -24,7 +24,7 @@ public abstract unsafe class MenuArgs /// List of AtkEventInterfaces associated with the context menu. protected internal MenuArgs(AtkUnitBase* addon, AgentInterface* agent, ContextMenuType type, IReadOnlySet? eventInterfaces) { - this.AddonName = addon != null ? MemoryHelper.ReadString((nint)addon->Name, 32) : null; + this.AddonName = addon != null ? addon->NameString : null; this.AddonPtr = (nint)addon; this.AgentPtr = (nint)agent; this.MenuType = type; diff --git a/Dalamud/Game/Gui/ContextMenu/MenuItemClickedArgs.cs b/Dalamud/Game/Gui/ContextMenu/MenuItemClickedArgs.cs index bec16590d..ded1475f0 100644 --- a/Dalamud/Game/Gui/ContextMenu/MenuItemClickedArgs.cs +++ b/Dalamud/Game/Gui/ContextMenu/MenuItemClickedArgs.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Dalamud.Game.Text.SeStringHandling; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; namespace Dalamud.Game.Gui.ContextMenu; diff --git a/Dalamud/Game/Gui/ContextMenu/MenuOpenedArgs.cs b/Dalamud/Game/Gui/ContextMenu/MenuOpenedArgs.cs index de3347f63..c5e6a7ade 100644 --- a/Dalamud/Game/Gui/ContextMenu/MenuOpenedArgs.cs +++ b/Dalamud/Game/Gui/ContextMenu/MenuOpenedArgs.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; namespace Dalamud.Game.Gui.ContextMenu; diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs index 5c92a721a..0c116f8e1 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBar.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs @@ -276,7 +276,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar var node = addon->UldManager.NodeList[index]; if (node->IsVisible) { - var nodeId = node->NodeID; + var nodeId = node->NodeId; var nodeType = node->Type; if (nodeType == NodeType.Collision) @@ -330,7 +330,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar for (var i = 0; i < dtr->UldManager.NodeListCount; i++) { - if (dtr->UldManager.NodeList[i]->NodeID > 1000) + if (dtr->UldManager.NodeList[i]->NodeId > 1000) return true; } @@ -357,8 +357,8 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar var dtr = this.GetDtr(); if (dtr == null || dtr->RootNode == null || dtr->UldManager.NodeList == null || node == null) return false; - this.eventHandles.TryAdd(node->AtkResNode.NodeID, new List()); - this.eventHandles[node->AtkResNode.NodeID].AddRange(new List + this.eventHandles.TryAdd(node->AtkResNode.NodeId, new List()); + this.eventHandles[node->AtkResNode.NodeId].AddRange(new List { this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOver, this.DtrEventHandler), this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOut, this.DtrEventHandler), @@ -386,8 +386,8 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar var dtr = this.GetDtr(); if (dtr == null || dtr->RootNode == null || dtr->UldManager.NodeList == null || node == null) return; - this.eventHandles[node->AtkResNode.NodeID].ForEach(handle => this.uiEventManager.RemoveEvent(AddonEventManager.DalamudInternalKey, handle)); - this.eventHandles[node->AtkResNode.NodeID].Clear(); + this.eventHandles[node->AtkResNode.NodeId].ForEach(handle => this.uiEventManager.RemoveEvent(AddonEventManager.DalamudInternalKey, handle)); + this.eventHandles[node->AtkResNode.NodeId].Clear(); var tmpPrevNode = node->AtkResNode.PrevSiblingNode; var tmpNextNode = node->AtkResNode.NextSiblingNode; @@ -414,7 +414,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar return null; } - newTextNode->AtkResNode.NodeID = nodeId; + newTextNode->AtkResNode.NodeId = nodeId; newTextNode->AtkResNode.Type = NodeType.Text; newTextNode->AtkResNode.NodeFlags = NodeFlags.AnchorLeft | NodeFlags.AnchorTop | NodeFlags.Enabled | NodeFlags.RespondToMouse | NodeFlags.HasCollision | NodeFlags.EmitsEvents; newTextNode->AtkResNode.DrawFlags = 12; @@ -459,11 +459,11 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar switch (atkEventType) { case AddonEventType.MouseOver: - AtkStage.GetSingleton()->TooltipManager.ShowTooltip(addon->ID, node, dtrBarEntry.Tooltip.Encode()); + AtkStage.GetSingleton()->TooltipManager.ShowTooltip(addon->Id, node, dtrBarEntry.Tooltip.Encode()); break; case AddonEventType.MouseOut: - AtkStage.GetSingleton()->TooltipManager.HideTooltip(addon->ID); + AtkStage.GetSingleton()->TooltipManager.HideTooltip(addon->Id); break; } } diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs index bdc483655..32d1d7606 100644 --- a/Dalamud/Game/Gui/GameGui.cs +++ b/Dalamud/Game/Gui/GameGui.cs @@ -12,6 +12,7 @@ using Dalamud.Utility; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.UI; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Common.Component.BGCollision; using FFXIVClientStructs.FFXIV.Component.GUI; using ImGuiNET; @@ -322,7 +323,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui return IntPtr.Zero; var addon = (AtkUnitBase*)addonPtr; - var addonId = addon->ParentID == 0 ? addon->ID : addon->ParentID; + var addonId = addon->ParentId == 0 ? addon->Id : addon->ParentId; if (addonId == 0) return IntPtr.Zero; @@ -330,7 +331,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui var index = 0; while (true) { - var agent = agentModule->GetAgentByInternalID((uint)index++); + var agent = agentModule->GetAgentByInternalId((AgentId)index++); if (agent == uiModule || agent == null) break; diff --git a/Dalamud/Game/Inventory/GameInventory.cs b/Dalamud/Game/Inventory/GameInventory.cs index dde0e3614..985104450 100644 --- a/Dalamud/Game/Inventory/GameInventory.cs +++ b/Dalamud/Game/Inventory/GameInventory.cs @@ -51,7 +51,7 @@ internal class GameInventory : IInternalDisposableService unsafe { this.raptureAtkModuleUpdateHook = Hook.FromFunctionPointerVariable( - new(&((RaptureAtkModule.RaptureAtkModuleVTable*)RaptureAtkModule.StaticAddressPointers.VTable)->Update), + new(&RaptureAtkModule.StaticVirtualTablePointer->Update), this.RaptureAtkModuleUpdateDetour); } diff --git a/Dalamud/Game/Inventory/GameInventoryItem.cs b/Dalamud/Game/Inventory/GameInventoryItem.cs index 877fd26c6..31ace0e0b 100644 --- a/Dalamud/Game/Inventory/GameInventoryItem.cs +++ b/Dalamud/Game/Inventory/GameInventoryItem.cs @@ -46,7 +46,7 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets a value indicating whether the this is empty. /// - public bool IsEmpty => this.InternalItem.ItemID == 0; + public bool IsEmpty => this.InternalItem.ItemId == 0; /// /// Gets the container inventory type. @@ -61,7 +61,7 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets the item id. /// - public uint ItemId => this.InternalItem.ItemID; + public uint ItemId => this.InternalItem.ItemId; /// /// Gets the quantity of items in this item stack. @@ -81,7 +81,7 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets a value indicating whether the item is High Quality. /// - public bool IsHq => (this.InternalItem.Flags & InventoryItem.ItemFlags.HQ) != 0; + public bool IsHq => (this.InternalItem.Flags & InventoryItem.ItemFlags.HighQuality) != 0; /// /// Gets a value indicating whether the item has a company crest applied. @@ -141,13 +141,13 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets the glamour id for this item. /// - public uint GlamourId => this.InternalItem.GlamourID; + public uint GlamourId => this.InternalItem.GlamourId; /// /// Gets the items crafter's content id. /// NOTE: I'm not sure if this is a good idea to include or not in the dalamud api. Marked internal for now. /// - internal ulong CrafterContentId => this.InternalItem.CrafterContentID; + internal ulong CrafterContentId => this.InternalItem.CrafterContentId; public static bool operator ==(in GameInventoryItem l, in GameInventoryItem r) => l.Equals(r); diff --git a/Dalamud/Game/Network/Structures/InfoProxy/CharacterData.cs b/Dalamud/Game/Network/Structures/InfoProxy/CharacterData.cs index 0ca35d672..25952db35 100644 --- a/Dalamud/Game/Network/Structures/InfoProxy/CharacterData.cs +++ b/Dalamud/Game/Network/Structures/InfoProxy/CharacterData.cs @@ -132,12 +132,12 @@ public unsafe class CharacterData /// /// Gets the name of the character. /// - public string Name => MemoryHelper.ReadString((nint)this.Struct->Name, 32); + public string Name => this.Struct->NameString; /// /// Gets the free company tag of the character. /// - public string FCTag => MemoryHelper.ReadString((nint)this.Struct->Name, 6); + public string FCTag => this.Struct->FCTagString; /// /// Gets the underlying struct. diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 54c5e1ba9..06795aa53 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -779,7 +779,7 @@ internal class DalamudInterface : IInternalDisposableService unsafe { var hook = Hook.FromAddress( - (nint)UIModule.StaticVTable.GetUIInputData, + (nint)UIModule.StaticVirtualTablePointer->GetUIInputData, self => { _ = *(byte*)0; diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs index e5e99f6d4..562693de0 100644 --- a/Dalamud/Interface/Internal/UiDebug.cs +++ b/Dalamud/Interface/Internal/UiDebug.cs @@ -80,7 +80,7 @@ internal unsafe class UiDebug private void DrawUnitBase(AtkUnitBase* atkUnitBase) { var isVisible = (atkUnitBase->Flags & 0x20) == 0x20; - var addonName = MemoryHelper.ReadSeStringAsString(out _, new IntPtr(atkUnitBase->Name)); + var addonName = atkUnitBase->NameString; var agent = Service.Get().FindAgentInterface(atkUnitBase); ImGui.Text($"{addonName}"); @@ -352,11 +352,11 @@ internal unsafe class UiDebug var textInputComponent = (AtkComponentTextInput*)compNode->Component; ImGui.Text($"InputBase Text1: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->AtkComponentInputBase.UnkText1.StringPtr))}"); ImGui.Text($"InputBase Text2: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->AtkComponentInputBase.UnkText2.StringPtr))}"); - ImGui.Text($"Text1: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText1.StringPtr))}"); - ImGui.Text($"Text2: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText2.StringPtr))}"); - ImGui.Text($"Text3: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText3.StringPtr))}"); - ImGui.Text($"Text4: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText4.StringPtr))}"); - ImGui.Text($"Text5: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText5.StringPtr))}"); + ImGui.Text($"Text1: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText01.StringPtr))}"); + ImGui.Text($"Text2: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText02.StringPtr))}"); + ImGui.Text($"Text3: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText03.StringPtr))}"); + ImGui.Text($"Text4: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText04.StringPtr))}"); + ImGui.Text($"Text5: {MemoryHelper.ReadSeStringAsString(out _, new IntPtr(textInputComponent->UnkText05.StringPtr))}"); break; } @@ -390,7 +390,7 @@ internal unsafe class UiDebug private void PrintResNode(AtkResNode* node) { - ImGui.Text($"NodeID: {node->NodeID}"); + ImGui.Text($"NodeID: {node->NodeId}"); ImGui.SameLine(); if (ImGui.SmallButton($"T:Visible##{(ulong)node:X}")) { @@ -465,14 +465,14 @@ internal unsafe class UiDebug for (var j = 0; j < unitManager->Count && headerOpen; j++) { - var unitBase = *(AtkUnitBase**)Unsafe.AsPointer(ref unitManager->EntriesSpan[j]); + AtkUnitBase* unitBase = unitManager->Entries[j]; if (this.selectedUnitBase != null && unitBase == this.selectedUnitBase) { this.selectedInList[i] = true; foundSelected = true; } - var name = MemoryHelper.ReadSeStringAsString(out _, new IntPtr(unitBase->Name)); + var name = unitBase->NameString; if (searching) { if (name == null || !name.ToLower().Contains(searchStr.ToLower())) continue; @@ -510,7 +510,7 @@ internal unsafe class UiDebug { for (var j = 0; j < unitManager->Count; j++) { - var unitBase = *(AtkUnitBase**)Unsafe.AsPointer(ref unitManager->EntriesSpan[j]); + AtkUnitBase* unitBase = unitManager->Entries[j]; if (this.selectedUnitBase == null || unitBase != this.selectedUnitBase) continue; this.selectedInList[i] = true; foundSelected = true; diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs index 1056b434e..cf4979368 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs @@ -49,7 +49,7 @@ internal unsafe class AddonWidget : IDataWindowWidget } var addon = (FFXIVClientStructs.FFXIV.Component.GUI.AtkUnitBase*)address; - var name = MemoryHelper.ReadStringNullTerminated((nint)addon->Name); + var name = addon->NameString; ImGui.TextUnformatted($"{name} - 0x{address.ToInt64():X}\n v:{addon->IsVisible} x:{addon->X} y:{addon->Y} s:{addon->Scale}, w:{addon->RootNode->Width}, h:{addon->RootNode->Height}"); if (ImGui.Button("Find Agent")) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs index 0efe1ae4c..606c49c49 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AetherytesWidget.cs @@ -83,7 +83,7 @@ internal class AetherytesWidget : IDataWindowWidget ImGui.TextUnformatted($"{info.IsSharedHouse}"); ImGui.TableNextColumn(); // Apartment - ImGui.TextUnformatted($"{info.IsAppartment}"); + ImGui.TextUnformatted($"{info.IsApartment}"); } ImGui.EndTable(); diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index b7a834e78..7e59f75b2 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit b7a834e78fd7250023c3f70c5717c28b01d18acc +Subproject commit 7e59f75b210593c4a1bdba8a296a08c3c40d05af