@@ -19,7 +19,7 @@ public class ApplicationAnalysisContext : ContextWithDataStorage
19
19
/// The IL2CPP binary file this application was loaded from
20
20
/// </summary>
21
21
public Il2CppBinary Binary ;
22
-
22
+
23
23
/// <summary>
24
24
/// The IL2CPP global-metadata file this application was loaded from.
25
25
/// </summary>
@@ -34,12 +34,12 @@ public class ApplicationAnalysisContext : ContextWithDataStorage
34
34
/// The instruction set helper class associated with the instruction set that this application was compiled with.
35
35
/// </summary>
36
36
public Cpp2IlInstructionSet InstructionSet ;
37
-
37
+
38
38
/// <summary>
39
39
/// Contains references to some commonly-used System types.
40
40
/// </summary>
41
41
public SystemTypesContext SystemTypes ;
42
-
42
+
43
43
/// <summary>
44
44
/// All the managed assemblies contained within the metadata file.
45
45
/// </summary>
@@ -54,17 +54,22 @@ public class ApplicationAnalysisContext : ContextWithDataStorage
54
54
/// A dictionary of method pointers to the corresponding method, which may or may not be generic.
55
55
/// </summary>
56
56
public readonly Dictionary < ulong , List < MethodAnalysisContext > > MethodsByAddress = new ( ) ;
57
-
57
+
58
58
/// <summary>
59
59
/// A dictionary of all the generic method variants to their corresponding analysis contexts.
60
60
/// </summary>
61
61
public readonly Dictionary < Cpp2IlMethodRef , ConcreteGenericMethodAnalysisContext > ConcreteGenericMethodsByRef = new ( ) ;
62
62
63
- /// <summary>
63
+ /// <summary>
64
64
/// Key Function Addresses for the binary file. Populated on-demand
65
65
/// </summary>
66
66
private BaseKeyFunctionAddresses ? _keyFunctionAddresses ;
67
67
68
+ /// <summary>
69
+ /// True if this ApplicationAnalysisContext has finished initialization of all of its child contexts, else false.
70
+ /// </summary>
71
+ public bool HasFinishedInitializing { get ; private set ; }
72
+
68
73
public ApplicationAnalysisContext ( Il2CppBinary binary , Il2CppMetadata metadata , float metadataVersion )
69
74
{
70
75
Binary = binary ;
@@ -79,7 +84,7 @@ public ApplicationAnalysisContext(Il2CppBinary binary, Il2CppMetadata metadata,
79
84
{
80
85
throw new InstructionSetHandlerNotRegisteredException ( binary . InstructionSetId ) ;
81
86
}
82
-
87
+
83
88
Logger . VerboseNewline ( "\t Using instruction set handler: " + InstructionSet . GetType ( ) . FullName ) ;
84
89
85
90
foreach ( var assemblyDefinition in Metadata . AssemblyDefinitions )
@@ -91,8 +96,10 @@ public ApplicationAnalysisContext(Il2CppBinary binary, Il2CppMetadata metadata,
91
96
}
92
97
93
98
SystemTypes = new ( this ) ;
94
-
99
+
95
100
PopulateMethodsByAddressTable ( ) ;
101
+
102
+ HasFinishedInitializing = true ;
96
103
}
97
104
98
105
/// <summary>
@@ -147,19 +154,19 @@ private void PopulateMethodsByAddressTable()
147
154
}
148
155
149
156
public TypeAnalysisContext ? ResolveContextForType ( Il2CppTypeDefinition typeDefinition ) => GetAssemblyByName ( typeDefinition . DeclaringAssembly ! . Name ! ) ? . TypesByDefinition [ typeDefinition ] ;
150
-
157
+
151
158
public BaseKeyFunctionAddresses GetOrCreateKeyFunctionAddresses ( )
152
159
{
153
- if ( _keyFunctionAddresses == null )
160
+ if ( _keyFunctionAddresses == null )
154
161
( _keyFunctionAddresses = InstructionSet . CreateKeyFunctionAddressesInstance ( ) ) . Find ( this ) ;
155
162
156
163
return _keyFunctionAddresses ;
157
164
}
158
165
159
166
public MultiAssemblyInjectedType InjectTypeIntoAllAssemblies ( string ns , string name , TypeAnalysisContext baseType )
160
167
{
161
- var types = Assemblies . Select ( a => ( InjectedTypeAnalysisContext ) a . InjectType ( ns , name , baseType ) ) . ToArray ( ) ;
162
-
168
+ var types = Assemblies . Select ( a => ( InjectedTypeAnalysisContext ) a . InjectType ( ns , name , baseType ) ) . ToArray ( ) ;
169
+
163
170
return new ( types ) ;
164
171
}
165
172
0 commit comments