From 59003f8cd56fe73aabd860cfcf678bdb9283f22c Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Wed, 30 Jul 2025 22:48:01 +0200 Subject: [PATCH] Use AtkUnitBasePtr on IGameGui.GetAddonByName --- Dalamud/Game/Gui/GameGui.cs | 13 +++++++------ Dalamud/Plugin/Services/IGameGui.cs | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs index ada9021c4..f19513a7f 100644 --- a/Dalamud/Game/Gui/GameGui.cs +++ b/Dalamud/Game/Gui/GameGui.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; +using Dalamud.Game.Gui.NativeWrapper; using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Hooking; using Dalamud.Interface.Utility; @@ -181,21 +182,21 @@ internal sealed unsafe class GameGui : IInternalDisposableService, IGameGui } /// - public IntPtr GetAddonByName(string name, int index = 1) + public AtkUnitBasePtr GetAddonByName(string name, int index = 1) { var atkStage = AtkStage.Instance(); if (atkStage == null) - return IntPtr.Zero; + return 0; var unitMgr = atkStage->RaptureAtkUnitManager; if (unitMgr == null) - return IntPtr.Zero; + return 0; var addon = unitMgr->GetAddonByName(name, index); if (addon == null) - return IntPtr.Zero; + return 0; - return (IntPtr)addon; + return (nint)addon; } /// @@ -458,7 +459,7 @@ internal class GameGuiPluginScoped : IInternalDisposableService, IGameGui => this.gameGuiService.GetUIModule(); /// - public IntPtr GetAddonByName(string name, int index = 1) + public AtkUnitBasePtr GetAddonByName(string name, int index = 1) => this.gameGuiService.GetAddonByName(name, index); /// diff --git a/Dalamud/Plugin/Services/IGameGui.cs b/Dalamud/Plugin/Services/IGameGui.cs index 0e2da7874..12f69a8f4 100644 --- a/Dalamud/Plugin/Services/IGameGui.cs +++ b/Dalamud/Plugin/Services/IGameGui.cs @@ -1,6 +1,7 @@ -using System.Numerics; +using System.Numerics; using Dalamud.Game.Gui; +using Dalamud.Game.Gui.NativeWrapper; using Dalamud.Game.Text.SeStringHandling.Payloads; namespace Dalamud.Plugin.Services; @@ -86,7 +87,7 @@ public unsafe interface IGameGui /// Name of addon to find. /// Index of addon to find (1-indexed). /// nint.Zero if unable to find UI, otherwise nint pointing to the start of the addon. - public nint GetAddonByName(string name, int index = 1); + public AtkUnitBasePtr GetAddonByName(string name, int index = 1); /// /// Find the agent associated with an addon, if possible.