diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index c898e107ab..da9873d8da 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -48,7 +48,6 @@ internal sealed class ClientState : IInternalDisposableService, IClientState private bool lastConditionNone = true; - [ServiceManager.ServiceConstructor] private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLifecycle lifecycle) { diff --git a/Dalamud/Game/Text/XivChatEntry.cs b/Dalamud/Game/Text/XivChatEntry.cs index 7932ead727..d4ec751f30 100644 --- a/Dalamud/Game/Text/XivChatEntry.cs +++ b/Dalamud/Game/Text/XivChatEntry.cs @@ -36,12 +36,12 @@ public SeString Message } /// - /// Gets or Sets the name payloads + /// Gets or sets the name payloads. /// public byte[] NameBytes { get; set; } = []; /// - /// Gets or Sets the message payloads. + /// Gets or sets the message payloads. /// public byte[] MessageBytes { get; set; } = []; diff --git a/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs b/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs index 10f177590d..3e61e16bba 100644 --- a/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs +++ b/Dalamud/Interface/Components/ImGuiComponents.IconButton.cs @@ -182,7 +182,10 @@ public static bool IconButton(string iconText, Vector4? defaultColor, Vector4? a /// /// Icon to show. /// Text to show. - /// Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text. + /// + /// Sets the size of the button. If either dimension is set to 0, + /// that dimension will conform to the size of the icon and text. + /// /// Indicator if button is clicked. public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size); @@ -194,7 +197,10 @@ public static bool IconButton(string iconText, Vector4? defaultColor, Vector4? a /// The default color of the button. /// The color of the button when active. /// The color of the button when hovered. - /// Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text. + /// + /// Sets the size of the button. If either dimension is set to 0, + /// that dimension will conform to the size of the icon and text. + /// /// Indicator if button is clicked. public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null) { diff --git a/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs b/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs index ad83c7201c..99050473f8 100644 --- a/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs +++ b/Dalamud/Interface/Components/ImGuiComponents.IconButtonSelect.cs @@ -8,6 +8,9 @@ namespace Dalamud.Interface.Components; +/// +/// ImGui component used to create a radio-like input that uses icon buttons. +/// public static partial class ImGuiComponents { /// diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs index ff34574b58..3f510b088b 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs @@ -18,7 +18,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets; public class IconBrowserWidget : IDataWindowWidget { private const int MaxIconId = 250_000; - + private Vector2 iconSize = new(64.0f, 64.0f); private Vector2 editIconSize = new(64.0f, 64.0f); @@ -126,7 +126,6 @@ private void DrawOptions() this.valueRange = null; } - ImGui.NextColumn(); ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X); if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0)) @@ -204,7 +203,7 @@ private void DrawIcon(int iconId) ImGui.GetColorU32(ImGuiColors.DalamudRed), iconText); } - + if (ImGui.IsItemHovered()) ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%")); @@ -224,7 +223,7 @@ private void DrawIcon(int iconId) cursor + ((this.iconSize - textSize) / 2), color, text); - + if (ImGui.IsItemHovered()) ImGui.SetTooltip(iconId.ToString()); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs index 69282a8e85..35a2a616ec 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeFontTestWidget.cs @@ -1,7 +1,7 @@ -using Dalamud.Game.Text; -using ImGuiNET; +using System.Linq; -using System.Linq; +using Dalamud.Game.Text; +using ImGuiNET; namespace Dalamud.Interface.Internal.Windows.Data.Widgets; diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs index 101b21d38e..4a78735f61 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/DevPluginsSettingsEntry.cs @@ -196,6 +196,14 @@ public override void Draw() } } + public override void PostDraw() + { + this.fileDialogManager.Draw(); + } + + private static bool ValidDevPluginPath(string path) + => Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll"; + private void AddDevPlugin() { if (this.devPluginLocations.Any( @@ -223,16 +231,7 @@ private void AddDevPlugin() this.devPluginTempLocation = string.Empty; } - var config = Service.Get(); - if (!config.ImGuiAssertsEnabledAtStartup.HasValue) - config.ImGuiAssertsEnabledAtStartup = true; + // Enable ImGui asserts if a dev plugin is added, if no choice was made prior + Service.Get().ImGuiAssertsEnabledAtStartup ??= true; } - - public override void PostDraw() - { - this.fileDialogManager.Draw(); - } - - private static bool ValidDevPluginPath(string path) - => Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll"; } diff --git a/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs b/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs index 99850ddb49..ce135b9476 100644 --- a/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs +++ b/Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs @@ -72,6 +72,8 @@ internal class AutoUpdateManager : IServiceType private readonly IConsoleVariable isDryRun; + private readonly Task openInstallerWindowLinkTask; + private DateTime? loginTime; private DateTime? nextUpdateCheckTime; private DateTime? unblockedSince; @@ -82,8 +84,6 @@ internal class AutoUpdateManager : IServiceType private Task? autoUpdateTask; - private readonly Task openInstallerWindowLink; - /// /// Initializes a new instance of the class. /// @@ -99,7 +99,7 @@ public AutoUpdateManager(ConsoleManager console) }); Service.GetAsync().ContinueWith(t => { t.Result.Update += this.OnUpdate; }); - this.openInstallerWindowLink = + this.openInstallerWindowLinkTask = Service.GetAsync().ContinueWith( chatGuiTask => chatGuiTask.Result.AddChatLinkHandler( "Dalamud", @@ -109,7 +109,6 @@ public AutoUpdateManager(ConsoleManager console) Service.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins); })); - this.isDryRun = console.AddVariable("dalamud.autoupdate.dry_run", "Simulate updates instead", false); console.AddCommand("dalamud.autoupdate.trigger_login", "Trigger a login event", () => { @@ -441,7 +440,7 @@ void DrawNotificationContent(INotificationDrawArgs args) new TextPayload(Locs.NotificationContentUpdatesAvailableMinimized(updatablePlugins.Count)), new TextPayload(" ["), new UIForegroundPayload(500), - this.openInstallerWindowLink.Result, + this.openInstallerWindowLinkTask.Result, new TextPayload(Loc.Localize("DalamudInstallerHelp", "Open the plugin installer")), RawPayload.LinkTerminator, new UIForegroundPayload(0), diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index d5e14e212a..d53828858e 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -19,6 +19,7 @@ using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Interface.Colors; using Dalamud.Interface.Utility; +using Dalamud.Interface.Utility.Raii; using Dalamud.Support; using ImGuiNET; using Lumina.Excel.Sheets; @@ -28,8 +29,6 @@ using Windows.Win32.System.Memory; using Windows.Win32.System.Ole; -using Dalamud.Interface.Utility.Raii; - using static TerraFX.Interop.Windows.Windows; using Win32_PInvoke = Windows.Win32.PInvoke; @@ -139,11 +138,11 @@ public static unsafe bool FastByteArrayCompare(byte[]? a1, byte[]? a2) public static string GetScmVersion() { if (scmVersionInternal != null) return scmVersionInternal; - + var asm = typeof(Util).Assembly; var attrs = asm.GetCustomAttributes(); - return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value + return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value ?? asm.GetName().Version!.ToString(); } @@ -853,7 +852,7 @@ internal static void SetExceptionIfIncomplete(this TaskCompletionSource t, // ignore } } - + /// /// Print formatted IGameObject Information to ImGui. /// @@ -1051,7 +1050,8 @@ private static unsafe void ShowSpanPrivate(ulong addr, IList path, in } } - private static unsafe void ShowSpanEntryPrivate(ulong addr, IList path, int offset, Span spanobj) { + private static unsafe void ShowSpanEntryPrivate(ulong addr, IList path, int offset, Span spanobj) + { const int batchSize = 20; if (spanobj.Length > batchSize) { @@ -1221,6 +1221,7 @@ private static void ShowStructInternal(object obj, ulong addr, bool autoExpand = ImGui.TextDisabled($"[0x{offset.Value:X}]"); ImGui.SameLine(); } + ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}"); }