mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
MinSharp multihook
This commit is contained in:
parent
93ae7c9a66
commit
0184062901
3 changed files with 16 additions and 2 deletions
|
|
@ -67,7 +67,7 @@
|
|||
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
|
||||
<PackageReference Include="Lumina" Version="3.3.0" />
|
||||
<PackageReference Include="Lumina.Excel" Version="5.50.0" />
|
||||
<PackageReference Include="MinSharp" Version="1.0.1" />
|
||||
<PackageReference Include="MinSharp" Version="1.0.2" />
|
||||
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.10.10.01" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||
|
|
|
|||
|
|
@ -56,7 +56,15 @@ namespace Dalamud.Hooking
|
|||
this.address = address;
|
||||
if (this.isMinHook)
|
||||
{
|
||||
this.minHookImpl = new MinSharp.Hook<T>(address, detour);
|
||||
var indexList = hasOtherHooks
|
||||
? HookManager.MultiHookTracker[address]
|
||||
: HookManager.MultiHookTracker[address] = new();
|
||||
var index = (ulong)indexList.Count;
|
||||
|
||||
this.minHookImpl = new MinSharp.Hook<T>(address, detour, index);
|
||||
|
||||
// Add afterwards, so the hookIdent starts at 0.
|
||||
indexList.Add(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -168,6 +176,7 @@ namespace Dalamud.Hooking
|
|||
if (this.isMinHook)
|
||||
{
|
||||
this.minHookImpl.Dispose();
|
||||
HookManager.MultiHookTracker[this.address] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ namespace Dalamud.Hooking.Internal
|
|||
/// </summary>
|
||||
internal static Dictionary<IntPtr, byte[]> Originals { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static dictionary of the number of hooks on a given address.
|
||||
/// </summary>
|
||||
internal static Dictionary<IntPtr, List<IDalamudHook?>> MultiHookTracker { get; } = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue