From b80b20ccfcbcb46f3de5c4e7cd5f987c8558cf1c Mon Sep 17 00:00:00 2001 From: js6pak Date: Mon, 3 Oct 2022 18:28:36 +0200 Subject: [PATCH] Don't generate interop methods for interface overrides --- Il2CppInterop.Generator/Contexts/TypeRewriteContext.cs | 1 + Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Il2CppInterop.Generator/Contexts/TypeRewriteContext.cs b/Il2CppInterop.Generator/Contexts/TypeRewriteContext.cs index 379923de..2d7941d3 100644 --- a/Il2CppInterop.Generator/Contexts/TypeRewriteContext.cs +++ b/Il2CppInterop.Generator/Contexts/TypeRewriteContext.cs @@ -99,6 +99,7 @@ public void AddMembers() if (originalTypeMethod.Name == ".cctor") continue; if (originalTypeMethod.Name == ".ctor" && originalTypeMethod.Parameters.Count == 1 && originalTypeMethod.Parameters[0].ParameterType.FullName == "System.IntPtr") continue; + if (originalTypeMethod.HasOverrides) continue; var methodRewriteContext = new MethodRewriteContext(this, originalTypeMethod); myMethodContexts[originalTypeMethod] = methodRewriteContext; diff --git a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs index e4047f34..0a174ca3 100644 --- a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs +++ b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs @@ -20,6 +20,8 @@ public static void DoPass(RewriteGlobalContext context) foreach (var oldProperty in type.Properties) { + if ((oldProperty.GetMethod?.HasOverrides ?? false) || (oldProperty.SetMethod?.HasOverrides ?? false)) continue; + var unmangledPropertyName = UnmanglePropertyName(assemblyContext, oldProperty, typeContext.NewType, propertyCountsByName);