diff --git a/Il2CppDumper/Elf.cs b/Il2CppDumper/Elf.cs index 92eac53..b689dfe 100644 --- a/Il2CppDumper/Elf.cs +++ b/Il2CppDumper/Elf.cs @@ -57,11 +57,6 @@ namespace Il2CppDumper RelocationProcessing(); } - public Elf(Stream stream, ulong codeRegistration, ulong metadataRegistration, int version, long maxmetadataUsages) : this(stream, version, maxmetadataUsages) - { - Init(codeRegistration, metadataRegistration); - } - private void GetSectionWithName() { try diff --git a/Il2CppDumper/Il2Cpp.cs b/Il2CppDumper/Il2Cpp.cs index 8a91026..5d14999 100644 --- a/Il2CppDumper/Il2Cpp.cs +++ b/Il2CppDumper/Il2Cpp.cs @@ -28,7 +28,7 @@ namespace Il2CppDumper protected Il2Cpp(Stream stream) : base(stream) { } - protected virtual void Init(ulong codeRegistration, ulong metadataRegistration) + public virtual void Init(ulong codeRegistration, ulong metadataRegistration) { pCodeRegistration = MapVATR(codeRegistration); pMetadataRegistration = MapVATR(metadataRegistration); @@ -51,7 +51,7 @@ namespace Il2CppDumper metadataUsages = Array.ConvertAll(MapVATR(pMetadataRegistration.metadataUsages, maxmetadataUsages), x => (ulong)x); } - protected void Init64(ulong codeRegistration, ulong metadataRegistration) + public void Init64(ulong codeRegistration, ulong metadataRegistration) { pCodeRegistration = MapVATR(codeRegistration); pMetadataRegistration = MapVATR(metadataRegistration); diff --git a/Il2CppDumper/Macho.cs b/Il2CppDumper/Macho.cs index 84c1c06..e51bed9 100644 --- a/Il2CppDumper/Macho.cs +++ b/Il2CppDumper/Macho.cs @@ -56,18 +56,13 @@ namespace Il2CppDumper } } - public Macho(Stream stream, ulong codeRegistration, ulong metadataRegistration, int version, long maxmetadataUsages) : this(stream, version, maxmetadataUsages) - { - Init(codeRegistration, metadataRegistration); - } - public override dynamic MapVATR(dynamic uiAddr) { var section = sections.First(x => uiAddr >= x.address && uiAddr <= x.end); return uiAddr - (section.address - section.offset); } - protected override void Init(ulong codeRegistration, ulong metadataRegistration) + public override void Init(ulong codeRegistration, ulong metadataRegistration) { base.Init(codeRegistration, metadataRegistration); methodPointers = methodPointers.Select(x => x - 1).ToArray(); diff --git a/Il2CppDumper/Macho64.cs b/Il2CppDumper/Macho64.cs index ff1946f..01b8bff 100644 --- a/Il2CppDumper/Macho64.cs +++ b/Il2CppDumper/Macho64.cs @@ -55,11 +55,6 @@ namespace Il2CppDumper } } - public Macho64(Stream stream, ulong codeRegistration, ulong metadataRegistration, int version, long maxmetadataUsages) : this(stream, version, maxmetadataUsages) - { - Init64(codeRegistration, metadataRegistration); - } - public override dynamic MapVATR(dynamic uiAddr) { var section = sections.First(x => uiAddr >= x.address && uiAddr <= x.end); diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index dba51dc..16c9a00 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -74,19 +74,19 @@ namespace Il2CppDumper Console.WriteLine(); key = Console.ReadKey(true); var version = config.ForceIl2CppVersion ? config.ForceVersion : metadata.version; + Console.WriteLine("Initializing il2cpp file..."); + if (isElf) + il2cpp = new Elf(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); + else if (is64bit) + il2cpp = new Macho64(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); + else + il2cpp = new Macho(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); switch (key.KeyChar) { case '2': case '3': case '4': case '5': - Console.WriteLine("Initializing il2cpp file..."); - if (isElf) - il2cpp = new Elf(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); - else if (is64bit) - il2cpp = new Macho64(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); - else - il2cpp = new Macho(new MemoryStream(il2cppfile), version, metadata.maxmetadataUsages); try { if (key.KeyChar == '5') @@ -119,12 +119,10 @@ namespace Il2CppDumper var codeRegistration = Convert.ToUInt64(Console.ReadLine(), 16); Console.Write("Input MetadataRegistration: "); var metadataRegistration = Convert.ToUInt64(Console.ReadLine(), 16); - if (isElf) - il2cpp = new Elf(new MemoryStream(il2cppfile), codeRegistration, metadataRegistration, version, metadata.maxmetadataUsages); - else if (is64bit) - il2cpp = new Macho64(new MemoryStream(il2cppfile), codeRegistration, metadataRegistration, version, metadata.maxmetadataUsages); + if (is64bit) + il2cpp.Init64(codeRegistration, metadataRegistration); else - il2cpp = new Macho(new MemoryStream(il2cppfile), codeRegistration, metadataRegistration, version, metadata.maxmetadataUsages); + il2cpp.Init(codeRegistration, metadataRegistration); break; } default: @@ -441,9 +439,9 @@ namespace Il2CppDumper writer.Close(); scriptwriter.Close(); Console.WriteLine("Done !"); - Console.WriteLine("Create DummyDll..."); if (config.DummyDll) { + Console.WriteLine("Create DummyDll..."); if (Directory.Exists("DummyDll")) Directory.Delete("DummyDll", true); Directory.CreateDirectory("DummyDll");