From 30d56e4d112131efecc169e30448d0c5463119dc Mon Sep 17 00:00:00 2001 From: wolfcomp <4028289+wolfcomp@users.noreply.github.com> Date: Tue, 5 Nov 2024 06:14:51 +0100 Subject: [PATCH] fix all warnings and breaking changes for CS (#2061) --- Dalamud/Game/ClientState/Fates/Fate.cs | 10 ++++++++++ Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs | 4 ++-- Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs | 4 ++-- Dalamud/Game/Inventory/GameInventoryItem.cs | 2 +- Dalamud/Interface/Internal/UiDebug.cs | 6 +++--- .../Internal/Windows/Data/Widgets/FateTableWidget.cs | 2 +- .../SelfTest/AgingSteps/ContextMenuAgingStep.cs | 2 +- Dalamud/Interface/Windowing/Window.cs | 4 ++-- Dalamud/Utility/StringExtensions.cs | 2 +- lib/FFXIVClientStructs | 2 +- 10 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Dalamud/Game/ClientState/Fates/Fate.cs b/Dalamud/Game/ClientState/Fates/Fate.cs index 9b41ac758..7b6f110a3 100644 --- a/Dalamud/Game/ClientState/Fates/Fate.cs +++ b/Dalamud/Game/ClientState/Fates/Fate.cs @@ -71,8 +71,14 @@ public interface IFate : IEquatable /// /// Gets a value indicating whether or not this has a EXP bonus. /// + [Obsolete("Use HasBonus instead")] bool HasExpBonus { get; } + /// + /// Gets a value indicating whether or not this has a bonus. + /// + bool HasBonus { get; } + /// /// Gets the icon id of this . /// @@ -216,8 +222,12 @@ internal unsafe partial class Fate : IFate public byte Progress => this.Struct->Progress; /// + [Obsolete("Use HasBonus instead")] public bool HasExpBonus => this.Struct->IsExpBonus; + /// + public bool HasBonus => this.Struct->IsBonus; + /// public uint IconId => this.Struct->IconId; diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs index b8a4a9bd8..2d5633bcb 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateContext.cs @@ -127,7 +127,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext /// /// Gets a pointer to the NamePlate addon's number array entries as a struct. /// - internal AddonNamePlate.NamePlateIntArrayData* NumberStruct { get; private set; } + internal AddonNamePlate.AddonNamePlateNumberArray* NumberStruct { get; private set; } /// /// Gets or sets a value indicating whether any handler in the current context has instantiated a part builder. @@ -142,7 +142,7 @@ internal unsafe class NamePlateUpdateContext : INamePlateUpdateContext { this.Addon = (AddonNamePlate*)args.Addon; this.NumberData = ((NumberArrayData**)args.NumberArrayData)![NamePlateGui.NumberArrayIndex]; - this.NumberStruct = (AddonNamePlate.NamePlateIntArrayData*)this.NumberData->IntArray; + this.NumberStruct = (AddonNamePlate.AddonNamePlateNumberArray*)this.NumberData->IntArray; this.StringData = ((StringArrayData**)args.StringArrayData)![NamePlateGui.StringArrayIndex]; this.HasParts = false; diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs index 99429d932..170fea687 100644 --- a/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs +++ b/Dalamud/Game/Gui/NamePlate/NamePlateUpdateHandler.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; @@ -490,7 +490,7 @@ internal unsafe class NamePlateUpdateHandler : INamePlateUpdateHandler private AddonNamePlate.NamePlateObject* NamePlateObject => &this.context.Addon->NamePlateObjectArray[this.NamePlateIndex]; - private AddonNamePlate.NamePlateIntArrayData.NamePlateObjectIntArrayData* ObjectData => + private AddonNamePlate.AddonNamePlateNumberArray.NamePlateObjectIntArrayData* ObjectData => this.context.NumberStruct->ObjectData.GetPointer(this.ArrayIndex); /// diff --git a/Dalamud/Game/Inventory/GameInventoryItem.cs b/Dalamud/Game/Inventory/GameInventoryItem.cs index 3844da15d..53aa9a9d9 100644 --- a/Dalamud/Game/Inventory/GameInventoryItem.cs +++ b/Dalamud/Game/Inventory/GameInventoryItem.cs @@ -63,7 +63,7 @@ public unsafe struct GameInventoryItem : IEquatable /// /// Gets the quantity of items in this item stack. /// - public uint Quantity => this.InternalItem.Quantity; + public int Quantity => this.InternalItem.Quantity; /// /// Gets the spiritbond of this item. diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs index f1a025d93..88294fdee 100644 --- a/Dalamud/Interface/Internal/UiDebug.cs +++ b/Dalamud/Interface/Internal/UiDebug.cs @@ -300,7 +300,7 @@ internal unsafe class UiDebug { ImGui.Image( new IntPtr(kernelTexture->D3D11ShaderResourceView), - new Vector2(kernelTexture->Width, kernelTexture->Height)); + new Vector2(kernelTexture->ActualWidth, kernelTexture->ActualHeight)); ImGui.TreePop(); } } @@ -312,8 +312,8 @@ internal unsafe class UiDebug ImGui.Image( new IntPtr(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView), new Vector2( - textureInfo->AtkTexture.KernelTexture->Width, - textureInfo->AtkTexture.KernelTexture->Height)); + textureInfo->AtkTexture.KernelTexture->ActualWidth, + textureInfo->AtkTexture.KernelTexture->ActualHeight)); ImGui.TreePop(); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs index 77c05cb46..1a43f2b2d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FateTableWidget.cs @@ -153,7 +153,7 @@ internal class FateTableWidget : IDataWindowWidget } ImGui.TableNextColumn(); // HasExpBonus - ImGui.TextUnformatted(fate.HasExpBonus.ToString()); + ImGui.TextUnformatted(fate.HasBonus.ToString()); ImGui.TableNextColumn(); // Position DrawCopyableText(fate.Position.ToString(), "Click to copy Position"); diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs index 5bcd1845c..f08eccd96 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs @@ -141,7 +141,7 @@ internal class ContextMenuAgingStep : IAgingStep OnClicked = (IMenuItemClickedArgs a) => { SeString name; - uint count; + int count; var targetItem = (a.Target as MenuTargetInventory)!.TargetItem; if (targetItem is { } item) { diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index d2a51235d..e507750dc 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -287,7 +287,7 @@ public abstract class Window this.IsFocused = false; - if (doSoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnCloseSfxId, 0, 0, 0); + if (doSoundEffects && !this.DisableWindowSounds) UIGlobals.PlaySoundEffect(this.OnCloseSfxId); } return; @@ -307,7 +307,7 @@ public abstract class Window this.internalLastIsOpen = this.internalIsOpen; this.OnOpen(); - if (doSoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnOpenSfxId, 0, 0, 0); + if (doSoundEffects && !this.DisableWindowSounds) UIGlobals.PlaySoundEffect(this.OnOpenSfxId); } this.PreDraw(); diff --git a/Dalamud/Utility/StringExtensions.cs b/Dalamud/Utility/StringExtensions.cs index 02dfdafbf..a63109167 100644 --- a/Dalamud/Utility/StringExtensions.cs +++ b/Dalamud/Utility/StringExtensions.cs @@ -40,7 +40,7 @@ public static class StringExtensions public static bool IsValidCharacterName(this string value, bool includeLegacy = true) { if (string.IsNullOrEmpty(value)) return false; - if (!FFXIVClientStructs.FFXIV.Client.UI.UIModule.IsPlayerCharacterName(value)) return false; + if (!FFXIVClientStructs.FFXIV.Client.UI.UIGlobals.IsValidPlayerCharacterName(value)) return false; return includeLegacy || value.Length <= 21; } } diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 7c5f04e34..e59323cf3 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 7c5f04e346067f7a316ad9072fb8260122ba80f0 +Subproject commit e59323cf39e6acffd385006c156fa0105c255b54