mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-10 03:27:28 -03:00
调整逻辑
This commit is contained in:
parent
218f8e2168
commit
8c0615f4e2
5 changed files with 14 additions and 31 deletions
|
@ -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
|
||||
|
|
|
@ -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<Il2CppCodeRegistration>(codeRegistration);
|
||||
pMetadataRegistration = MapVATR<Il2CppMetadataRegistration>(metadataRegistration);
|
||||
|
@ -51,7 +51,7 @@ namespace Il2CppDumper
|
|||
metadataUsages = Array.ConvertAll(MapVATR<uint>(pMetadataRegistration.metadataUsages, maxmetadataUsages), x => (ulong)x);
|
||||
}
|
||||
|
||||
protected void Init64(ulong codeRegistration, ulong metadataRegistration)
|
||||
public void Init64(ulong codeRegistration, ulong metadataRegistration)
|
||||
{
|
||||
pCodeRegistration = MapVATR<Il2CppCodeRegistration>(codeRegistration);
|
||||
pMetadataRegistration = MapVATR<Il2CppMetadataRegistration>(metadataRegistration);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -74,12 +74,6 @@ namespace Il2CppDumper
|
|||
Console.WriteLine();
|
||||
key = Console.ReadKey(true);
|
||||
var version = config.ForceIl2CppVersion ? config.ForceVersion : metadata.version;
|
||||
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);
|
||||
|
@ -87,6 +81,12 @@ namespace Il2CppDumper
|
|||
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':
|
||||
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");
|
||||
|
|
Loading…
Reference in a new issue