Model: Handle generic type definition fetch for metadata v27
This commit is contained in:
@@ -202,7 +202,7 @@ namespace Il2CppInspector
|
||||
[Version(Max = 24.3)]
|
||||
public long typeDefinitionIndex; /* the generic type definition */
|
||||
[Version(Min = 27)]
|
||||
public long type; // Il2CppType* /* the generic type definition */
|
||||
public ulong type; // Il2CppType* /* the generic type definition */
|
||||
|
||||
public Il2CppGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */
|
||||
public ulong cached_class; /* if present, the Il2CppClass corresponding to the instantiation. */
|
||||
|
||||
@@ -195,15 +195,19 @@ namespace Il2CppInspector.Reflection
|
||||
// TODO: Replace with array load from Il2CppMetadataRegistration.genericClasses
|
||||
var generic = image.ReadMappedObject<Il2CppGenericClass>(typeRef.datapoint); // Il2CppGenericClass *
|
||||
|
||||
// Get generic type definition
|
||||
TypeInfo genericTypeDef;
|
||||
if (Package.Version < 27) {
|
||||
// It appears that TypeRef can be -1 if the generic depth recursion limit
|
||||
// (--maximum-recursive-generic-depth=) is reached in Il2Cpp. In this case,
|
||||
// no generic instance type is generated, so we just produce a null TypeInfo here.
|
||||
|
||||
// TODO: Generic type definition index resolution is broken in metadata v27 (replaced with Il2CppType *type)
|
||||
if ((generic.typeDefinitionIndex & 0xffff_ffff) == 0x0000_0000_ffff_ffff)
|
||||
return null;
|
||||
|
||||
var genericTypeDef = TypesByDefinitionIndex[generic.typeDefinitionIndex];
|
||||
genericTypeDef = TypesByDefinitionIndex[generic.typeDefinitionIndex];
|
||||
} else {
|
||||
genericTypeDef = GetTypeFromVirtualAddress(generic.type);
|
||||
}
|
||||
|
||||
// Get the instantiation
|
||||
// TODO: Replace with array load from Il2CppMetadataRegistration.genericInsts
|
||||
|
||||
Reference in New Issue
Block a user