Skip to content

Commit

Permalink
IHookProvider => IGameInteropProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Sep 21, 2023
1 parent 8a7526c commit 173e9a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ namespace Dalamud.Hooking.Internal;
[InterfaceVersion("1.0")]
[ServiceManager.ScopedService]
#pragma warning disable SA1015
[ResolveVia<IHookProvider>]
[ResolveVia<IGameInteropProvider>]
#pragma warning restore SA1015
internal class HookProviderPluginScoped : IHookProvider, IServiceType, IDisposable
internal class GameInteropProviderPluginScoped : IGameInteropProvider, IServiceType, IDisposable
{
private readonly LocalPlugin plugin;
private readonly SigScanner scanner;

private readonly ConcurrentBag<IDalamudHook> trackedHooks = new();

/// <summary>
/// Initializes a new instance of the <see cref="HookProviderPluginScoped"/> class.
/// Initializes a new instance of the <see cref="GameInteropProviderPluginScoped"/> class.
/// </summary>
/// <param name="plugin">Plugin this instance belongs to.</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.scanner = scanner;
Expand Down Expand Up @@ -63,23 +63,23 @@ public Hook<T> FromImport<T>(ProcessModule? module, string moduleName, string fu
}

/// <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);
return hook;
}

/// <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);
return hook;
}

/// <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);

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Dalamud.Plugin.Services;
/// <summary>
/// Service responsible for the creation of hooks.
/// </summary>
public interface IHookProvider
public interface IGameInteropProvider
{
/// <summary>
/// Available hooking backends.
Expand Down
2 changes: 1 addition & 1 deletion Dalamud/Utility/Signatures/SignatureHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void Invalid(string message, bool prepend = true)
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);
createdHooks.Add(hook);

Expand Down

0 comments on commit 173e9a3

Please sign in to comment.