From 54e94ea46271dbcd16bfdc13834be2a752d3d39e Mon Sep 17 00:00:00 2001 From: Perfare Date: Sat, 13 Feb 2021 14:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E9=87=8D=E5=A4=8D=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/Outputs/ScriptGenerator.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Il2CppDumper/Outputs/ScriptGenerator.cs b/Il2CppDumper/Outputs/ScriptGenerator.cs index eaf57a1..8959dd0 100644 --- a/Il2CppDumper/Outputs/ScriptGenerator.cs +++ b/Il2CppDumper/Outputs/ScriptGenerator.cs @@ -25,6 +25,7 @@ namespace Il2CppDumper private List genericClassList = new List(); private StringBuilder arrayClassHeader = new StringBuilder(); private StringBuilder methodInfoHeader = new StringBuilder(); + private static HashSet methodInfoCache = new HashSet(); private static HashSet keyword = new HashSet(StringComparer.Ordinal) { "klass", "monitor", "register", "_cs", "auto", "friend", "template", "near", "far", "flat", "default", "_ds", "interrupt", "inline", "unsigned", "signed", "asm", "if", "case", "break", "continue", "do", "new", "_", "short", "union"}; @@ -137,10 +138,13 @@ namespace Il2CppDumper var scriptMethod = new ScriptMethod(); json.ScriptMethod.Add(scriptMethod); scriptMethod.Address = il2Cpp.GetRVA(genericMethodPointer); - var methodInfoName = $"MethodInfo_{scriptMethod.Address}"; + var methodInfoName = $"MethodInfo_{scriptMethod.Address:X}"; var structTypeName = structNameDic[typeDef]; var rgctxs = GenerateRGCTX(imageName, methodDef); - GenerateMethodInfo(methodInfoName, structTypeName, rgctxs); + if (methodInfoCache.Add(genericMethodPointer)) + { + GenerateMethodInfo(methodInfoName, structTypeName, rgctxs); + } (var methodSpecTypeName, var methodSpecMethodName) = executor.GetMethodSpecName(methodSpec, true); var methodFullName = methodSpecTypeName + "$$" + methodSpecMethodName; scriptMethod.Name = methodFullName;