Skip to content

Commit

Permalink
Tidy up TryResolveFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
DaZombieKiller committed Sep 14, 2020
1 parent ffb7b00 commit 70e0bf1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Unity/SymbolResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@ public unsafe bool TryResolve<T>(string name, out T* address)
return address != null;
}

public unsafe bool TryResolveFunction<T>(string name, out T del)
public bool TryResolveFunction<T>(string name, out T function)
where T : Delegate
{
var address = GetAddressOrZero(name);
if (address == IntPtr.Zero)
{
del = null;
return false;
}
del = Marshal.GetDelegateForFunctionPointer<T>(address);
return del != null;
function = address != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer<T>(address) : null;
return function != null;
}

public T ResolveFunction<T>(string name)
Expand Down

0 comments on commit 70e0bf1

Please sign in to comment.