fix Il2CppType definition for 27.2+ (better)

This commit is contained in:
LukeFZ
2023-11-30 21:36:17 +01:00
parent cbc22dcaf6
commit d7067225fe
3 changed files with 30 additions and 48 deletions

View File

@@ -382,7 +382,13 @@ namespace Il2CppInspector
// Type references (pointer array)
var typeRefPointers = Image.ReadMappedArray<ulong>(MetadataRegistration.ptypes, (int) MetadataRegistration.typesCount);
TypeReferenceIndicesByAddress = typeRefPointers.Zip(Enumerable.Range(0, typeRefPointers.Length), (a, i) => new { a, i }).ToDictionary(x => x.a, x => x.i);
TypeReferences = Image.ReadMappedObjectPointerArray<Il2CppType>(MetadataRegistration.ptypes, (int) MetadataRegistration.typesCount);
TypeReferences =
Image.Version >= 27.2
? Image.ReadMappedObjectPointerArray<Il2CppTypeV272>(MetadataRegistration.ptypes, (int) MetadataRegistration.typesCount)
.Cast<Il2CppType>()
.ToList()
: Image.ReadMappedObjectPointerArray<Il2CppType>(MetadataRegistration.ptypes, (int)MetadataRegistration.typesCount);
// Custom attribute constructors (function pointers)
// This is managed in Il2CppInspector for metadata >= 27