From 8d6b603963e4bef03b87ae5f042a87f45b23988e Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 26 May 2026 19:35:42 +0200 Subject: [PATCH] =?UTF-8?q?Bump=20Dalamud=20SDK=2014.0.1=20=E2=86=92=2015.?= =?UTF-8?q?0.0=20for=20FFXIV=207.5=20API=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update Dalamud.NET.Sdk version in csproj - Regenerate packages.lock.json against SDK 15 - Migrate FFXIVClientStructs.FFXIV.Component.GUI.ValueType → AtkValueType (SynthesisValues.cs) - Introduce local IEndObject interface in ImRaii2.cs (Dalamud's nested ImRaii.IEndObject was removed in SDK 15) - Switch direct Dalamud ImRaii returns to typed disposables (ImRaii.TabItemDisposable, ImRaii.ColorDisposable) - Replace `if (!panel)` / `if (plot)` with `.Success` checks for the local IEndObject helpers - Fix ref-bool lifetime issue in Settings.TabItem by using the ImRaii.TabItem(label, flags) overload --- Craftimizer/Craftimizer.csproj | 2 +- Craftimizer/ImGuiUtils.cs | 2 +- Craftimizer/ImRaii2.cs | 21 +++++++++++++-------- Craftimizer/Utils/DynamicBars.cs | 2 +- Craftimizer/Utils/SynthesisValues.cs | 2 +- Craftimizer/Windows/RecipeNote.cs | 2 +- Craftimizer/Windows/Settings.cs | 5 ++--- Craftimizer/packages.lock.json | 6 +++--- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Craftimizer/Craftimizer.csproj b/Craftimizer/Craftimizer.csproj index a4d9aa0..683e76e 100644 --- a/Craftimizer/Craftimizer.csproj +++ b/Craftimizer/Craftimizer.csproj @@ -1,5 +1,5 @@ - + Asriel Camora 2.9.1.1 diff --git a/Craftimizer/ImGuiUtils.cs b/Craftimizer/ImGuiUtils.cs index 2e80df0..4fb876f 100644 --- a/Craftimizer/ImGuiUtils.cs +++ b/Craftimizer/ImGuiUtils.cs @@ -321,7 +321,7 @@ internal static class ImGuiUtils using var fill = ImRaii2.PushColor(ImPlotCol.Fill, Vector4.One.WithAlpha(.5f)); using var plot = ImRaii2.Plot("##violin", size, ImPlotFlags.CanvasOnly | ImPlotFlags.NoInputs | ImPlotFlags.NoChild | ImPlotFlags.NoFrame); - if (plot) + if (plot.Success) { ImPlot.SetupAxes([], [], ImPlotAxisFlags.NoDecorations, ImPlotAxisFlags.NoDecorations | ImPlotAxisFlags.AutoFit); ImPlot.SetupAxisLimits(ImAxis.X1, data.Min, data.Max, ImPlotCond.Always); diff --git a/Craftimizer/ImRaii2.cs b/Craftimizer/ImRaii2.cs index 83d253e..b25164d 100644 --- a/Craftimizer/ImRaii2.cs +++ b/Craftimizer/ImRaii2.cs @@ -6,9 +6,14 @@ using System.Numerics; namespace Craftimizer.Plugin; +public interface IEndObject : IDisposable +{ + bool Success { get; } +} + public static class ImRaii2 { - private struct EndUnconditionally(Action endAction, bool success) : ImRaii.IEndObject, IDisposable + private struct EndUnconditionally(Action endAction, bool success) : IEndObject { private Action EndAction { get; } = endAction; @@ -26,7 +31,7 @@ public static class ImRaii2 } } - private struct EndConditionally(Action endAction, bool success) : ImRaii.IEndObject, IDisposable + private struct EndConditionally(Action endAction, bool success) : IEndObject { public bool Success { get; } = success; @@ -48,36 +53,36 @@ public static class ImRaii2 } } - public static ImRaii.IEndObject GroupPanel(string name, float width, out float internalWidth) + public static IEndObject GroupPanel(string name, float width, out float internalWidth) { internalWidth = ImGuiUtils.BeginGroupPanel(name, width); return new EndUnconditionally(ImGuiUtils.EndGroupPanel, true); } - public static ImRaii.IEndObject Plot(string title_id, Vector2 size, ImPlotFlags flags) + public static IEndObject Plot(string title_id, Vector2 size, ImPlotFlags flags) { return new EndConditionally(new Action(ImPlot.EndPlot), ImPlot.BeginPlot(title_id, size, flags)); } - public static ImRaii.IEndObject PushStyle(ImPlotStyleVar idx, Vector2 val) + public static IEndObject PushStyle(ImPlotStyleVar idx, Vector2 val) { ImPlot.PushStyleVar(idx, val); return new EndUnconditionally(ImPlot.PopStyleVar, true); } - public static ImRaii.IEndObject PushStyle(ImPlotStyleVar idx, float val) + public static IEndObject PushStyle(ImPlotStyleVar idx, float val) { ImPlot.PushStyleVar(idx, val); return new EndUnconditionally(ImPlot.PopStyleVar, true); } - public static ImRaii.IEndObject PushColor(ImPlotCol idx, Vector4 col) + public static IEndObject PushColor(ImPlotCol idx, Vector4 col) { ImPlot.PushStyleColor(idx, col); return new EndUnconditionally(ImPlot.PopStyleColor, true); } - public static ImRaii.IEndObject TextWrapPos(float wrap_local_pos_x) + public static IEndObject TextWrapPos(float wrap_local_pos_x) { ImGui.PushTextWrapPos(wrap_local_pos_x); return new EndUnconditionally(ImGui.PopTextWrapPos, true); diff --git a/Craftimizer/Utils/DynamicBars.cs b/Craftimizer/Utils/DynamicBars.cs index 08e1c62..a0c2181 100644 --- a/Craftimizer/Utils/DynamicBars.cs +++ b/Craftimizer/Utils/DynamicBars.cs @@ -45,7 +45,7 @@ internal static class DynamicBars defaultSize); }); - private static ImRaii.Color? PushCollectableColor(this in BarData bar, float collectability, bool colorUnmetThreshold = true) + private static ImRaii.ColorDisposable? PushCollectableColor(this in BarData bar, float collectability, bool colorUnmetThreshold = true) { if (bar.Collectability is not { } collectabilities) return null; diff --git a/Craftimizer/Utils/SynthesisValues.cs b/Craftimizer/Utils/SynthesisValues.cs index 494d177..102d7d7 100644 --- a/Craftimizer/Utils/SynthesisValues.cs +++ b/Craftimizer/Utils/SynthesisValues.cs @@ -4,7 +4,7 @@ using Dalamud.Memory; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Component.GUI; using System; -using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; +using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.AtkValueType; namespace Craftimizer.Utils; diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index 155d93a..b7033b1 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -810,7 +810,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable }; using var panel = ImRaii2.GroupPanel(panelTitle, panelWidth, out _); - if (!panel) + if (!panel.Success) return; var stepsAvailWidthOffset = ImGui.GetContentRegionAvail().X - panelWidth; diff --git a/Craftimizer/Windows/Settings.cs b/Craftimizer/Windows/Settings.cs index f9d4cb1..fd2e7a3 100644 --- a/Craftimizer/Windows/Settings.cs +++ b/Craftimizer/Windows/Settings.cs @@ -50,14 +50,13 @@ public sealed class Settings : Window, IDisposable SelectedTab = label; } - private ImRaii.IEndObject TabItem(string label) + private ImRaii.TabItemDisposable TabItem(string label) { var isSelected = string.Equals(SelectedTab, label, StringComparison.Ordinal); if (isSelected) { SelectedTab = null; - var open = true; - return ImRaii.TabItem(label, ref open, ImGuiTabItemFlags.SetSelected); + return ImRaii.TabItem(label, ImGuiTabItemFlags.SetSelected); } return ImRaii.TabItem(label); } diff --git a/Craftimizer/packages.lock.json b/Craftimizer/packages.lock.json index 9b0ed54..f158038 100644 --- a/Craftimizer/packages.lock.json +++ b/Craftimizer/packages.lock.json @@ -4,9 +4,9 @@ "net10.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[14.0.1, )", - "resolved": "14.0.1", - "contentHash": "y0WWyUE6dhpGdolK3iKgwys05/nZaVf4ZPtIjpLhJBZvHxkkiE23zYRo7K7uqAgoK/QvK5cqF6l3VG5AbgC6KA==" + "requested": "[15.0.0, )", + "resolved": "15.0.0", + "contentHash": "411vwC8/X8Z/sQ2TI6v3SvOn66xFPeOjFn3Zn+h0d3Ox2t1kFm66AhDvmx/qcMwVrR+Hidxj0dadpQ2dgyXMBQ==" }, "DotNet.ReproducibleBuilds": { "type": "Direct",