IL2CPP: Implement GetGenericMethodPointer and VirtualAddress for concrete generic methods from MethodSpecs

This commit is contained in:
Katy Coe
2020-02-02 07:20:02 +01:00
parent 63eb2562b7
commit 21e77b7965
2 changed files with 10 additions and 1 deletions

View File

@@ -230,6 +230,7 @@ namespace Il2CppInspector
}
}
// Get a method pointer if available
public (ulong Start, ulong End)? GetMethodPointer(Il2CppCodeGenModule module, Il2CppMethodDefinition methodDef) {
// Find method pointer
if (methodDef.methodIndex < 0)
@@ -268,6 +269,14 @@ namespace Il2CppInspector
return (start & 0xffff_ffff_ffff_fffe, FunctionAddresses[start]);
}
// Get a concrete generic method pointer if available
public (ulong Start, ulong End)? GetGenericMethodPointer(Il2CppMethodSpec spec) {
if (GenericMethodPointers.TryGetValue(spec, out var start)) {
return (start & 0xffff_ffff_ffff_fffe, FunctionAddresses[start]);
}
return null;
}
public static List<Il2CppInspector> LoadFromFile(string codeFile, string metadataFile) {
// Load the metadata file
Metadata metadata;

View File

@@ -160,7 +160,7 @@ namespace Il2CppInspector.Reflection
DeclaredParameters.Add(new ParameterInfo(model, p, genericArguments[p.ParameterType.GenericParameterPosition]));
}
// TODO: Populate VirtualAddress via Il2CppGenericMethodFunctionsDefinitions
VirtualAddress = model.Package.GetGenericMethodPointer(spec);
}
public string GetAccessModifierString() => this switch {