【m】hybrid更新为8.11.0
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 3s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 5s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 10s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 8s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 34s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 2s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 17s
Plugin Library CI / publish (07.RKTools) (push) Successful in 4s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 17s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 4s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s

This commit is contained in:
2026-04-13 22:59:23 +08:00
parent a7902e8224
commit a441a06257
20 changed files with 335 additions and 121 deletions

View File

@@ -287,6 +287,7 @@ namespace HybridCLR.Editor.MethodBridge
CollectStructDefs(_managed2NativeMethodList0, structTypeSet);
CollectStructDefs(_native2ManagedMethodList0, structTypeSet);
CollectStructDefs(_adjustThunkMethodList0, structTypeSet);
CollectStructDefs(_originalCalliMethodSignatures.Select(m => m.MethodSig).ToList(), structTypeSet);
_structTypes0 = structTypeSet.ToList();
_structTypes0.Sort((a, b) => a.TypeId - b.TypeId);
@@ -558,6 +559,11 @@ namespace HybridCLR.Editor.MethodBridge
{
return CallingConvention.Winapi;
}
if (monoPInvokeCallbackAttr.ConstructorArguments.Count == 0)
{
Debug.LogError($"MonoPInvokeCallbackAttribute on method {method.FullName} has no constructor arguments. Using CallingConvention.Winapi as default.");
return CallingConvention.Winapi;
}
object delegateTypeSig = monoPInvokeCallbackAttr.ConstructorArguments[0].Value;
TypeDef delegateTypeDef;
@@ -579,7 +585,7 @@ namespace HybridCLR.Editor.MethodBridge
throw new NotSupportedException($"Unsupported delegate type: {delegateTypeSig}");
}
var attr = delegateTypeDef.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute");
if (attr == null)
if (attr == null || attr.ConstructorArguments.Count == 0)
{
return CallingConvention.Winapi;
}
@@ -637,7 +643,7 @@ namespace HybridCLR.Editor.MethodBridge
sharedMethod.Init();
sharedMethod = ToIsomorphicMethod(sharedMethod);
CallingConvention callingConv = (CallingConvention)((int)(method.MethodSig.CallingConvention & dnlib.DotNet.CallingConvention.Mask) + 1);
CallingConvention callingConv = (CallingConvention)((int)((method.Callvention ?? method.MethodSig.CallingConvention) & dnlib.DotNet.CallingConvention.Mask) + 1);
string signature = MakeCalliSignature(sharedMethod, callingConv);
if (!methodsBySig.TryGetValue(signature, out var arm))
@@ -829,6 +835,38 @@ const ReversePInvokeMethodData hybridclr::interpreter::g_reversePInvokeMethodStu
}
private void CollectStructDefs(List<MethodSig> methods, HashSet<TypeInfo> structTypes)
{
ICorLibTypes corLibTypes = _genericMethods[0].Method.Module.CorLibTypes;
foreach (var method in methods)
{
foreach (var paramInfo in method.Params)
{
var paramType = GetSharedTypeInfo(MetaUtil.ToShareTypeSig(corLibTypes, paramInfo));
if (paramType.IsStruct)
{
structTypes.Add(paramType);
if (paramType.Klass.ContainsGenericParameter)
{
throw new Exception($"[CollectStructDefs] method:{method} type:{paramType.Klass} contains generic parameter");
}
}
}
var returnType = GetSharedTypeInfo(MetaUtil.ToShareTypeSig(corLibTypes, method.RetType));
if (returnType.IsStruct)
{
structTypes.Add(returnType);
if (returnType.Klass.ContainsGenericParameter)
{
throw new Exception($"[CollectStructDefs] method:{method} type:{returnType.Klass} contains generic parameter");
}
}
}
}
class FieldInfo
{
public FieldDef field;