cache tyoes
This commit is contained in:
@@ -210,12 +210,18 @@ namespace Il2CppInspector.Model
|
||||
|
||||
switch (usage.Type) {
|
||||
case MetadataUsageType.StringLiteral:
|
||||
//if (usage.SourceIndex >= TypeModel.Package.Metadata.StringLiterals.Length)
|
||||
// break;
|
||||
|
||||
var str = TypeModel.GetMetadataUsageName(usage);
|
||||
Strings.Add(address, str);
|
||||
break;
|
||||
|
||||
case MetadataUsageType.Type:
|
||||
case MetadataUsageType.TypeInfo:
|
||||
//if (usage.SourceIndex >= TypeModel.TypesByReferenceIndex.Length)
|
||||
// break;
|
||||
|
||||
var type = TypeModel.GetMetadataUsageType(usage);
|
||||
declarationGenerator.IncludeType(type);
|
||||
AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations());
|
||||
@@ -233,13 +239,17 @@ namespace Il2CppInspector.Model
|
||||
break;
|
||||
case MetadataUsageType.MethodDef:
|
||||
case MetadataUsageType.MethodRef:
|
||||
//if (usage.SourceIndex > TypeModel.Package.Metadata.Methods.Length)
|
||||
// break;
|
||||
|
||||
var method = TypeModel.GetMetadataUsageMethod(usage);
|
||||
declarationGenerator.IncludeMethod(method);
|
||||
AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations());
|
||||
|
||||
// Any method here SHOULD already be in the Methods list
|
||||
// but we have seen one example where this is not the case for a MethodDef
|
||||
if (!Methods.ContainsKey(method)) {
|
||||
if (!Methods.ContainsKey(method))
|
||||
{
|
||||
var fnPtr = declarationGenerator.GenerateMethodDeclaration(method);
|
||||
Methods.Add(method, fnPtr, new AppMethod(method, fnPtr) { Group = Group });
|
||||
}
|
||||
|
||||
@@ -36,8 +36,18 @@ namespace Il2CppInspector.Reflection
|
||||
public Dictionary<string, TypeInfo> TypesByFullName { get; } = new Dictionary<string, TypeInfo>();
|
||||
|
||||
// Every type
|
||||
public IEnumerable<TypeInfo> Types => TypesByDefinitionIndex.Concat(TypesByReferenceIndex)
|
||||
.Concat(GenericMethods.Values.Select(m => m.DeclaringType)).Distinct().Where(t => t != null);
|
||||
public IEnumerable<TypeInfo> Types
|
||||
{
|
||||
get
|
||||
{
|
||||
types ??= TypesByDefinitionIndex.Concat(TypesByReferenceIndex)
|
||||
.Concat(GenericMethods.Values.Select(m => m.DeclaringType)).Distinct().Where(t => t != null).ToList();
|
||||
return types;
|
||||
}
|
||||
}
|
||||
|
||||
private List<TypeInfo> types;
|
||||
|
||||
|
||||
// List of all methods ordered by their MethodDefinitionIndex
|
||||
public MethodBase[] MethodsByDefinitionIndex { get; }
|
||||
|
||||
Reference in New Issue
Block a user