From 2176b32219a68b744df9d488ae1ff8b5723f5dd3 Mon Sep 17 00:00:00 2001 From: Kaz Wolfe Date: Mon, 24 Mar 2025 13:25:13 -0700 Subject: [PATCH] chore: Bump ClientStructs and make it build again --- Dalamud/Dalamud.csproj | 1 + .../Game/Addon/Events/AddonEventListener.cs | 14 ++--- Dalamud/Game/ClientState/Statuses/Status.cs | 4 +- Dalamud/Game/Config/GameConfigSection.cs | 12 ++-- Dalamud/Game/Gui/Dtr/DtrBar.cs | 18 +++--- Dalamud/Game/Inventory/GameInventoryItem.cs | 10 ++- .../Game/Network/Internal/NetworkHandlers.cs | 8 +-- .../Game/Text/Evaluator/SeStringEvaluator.cs | 2 +- Dalamud/Interface/Internal/UiDebug.cs | 14 ++--- .../UiDebug2/Browsing/AddonTree.AtkValues.cs | 5 +- .../UiDebug2/Browsing/NodeTree.Text.cs | 2 +- .../Data/Widgets/SeStringCreatorWidget.cs | 6 +- .../Internal/Windows/TitleScreenMenuWindow.cs | 4 +- .../TextureManager.FromExistingTexture.cs | 63 +++++++++---------- Dalamud/Utility/SeStringExtensions.cs | 7 +++ lib/FFXIVClientStructs | 2 +- 16 files changed, 92 insertions(+), 80 deletions(-) diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 51fc46ebe..9f3a9bb4a 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -90,6 +90,7 @@ + diff --git a/Dalamud/Game/Addon/Events/AddonEventListener.cs b/Dalamud/Game/Addon/Events/AddonEventListener.cs index cc6416fe8..515785d72 100644 --- a/Dalamud/Game/Addon/Events/AddonEventListener.cs +++ b/Dalamud/Game/Addon/Events/AddonEventListener.cs @@ -11,9 +11,9 @@ namespace Dalamud.Game.Addon.Events; internal unsafe class AddonEventListener : IDisposable { private ReceiveEventDelegate? receiveEventDelegate; - + private AtkEventListener* eventListener; - + /// /// Initializes a new instance of the class. /// @@ -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)(delegate* unmanaged)&NullSub; + 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); } @@ -38,17 +38,17 @@ internal unsafe class AddonEventListener : IDisposable /// Pointer to the AtkEvent. /// Pointer to the AtkEventData. public delegate void ReceiveEventDelegate(AtkEventListener* self, AtkEventType eventType, uint eventParam, AtkEvent* eventPtr, AtkEventData* eventDataPtr); - + /// /// Gets the address of this listener. /// public nint Address => (nint)this.eventListener; - + /// 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() { diff --git a/Dalamud/Game/ClientState/Statuses/Status.cs b/Dalamud/Game/ClientState/Statuses/Status.cs index f09d13fb3..c3493ce55 100644 --- a/Dalamud/Game/ClientState/Statuses/Status.cs +++ b/Dalamud/Game/ClientState/Statuses/Status.cs @@ -42,8 +42,10 @@ public unsafe class Status /// /// Gets the stack count of this status. + /// Only valid if this is a non-food status. /// - public byte StackCount => this.Struct->StackCount; + [Obsolete($"Replaced with {nameof(Param)}", true)] + public byte StackCount => (byte)this.Struct->Param; /// /// Gets the time remaining of this status. diff --git a/Dalamud/Game/Config/GameConfigSection.cs b/Dalamud/Game/Config/GameConfigSection.cs index 9cd239d84..8ebab8a60 100644 --- a/Dalamud/Game/Config/GameConfigSection.cs +++ b/Dalamud/Game/Config/GameConfigSection.cs @@ -52,7 +52,7 @@ public class GameConfigSection /// /// Event which is fired when a game config option is changed within the section. /// - internal event EventHandler? Changed; + internal event EventHandler? Changed; /// /// 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); diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs index f37b3addc..c6208fb2f 100644 --- a/Dalamud/Game/Gui/Dtr/DtrBar.cs +++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs @@ -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.Get(); @@ -58,7 +58,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar private ImmutableList? 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; diff --git a/Dalamud/Game/Inventory/GameInventoryItem.cs b/Dalamud/Game/Inventory/GameInventoryItem.cs index a9b178411..32eb9911b 100644 --- a/Dalamud/Game/Inventory/GameInventoryItem.cs +++ b/Dalamud/Game/Inventory/GameInventoryItem.cs @@ -17,7 +17,7 @@ public unsafe struct GameInventoryItem : IEquatable /// [FieldOffset(0)] internal readonly InventoryItem InternalItem; - + /// /// The view of the backing data, in . /// @@ -55,10 +55,16 @@ public unsafe struct GameInventoryItem : IEquatable /// public int Quantity => this.InternalItem.Quantity; + /// + /// Gets the spiritbond or collectability of this item. + /// + public uint SpiritbondOrCollectability => this.InternalItem.SpiritbondOrCollectability; + /// /// Gets the spiritbond of this item. /// - public uint Spiritbond => this.InternalItem.Spiritbond; + [Obsolete($"Renamed to {nameof(SpiritbondOrCollectability)}", true)] + public uint Spiritbond => this.SpiritbondOrCollectability; /// /// Gets the repair condition of this item. diff --git a/Dalamud/Game/Network/Internal/NetworkHandlers.cs b/Dalamud/Game/Network/Internal/NetworkHandlers.cs index 2ba7f2587..c0929fa84 100644 --- a/Dalamud/Game/Network/Internal/NetworkHandlers.cs +++ b/Dalamud/Game/Network/Internal/NetworkHandlers.cs @@ -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) diff --git a/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs b/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs index eb6dee290..47c4b5899 100644 --- a/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs +++ b/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs @@ -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: diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs index 2e8f4416b..9dfff75ec 100644 --- a/Dalamud/Interface/Internal/UiDebug.cs +++ b/Dalamud/Interface/Internal/UiDebug.cs @@ -225,7 +225,7 @@ internal unsafe class UiDebug ImGui.SameLine(); 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}"); int b = textNode->AlignmentFontType; @@ -418,27 +418,27 @@ internal unsafe class UiDebug ImGui.Text("InputBase Text1: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText1); - + ImGui.Text("InputBase Text2: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText2); - + ImGui.Text("Text1: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText01); - + ImGui.Text("Text2: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText02); - + ImGui.Text("Text3: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText03); - + ImGui.Text("Text4: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText04); - + ImGui.Text("Text5: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText05); diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs index c3930821b..c3f6133dd 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs @@ -76,14 +76,13 @@ public unsafe partial class AddonTree case ValueType.String8: case ValueType.String: { - if (atkValue->String == null) + if (atkValue->String.Value == null) { ImGui.TextDisabled("null"); } else { - var str = MemoryHelper.ReadSeStringNullTerminated(new nint(atkValue->String)); - Util.ShowStruct(str, (ulong)atkValue); + Util.ShowStruct(atkValue->String.ToString(), (ulong)atkValue); } break; diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs index 61e0e79b8..02bd5feca 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs @@ -89,7 +89,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree var seStringBytes = new byte[utf8String.BufUsed]; for (var i = 0L; i < utf8String.BufUsed; i++) { - seStringBytes[i] = utf8String.StringPtr[i]; + seStringBytes[i] = utf8String.StringPtr.Value[i]; } var seString = SeString.Parse(seStringBytes); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs index 2a56cb6c7..92e57ddac 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs @@ -187,7 +187,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget // resize panels relative to the window size 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.lastContentWidth = contentWidth; } @@ -299,8 +299,8 @@ internal class SeStringCreatorWidget : IDataWindowWidget break; case TextParameterType.String: - if (item.StringValue != null) - WidgetUtil.DrawCopyableText(MemoryHelper.ReadStringNullTerminated((nint)item.StringValue)); + if (item.StringValue.Value != null) + WidgetUtil.DrawCopyableText(item.StringValue.ToString()); else ImGui.TextUnformatted("null"); break; diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index 3b6140b8c..891751c1e 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -442,7 +442,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable textNode->TextFlags |= (byte)TextFlags.MultiLine; 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 (containsDalamudVersionString) @@ -460,7 +460,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable this.lastLoadedPluginCount = count; 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) .Append(SeIconChar.BoxedLetterD.ToIconChar()) .PopColorType().PopEdgeColorType(); diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs index 2ce96e59d..829b8d0c5 100644 --- a/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs +++ b/Dalamud/Interface/Textures/Internal/TextureManager.FromExistingTexture.cs @@ -9,7 +9,7 @@ using Dalamud.Plugin.Services; using Dalamud.Utility; using Dalamud.Utility.TerraFxCom; -using Lumina.Data.Files; +using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -24,32 +24,30 @@ internal sealed partial class TextureManager (nint)this.ConvertToKernelTexture(wrap, leaveWrapOpen); /// - public unsafe FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.Texture* ConvertToKernelTexture( - IDalamudTextureWrap wrap, - bool leaveWrapOpen = false) + public unsafe Texture* ConvertToKernelTexture(IDalamudTextureWrap wrap, bool leaveWrapOpen = false) { 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) - flags |= TexFile.Attribute.Immutable; + flags |= TextureFlags.Immutable; 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) - flags |= TexFile.Attribute.CpuRead; + flags |= TextureFlags.CpuRead; 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) - flags |= TexFile.Attribute.TextureDepthStencil; + flags |= TextureFlags.TextureDepthStencil; if (wrapAux.Desc.ArraySize != 1) 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.Height, (byte)wrapAux.Desc.MipLevels, - (uint)TexFile.TextureFormat.Null, // instructs the game to skip preprocessing it seems - (uint)flags, + 0, // instructs the game to skip preprocessing it seems + flags, 0); // Kernel::Texture owns these resources. We're passing the ownership to them. @@ -57,28 +55,27 @@ internal sealed partial class TextureManager wrapAux.SrvPtr->AddRef(); // 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_R16G16B16A16_FLOAT => TexFile.TextureFormat.R16G16B16A16F, - DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT => TexFile.TextureFormat.R32G32F, - DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT => TexFile.TextureFormat.R16G16F, - DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT => TexFile.TextureFormat.R32F, - DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS => TexFile.TextureFormat.D24S8, - DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS => TexFile.TextureFormat.D16, - DXGI_FORMAT.DXGI_FORMAT_A8_UNORM => TexFile.TextureFormat.A8, - DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM => TexFile.TextureFormat.BC1, - DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM => TexFile.TextureFormat.BC2, - DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM => TexFile.TextureFormat.BC3, - DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM => TexFile.TextureFormat.BC5, - DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM => TexFile.TextureFormat.B4G4R4A4, - DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM => TexFile.TextureFormat.B5G5R5A1, - DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM => TexFile.TextureFormat.B8G8R8A8, - DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM => TexFile.TextureFormat.B8G8R8X8, - DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => TexFile.TextureFormat.BC7, - _ => TexFile.TextureFormat.Null, + DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT => TextureFormat.R32G32B32A32_FLOAT, + DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT => TextureFormat.R16G16B16A16_FLOAT, + DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT => TextureFormat.R32G32_FLOAT, + DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT => TextureFormat.R16G16_FLOAT, + DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT => TextureFormat.R32_FLOAT, + DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS => TextureFormat.D24_UNORM_S8_UINT, + DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS => TextureFormat.D16_UNORM, + DXGI_FORMAT.DXGI_FORMAT_A8_UNORM => TextureFormat.A8_UNORM, + DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM => TextureFormat.BC1_UNORM, + DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM => TextureFormat.BC2_UNORM, + DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM => TextureFormat.BC3_UNORM, + DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM => TextureFormat.BC5_UNORM, + DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM => TextureFormat.B4G4R4A4_UNORM, + DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM => TextureFormat.B5G5R5A1_UNORM, + DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM => TextureFormat.B8G8R8A8_UNORM, + DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM => TextureFormat.B8G8R8X8_UNORM, + DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => TextureFormat.BC7_UNORM, + _ => 0, }; - gtex->TextureFormat = (FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.TextureFormat)ltf; gtex->D3D11Texture2D = wrapAux.TexPtr; gtex->D3D11ShaderResourceView = wrapAux.SrvPtr; diff --git a/Dalamud/Utility/SeStringExtensions.cs b/Dalamud/Utility/SeStringExtensions.cs index b21b9b743..7dbffc696 100644 --- a/Dalamud/Utility/SeStringExtensions.cs +++ b/Dalamud/Utility/SeStringExtensions.cs @@ -1,5 +1,7 @@ using System.Linq; +using InteropGenerator.Runtime; + using Lumina.Text.Parse; using Lumina.Text.ReadOnly; @@ -226,4 +228,9 @@ public static class SeStringExtensions var replaced = ReplaceText(new ReadOnlySeString(builder.GetViewAsMemory()), toFind, replacement); builder.Clear().Append(replaced); } + + public static unsafe ReadOnlySeStringSpan AsReadOnlySeStringSpan(this CStringPointer ptr) + { + return new ReadOnlySeStringSpan(ptr.Value); + } } diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 2c3e84640..3c99b4f8f 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 2c3e84640af5220b78b944a06fdca79c52144075 +Subproject commit 3c99b4f8f7f56ee4defd3ee75809c73312359f9e