Fix x86 edge case bugs
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Il2CppInspector
|
|||||||
{
|
{
|
||||||
public Il2CppBinaryX86(IFileFormatReader stream) : base(stream) { }
|
public Il2CppBinaryX86(IFileFormatReader stream) : base(stream) { }
|
||||||
public Il2CppBinaryX86(IFileFormatReader stream, uint codeRegistration, uint metadataRegistration) : base(stream, codeRegistration, metadataRegistration) { }
|
public Il2CppBinaryX86(IFileFormatReader stream, uint codeRegistration, uint metadataRegistration) : base(stream, codeRegistration, metadataRegistration) { }
|
||||||
|
|
||||||
protected override (ulong, ulong) ConsiderCode(uint loc, ulong globalOffset) {
|
protected override (ulong, ulong) ConsiderCode(uint loc, ulong globalOffset) {
|
||||||
ulong metadata, code;
|
ulong metadata, code;
|
||||||
long funcPtr;
|
long funcPtr;
|
||||||
@@ -32,15 +33,16 @@ namespace Il2CppInspector
|
|||||||
return (0, 0);
|
return (0, 0);
|
||||||
|
|
||||||
// Jump to Il2CppCodegenRegistration
|
// Jump to Il2CppCodegenRegistration
|
||||||
Image.Position = Image.MapVATR((ulong) funcPtr) + 6;
|
Image.Position = Image.MapVATR((ulong) funcPtr + 6);
|
||||||
metadata = Image.ReadUInt32();
|
metadata = Image.ReadUInt32();
|
||||||
Image.Position = Image.MapVATR((ulong) funcPtr) + 11;
|
Image.Position = Image.MapVATR((ulong) funcPtr + 11);
|
||||||
code = Image.ReadUInt32();
|
code = Image.ReadUInt32();
|
||||||
return (code, metadata);
|
return (code, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variant 2
|
// Variant 2
|
||||||
bytes = new byte[] { 0x55, 0x89, 0xE5, 0x53, 0x83, 0xE4, 0xF0, 0x83, 0xEC, 0x20, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5B };
|
bytes = new byte[]
|
||||||
|
{0x55, 0x89, 0xE5, 0x53, 0x83, 0xE4, 0xF0, 0x83, 0xEC, 0x20, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5B};
|
||||||
Image.Position = loc;
|
Image.Position = loc;
|
||||||
buff = Image.ReadBytes(16);
|
buff = Image.ReadBytes(16);
|
||||||
if (!bytes.SequenceEqual(buff))
|
if (!bytes.SequenceEqual(buff))
|
||||||
@@ -61,7 +63,6 @@ namespace Il2CppInspector
|
|||||||
if (opcode == 0x838B) {
|
if (opcode == 0x838B) {
|
||||||
Image.Position = Image.MapVATR(metadata);
|
Image.Position = Image.MapVATR(metadata);
|
||||||
metadata = Image.ReadUInt32();
|
metadata = Image.ReadUInt32();
|
||||||
}
|
|
||||||
|
|
||||||
// Repeat the same logic for extracting the Code pointer
|
// Repeat the same logic for extracting the Code pointer
|
||||||
Image.Position = funcPtr + 0x2A;
|
Image.Position = funcPtr + 0x2A;
|
||||||
@@ -71,9 +72,11 @@ namespace Il2CppInspector
|
|||||||
if (opcode == 0x838B) {
|
if (opcode == 0x838B) {
|
||||||
Image.Position = Image.MapVATR(code);
|
Image.Position = Image.MapVATR(code);
|
||||||
code = Image.ReadUInt32();
|
code = Image.ReadUInt32();
|
||||||
}
|
|
||||||
|
|
||||||
return (code, metadata);
|
return (code, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return (0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user