From 11af31b0b1454b810ecfa510c9719ca876ef40ea Mon Sep 17 00:00:00 2001 From: Perfare Date: Sun, 23 Feb 2020 03:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/Outputs/ScriptGenerator.cs | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Il2CppDumper/Outputs/ScriptGenerator.cs b/Il2CppDumper/Outputs/ScriptGenerator.cs index 8c3c7b8..f919f73 100644 --- a/Il2CppDumper/Outputs/ScriptGenerator.cs +++ b/Il2CppDumper/Outputs/ScriptGenerator.cs @@ -80,7 +80,14 @@ namespace Il2CppDumper scriptMetadataMethod.Name = "Method$" + methodName; var imageIndex = typeDefImageIndices[typeDef]; var methodPointer = il2Cpp.GetMethodPointer(methodDef.methodIndex, (int)i.Value, imageIndex, methodDef.token); - scriptMetadataMethod.MethodAddress = il2Cpp.GetRVA(methodPointer); + if (methodPointer == 0) + { + scriptMetadataMethod.MethodAddress = 0; + } + else + { + scriptMetadataMethod.MethodAddress = il2Cpp.GetRVA(methodPointer); + } } foreach (var i in metadata.metadataUsageDic[4]) //kIl2CppMetadataUsageFieldInfo { @@ -131,7 +138,14 @@ namespace Il2CppDumper scriptMetadataMethod.Name = "Method$" + methodName; var imageIndex = typeDefImageIndices[typeDef]; var methodPointer = il2Cpp.GetMethodPointer(methodDef.methodIndex, methodSpec.methodDefinitionIndex, imageIndex, methodDef.token); - scriptMetadataMethod.MethodAddress = il2Cpp.GetRVA(methodPointer); + if (methodPointer == 0) + { + scriptMetadataMethod.MethodAddress = 0; + } + else + { + scriptMetadataMethod.MethodAddress = il2Cpp.GetRVA(methodPointer); + } } } if (config.MakeFunction) @@ -160,17 +174,11 @@ namespace Il2CppDumper //TODO interopData内也包含函数 orderedPointers = orderedPointers.Distinct().OrderBy(x => x).ToList(); orderedPointers.Remove(0); - var addresses = new List(orderedPointers.Count); for (int i = 0; i < orderedPointers.Count; i++) { - var addr = orderedPointers[i]; - if (addr > long.MaxValue) - { - continue; - } - addresses.Add(il2Cpp.GetRVA(addr)); + orderedPointers[i] = il2Cpp.GetRVA(orderedPointers[i]); } - json.Addresses = addresses; + json.Addresses = orderedPointers; } File.WriteAllText("script.json", JsonConvert.SerializeObject(json, Formatting.Indented)); }