[apiX] dalamud fixes for CS updates (#1821)

* update CS & fix compilation issues

* update CS to latest commit

* update CS & change battlechara

* more CS updates and compilation fixes

* one last cs update
This commit is contained in:
aers 2024-06-03 12:49:44 -07:00 committed by GitHub
parent 8d5f2bdf51
commit 479049b78d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 24 additions and 27 deletions

View file

@ -173,14 +173,14 @@ internal unsafe class AddonEventManager : IInternalDisposableService
{
try
{
var atkStage = AtkStage.GetSingleton();
var atkStage = AtkStage.Instance();
if (this.cursorOverride is not null && atkStage is not null)
{
var cursor = (AddonCursorType)atkStage->AtkCursor.Type;
if (cursor != this.cursorOverride)
{
AtkStage.GetSingleton()->AtkCursor.SetCursorType((AtkCursor.CursorType)this.cursorOverride, 1);
AtkStage.Instance()->AtkCursor.SetCursorType((AtkCursor.CursorType)this.cursorOverride, 1);
}
return nint.Zero;

View file

@ -371,7 +371,7 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
try
{
addon->OnUpdate(numberArrayData, stringArrayData);
addon->OnRequestedUpdate(numberArrayData, stringArrayData);
}
catch (Exception e)
{

View file

@ -29,7 +29,7 @@ public unsafe class BuddyMember
/// <summary>
/// Gets the object ID of this buddy.
/// </summary>
public uint ObjectId => this.Struct->ObjectId;
public uint ObjectId => this.Struct->EntityId;
/// <summary>
/// Gets the actor associated with this buddy.

View file

@ -21,15 +21,15 @@ public unsafe class PlayerCharacter : BattleChara
/// <summary>
/// Gets the current <see cref="ExcelResolver{T}">world</see> of the character.
/// </summary>
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> CurrentWorld => new(this.Struct->Character.CurrentWorld);
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> CurrentWorld => new(this.Struct->CurrentWorld);
/// <summary>
/// Gets the home <see cref="ExcelResolver{T}">world</see> of the character.
/// </summary>
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> HomeWorld => new(this.Struct->Character.HomeWorld);
public ExcelResolver<Lumina.Excel.GeneratedSheets.World> HomeWorld => new(this.Struct->HomeWorld);
/// <summary>
/// Gets the target actor ID of the PlayerCharacter.
/// </summary>
public override ulong TargetObjectId => this.Struct->Character.Gaze.Controller.Gazes[0].TargetInfo.TargetId;
public override ulong TargetObjectId => this.Struct->LookAt.Controller.Params[0].TargetParam.TargetId;
}

View file

@ -46,7 +46,7 @@ public unsafe class BattleChara : Character
/// <summary>
/// Gets the object ID of the target currently being cast at by the chara.
/// </summary>
public uint CastTargetObjectId => this.Struct->GetCastInfo()->CastTargetId;
public ulong CastTargetObjectId => this.Struct->GetCastInfo()->CastTargetId;
/// <summary>
/// Gets the current casting time of the spell being cast by the chara.

View file

@ -82,7 +82,7 @@ public unsafe class Character : GameObject
/// Gets a byte array describing the visual appearance of this Chara.
/// Indexed by <see cref="CustomizeIndex"/>.
/// </summary>
public byte[] Customize => MemoryHelper.Read<byte>((IntPtr)this.Struct->DrawData.CustomizeData.Data, 28);
public byte[] Customize => this.Struct->DrawData.CustomizeData.Data.ToArray();
/// <summary>
/// Gets the Free Company tag of this chara.

View file

@ -1,4 +1,5 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types;
@ -41,12 +42,12 @@ public unsafe class PartyMember
/// <summary>
/// Gets the content ID of the party member.
/// </summary>
public long ContentId => this.Struct->ContentId;
public long ContentId => (long)this.Struct->ContentId;
/// <summary>
/// Gets the actor ID of this party member.
/// </summary>
public uint ObjectId => this.Struct->ObjectId;
public uint ObjectId => this.Struct->EntityId;
/// <summary>
/// Gets the actor associated with this buddy.
@ -89,7 +90,7 @@ public unsafe class PartyMember
/// <summary>
/// Gets the displayname of this party member.
/// </summary>
public SeString Name => MemoryHelper.ReadSeString((IntPtr)Struct->Name, 0x40);
public SeString Name => MemoryHelper.ReadSeString((nint)Unsafe.AsPointer(ref Struct->Name[0]), 0x40);
/// <summary>
/// Gets the sex of this party member.

View file

@ -317,8 +317,8 @@ internal sealed unsafe class ContextMenu : IInternalDisposableService, IContextM
this.SelectedMenuType = ContextMenuType.Default;
var menu = AgentContext.Instance()->CurrentContextMenu;
var handlers = new Span<Pointer<AtkEventInterface>>(menu->EventHandlerArray, 32);
var ids = new Span<byte>(menu->EventIdArray, 32);
var handlers = menu->EventHandlers;
var ids = menu->EventIds;
var count = (int)values[0].UInt;
handlers = handlers.Slice(7, count);
ids = ids.Slice(7, count);

View file

@ -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.Instance()->TooltipManager.ShowTooltip(addon->Id, node, dtrBarEntry.Tooltip.Encode());
break;
case AddonEventType.MouseOut:
AtkStage.GetSingleton()->TooltipManager.HideTooltip(addon->Id);
AtkStage.Instance()->TooltipManager.HideTooltip(addon->Id);
break;
}
}

View file

@ -273,7 +273,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
if (framework == null)
return IntPtr.Zero;
var uiModule = framework->GetUiModule();
var uiModule = framework->GetUIModule();
if (uiModule == null)
return IntPtr.Zero;
@ -283,7 +283,7 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui
/// <inheritdoc/>
public IntPtr GetAddonByName(string name, int index = 1)
{
var atkStage = AtkStage.GetSingleton();
var atkStage = AtkStage.Instance();
if (atkStage == null)
return IntPtr.Zero;

View file

@ -1,10 +1,7 @@
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Game;
namespace Dalamud.Game.Inventory;
@ -101,13 +98,12 @@ public unsafe struct GameInventoryItem : IEquatable<GameInventoryItem>
/// <summary>
/// Gets the array of materia types.
/// </summary>
public ReadOnlySpan<ushort> Materia => new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.Materia[0])), 5);
public ReadOnlySpan<ushort> Materia => new(Unsafe.AsPointer(ref this.InternalItem.Materia[0]), 5);
/// <summary>
/// Gets the array of materia grades.
/// </summary>
public ReadOnlySpan<byte> MateriaGrade =>
new(Unsafe.AsPointer(ref Unsafe.AsRef(in this.InternalItem.MateriaGrade[0])), 5);
public ReadOnlySpan<byte> MateriaGrade => new(Unsafe.AsPointer(ref this.InternalItem.MateriaGrades[0]), 5);
/// <summary>
/// Gets the address of native inventory item in the game.<br />

View file

@ -439,7 +439,7 @@ internal unsafe class UiDebug
{
var foundSelected = false;
var noResults = true;
var stage = AtkStage.GetSingleton();
var stage = AtkStage.Instance();
var unitManagers = &stage->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;

View file

@ -30,7 +30,7 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
{
var fontWidth = ImGui.CalcTextSize("A").X;
var fontHeight = ImGui.GetTextLineHeightWithSpacing();
var uiModule = FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance()->GetUiModule();
var uiModule = FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance()->GetUIModule();
if (uiModule == null)
{

@ -1 +1 @@
Subproject commit 7e59f75b210593c4a1bdba8a296a08c3c40d05af
Subproject commit d0cbe19f145bcae573a1eb2313f1f8240f869cd7