diff --git a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs index 4303d6fcd2..00a2566d65 100644 --- a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs +++ b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs @@ -26,7 +26,7 @@ namespace BizHawk.BizInvoke /// back into host code. /// /// - IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime); + IntPtr GetArrivalFunctionPointer(IntPtr p, InvokerParameterInfo pp, object lifetime); /// /// Like Marshal.GetDelegateForFunctionPointer(), but wraps a thunk around the passed native pointer @@ -45,7 +45,7 @@ namespace BizHawk.BizInvoke /// /// /// - 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 ParameterTypes { get; } - public ParameterInfo(Type returnType, IEnumerable parameterTypes) + public InvokerParameterInfo(Type returnType, IEnumerable parameterTypes) { ReturnType = returnType; ParameterTypes = parameterTypes.ToList().AsReadOnly(); } /// does not inherit - 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) {