Skip to content

Commit

Permalink
fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Dec 26, 2024
1 parent ce5ee71 commit 2e2feb1
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 34 deletions.
1 change: 0 additions & 1 deletion Dalamud/Game/ClientState/ClientState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions Dalamud/Game/Text/XivChatEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public SeString Message
}

/// <summary>
/// Gets or Sets the name payloads
/// Gets or sets the name payloads.
/// </summary>
public byte[] NameBytes { get; set; } = [];

/// <summary>
/// Gets or Sets the message payloads.
/// Gets or sets the message payloads.
/// </summary>
public byte[] MessageBytes { get; set; } = [];

Expand Down
10 changes: 8 additions & 2 deletions Dalamud/Interface/Components/ImGuiComponents.IconButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ public static bool IconButton(string iconText, Vector4? defaultColor, Vector4? a
/// </summary>
/// <param name="icon">Icon 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>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size);

Expand All @@ -194,7 +197,10 @@ public static bool IconButton(string iconText, Vector4? defaultColor, Vector4? a
/// <param name="defaultColor">The default color of the button.</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="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>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace Dalamud.Interface.Components;

/// <summary>
/// ImGui component used to create a radio-like input that uses icon buttons.
/// </summary>
public static partial class ImGuiComponents
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -204,7 +203,7 @@ private void DrawIcon(int iconId)
ImGui.GetColorU32(ImGuiColors.DalamudRed),
iconText);
}

if (ImGui.IsItemHovered())
ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%"));

Expand All @@ -224,7 +223,7 @@ private void DrawIcon(int iconId)
cursor + ((this.iconSize - textSize) / 2),
color,
text);

if (ImGui.IsItemHovered())
ImGui.SetTooltip(iconId.ToString());

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -223,16 +231,7 @@ private void AddDevPlugin()
this.devPluginTempLocation = string.Empty;
}

var config = Service<DalamudConfiguration>.Get();
if (!config.ImGuiAssertsEnabledAtStartup.HasValue)
config.ImGuiAssertsEnabledAtStartup = true;
// Enable ImGui asserts if a dev plugin is added, if no choice was made prior
Service<DalamudConfiguration>.Get().ImGuiAssertsEnabledAtStartup ??= true;
}

public override void PostDraw()
{
this.fileDialogManager.Draw();
}

private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
}
9 changes: 4 additions & 5 deletions Dalamud/Plugin/Internal/AutoUpdate/AutoUpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ internal class AutoUpdateManager : IServiceType

private readonly IConsoleVariable<bool> isDryRun;

private readonly Task<DalamudLinkPayload> openInstallerWindowLinkTask;

private DateTime? loginTime;
private DateTime? nextUpdateCheckTime;
private DateTime? unblockedSince;
Expand All @@ -82,8 +84,6 @@ internal class AutoUpdateManager : IServiceType

private Task? autoUpdateTask;

private readonly Task<DalamudLinkPayload> openInstallerWindowLink;

/// <summary>
/// Initializes a new instance of the <see cref="AutoUpdateManager"/> class.
/// </summary>
Expand All @@ -99,7 +99,7 @@ public AutoUpdateManager(ConsoleManager console)
});
Service<Framework>.GetAsync().ContinueWith(t => { t.Result.Update += this.OnUpdate; });

this.openInstallerWindowLink =
this.openInstallerWindowLinkTask =
Service<ChatGui>.GetAsync().ContinueWith(
chatGuiTask => chatGuiTask.Result.AddChatLinkHandler(
"Dalamud",
Expand All @@ -109,7 +109,6 @@ public AutoUpdateManager(ConsoleManager console)
Service<DalamudInterface>.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", () =>
{
Expand Down Expand Up @@ -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),
Expand Down
13 changes: 7 additions & 6 deletions Dalamud/Utility/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<AssemblyMetadataAttribute>();

return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value
return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value
?? asm.GetName().Version!.ToString();
}

Expand Down Expand Up @@ -853,7 +852,7 @@ internal static void SetExceptionIfIncomplete<T>(this TaskCompletionSource<T> t,
// ignore
}
}

/// <summary>
/// Print formatted IGameObject Information to ImGui.
/// </summary>
Expand Down Expand Up @@ -1051,7 +1050,8 @@ private static unsafe void ShowSpanPrivate<T>(ulong addr, IList<string> path, in
}
}

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;
if (spanobj.Length > batchSize)
{
Expand Down Expand Up @@ -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}");
}

Expand Down

0 comments on commit 2e2feb1

Please sign in to comment.