fix some warnings

This commit is contained in:
goat 2024-12-26 14:11:14 +01:00
parent ce5ee71c91
commit 2e2feb144f
9 changed files with 40 additions and 34 deletions

View file

@ -48,7 +48,6 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
private bool lastConditionNone = true; private bool lastConditionNone = true;
[ServiceManager.ServiceConstructor] [ServiceManager.ServiceConstructor]
private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLifecycle lifecycle) private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLifecycle lifecycle)
{ {

View file

@ -36,12 +36,12 @@ public sealed class XivChatEntry
} }
/// <summary> /// <summary>
/// Gets or Sets the name payloads /// Gets or sets the name payloads.
/// </summary> /// </summary>
public byte[] NameBytes { get; set; } = []; public byte[] NameBytes { get; set; } = [];
/// <summary> /// <summary>
/// Gets or Sets the message payloads. /// Gets or sets the message payloads.
/// </summary> /// </summary>
public byte[] MessageBytes { get; set; } = []; public byte[] MessageBytes { get; set; } = [];

View file

@ -182,7 +182,10 @@ public static partial class ImGuiComponents
/// </summary> /// </summary>
/// <param name="icon">Icon to show.</param> /// <param name="icon">Icon to show.</param>
/// <param name="text">Text to show.</param> /// <param name="text">Text to show.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param> /// <param name="size">
/// 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.
/// </param>
/// <returns>Indicator if button is clicked.</returns> /// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size); public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size);
@ -194,7 +197,10 @@ public static partial class ImGuiComponents
/// <param name="defaultColor">The default color of the button.</param> /// <param name="defaultColor">The default color of the button.</param>
/// <param name="activeColor">The color of the button when active.</param> /// <param name="activeColor">The color of the button when active.</param>
/// <param name="hoveredColor">The color of the button when hovered.</param> /// <param name="hoveredColor">The color of the button when hovered.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param> /// <param name="size">
/// 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.
/// </param>
/// <returns>Indicator if button is clicked.</returns> /// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null) public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null)
{ {

View file

@ -8,6 +8,9 @@ using ImGuiNET;
namespace Dalamud.Interface.Components; namespace Dalamud.Interface.Components;
/// <summary>
/// ImGui component used to create a radio-like input that uses icon buttons.
/// </summary>
public static partial class ImGuiComponents public static partial class ImGuiComponents
{ {
/// <summary> /// <summary>

View file

@ -126,7 +126,6 @@ public class IconBrowserWidget : IDataWindowWidget
this.valueRange = null; this.valueRange = null;
} }
ImGui.NextColumn(); ImGui.NextColumn();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X); ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0)) if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0))

View file

@ -1,7 +1,7 @@
using Dalamud.Game.Text; using System.Linq;
using ImGuiNET;
using System.Linq; using Dalamud.Game.Text;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets; namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -196,6 +196,14 @@ public class DevPluginsSettingsEntry : SettingsEntry
} }
} }
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
private void AddDevPlugin() private void AddDevPlugin()
{ {
if (this.devPluginLocations.Any( if (this.devPluginLocations.Any(
@ -223,16 +231,7 @@ public class DevPluginsSettingsEntry : SettingsEntry
this.devPluginTempLocation = string.Empty; this.devPluginTempLocation = string.Empty;
} }
var config = Service<DalamudConfiguration>.Get(); // Enable ImGui asserts if a dev plugin is added, if no choice was made prior
if (!config.ImGuiAssertsEnabledAtStartup.HasValue) Service<DalamudConfiguration>.Get().ImGuiAssertsEnabledAtStartup ??= true;
config.ImGuiAssertsEnabledAtStartup = true;
} }
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
} }

View file

@ -72,6 +72,8 @@ internal class AutoUpdateManager : IServiceType
private readonly IConsoleVariable<bool> isDryRun; private readonly IConsoleVariable<bool> isDryRun;
private readonly Task<DalamudLinkPayload> openInstallerWindowLinkTask;
private DateTime? loginTime; private DateTime? loginTime;
private DateTime? nextUpdateCheckTime; private DateTime? nextUpdateCheckTime;
private DateTime? unblockedSince; private DateTime? unblockedSince;
@ -82,8 +84,6 @@ internal class AutoUpdateManager : IServiceType
private Task? autoUpdateTask; private Task? autoUpdateTask;
private readonly Task<DalamudLinkPayload> openInstallerWindowLink;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AutoUpdateManager"/> class. /// Initializes a new instance of the <see cref="AutoUpdateManager"/> class.
/// </summary> /// </summary>
@ -99,7 +99,7 @@ internal class AutoUpdateManager : IServiceType
}); });
Service<Framework>.GetAsync().ContinueWith(t => { t.Result.Update += this.OnUpdate; }); Service<Framework>.GetAsync().ContinueWith(t => { t.Result.Update += this.OnUpdate; });
this.openInstallerWindowLink = this.openInstallerWindowLinkTask =
Service<ChatGui>.GetAsync().ContinueWith( Service<ChatGui>.GetAsync().ContinueWith(
chatGuiTask => chatGuiTask.Result.AddChatLinkHandler( chatGuiTask => chatGuiTask.Result.AddChatLinkHandler(
"Dalamud", "Dalamud",
@ -109,7 +109,6 @@ internal class AutoUpdateManager : IServiceType
Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins); Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins);
})); }));
this.isDryRun = console.AddVariable("dalamud.autoupdate.dry_run", "Simulate updates instead", false); this.isDryRun = console.AddVariable("dalamud.autoupdate.dry_run", "Simulate updates instead", false);
console.AddCommand("dalamud.autoupdate.trigger_login", "Trigger a login event", () => console.AddCommand("dalamud.autoupdate.trigger_login", "Trigger a login event", () =>
{ {
@ -441,7 +440,7 @@ internal class AutoUpdateManager : IServiceType
new TextPayload(Locs.NotificationContentUpdatesAvailableMinimized(updatablePlugins.Count)), new TextPayload(Locs.NotificationContentUpdatesAvailableMinimized(updatablePlugins.Count)),
new TextPayload(" ["), new TextPayload(" ["),
new UIForegroundPayload(500), new UIForegroundPayload(500),
this.openInstallerWindowLink.Result, this.openInstallerWindowLinkTask.Result,
new TextPayload(Loc.Localize("DalamudInstallerHelp", "Open the plugin installer")), new TextPayload(Loc.Localize("DalamudInstallerHelp", "Open the plugin installer")),
RawPayload.LinkTerminator, RawPayload.LinkTerminator,
new UIForegroundPayload(0), new UIForegroundPayload(0),

View file

@ -19,6 +19,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Support; using Dalamud.Support;
using ImGuiNET; using ImGuiNET;
using Lumina.Excel.Sheets; using Lumina.Excel.Sheets;
@ -28,8 +29,6 @@ using Windows.Win32.Storage.FileSystem;
using Windows.Win32.System.Memory; using Windows.Win32.System.Memory;
using Windows.Win32.System.Ole; using Windows.Win32.System.Ole;
using Dalamud.Interface.Utility.Raii;
using static TerraFX.Interop.Windows.Windows; using static TerraFX.Interop.Windows.Windows;
using Win32_PInvoke = Windows.Win32.PInvoke; using Win32_PInvoke = Windows.Win32.PInvoke;
@ -1051,7 +1050,8 @@ public static class Util
} }
} }
private static unsafe void ShowSpanEntryPrivate<T>(ulong addr, IList<string> path, int offset, Span<T> spanobj) { private static unsafe void ShowSpanEntryPrivate<T>(ulong addr, IList<string> path, int offset, Span<T> spanobj)
{
const int batchSize = 20; const int batchSize = 20;
if (spanobj.Length > batchSize) if (spanobj.Length > batchSize)
{ {
@ -1221,6 +1221,7 @@ public static class Util
ImGui.TextDisabled($"[0x{offset.Value:X}]"); ImGui.TextDisabled($"[0x{offset.Value:X}]");
ImGui.SameLine(); ImGui.SameLine();
} }
ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}"); ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}");
} }