From 01ec5a6d58879b6a6ebc2160584e32adb2ef600f Mon Sep 17 00:00:00 2001 From: 1582421598 <1582421598@qq.com> Date: Sat, 11 Jun 2022 19:50:42 +0800 Subject: [PATCH] Fixed bugs and compatibility with Il2CppAssemblyUnhollower --- Il2CppDumper/Program.cs | 3 +-- Il2CppDumper/Utils/Il2CppExecutor.cs | 8 ++++++-- Il2CppDumper/ghidra.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index a62d084..7c726fc 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -43,8 +43,7 @@ static void Main(string[] args) { if (File.Exists(arg)) { - var file = File.ReadAllBytes(arg); - if (BitConverter.ToUInt32(file, 0) == 0xFAB11BAF) + if (arg.Contains("global-metadata.dat")) { metadataPath = arg; } diff --git a/Il2CppDumper/Utils/Il2CppExecutor.cs b/Il2CppDumper/Utils/Il2CppExecutor.cs index 13b5255..d13aa1b 100644 --- a/Il2CppDumper/Utils/Il2CppExecutor.cs +++ b/Il2CppDumper/Utils/Il2CppExecutor.cs @@ -38,7 +38,7 @@ public Il2CppExecutor(Metadata metadata, Il2Cpp il2Cpp) this.metadata = metadata; this.il2Cpp = il2Cpp; - if ((il2Cpp.Version >= 27 && il2Cpp.Version < 29)&& !Program.IsGenshinMetadata) + if ((il2Cpp.Version >= 27 && il2Cpp.Version < 29) && !Program.IsGenshinMetadata) { customAttributeGenerators = new ulong[metadata.imageDefs.Sum(x => x.customAttributeCount)]; foreach (var imageDef in metadata.imageDefs) @@ -274,7 +274,11 @@ public Il2CppRGCTXDefinition[] GetRGCTXDefinition(string imageName, Il2CppMethod public Il2CppTypeDefinition GetGenericClassTypeDefinition(Il2CppGenericClass genericClass) { - if (il2Cpp.Version >= 27 && !Program.IsGenshinMetadata) + if (Program.IsGenshinMetadata) + { + return metadata.typeDefs[genericClass.type]; + } + if (il2Cpp.Version >= 27) { var il2CppType = il2Cpp.GetIl2CppType(genericClass.type); if (il2CppType == null) diff --git a/Il2CppDumper/ghidra.py b/Il2CppDumper/ghidra.py index 9e26ded..b758839 100644 --- a/Il2CppDumper/ghidra.py +++ b/Il2CppDumper/ghidra.py @@ -84,4 +84,4 @@ def make_function(start): make_function(start) monitor.incrementProgress(1) -print 'Script finished!' +print("Script finished!")