mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-23 08:17:59 +01:00
Add unused debug hook for finding functions faster.
This commit is contained in:
parent
fba5bc6820
commit
49ba771b26
1 changed files with 27 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ using Dalamud.Hooking;
|
||||||
using Dalamud.Utility.Signatures;
|
using Dalamud.Utility.Signatures;
|
||||||
using Penumbra.GameData;
|
using Penumbra.GameData;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
using Penumbra.Interop.Structs;
|
using Penumbra.Interop.Structs;
|
||||||
|
|
@ -29,7 +30,8 @@ public unsafe class GameEventManager : IDisposable
|
||||||
_resourceHandleDestructorHook.Enable();
|
_resourceHandleDestructorHook.Enable();
|
||||||
_characterBaseCreateHook.Enable();
|
_characterBaseCreateHook.Enable();
|
||||||
_characterBaseDestructorHook.Enable();
|
_characterBaseDestructorHook.Enable();
|
||||||
_weaponReloadHook.Enable();
|
_weaponReloadHook.Enable();
|
||||||
|
EnableDebugHook();
|
||||||
Penumbra.Log.Verbose($"{Prefix} Created.");
|
Penumbra.Log.Verbose($"{Prefix} Created.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,6 +43,7 @@ public unsafe class GameEventManager : IDisposable
|
||||||
_characterBaseCreateHook.Dispose();
|
_characterBaseCreateHook.Dispose();
|
||||||
_characterBaseDestructorHook.Dispose();
|
_characterBaseDestructorHook.Dispose();
|
||||||
_weaponReloadHook.Dispose();
|
_weaponReloadHook.Dispose();
|
||||||
|
DisposeDebugHook();
|
||||||
Penumbra.Log.Verbose($"{Prefix} Disposed.");
|
Penumbra.Log.Verbose($"{Prefix} Disposed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,4 +259,27 @@ public unsafe class GameEventManager : IDisposable
|
||||||
public delegate void WeaponReloadedEvent(nint drawDataContainer, nint gameObject);
|
public delegate void WeaponReloadedEvent(nint drawDataContainer, nint gameObject);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Testing
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
//[Signature("48 89 5C 24 ?? 48 89 74 24 ?? 89 54 24 ?? 57 48 83 EC ?? 48 8B F9", DetourName = nameof(TestDetour))]
|
||||||
|
private readonly Hook<TestDelegate>? _testHook = null;
|
||||||
|
|
||||||
|
private delegate void TestDelegate(nint a1, int a2);
|
||||||
|
private void TestDetour(nint a1, int a2)
|
||||||
|
{
|
||||||
|
Penumbra.Log.Information($"Test: {a1:X} {a2}");
|
||||||
|
_testHook!.Original(a1, a2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void EnableDebugHook()
|
||||||
|
=> _testHook?.Enable();
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
private void DisposeDebugHook()
|
||||||
|
=> _testHook?.Dispose();
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue