Model: Eliminate stream reads and duplicate TypeInfos from GetTypeFromVirtualAddress

This commit is contained in:
Katy Coe
2020-02-02 09:36:23 +01:00
parent b73885ca8e
commit 57451de036
5 changed files with 21 additions and 18 deletions

View File

@@ -103,10 +103,8 @@ namespace Il2CppInspector.Reflection
Position = generic.Position;
Attributes = generic.Attributes;
// TODO: Duplicate instances of 'concrete' may cause this search to fail. Replace with a straight lookup after eliminating GetTypeFromVirtualAddress
//paramTypeReference = Array.IndexOf(model.TypesByReferenceIndex, concrete);
// TODO: Get rid of this slow and filthy hack to force finding the correct type reference
paramTypeReference = model.TypesByReferenceIndex.Select((v, i) => new {i, v}).First(t => t.v.ToString() == concrete.ToString()).i;
// Search for the concrete type's TypeRef index to store as the parameter type reference index
paramTypeReference = Array.IndexOf(model.TypesByReferenceIndex, concrete);
DefaultValue = generic.DefaultValue;
DefaultValueMetadataAddress = generic.DefaultValueMetadataAddress;