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

@ -90,6 +90,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Dalamud.Common\Dalamud.Common.csproj" /> <ProjectReference Include="..\Dalamud.Common\Dalamud.Common.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" /> <ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" />
<ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" />
<ProjectReference Include="..\lib\ImGuiScene\deps\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" /> <ProjectReference Include="..\lib\ImGuiScene\deps\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" />
<ProjectReference Include="..\lib\ImGuiScene\deps\SDL2-CS\SDL2-CS.csproj" /> <ProjectReference Include="..\lib\ImGuiScene\deps\SDL2-CS\SDL2-CS.csproj" />
<ProjectReference Include="..\lib\ImGuiScene\ImGuiScene\ImGuiScene.csproj" /> <ProjectReference Include="..\lib\ImGuiScene\ImGuiScene\ImGuiScene.csproj" />

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -225,7 +225,7 @@ internal unsafe class UiDebug
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.Button($"Decode##{(ulong)textNode:X}")) if (ImGui.Button($"Decode##{(ulong)textNode:X}"))
textNode->NodeText.SetString(new ReadOnlySeStringSpan(textNode->NodeText.StringPtr).ToString()); textNode->NodeText.SetString(textNode->NodeText.StringPtr.AsReadOnlySeStringSpan().ToString());
ImGui.Text($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType} FontSize: {textNode->FontSize}"); ImGui.Text($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType} FontSize: {textNode->FontSize}");
int b = textNode->AlignmentFontType; int b = textNode->AlignmentFontType;
@ -418,27 +418,27 @@ internal unsafe class UiDebug
ImGui.Text("InputBase Text1: "); ImGui.Text("InputBase Text1: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText1); Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText1);
ImGui.Text("InputBase Text2: "); ImGui.Text("InputBase Text2: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText2); Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText2);
ImGui.Text("Text1: "); ImGui.Text("Text1: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText01); Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText01);
ImGui.Text("Text2: "); ImGui.Text("Text2: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText02); Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText02);
ImGui.Text("Text3: "); ImGui.Text("Text3: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText03); Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText03);
ImGui.Text("Text4: "); ImGui.Text("Text4: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText04); Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText04);
ImGui.Text("Text5: "); ImGui.Text("Text5: ");
ImGui.SameLine(); ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText05); Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText05);

View file

@ -76,14 +76,13 @@ public unsafe partial class AddonTree
case ValueType.String8: case ValueType.String8:
case ValueType.String: case ValueType.String:
{ {
if (atkValue->String == null) if (atkValue->String.Value == null)
{ {
ImGui.TextDisabled("null"); ImGui.TextDisabled("null");
} }
else else
{ {
var str = MemoryHelper.ReadSeStringNullTerminated(new nint(atkValue->String)); Util.ShowStruct(atkValue->String.ToString(), (ulong)atkValue);
Util.ShowStruct(str, (ulong)atkValue);
} }
break; break;

View file

@ -89,7 +89,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree
var seStringBytes = new byte[utf8String.BufUsed]; var seStringBytes = new byte[utf8String.BufUsed];
for (var i = 0L; i < utf8String.BufUsed; i++) for (var i = 0L; i < utf8String.BufUsed; i++)
{ {
seStringBytes[i] = utf8String.StringPtr[i]; seStringBytes[i] = utf8String.StringPtr.Value[i];
} }
var seString = SeString.Parse(seStringBytes); var seString = SeString.Parse(seStringBytes);

View file

@ -187,7 +187,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
// resize panels relative to the window size // resize panels relative to the window size
if (contentWidth != this.lastContentWidth) if (contentWidth != this.lastContentWidth)
{ {
var originalWidth = this.lastContentWidth != 0 ? this.lastContentWidth : contentWidth; var originalWidth = this.lastContentWidth != 0 ? this.lastContentWidth : contentWidth;
this.inputsWidth = this.inputsWidth / originalWidth * contentWidth; this.inputsWidth = this.inputsWidth / originalWidth * contentWidth;
this.lastContentWidth = contentWidth; this.lastContentWidth = contentWidth;
} }
@ -299,8 +299,8 @@ internal class SeStringCreatorWidget : IDataWindowWidget
break; break;
case TextParameterType.String: case TextParameterType.String:
if (item.StringValue != null) if (item.StringValue.Value != null)
WidgetUtil.DrawCopyableText(MemoryHelper.ReadStringNullTerminated((nint)item.StringValue)); WidgetUtil.DrawCopyableText(item.StringValue.ToString());
else else
ImGui.TextUnformatted("null"); ImGui.TextUnformatted("null");
break; break;

View file

@ -442,7 +442,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
textNode->TextFlags |= (byte)TextFlags.MultiLine; textNode->TextFlags |= (byte)TextFlags.MultiLine;
textNode->AlignmentType = AlignmentType.TopLeft; textNode->AlignmentType = AlignmentType.TopLeft;
var containsDalamudVersionString = textNode->OriginalTextPointer == textNode->NodeText.StringPtr; var containsDalamudVersionString = textNode->OriginalTextPointer.Value == textNode->NodeText.StringPtr.Value;
if (!this.configuration.ShowTsm || !this.showTsm.Value) if (!this.configuration.ShowTsm || !this.showTsm.Value)
{ {
if (containsDalamudVersionString) if (containsDalamudVersionString)
@ -460,7 +460,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
this.lastLoadedPluginCount = count; this.lastLoadedPluginCount = count;
var lssb = LSeStringBuilder.SharedPool.Get(); var lssb = LSeStringBuilder.SharedPool.Get();
lssb.Append(new ReadOnlySeStringSpan(addon->AtkValues[1].String)).Append("\n\n"); lssb.Append(new ReadOnlySeStringSpan(addon->AtkValues[1].String.Value)).Append("\n\n");
lssb.PushEdgeColorType(701).PushColorType(539) lssb.PushEdgeColorType(701).PushColorType(539)
.Append(SeIconChar.BoxedLetterD.ToIconChar()) .Append(SeIconChar.BoxedLetterD.ToIconChar())
.PopColorType().PopEdgeColorType(); .PopColorType().PopEdgeColorType();

View file

@ -9,7 +9,7 @@ using Dalamud.Plugin.Services;
using Dalamud.Utility; using Dalamud.Utility;
using Dalamud.Utility.TerraFxCom; using Dalamud.Utility.TerraFxCom;
using Lumina.Data.Files; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using TerraFX.Interop.DirectX; using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows; using TerraFX.Interop.Windows;
@ -24,32 +24,30 @@ internal sealed partial class TextureManager
(nint)this.ConvertToKernelTexture(wrap, leaveWrapOpen); (nint)this.ConvertToKernelTexture(wrap, leaveWrapOpen);
/// <inheritdoc cref="ITextureProvider.ConvertToKernelTexture"/> /// <inheritdoc cref="ITextureProvider.ConvertToKernelTexture"/>
public unsafe FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Texture* ConvertToKernelTexture( public unsafe Texture* ConvertToKernelTexture(IDalamudTextureWrap wrap, bool leaveWrapOpen = false)
IDalamudTextureWrap wrap,
bool leaveWrapOpen = false)
{ {
using var wrapAux = new WrapAux(wrap, leaveWrapOpen); using var wrapAux = new WrapAux(wrap, leaveWrapOpen);
var flags = TexFile.Attribute.TextureType2D; var flags = TextureFlags.TextureType2D;
if (wrapAux.Desc.Usage == D3D11_USAGE.D3D11_USAGE_IMMUTABLE) if (wrapAux.Desc.Usage == D3D11_USAGE.D3D11_USAGE_IMMUTABLE)
flags |= TexFile.Attribute.Immutable; flags |= TextureFlags.Immutable;
if (wrapAux.Desc.Usage == D3D11_USAGE.D3D11_USAGE_DYNAMIC) if (wrapAux.Desc.Usage == D3D11_USAGE.D3D11_USAGE_DYNAMIC)
flags |= TexFile.Attribute.ReadWrite; flags |= TextureFlags.ReadWrite;
if ((wrapAux.Desc.CPUAccessFlags & (uint)D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ) != 0) if ((wrapAux.Desc.CPUAccessFlags & (uint)D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ) != 0)
flags |= TexFile.Attribute.CpuRead; flags |= TextureFlags.CpuRead;
if ((wrapAux.Desc.BindFlags & (uint)D3D11_BIND_FLAG.D3D11_BIND_RENDER_TARGET) != 0) if ((wrapAux.Desc.BindFlags & (uint)D3D11_BIND_FLAG.D3D11_BIND_RENDER_TARGET) != 0)
flags |= TexFile.Attribute.TextureRenderTarget; flags |= TextureFlags.TextureRenderTarget;
if ((wrapAux.Desc.BindFlags & (uint)D3D11_BIND_FLAG.D3D11_BIND_DEPTH_STENCIL) != 0) if ((wrapAux.Desc.BindFlags & (uint)D3D11_BIND_FLAG.D3D11_BIND_DEPTH_STENCIL) != 0)
flags |= TexFile.Attribute.TextureDepthStencil; flags |= TextureFlags.TextureDepthStencil;
if (wrapAux.Desc.ArraySize != 1) if (wrapAux.Desc.ArraySize != 1)
throw new NotSupportedException("TextureArray2D is currently not supported."); throw new NotSupportedException("TextureArray2D is currently not supported.");
var gtex = FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Texture.CreateTexture2D( var gtex = Texture.CreateTexture2D(
(int)wrapAux.Desc.Width, (int)wrapAux.Desc.Width,
(int)wrapAux.Desc.Height, (int)wrapAux.Desc.Height,
(byte)wrapAux.Desc.MipLevels, (byte)wrapAux.Desc.MipLevels,
(uint)TexFile.TextureFormat.Null, // instructs the game to skip preprocessing it seems 0, // instructs the game to skip preprocessing it seems
(uint)flags, flags,
0); 0);
// Kernel::Texture owns these resources. We're passing the ownership to them. // Kernel::Texture owns these resources. We're passing the ownership to them.
@ -57,28 +55,27 @@ internal sealed partial class TextureManager
wrapAux.SrvPtr->AddRef(); wrapAux.SrvPtr->AddRef();
// Not sure this is needed // Not sure this is needed
var ltf = wrapAux.Desc.Format switch gtex->TextureFormat = wrapAux.Desc.Format switch
{ {
DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT => TexFile.TextureFormat.R32G32B32A32F, DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT => TextureFormat.R32G32B32A32_FLOAT,
DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT => TexFile.TextureFormat.R16G16B16A16F, DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT => TextureFormat.R16G16B16A16_FLOAT,
DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT => TexFile.TextureFormat.R32G32F, DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT => TextureFormat.R32G32_FLOAT,
DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT => TexFile.TextureFormat.R16G16F, DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT => TextureFormat.R16G16_FLOAT,
DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT => TexFile.TextureFormat.R32F, DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT => TextureFormat.R32_FLOAT,
DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS => TexFile.TextureFormat.D24S8, DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS => TextureFormat.D24_UNORM_S8_UINT,
DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS => TexFile.TextureFormat.D16, DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS => TextureFormat.D16_UNORM,
DXGI_FORMAT.DXGI_FORMAT_A8_UNORM => TexFile.TextureFormat.A8, DXGI_FORMAT.DXGI_FORMAT_A8_UNORM => TextureFormat.A8_UNORM,
DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM => TexFile.TextureFormat.BC1, DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM => TextureFormat.BC1_UNORM,
DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM => TexFile.TextureFormat.BC2, DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM => TextureFormat.BC2_UNORM,
DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM => TexFile.TextureFormat.BC3, DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM => TextureFormat.BC3_UNORM,
DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM => TexFile.TextureFormat.BC5, DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM => TextureFormat.BC5_UNORM,
DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM => TexFile.TextureFormat.B4G4R4A4, DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM => TextureFormat.B4G4R4A4_UNORM,
DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM => TexFile.TextureFormat.B5G5R5A1, DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM => TextureFormat.B5G5R5A1_UNORM,
DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM => TexFile.TextureFormat.B8G8R8A8, DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM => TextureFormat.B8G8R8A8_UNORM,
DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM => TexFile.TextureFormat.B8G8R8X8, DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM => TextureFormat.B8G8R8X8_UNORM,
DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => TexFile.TextureFormat.BC7, DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => TextureFormat.BC7_UNORM,
_ => TexFile.TextureFormat.Null, _ => 0,
}; };
gtex->TextureFormat = (FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.TextureFormat)ltf;
gtex->D3D11Texture2D = wrapAux.TexPtr; gtex->D3D11Texture2D = wrapAux.TexPtr;
gtex->D3D11ShaderResourceView = wrapAux.SrvPtr; gtex->D3D11ShaderResourceView = wrapAux.SrvPtr;

View file

@ -1,5 +1,7 @@
using System.Linq; using System.Linq;
using InteropGenerator.Runtime;
using Lumina.Text.Parse; using Lumina.Text.Parse;
using Lumina.Text.ReadOnly; using Lumina.Text.ReadOnly;
@ -226,4 +228,9 @@ public static class SeStringExtensions
var replaced = ReplaceText(new ReadOnlySeString(builder.GetViewAsMemory()), toFind, replacement); var replaced = ReplaceText(new ReadOnlySeString(builder.GetViewAsMemory()), toFind, replacement);
builder.Clear().Append(replaced); builder.Clear().Append(replaced);
} }
public static unsafe ReadOnlySeStringSpan AsReadOnlySeStringSpan(this CStringPointer ptr)
{
return new ReadOnlySeStringSpan(ptr.Value);
}
} }

@ -1 +1 @@
Subproject commit 2c3e84640af5220b78b944a06fdca79c52144075 Subproject commit 3c99b4f8f7f56ee4defd3ee75809c73312359f9e