diff --git a/Dalamud/Game/Addon/Events/PluginEventController.cs b/Dalamud/Game/Addon/Events/PluginEventController.cs
index b1251855b..950087c5c 100644
--- a/Dalamud/Game/Addon/Events/PluginEventController.cs
+++ b/Dalamud/Game/Addon/Events/PluginEventController.cs
@@ -140,7 +140,7 @@ internal unsafe class PluginEventController : IDisposable
if (currentAddonPointer != eventEntry.Addon) return;
// Make sure the addon is not unloaded
- var atkUnitBase = (AtkUnitBase*)currentAddonPointer;
+ var atkUnitBase = currentAddonPointer.Struct;
if (atkUnitBase->UldManager.LoadedState == AtkLoadState.Unloaded) return;
// Does this addon contain the node this event is for? (by address)
diff --git a/Dalamud/Game/Gui/Dtr/DtrBar.cs b/Dalamud/Game/Gui/Dtr/DtrBar.cs
index dc814232e..18d8b7f86 100644
--- a/Dalamud/Game/Gui/Dtr/DtrBar.cs
+++ b/Dalamud/Game/Gui/Dtr/DtrBar.cs
@@ -330,7 +330,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
this.entriesReadOnlyCopy = null;
}
- private AtkUnitBase* GetDtr() => (AtkUnitBase*)this.gameGui.GetAddonByName("_DTR").ToPointer();
+ private AtkUnitBase* GetDtr() => this.gameGui.GetAddonByName("_DTR").Struct;
private void Update(IFramework unused)
{
diff --git a/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs b/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs
index cd84b996b..7f83f180c 100644
--- a/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs
+++ b/Dalamud/Game/Gui/NamePlate/NamePlateGui.cs
@@ -72,7 +72,7 @@ internal sealed class NamePlateGui : IInternalDisposableService, INamePlateGui
///
public unsafe void RequestRedraw()
{
- var addon = (AddonNamePlate*)this.gameGui.GetAddonByName("NamePlate");
+ var addon = (AddonNamePlate*)(nint)this.gameGui.GetAddonByName("NamePlate");
if (addon != null)
{
addon->DoFullUpdate = 1;
diff --git a/Dalamud/Game/Gui/NativeWrapper/AtkUnitBasePtr.cs b/Dalamud/Game/Gui/NativeWrapper/AtkUnitBasePtr.cs
index a35c4a743..94e1639da 100644
--- a/Dalamud/Game/Gui/NativeWrapper/AtkUnitBasePtr.cs
+++ b/Dalamud/Game/Gui/NativeWrapper/AtkUnitBasePtr.cs
@@ -1,9 +1,7 @@
-using System.Collections.Generic;
using System.Numerics;
using System.Runtime.InteropServices;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using FFXIVClientStructs.Interop;
namespace Dalamud.Game.Gui.NativeWrapper;
diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
index 9d6575a55..2dc1b6cfd 100644
--- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
+++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs
@@ -81,7 +81,7 @@ public unsafe partial class AddonTree : IDisposable
{
var ptr = GameGui.GetAddonByName(name);
- if ((AtkUnitBase*)ptr != null)
+ if (!ptr.IsNull)
{
if (AddonTrees.TryGetValue(name, out var tree))
{
@@ -234,7 +234,7 @@ public unsafe partial class AddonTree : IDisposable
/// true if the addon is found.
private bool ValidateAddon(out AtkUnitBase* addon)
{
- addon = (AtkUnitBase*)GameGui.GetAddonByName(this.AddonName);
+ addon = GameGui.GetAddonByName(this.AddonName).Struct;
if (addon == null || (nint)addon != this.InitialPtr)
{
this.Dispose();
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
index 18bcd9334..16bdc8bb3 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
@@ -1,4 +1,4 @@
-using Dalamud.Game.Gui;
+using Dalamud.Game.Gui;
using Dalamud.Memory;
using Dalamud.Utility;
using ImGuiNET;
@@ -48,7 +48,7 @@ internal unsafe class AddonWidget : IDataWindowWidget
return;
}
- var addon = (FFXIVClientStructs.FFXIV.Component.GUI.AtkUnitBase*)address;
+ var addon = address.Struct;
var name = addon->NameString;
ImGui.TextUnformatted($"{name} - {Util.DescribeAddress(address)}\n v:{addon->IsVisible} x:{addon->X} y:{addon->Y} s:{addon->Scale}, w:{addon->RootNode->Width}, h:{addon->RootNode->Height}");