mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-10 03:27:28 -03:00
Fixed #439
This commit is contained in:
parent
7a0ee09aa8
commit
65ad2bffa8
7 changed files with 76 additions and 50 deletions
|
@ -84,7 +84,11 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong MapRTVA(ulong addr)
|
||||
{
|
||||
var phdr = programSegment.First(x => addr >= x.p_offset && addr <= x.p_offset + x.p_filesz);
|
||||
var phdr = programSegment.FirstOrDefault(x => addr >= x.p_offset && addr <= x.p_offset + x.p_filesz);
|
||||
if (phdr == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return addr - phdr.p_offset + phdr.p_vaddr;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,11 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong MapRTVA(ulong addr)
|
||||
{
|
||||
var phdr = programSegment.First(x => addr >= x.p_offset && addr <= x.p_offset + x.p_filesz);
|
||||
var phdr = programSegment.FirstOrDefault(x => addr >= x.p_offset && addr <= x.p_offset + x.p_filesz);
|
||||
if (phdr == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return addr - phdr.p_offset + phdr.p_vaddr;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong MapRTVA(ulong addr)
|
||||
{
|
||||
var section = sections.First(x => addr >= x.offset && addr <= x.offset + x.size);
|
||||
var section = sections.FirstOrDefault(x => addr >= x.offset && addr <= x.offset + x.size);
|
||||
if (section == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return addr - section.offset + section.addr;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,11 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong MapRTVA(ulong addr)
|
||||
{
|
||||
var section = sections.First(x => addr >= x.offset && addr <= x.offset + x.size);
|
||||
var section = sections.FirstOrDefault(x => addr >= x.offset && addr <= x.offset + x.size);
|
||||
if (section == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (section.sectname == "__bss")
|
||||
{
|
||||
throw new Exception();
|
||||
|
|
|
@ -98,7 +98,11 @@ namespace Il2CppDumper
|
|||
|
||||
public override ulong MapRTVA(ulong addr)
|
||||
{
|
||||
var segment = segments.First(x => addr >= x.FileOffset && addr <= x.FileOffset + x.DecompressedSize);
|
||||
var segment = segments.FirstOrDefault(x => addr >= x.FileOffset && addr <= x.FileOffset + x.DecompressedSize);
|
||||
if (segment == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return addr - segment.FileOffset + segment.MemoryOffset;
|
||||
}
|
||||
|
||||
|
|
|
@ -261,50 +261,53 @@ namespace Il2CppDumper
|
|||
if (metadataValue == ((usage << 29) | (decodedIndex << 1)) + 1)
|
||||
{
|
||||
var va = il2Cpp.MapRTVA(addr);
|
||||
switch ((Il2CppMetadataUsage)usage)
|
||||
if (va > 0)
|
||||
{
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageInvalid:
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageTypeInfo:
|
||||
if (decodedIndex < il2Cpp.types.Length)
|
||||
{
|
||||
AddMetadataUsageTypeInfo(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageIl2CppType:
|
||||
if (decodedIndex < il2Cpp.types.Length)
|
||||
{
|
||||
AddMetadataUsageIl2CppType(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageMethodDef:
|
||||
if (decodedIndex < metadata.methodDefs.Length)
|
||||
{
|
||||
AddMetadataUsageMethodDef(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageFieldInfo:
|
||||
if (decodedIndex < metadata.fieldRefs.Length)
|
||||
{
|
||||
AddMetadataUsageFieldInfo(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageStringLiteral:
|
||||
if (decodedIndex < metadata.stringLiterals.Length)
|
||||
{
|
||||
AddMetadataUsageStringLiteral(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageMethodRef:
|
||||
if (decodedIndex < il2Cpp.methodSpecs.Length)
|
||||
{
|
||||
AddMetadataUsageMethodRef(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (il2Cpp.Position != position)
|
||||
{
|
||||
il2Cpp.Position = position;
|
||||
switch ((Il2CppMetadataUsage)usage)
|
||||
{
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageInvalid:
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageTypeInfo:
|
||||
if (decodedIndex < il2Cpp.types.Length)
|
||||
{
|
||||
AddMetadataUsageTypeInfo(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageIl2CppType:
|
||||
if (decodedIndex < il2Cpp.types.Length)
|
||||
{
|
||||
AddMetadataUsageIl2CppType(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageMethodDef:
|
||||
if (decodedIndex < metadata.methodDefs.Length)
|
||||
{
|
||||
AddMetadataUsageMethodDef(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageFieldInfo:
|
||||
if (decodedIndex < metadata.fieldRefs.Length)
|
||||
{
|
||||
AddMetadataUsageFieldInfo(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageStringLiteral:
|
||||
if (decodedIndex < metadata.stringLiterals.Length)
|
||||
{
|
||||
AddMetadataUsageStringLiteral(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
case Il2CppMetadataUsage.kIl2CppMetadataUsageMethodRef:
|
||||
if (decodedIndex < il2Cpp.methodSpecs.Length)
|
||||
{
|
||||
AddMetadataUsageMethodRef(json, decodedIndex, va);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (il2Cpp.Position != position)
|
||||
{
|
||||
il2Cpp.Position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,11 @@ namespace Il2CppDumper
|
|||
{
|
||||
var imageDefName = metadata.GetStringFromIndex(imageDef.nameIndex);
|
||||
var codeGenModule = il2Cpp.codeGenModules[imageDefName];
|
||||
var pointers = il2Cpp.ReadClassArray<ulong>(il2Cpp.MapVATR(codeGenModule.customAttributeCacheGenerator), imageDef.customAttributeCount);
|
||||
pointers.CopyTo(customAttributeGenerators, imageDef.customAttributeStart);
|
||||
if (imageDef.customAttributeCount > 0)
|
||||
{
|
||||
var pointers = il2Cpp.ReadClassArray<ulong>(il2Cpp.MapVATR(codeGenModule.customAttributeCacheGenerator), imageDef.customAttributeCount);
|
||||
pointers.CopyTo(customAttributeGenerators, imageDef.customAttributeStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue