Rename `BizHawk.BizInvoke.ParameterInfo` to `InvokerParameterInfo`

This commit is contained in:
YoshiRulz 2024-07-03 21:11:23 +10:00
parent db2782ca1b
commit 91c48117a3
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 12 additions and 12 deletions

View File

@ -26,7 +26,7 @@ namespace BizHawk.BizInvoke
/// back into host code.
/// </summary>
/// <returns></returns>
IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime);
IntPtr GetArrivalFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime);
/// <summary>
/// Like Marshal.GetDelegateForFunctionPointer(), but wraps a thunk around the passed native pointer
@ -45,7 +45,7 @@ namespace BizHawk.BizInvoke
/// <param name="pp"></param>
/// <param name="lifetime"></param>
/// <returns></returns>
IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime);
IntPtr GetDepartureFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime);
}
public static class CallingConventionAdapterExtensions
@ -55,19 +55,19 @@ namespace BizHawk.BizInvoke
=> (T) a.GetDelegateForFunctionPointer(p, typeof(T));
}
public class ParameterInfo
public sealed class InvokerParameterInfo
{
public Type ReturnType { get; }
public IReadOnlyList<Type> ParameterTypes { get; }
public ParameterInfo(Type returnType, IEnumerable<Type> parameterTypes)
public InvokerParameterInfo(Type returnType, IEnumerable<Type> parameterTypes)
{
ReturnType = returnType;
ParameterTypes = parameterTypes.ToList().AsReadOnly();
}
/// <exception cref="InvalidOperationException"><paramref name="delegateType"/> does not inherit <see cref="Delegate"/></exception>
public ParameterInfo(Type delegateType)
public InvokerParameterInfo(Type delegateType)
{
if (!typeof(Delegate).IsAssignableFrom(delegateType))
{
@ -101,13 +101,13 @@ namespace BizHawk.BizInvoke
{
private class NativeConvention : ICallingConventionAdapter
{
public IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetArrivalFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
=> p;
public Delegate GetDelegateForFunctionPointer(IntPtr p, Type delegateType)
=> Marshal.GetDelegateForFunctionPointer(p, delegateType);
public IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetDepartureFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
=> p;
public IntPtr GetFunctionPointerForDelegate(Delegate d)
@ -174,7 +174,7 @@ namespace BizHawk.BizInvoke
_waterboxHost = waterboxHost;
}
public IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetArrivalFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
{
if (_slots == null)
{
@ -200,7 +200,7 @@ namespace BizHawk.BizInvoke
return WaterboxWrapper.GetDelegateForFunctionPointer(p, delegateType);
}
public IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetDepartureFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
{
p = _waterboxHost.GetCallinProcAddr(p);
return WaterboxWrapper.GetDepartureFunctionPointer(p, pp, lifetime);
@ -289,7 +289,7 @@ namespace BizHawk.BizInvoke
throw new NotSupportedException($"Unknown type {type}. Possibly supported?");
}
private static int VerifyDelegateSignature(ParameterInfo pp)
private static int VerifyDelegateSignature(InvokerParameterInfo pp)
{
VerifyParameter(pp.ReturnType);
foreach (var ppp in pp.ParameterTypes)
@ -366,7 +366,7 @@ namespace BizHawk.BizInvoke
}
}
public IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetArrivalFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
{
lock (_sync)
{
@ -391,7 +391,7 @@ namespace BizHawk.BizInvoke
}
}
public IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
public IntPtr GetDepartureFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime)
{
lock (_sync)
{