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