mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-11 23:41:53 +00:00
feat(modloader): pdb mapping, dynamic invoke, mixins
This commit is contained in:
23
WeaveLoader.API/Native/NativeInvoker.cs
Normal file
23
WeaveLoader.API/Native/NativeInvoker.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace WeaveLoader.API.Native;
|
||||
|
||||
internal static class NativeInvoker
|
||||
{
|
||||
internal static bool TryInvoke(string fullName, nint thisPtr, bool hasThis, NativeType retType, NativeArg[] args, out NativeRet ret)
|
||||
{
|
||||
ret = new NativeRet { Type = retType };
|
||||
nint fn = NativeSymbol.Find(fullName);
|
||||
if (fn == 0)
|
||||
return false;
|
||||
int ok = NativeInterop.native_invoke(fn, thisPtr, hasThis ? 1 : 0, args, args.Length, ref ret);
|
||||
return ok != 0;
|
||||
}
|
||||
|
||||
internal static bool TryInvoke(nint fn, nint thisPtr, bool hasThis, NativeType retType, NativeArg[] args, out NativeRet ret)
|
||||
{
|
||||
ret = new NativeRet { Type = retType };
|
||||
if (fn == 0)
|
||||
return false;
|
||||
int ok = NativeInterop.native_invoke(fn, thisPtr, hasThis ? 1 : 0, args, args.Length, ref ret);
|
||||
return ok != 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user