AppModel/C++/JSON/Script: Don't output generic method definitions (no compiled code)
This commit is contained in:
@@ -23,10 +23,16 @@ namespace Il2CppInspector.Model
|
|||||||
public MethodBase Method { get; internal set; }
|
public MethodBase Method { get; internal set; }
|
||||||
|
|
||||||
// The VA of the MethodInfo* (VA of the pointer to the MethodInfo) object which defines this method
|
// The VA of the MethodInfo* (VA of the pointer to the MethodInfo) object which defines this method
|
||||||
|
// Methods not referenced by the binary will be 0xffffffff_ffffffff
|
||||||
public ulong MethodInfoPtrAddress { get; internal set; }
|
public ulong MethodInfoPtrAddress { get; internal set; }
|
||||||
|
|
||||||
// The VA of the method code itself, or 0 if unknown/not compiled
|
// The VA of the method code itself
|
||||||
public ulong MethodCodeAddress => Method.VirtualAddress?.Start ?? 0;
|
// Generic method definitions do not have a code address but may have a reference above
|
||||||
|
public ulong MethodCodeAddress => Method.VirtualAddress?.Start ?? 0xffffffff_ffffffff;
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
public bool HasMethodInfo => MethodInfoPtrAddress != 0xffffffff_ffffffff;
|
||||||
|
public bool HasCompiledCode => Method.VirtualAddress.HasValue && Method.VirtualAddress.Value.Start != 0;
|
||||||
|
|
||||||
public AppMethod(MethodBase method, CppFnPtrType cppMethod, ulong methodInfoPtr = 0xffffffff_ffffffff) {
|
public AppMethod(MethodBase method, CppFnPtrType cppMethod, ulong methodInfoPtr = 0xffffffff_ffffffff) {
|
||||||
Method = method;
|
Method = method;
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ typedef size_t uintptr_t;
|
|||||||
writeCode("using namespace app;");
|
writeCode("using namespace app;");
|
||||||
writeLine("");
|
writeLine("");
|
||||||
|
|
||||||
foreach (var method in model.Methods.Values) {
|
foreach (var method in model.Methods.Values.Where(m => m.HasCompiledCode)) {
|
||||||
var arguments = string.Join(", ", method.CppFnPtrType.Arguments.Select(a => a.Type.Name + " " + (a.Name == "this" ? "__this" : a.Name)));
|
var arguments = string.Join(", ", method.CppFnPtrType.Arguments.Select(a => a.Type.Name + " " + (a.Name == "this" ? "__this" : a.Name)));
|
||||||
writeCode($"DO_APP_FUNC(0x{method.MethodCodeAddress - model.Package.BinaryImage.ImageBase:X8}, {method.CppFnPtrType.ReturnType.Name}, "
|
writeCode($"DO_APP_FUNC(0x{method.MethodCodeAddress - model.Package.BinaryImage.ImageBase:X8}, {method.CppFnPtrType.ReturnType.Name}, "
|
||||||
+ $"{method.CppFnPtrType.Name}, ({arguments}));");
|
+ $"{method.CppFnPtrType.Name}, ({arguments}));");
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeMethods(IEnumerable<AppMethod> methods) {
|
private void writeMethods(IEnumerable<AppMethod> methods) {
|
||||||
foreach (var method in methods) {
|
foreach (var method in methods.Where(m => m.HasCompiledCode)) {
|
||||||
writeObject(() => {
|
writeObject(() => {
|
||||||
writeTypedFunctionName(method.MethodCodeAddress, method.CppFnPtrType.ToSignatureString(), method.CppFnPtrType.Name);
|
writeTypedFunctionName(method.MethodCodeAddress, method.CppFnPtrType.ToSignatureString(), method.CppFnPtrType.Name);
|
||||||
writeDotNetSignature(method.Method);
|
writeDotNetSignature(method.Method);
|
||||||
@@ -123,7 +123,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
// Metedata usage methods
|
// Metedata usage methods
|
||||||
writeArray("methodInfoPointers",
|
writeArray("methodInfoPointers",
|
||||||
() => {
|
() => {
|
||||||
foreach (var method in model.Methods.Values.Where(m => m.MethodInfoPtrAddress != 0xffffffff_ffffffff)) {
|
foreach (var method in model.Methods.Values.Where(m => m.HasMethodInfo)) {
|
||||||
writeObject(() => {
|
writeObject(() => {
|
||||||
writeName(method.MethodInfoPtrAddress, $"{method.CppFnPtrType.Name}__MethodInfo");
|
writeName(method.MethodInfoPtrAddress, $"{method.CppFnPtrType.Name}__MethodInfo");
|
||||||
writeDotNetSignature(method.Method);
|
writeDotNetSignature(method.Method);
|
||||||
|
|||||||
Reference in New Issue
Block a user