From d1291364e01ba7e031f611397eae84c1d32b64d5 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Tue, 23 Jan 2024 19:30:09 +0900 Subject: [PATCH 01/11] Fix FontHandleWrapper and some docs --- Dalamud/Interface/UiBuilder.cs | 22 +++++++++---------- .../Storage/Assets/IDalamudAssetManager.cs | 6 +++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index 1134704ee..d01d307c3 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -744,10 +744,12 @@ public sealed class UiBuilder : IDisposable public event Action? ImFontChanged; - public Exception? LoadException => - this.wrapped!.LoadException ?? new ObjectDisposedException(nameof(FontHandleWrapper)); + public Exception? LoadException => this.WrappedNotDisposed.LoadException; - public bool Available => this.wrapped?.Available ?? false; + public bool Available => this.WrappedNotDisposed.Available; + + private IFontHandle WrappedNotDisposed => + this.wrapped ?? throw new ObjectDisposedException(nameof(FontHandleWrapper)); public void Dispose() { @@ -759,19 +761,17 @@ public sealed class UiBuilder : IDisposable // Note: do not dispose w; we do not own it } - public IFontHandle.ImFontLocked Lock() => - this.wrapped?.Lock() ?? throw new ObjectDisposedException(nameof(FontHandleWrapper)); + public IFontHandle.ImFontLocked Lock() => this.WrappedNotDisposed.Lock(); - public IDisposable Push() => - this.wrapped?.Push() ?? throw new ObjectDisposedException(nameof(FontHandleWrapper)); + public IDisposable Push() => this.WrappedNotDisposed.Push(); - public void Pop() => this.wrapped?.Pop(); + public void Pop() => this.WrappedNotDisposed.Pop(); public Task WaitAsync() => - this.wrapped?.WaitAsync().ContinueWith(_ => (IFontHandle)this) ?? - throw new ObjectDisposedException(nameof(FontHandleWrapper)); + this.WrappedNotDisposed.WaitAsync().ContinueWith(_ => (IFontHandle)this); - public override string ToString() => $"{nameof(FontHandleWrapper)}({this.wrapped})"; + public override string ToString() => + $"{nameof(FontHandleWrapper)}({this.wrapped?.ToString() ?? "disposed"})"; private void WrappedOnImFontChanged(IFontHandle obj) => this.ImFontChanged.InvokeSafely(this); } diff --git a/Dalamud/Storage/Assets/IDalamudAssetManager.cs b/Dalamud/Storage/Assets/IDalamudAssetManager.cs index 4fb83df80..1202891b8 100644 --- a/Dalamud/Storage/Assets/IDalamudAssetManager.cs +++ b/Dalamud/Storage/Assets/IDalamudAssetManager.cs @@ -1,4 +1,5 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Contracts; using System.IO; using System.Threading.Tasks; @@ -64,8 +65,9 @@ internal interface IDalamudAssetManager /// /// The texture asset. /// The default return value, if the asset is not ready for whatever reason. - /// The texture wrap. + /// The texture wrap. Can be null only if is null. [Pure] + [return: NotNullIfNotNull(nameof(defaultWrap))] IDalamudTextureWrap? GetDalamudTextureWrap(DalamudAsset asset, IDalamudTextureWrap? defaultWrap); /// From 9d6756fbca58f6069a26ea54065aea7af48ef181 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 24 Jan 2024 12:11:07 +0000 Subject: [PATCH 02/11] Update ClientStructs --- lib/FFXIVClientStructs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index e9341bb30..d0108d2e6 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit e9341bb3038bf4200300f21be4a8629525d15596 +Subproject commit d0108d2e6e30a6b51b1124fc27ec3523c8ca3acb From 31c3c1ecc0c5306c481312d79312835c37460e66 Mon Sep 17 00:00:00 2001 From: MidoriKami <9083275+MidoriKami@users.noreply.github.com> Date: Sun, 28 Jan 2024 17:55:49 -0800 Subject: [PATCH 03/11] Fix reset and reload not working --- .../Internal/Windows/PluginInstaller/PluginInstallerWindow.cs | 4 ++-- Dalamud/Plugin/Internal/PluginManager.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 5007691ab..18cac5cf2 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -2556,7 +2556,7 @@ internal class PluginInstallerWindow : Window, IDisposable if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload)) { - this.ShowDeletePluginConfigWarningModal(plugin.Name).ContinueWith(t => + this.ShowDeletePluginConfigWarningModal(plugin.Manifest.InternalName).ContinueWith(t => { var shouldDelete = t.Result; @@ -2571,7 +2571,7 @@ internal class PluginInstallerWindow : Window, IDisposable { this.installStatus = OperationStatus.Idle; - this.DisplayErrorContinuation(task, Locs.ErrorModal_DeleteConfigFail(plugin.Name)); + this.DisplayErrorContinuation(task, Locs.ErrorModal_DeleteConfigFail(plugin.Manifest.InternalName)); }); } }); diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 8bfb38c34..6bdf73036 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -1094,7 +1094,7 @@ internal partial class PluginManager : IDisposable, IServiceType { try { - this.PluginConfigs.Delete(plugin.Name); + this.PluginConfigs.Delete(plugin.Manifest.InternalName); break; } catch (IOException) From e065f3e988315ebc29c5c82a73130f9e979d4126 Mon Sep 17 00:00:00 2001 From: MidoriKami <9083275+MidoriKami@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:26:22 -0800 Subject: [PATCH 04/11] Show Name in text prompt --- .../Internal/Windows/PluginInstaller/PluginInstallerWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 18cac5cf2..40fc66221 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -2556,7 +2556,7 @@ internal class PluginInstallerWindow : Window, IDisposable if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload)) { - this.ShowDeletePluginConfigWarningModal(plugin.Manifest.InternalName).ContinueWith(t => + this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name).ContinueWith(t => { var shouldDelete = t.Result; From 0e724be4f8b3e778761e0c65d7d27560c43a1f73 Mon Sep 17 00:00:00 2001 From: MidoriKami <9083275+MidoriKami@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:27:36 -0800 Subject: [PATCH 05/11] Fix loc typo --- .../Internal/Windows/PluginInstaller/PluginInstallerWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 40fc66221..83d819634 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -3773,7 +3773,7 @@ internal class PluginInstallerWindow : Window, IDisposable public static string DeletePluginConfigWarningModal_Title => Loc.Localize("InstallerDeletePluginConfigWarning", "Warning###InstallerDeletePluginConfigWarning"); - public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for v{0}?").Format(pluginName); + public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?").Format(pluginName); public static string DeletePluginConfirmWarningModal_Yes => Loc.Localize("InstallerDeletePluginConfigWarningYes", "Yes"); From 866c41c2d8282258ef9d56796113009053142898 Mon Sep 17 00:00:00 2001 From: bleatbot <106497096+bleatbot@users.noreply.github.com> Date: Tue, 30 Jan 2024 03:03:31 +0100 Subject: [PATCH 06/11] Update ClientStructs (#1623) Co-authored-by: github-actions[bot] --- lib/FFXIVClientStructs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index d0108d2e6..0549ab9a9 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit d0108d2e6e30a6b51b1124fc27ec3523c8ca3acb +Subproject commit 0549ab9a993b4c4c8c0b4dcd4e31ed5413f75387 From 65265b678e1e56c28e4c23dc2f89f18b76c95a32 Mon Sep 17 00:00:00 2001 From: bleatbot <106497096+bleatbot@users.noreply.github.com> Date: Sun, 4 Feb 2024 19:57:00 +0100 Subject: [PATCH 07/11] Update ClientStructs (#1626) Co-authored-by: github-actions[bot] --- lib/FFXIVClientStructs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 0549ab9a9..b5f5f68e1 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 0549ab9a993b4c4c8c0b4dcd4e31ed5413f75387 +Subproject commit b5f5f68e147e1a21a0f0c88345f8d8c359678317 From 1d32e8fe45821de870f8730f58d9e3e60a12885d Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 7 Feb 2024 18:33:35 +0000 Subject: [PATCH 08/11] Fix language selector throwing a exception, use native name for Taiwan (#1634) The language selector has only been showing language codes and not the actual language names since dd0159ae5a2174819c1541644e5cdbd4ddd98a1d because "tw" (Taiwan Mandarin) was added and it's not supported by CultureInfo. This adds a specific check like the language code to work around this and stop throwing exceptions. Also converts to a switch so it looks a bit nicer. --- .../Widgets/LanguageChooserSettingsEntry.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs index 85f8a826f..c8cc1f42c 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs @@ -31,17 +31,20 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry try { var locLanguagesList = new List(); - string locLanguage; foreach (var language in this.languages) { - if (language != "ko") + switch (language) { - locLanguage = CultureInfo.GetCultureInfo(language).NativeName; - locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]); - } - else - { - locLanguagesList.Add("Korean"); + case "ko": + locLanguagesList.Add("Korean"); + break; + case "tw": + locLanguagesList.Add("中華民國國語"); + break; + default: + string locLanguage = CultureInfo.GetCultureInfo(language).NativeName; + locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]); + break; } } From 7112651b7762ac1f5554811e7a820e97a7fbb779 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 7 Feb 2024 18:37:55 +0000 Subject: [PATCH 09/11] Remove EnableWindowsTargeting from build.sh's run step (#1633) This removes the property that shouldn't be there, because it was considered a target. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 index a4c346c80..5aa50b1c1 --- a/build.sh +++ b/build.sh @@ -59,4 +59,4 @@ fi echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)" "$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false /p:EnableWindowsTargeting=true -nologo -clp:NoSummary --verbosity quiet -"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- /p:EnableWindowsTargeting=true "$@" +"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" From 8b30781b4c2b4f5169d254bd4a17f4c040a5e0dd Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 7 Feb 2024 13:06:03 -0500 Subject: [PATCH 10/11] Change "Enable AntiDebug" label to make it clearer You need to enable this to allow debugging, but the label has the negative which doesn't make sense. Now it's called "Disable Debugging Protections" which is what it actually does. --- Dalamud/Interface/Internal/DalamudInterface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 60c1f9957..6035ca0ec 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -667,7 +667,7 @@ internal class DalamudInterface : IDisposable, IServiceType } var antiDebug = Service.Get(); - if (ImGui.MenuItem("Enable AntiDebug", null, antiDebug.IsEnabled)) + if (ImGui.MenuItem("Disable Debugging Protections", null, antiDebug.IsEnabled)) { var newEnabled = !antiDebug.IsEnabled; if (newEnabled) From 0d10a179664af93c428dd5fabdf38a0be8dbc306 Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Thu, 8 Feb 2024 09:53:51 -0800 Subject: [PATCH 11/11] Make CommandWidget look better (and expose more info) (#1631) - Expose the plugin that owns the command. --- .../Windows/Data/Widgets/CommandWidget.cs | 53 +++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs index 8ec704888..c4c74274a 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs @@ -1,4 +1,8 @@ -using Dalamud.Game.Command; +using System.Linq; + +using Dalamud.Game.Command; +using Dalamud.Interface.Utility.Raii; + using ImGuiNET; namespace Dalamud.Interface.Internal.Windows.Data.Widgets; @@ -28,9 +32,52 @@ internal class CommandWidget : IDataWindowWidget { var commandManager = Service.Get(); - foreach (var command in commandManager.Commands) + var tableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.Borders | ImGuiTableFlags.SizingStretchProp | + ImGuiTableFlags.Sortable | ImGuiTableFlags.SortTristate; + using var table = ImRaii.Table("CommandList", 4, tableFlags); + if (table) { - ImGui.Text($"{command.Key}\n -> {command.Value.HelpMessage}\n -> In help: {command.Value.ShowInHelp}\n\n"); + ImGui.TableSetupScrollFreeze(0, 1); + + ImGui.TableSetupColumn("Command"); + ImGui.TableSetupColumn("Plugin"); + ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort); + ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort); + ImGui.TableHeadersRow(); + + var sortSpecs = ImGui.TableGetSortSpecs(); + var commands = commandManager.Commands.ToArray(); + + if (sortSpecs.SpecsCount != 0) + { + commands = sortSpecs.Specs.ColumnIndex switch + { + 0 => sortSpecs.Specs.SortDirection == ImGuiSortDirection.Ascending + ? commands.OrderBy(kv => kv.Key).ToArray() + : commands.OrderByDescending(kv => kv.Key).ToArray(), + 1 => sortSpecs.Specs.SortDirection == ImGuiSortDirection.Ascending + ? commands.OrderBy(kv => kv.Value.LoaderAssemblyName).ToArray() + : commands.OrderByDescending(kv => kv.Value.LoaderAssemblyName).ToArray(), + _ => commands, + }; + } + + foreach (var command in commands) + { + ImGui.TableNextRow(); + + ImGui.TableSetColumnIndex(0); + ImGui.Text(command.Key); + + ImGui.TableNextColumn(); + ImGui.Text(command.Value.LoaderAssemblyName); + + ImGui.TableNextColumn(); + ImGui.TextWrapped(command.Value.HelpMessage); + + ImGui.TableNextColumn(); + ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No"); + } } } }