mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
IHookProvider => IGameInteropProvider
This commit is contained in:
parent
8a7526cca4
commit
173e9a3144
3 changed files with 11 additions and 11 deletions
|
|
@ -19,9 +19,9 @@ namespace Dalamud.Hooking.Internal;
|
||||||
[InterfaceVersion("1.0")]
|
[InterfaceVersion("1.0")]
|
||||||
[ServiceManager.ScopedService]
|
[ServiceManager.ScopedService]
|
||||||
#pragma warning disable SA1015
|
#pragma warning disable SA1015
|
||||||
[ResolveVia<IHookProvider>]
|
[ResolveVia<IGameInteropProvider>]
|
||||||
#pragma warning restore SA1015
|
#pragma warning restore SA1015
|
||||||
internal class HookProviderPluginScoped : IHookProvider, IServiceType, IDisposable
|
internal class GameInteropProviderPluginScoped : IGameInteropProvider, IServiceType, IDisposable
|
||||||
{
|
{
|
||||||
private readonly LocalPlugin plugin;
|
private readonly LocalPlugin plugin;
|
||||||
private readonly SigScanner scanner;
|
private readonly SigScanner scanner;
|
||||||
|
|
@ -29,11 +29,11 @@ internal class HookProviderPluginScoped : IHookProvider, IServiceType, IDisposab
|
||||||
private readonly ConcurrentBag<IDalamudHook> trackedHooks = new();
|
private readonly ConcurrentBag<IDalamudHook> trackedHooks = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="HookProviderPluginScoped"/> class.
|
/// Initializes a new instance of the <see cref="GameInteropProviderPluginScoped"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">Plugin this instance belongs to.</param>
|
/// <param name="plugin">Plugin this instance belongs to.</param>
|
||||||
/// <param name="scanner">SigScanner instance for target module.</param>
|
/// <param name="scanner">SigScanner instance for target module.</param>
|
||||||
public HookProviderPluginScoped(LocalPlugin plugin, SigScanner scanner)
|
public GameInteropProviderPluginScoped(LocalPlugin plugin, SigScanner scanner)
|
||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.scanner = scanner;
|
this.scanner = scanner;
|
||||||
|
|
@ -63,23 +63,23 @@ internal class HookProviderPluginScoped : IHookProvider, IServiceType, IDisposab
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Hook<T> FromSymbol<T>(string moduleName, string exportName, T detour, IHookProvider.HookBackend backend = IHookProvider.HookBackend.Automatic) where T : Delegate
|
public Hook<T> FromSymbol<T>(string moduleName, string exportName, T detour, IGameInteropProvider.HookBackend backend = IGameInteropProvider.HookBackend.Automatic) where T : Delegate
|
||||||
{
|
{
|
||||||
var hook = Hook<T>.FromSymbol(moduleName, exportName, detour, backend == IHookProvider.HookBackend.MinHook);
|
var hook = Hook<T>.FromSymbol(moduleName, exportName, detour, backend == IGameInteropProvider.HookBackend.MinHook);
|
||||||
this.trackedHooks.Add(hook);
|
this.trackedHooks.Add(hook);
|
||||||
return hook;
|
return hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Hook<T> FromAddress<T>(IntPtr procAddress, T detour, IHookProvider.HookBackend backend = IHookProvider.HookBackend.Automatic) where T : Delegate
|
public Hook<T> FromAddress<T>(IntPtr procAddress, T detour, IGameInteropProvider.HookBackend backend = IGameInteropProvider.HookBackend.Automatic) where T : Delegate
|
||||||
{
|
{
|
||||||
var hook = Hook<T>.FromAddress(procAddress, detour, backend == IHookProvider.HookBackend.MinHook);
|
var hook = Hook<T>.FromAddress(procAddress, detour, backend == IGameInteropProvider.HookBackend.MinHook);
|
||||||
this.trackedHooks.Add(hook);
|
this.trackedHooks.Add(hook);
|
||||||
return hook;
|
return hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Hook<T> FromSignature<T>(string signature, T detour, IHookProvider.HookBackend backend = IHookProvider.HookBackend.Automatic) where T : Delegate
|
public Hook<T> FromSignature<T>(string signature, T detour, IGameInteropProvider.HookBackend backend = IGameInteropProvider.HookBackend.Automatic) where T : Delegate
|
||||||
=> this.FromAddress(this.scanner.ScanText(signature), detour, backend);
|
=> this.FromAddress(this.scanner.ScanText(signature), detour, backend);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Service responsible for the creation of hooks.
|
/// Service responsible for the creation of hooks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IHookProvider
|
public interface IGameInteropProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Available hooking backends.
|
/// Available hooking backends.
|
||||||
|
|
@ -161,7 +161,7 @@ internal static class SignatureHelper
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hook = creator.Invoke(null, new object?[] { ptr, detour, IHookProvider.HookBackend.Automatic }) as IDalamudHook;
|
var hook = creator.Invoke(null, new object?[] { ptr, detour, IGameInteropProvider.HookBackend.Automatic }) as IDalamudHook;
|
||||||
info.SetValue(self, hook);
|
info.SetValue(self, hook);
|
||||||
createdHooks.Add(hook);
|
createdHooks.Add(hook);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue