From dafbc427e0f67ae36fccb630c0a712084a1a98f9 Mon Sep 17 00:00:00 2001 From: thegu5 <58223632+thegu5@users.noreply.github.com> Date: Fri, 19 Jan 2024 00:16:29 -0500 Subject: [PATCH] Fix method renaming in the same way --- Il2CppInterop.Generator/Contexts/MethodRewriteContext.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Il2CppInterop.Generator/Contexts/MethodRewriteContext.cs b/Il2CppInterop.Generator/Contexts/MethodRewriteContext.cs index 83f63f42..b20fffe2 100644 --- a/Il2CppInterop.Generator/Contexts/MethodRewriteContext.cs +++ b/Il2CppInterop.Generator/Contexts/MethodRewriteContext.cs @@ -242,9 +242,18 @@ private string UnmangleMethodNameWithSignature() { var unmangleMethodNameWithSignature = ProduceMethodSignatureBase() + "_" + DeclaringType.Methods .Where(ParameterSignatureMatchesThis).TakeWhile(it => it != this).Count(); + if (DeclaringType.AssemblyContext.GlobalContext.Options.RenameMap.TryGetValue( + DeclaringType.NewType.GetNamespacePrefix() + "." + DeclaringType.NewType.Name + "::" + unmangleMethodNameWithSignature, out var newNameByType)) + { + unmangleMethodNameWithSignature = newNameByType; + } + else if (DeclaringType.AssemblyContext.GlobalContext.Options.RenameMap.TryGetValue( DeclaringType.NewType.GetNamespacePrefix() + "::" + unmangleMethodNameWithSignature, out var newName)) + { unmangleMethodNameWithSignature = newName; + } + return unmangleMethodNameWithSignature; }