Avoid recreating ref'd types that already exist
Because TypesByReferenceIndex can be populated in two places (Il2CppModel constructor and GetTypeFromVirtualAddress), we need to avoid generating the same type multiple times.
This commit is contained in:
@@ -73,6 +73,11 @@ namespace Il2CppInspector.Reflection
|
|||||||
// Create and reference types from TypeRefs
|
// Create and reference types from TypeRefs
|
||||||
// Note that you can't resolve any TypeRefs until all the TypeDefs have been processed
|
// Note that you can't resolve any TypeRefs until all the TypeDefs have been processed
|
||||||
for (int typeRefIndex = 0; typeRefIndex < package.TypeReferences.Count; typeRefIndex++) {
|
for (int typeRefIndex = 0; typeRefIndex < package.TypeReferences.Count; typeRefIndex++) {
|
||||||
|
if(TypesByReferenceIndex[typeRefIndex] != null) {
|
||||||
|
/* type already generated - probably by forward reference through GetTypeFromVirtualAddress */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var typeRef = Package.TypeReferences[typeRefIndex];
|
var typeRef = Package.TypeReferences[typeRefIndex];
|
||||||
var referencedType = TypeInfo.FromTypeReference(this, typeRef);
|
var referencedType = TypeInfo.FromTypeReference(this, typeRef);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user