mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
Refactor Addon Lifecycle
This commit is contained in:
parent
a31dda7865
commit
54bac7f32a
19 changed files with 543 additions and 825 deletions
|
|
@ -1,10 +1,8 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Game.Addon.Lifecycle;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Utility;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
|
@ -54,13 +52,6 @@ public class AddonLifecycleWidget : IDataWindowWidget
|
|||
this.DrawEventListeners();
|
||||
ImGui.Unindent();
|
||||
}
|
||||
|
||||
if (ImGui.CollapsingHeader("ReceiveEvent Hooks"u8))
|
||||
{
|
||||
ImGui.Indent();
|
||||
this.DrawReceiveEventHooks();
|
||||
ImGui.Unindent();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawEventListeners()
|
||||
|
|
@ -100,46 +91,4 @@ public class AddonLifecycleWidget : IDataWindowWidget
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawReceiveEventHooks()
|
||||
{
|
||||
if (!this.Ready) return;
|
||||
|
||||
var listeners = this.AddonLifecycle.ReceiveEventListeners;
|
||||
|
||||
if (listeners.Count == 0)
|
||||
{
|
||||
ImGui.Text("No ReceiveEvent Hooks are Registered"u8);
|
||||
}
|
||||
|
||||
foreach (var receiveEventListener in this.AddonLifecycle.ReceiveEventListeners)
|
||||
{
|
||||
if (ImGui.CollapsingHeader(string.Join(", ", receiveEventListener.AddonNames)))
|
||||
{
|
||||
ImGui.Columns(2);
|
||||
|
||||
var functionAddress = receiveEventListener.FunctionAddress;
|
||||
|
||||
ImGui.Text("Hook Address"u8);
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text($"0x{functionAddress:X} (ffxiv_dx11.exe+{functionAddress - Process.GetCurrentProcess().MainModule!.BaseAddress:X})");
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text("Hook Status"u8);
|
||||
ImGui.NextColumn();
|
||||
if (receiveEventListener.Hook is null)
|
||||
{
|
||||
ImGui.Text("Hook is null"u8);
|
||||
}
|
||||
else
|
||||
{
|
||||
var color = receiveEventListener.Hook.IsEnabled ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed;
|
||||
var text = receiveEventListener.Hook.IsEnabled ? "Enabled"u8 : "Disabled"u8;
|
||||
ImGui.TextColored(color, text);
|
||||
}
|
||||
|
||||
ImGui.Columns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue