From 4df62e1607b1455e00a1149d1b7b41f901ef187e Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Thu, 28 Oct 2021 01:27:32 +0200 Subject: [PATCH] backend name in hook tracker --- Dalamud/Hooking/AsmHook.cs | 3 +++ Dalamud/Hooking/Hook.cs | 12 ++++++++++++ Dalamud/Hooking/IDalamudHook.cs | 5 +++++ .../Interface/Internal/Windows/PluginStatWindow.cs | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/Dalamud/Hooking/AsmHook.cs b/Dalamud/Hooking/AsmHook.cs index 49c951867..35eac4efd 100644 --- a/Dalamud/Hooking/AsmHook.cs +++ b/Dalamud/Hooking/AsmHook.cs @@ -112,6 +112,9 @@ namespace Dalamud.Hooking /// public bool IsDisposed { get; private set; } + /// + public string BackendName => "Reloaded/Asm"; + /// /// Remove a hook from the current process. /// diff --git a/Dalamud/Hooking/Hook.cs b/Dalamud/Hooking/Hook.cs index 9c4230d7a..ba19ffb18 100644 --- a/Dalamud/Hooking/Hook.cs +++ b/Dalamud/Hooking/Hook.cs @@ -131,6 +131,18 @@ namespace Dalamud.Hooking /// public bool IsDisposed { get; private set; } + /// + public string BackendName + { + get + { + if (this.isMinHook) + return "MinHook"; + + return "Reloaded"; + } + } + /// /// Creates a hook. Hooking address is inferred by calling to GetProcAddress() function. /// The hook is not activated until Enable() method is called. diff --git a/Dalamud/Hooking/IDalamudHook.cs b/Dalamud/Hooking/IDalamudHook.cs index deaf62957..5a9ae2716 100644 --- a/Dalamud/Hooking/IDalamudHook.cs +++ b/Dalamud/Hooking/IDalamudHook.cs @@ -21,5 +21,10 @@ namespace Dalamud.Hooking /// Gets a value indicating whether or not the hook is disposed. /// public bool IsDisposed { get; } + + /// + /// Gets the name of the hooking backend used for the hook. + /// + public string BackendName { get; } } } diff --git a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs index e3760794a..48c792002 100644 --- a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs @@ -4,6 +4,7 @@ using System.Reflection; using Dalamud.Game; using Dalamud.Game.Internal; +using Dalamud.Hooking; using Dalamud.Hooking.Internal; using Dalamud.Interface.Windowing; using Dalamud.Plugin.Internal; @@ -196,6 +197,9 @@ namespace Dalamud.Interface.Internal.Windows ImGui.Text("Status"); ImGui.NextColumn(); + ImGui.Text("Backend"); + ImGui.NextColumn(); + ImGui.Separator(); ImGui.Separator(); @@ -240,6 +244,10 @@ namespace Dalamud.Interface.Internal.Windows } ImGui.NextColumn(); + + ImGui.Text(trackedHook.Hook.BackendName); + + ImGui.NextColumn(); } catch (Exception ex) {