chore: Bump ClientStructs and make it build again

This commit is contained in:
Kaz Wolfe 2025-03-24 13:25:13 -07:00
parent 9e3c03d0e8
commit 2176b32219
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4
16 changed files with 92 additions and 80 deletions

View file

@ -11,9 +11,9 @@ namespace Dalamud.Game.Addon.Events;
internal unsafe class AddonEventListener : IDisposable
{
private ReceiveEventDelegate? receiveEventDelegate;
private AtkEventListener* eventListener;
/// <summary>
/// Initializes a new instance of the <see cref="AddonEventListener"/> class.
/// </summary>
@ -24,7 +24,7 @@ internal unsafe class AddonEventListener : IDisposable
this.eventListener = (AtkEventListener*)Marshal.AllocHGlobal(sizeof(AtkEventListener));
this.eventListener->VirtualTable = (AtkEventListener.AtkEventListenerVirtualTable*)Marshal.AllocHGlobal(sizeof(void*) * 3);
this.eventListener->VirtualTable->Dtor = (delegate* unmanaged<AtkEventListener*, byte, void>)(delegate* unmanaged<void>)&NullSub;
this.eventListener->VirtualTable->Dtor = (delegate* unmanaged<AtkEventListener*, byte, AtkEventListener*>)(delegate* unmanaged<void>)&NullSub;
this.eventListener->VirtualTable->ReceiveGlobalEvent = (delegate* unmanaged<AtkEventListener*, AtkEventType, int, AtkEvent*, AtkEventData*, void>)(delegate* unmanaged<void>)&NullSub;
this.eventListener->VirtualTable->ReceiveEvent = (delegate* unmanaged<AtkEventListener*, AtkEventType, int, AtkEvent*, AtkEventData*, void>)Marshal.GetFunctionPointerForDelegate(this.receiveEventDelegate);
}
@ -38,17 +38,17 @@ internal unsafe class AddonEventListener : IDisposable
/// <param name="eventPtr">Pointer to the AtkEvent.</param>
/// <param name="eventDataPtr">Pointer to the AtkEventData.</param>
public delegate void ReceiveEventDelegate(AtkEventListener* self, AtkEventType eventType, uint eventParam, AtkEvent* eventPtr, AtkEventData* eventDataPtr);
/// <summary>
/// Gets the address of this listener.
/// </summary>
public nint Address => (nint)this.eventListener;
/// <inheritdoc />
public void Dispose()
{
if (this.eventListener is null) return;
Marshal.FreeHGlobal((nint)this.eventListener->VirtualTable);
Marshal.FreeHGlobal((nint)this.eventListener);
@ -88,7 +88,7 @@ internal unsafe class AddonEventListener : IDisposable
node->RemoveEvent(eventType, param, this.eventListener, false);
});
}
[UnmanagedCallersOnly]
private static void NullSub()
{

View file

@ -42,8 +42,10 @@ public unsafe class Status
/// <summary>
/// Gets the stack count of this status.
/// Only valid if this is a non-food status.
/// </summary>
public byte StackCount => this.Struct->StackCount;
[Obsolete($"Replaced with {nameof(Param)}", true)]
public byte StackCount => (byte)this.Struct->Param;
/// <summary>
/// Gets the time remaining of this status.

View file

@ -52,7 +52,7 @@ public class GameConfigSection
/// <summary>
/// Event which is fired when a game config option is changed within the section.
/// </summary>
internal event EventHandler<ConfigChangeEvent>? Changed;
internal event EventHandler<ConfigChangeEvent>? Changed;
/// <summary>
/// Gets the number of config entries contained within the section.
@ -526,8 +526,8 @@ public class GameConfigSection
{
if (!this.enumMap.TryGetValue(entry->Index, out var enumObject))
{
if (entry->Name == null) return null;
var name = MemoryHelper.ReadStringNullTerminated(new IntPtr(entry->Name));
if (entry->Name.Value == null) return null;
var name = entry->Name.ToString();
if (Enum.TryParse(typeof(TEnum), name, out enumObject))
{
this.enumMap.TryAdd(entry->Index, enumObject);
@ -544,7 +544,7 @@ public class GameConfigSection
this.Changed?.InvokeSafely(this, eventArgs);
return eventArgs;
}
private unsafe bool TryGetIndex(string name, out uint index)
{
if (this.indexMap.TryGetValue(name, out index))
@ -556,12 +556,12 @@ public class GameConfigSection
var e = configBase->ConfigEntry;
for (var i = 0U; i < configBase->ConfigCount; i++, e++)
{
if (e->Name == null)
if (e->Name.Value == null)
{
continue;
}
var eName = MemoryHelper.ReadStringNullTerminated(new IntPtr(e->Name));
var eName = e->Name.ToString();
if (eName.Equals(name))
{
this.indexMap.TryAdd(name, i);

View file

@ -30,7 +30,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
private const uint BaseNodeId = 1000;
private static readonly ModuleLog Log = new("DtrBar");
[ServiceManager.ServiceDependency]
private readonly Framework framework = Service<Framework>.Get();
@ -58,7 +58,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
private ImmutableList<IReadOnlyDtrBarEntry>? entriesReadOnlyCopy;
private Utf8String* emptyString;
private uint runningNodeIds = BaseNodeId;
private float entryStartPos = float.NaN;
@ -72,7 +72,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
this.addonLifecycle.RegisterListener(this.dtrPostDrawListener);
this.addonLifecycle.RegisterListener(this.dtrPostRequestedUpdateListener);
this.addonLifecycle.RegisterListener(this.dtrPreFinalizeListener);
this.framework.Update += this.Update;
this.configuration.DtrOrder ??= [];
@ -522,7 +522,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseOut, this.DtrEventHandler),
this.uiEventManager.AddEvent(AddonEventManager.DalamudInternalKey, (nint)dtr, (nint)node, AddonEventType.MouseClick, this.DtrEventHandler),
});
var lastChild = dtr->RootNode->ChildNode;
while (lastChild->PrevSiblingNode != null) lastChild = lastChild->PrevSiblingNode;
Log.Debug($"Found last sibling: {(ulong)lastChild:X}");
@ -590,7 +590,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
if (this.emptyString == null)
this.emptyString = Utf8String.FromString(" ");
newTextNode->SetText(this.emptyString->StringPtr);
newTextNode->TextColor = new ByteColor { R = 255, G = 255, B = 255, A = 255 };
@ -609,7 +609,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
return newTextNode;
}
private void DtrEventHandler(AddonEventType atkEventType, IntPtr atkUnitBase, IntPtr atkResNode)
{
var addon = (AtkUnitBase*)atkUnitBase;
@ -632,7 +632,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
case AddonEventType.MouseOver:
AtkStage.Instance()->TooltipManager.ShowTooltip(addon->Id, node, dtrBarEntry.Tooltip.Encode());
break;
case AddonEventType.MouseOut:
AtkStage.Instance()->TooltipManager.HideTooltip(addon->Id);
break;
@ -646,11 +646,11 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
case AddonEventType.MouseOver:
this.uiEventManager.SetCursor(AddonCursorType.Clickable);
break;
case AddonEventType.MouseOut:
this.uiEventManager.ResetCursor();
break;
case AddonEventType.MouseClick:
dtrBarEntry.OnClick.Invoke();
break;

View file

@ -17,7 +17,7 @@ public unsafe struct GameInventoryItem : IEquatable<GameInventoryItem>
/// </summary>
[FieldOffset(0)]
internal readonly InventoryItem InternalItem;
/// <summary>
/// The view of the backing data, in <see cref="ulong"/>.
/// </summary>
@ -55,10 +55,16 @@ public unsafe struct GameInventoryItem : IEquatable<GameInventoryItem>
/// </summary>
public int Quantity => this.InternalItem.Quantity;
/// <summary>
/// Gets the spiritbond or collectability of this item.
/// </summary>
public uint SpiritbondOrCollectability => this.InternalItem.SpiritbondOrCollectability;
/// <summary>
/// Gets the spiritbond of this item.
/// </summary>
public uint Spiritbond => this.InternalItem.Spiritbond;
[Obsolete($"Renamed to {nameof(SpiritbondOrCollectability)}", true)]
public uint Spiritbond => this.SpiritbondOrCollectability;
/// <summary>
/// Gets the repair condition of this item.

View file

@ -565,7 +565,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
return this.configuration.IsMbCollect;
}
private void MarketPurchasePacketDetour(PacketDispatcher* a1, nint packetData)
private void MarketPurchasePacketDetour(uint targetId, nint packetData)
{
try
{
@ -576,7 +576,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
Log.Error(ex, "MarketPurchasePacketHandler threw an exception");
}
this.mbPurchaseHook.OriginalDisposeSafe(a1, packetData);
this.mbPurchaseHook.OriginalDisposeSafe(targetId, packetData);
}
private void MarketHistoryPacketDetour(InfoProxyItemSearch* a1, nint packetData)
@ -609,7 +609,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
this.customTalkHook.OriginalDisposeSafe(a1, eventId, responseId, args, argCount);
}
private void MarketItemRequestStartDetour(PacketDispatcher* a1, nint packetRef)
private void MarketItemRequestStartDetour(uint targetId, nint packetRef)
{
try
{
@ -620,7 +620,7 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
Log.Error(ex, "MarketItemRequestStartDetour threw an exception");
}
this.mbItemRequestStartHook.OriginalDisposeSafe(a1, packetRef);
this.mbItemRequestStartHook.OriginalDisposeSafe(targetId, packetRef);
}
private void MarketBoardOfferingsDetour(InfoProxyItemSearch* a1, nint packetRef)

View file

@ -1744,7 +1744,7 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
return false;
case TextParameterType.String:
this.EvaluateAndAppendTo(builder, new(p.StringValue), null, language);
this.EvaluateAndAppendTo(builder, p.StringValue.AsReadOnlySeStringSpan(), null, language);
return false;
case TextParameterType.Uninitialized: