IL2CPP/Model: Handle invokers from Il2CppGenericMethodFunctionsDefinitions
This commit is contained in:
@@ -110,11 +110,22 @@ namespace Il2CppInspector.Reflection
|
||||
var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition);
|
||||
if (index != -1) {
|
||||
if (MethodInvokers[index] == null)
|
||||
MethodInvokers[index] = new MethodInvoker(method);
|
||||
MethodInvokers[index] = new MethodInvoker(method, index);
|
||||
|
||||
method.Invoker = MethodInvokers[index];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Some invokers are not initialized or missing, need to find out why
|
||||
// Create method invokers sourced from generic method invoker indices
|
||||
foreach (var spec in GenericMethods.Keys) {
|
||||
if (package.GenericMethodInvokerIndices.TryGetValue(spec, out var index)) {
|
||||
if (MethodInvokers[index] == null)
|
||||
MethodInvokers[index] = new MethodInvoker(GenericMethods[spec], index);
|
||||
|
||||
GenericMethods[spec].Invoker = MethodInvokers[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get generic arguments from either a type or method instanceIndex from a MethodSpec
|
||||
|
||||
@@ -33,11 +33,11 @@ namespace Il2CppInspector.Reflection
|
||||
public TypeInfo[] ParameterTypes { get; }
|
||||
|
||||
// Find the correct method invoker for a method with a specific signature
|
||||
public MethodInvoker(MethodBase exampleMethod) {
|
||||
public MethodInvoker(MethodBase exampleMethod, int index) {
|
||||
var model = exampleMethod.Assembly.Model;
|
||||
var package = exampleMethod.Assembly.Model.Package;
|
||||
|
||||
Index = package.GetInvokerIndex(exampleMethod.DeclaringType.Assembly.ModuleDefinition, exampleMethod.Definition);
|
||||
Index = index;
|
||||
IsStatic = exampleMethod.IsStatic;
|
||||
|
||||
ReturnType = exampleMethod.IsConstructor ? model.TypesByFullName["System.Void"] : mapParameterType(model, ((MethodInfo) exampleMethod).ReturnType);
|
||||
|
||||
Reference in New Issue
Block a user