From 91c48117a305390ec28f701246791985cf3f71f5 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 3 Jul 2024 21:11:23 +1000 Subject: [PATCH] Rename `BizHawk.BizInvoke.ParameterInfo` to `InvokerParameterInfo` --- .../CallingConventionAdapter.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) 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) {