From aa91e82196f977b78b4cb9fe86d50cbfb2a3997d Mon Sep 17 00:00:00 2001 From: thegu5 <58223632+thegu5@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:17:16 -0500 Subject: [PATCH 1/3] Account for the type name when renaming properties from the deobf map --- Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs index 0a174ca3..4e0ba9b1 100644 --- a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs +++ b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs @@ -85,7 +85,7 @@ private static string UnmanglePropertyName(AssemblyRewriteContext assemblyContex var unmanglePropertyName = baseName + "_" + index; if (assemblyContext.GlobalContext.Options.RenameMap.TryGetValue( - declaringType.GetNamespacePrefix() + "::" + unmanglePropertyName, out var newName)) + declaringType.GetNamespacePrefix() + "." + declaringType.Name + "::" + unmanglePropertyName, out var newName)) unmanglePropertyName = newName; return unmanglePropertyName; From dbbb2578d283ad8bf1d516d603adbffbcb44a8fa Mon Sep 17 00:00:00 2001 From: thegu5 <58223632+thegu5@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:34:34 -0500 Subject: [PATCH 2/3] avoid breaking change --- .../Passes/Pass70GenerateProperties.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs index 4e0ba9b1..9a31cdee 100644 --- a/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs +++ b/Il2CppInterop.Generator/Passes/Pass70GenerateProperties.cs @@ -85,8 +85,16 @@ private static string UnmanglePropertyName(AssemblyRewriteContext assemblyContex var unmanglePropertyName = baseName + "_" + index; if (assemblyContext.GlobalContext.Options.RenameMap.TryGetValue( - declaringType.GetNamespacePrefix() + "." + declaringType.Name + "::" + unmanglePropertyName, out var newName)) + declaringType.GetNamespacePrefix() + "." + declaringType.Name + "::" + unmanglePropertyName, out var newNameByType)) + { + unmanglePropertyName = newNameByType; + } + else if (assemblyContext.GlobalContext.Options.RenameMap.TryGetValue( + declaringType.GetNamespacePrefix() + "::" + unmanglePropertyName, out var newName)) + { unmanglePropertyName = newName; + } + return unmanglePropertyName; } 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 3/3] 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; }