Calculate and output pointers to the end of each method
This commit is contained in:
@@ -21,7 +21,9 @@ namespace Il2CppInspector.Reflection
|
||||
// The type of the attribute
|
||||
public TypeInfo AttributeType { get; set; }
|
||||
|
||||
public long VirtualAddress => package.CustomAttributeGenerators[Index];
|
||||
public (ulong Start, ulong End)? VirtualAddress =>
|
||||
// The last one will be wrong but there is no way to calculate it
|
||||
(package.CustomAttributeGenerators[Index], package.CustomAttributeGenerators[Math.Min(Index + 1, package.CustomAttributeGenerators.Length - 1)]);
|
||||
|
||||
public override string ToString() => "[" + AttributeType.FullName + "]";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Il2CppInspector.Reflection
|
||||
name = name[..suffix];
|
||||
sb.Append($"{linePrefix}[{attributePrefix}{name}]");
|
||||
if (emitPointer)
|
||||
sb.Append($" {(inline? "/*" : "//")} {((ulong)cad.VirtualAddress).ToAddressString()}{(inline? " */" : "")}");
|
||||
sb.Append($" {(inline? "/*" : "//")} {cad.VirtualAddress.ToAddressString()}{(inline? " */" : "")}");
|
||||
sb.Append(inline? " ":"\n");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Il2CppInspector.Reflection
|
||||
? string.Format($"0x{(uint)address:X8}")
|
||||
: string.Format($"0x{address:X16}");
|
||||
|
||||
public static string ToAddressString(this (ulong start, ulong end)? address) => ToAddressString(address?.start ?? 0) + "-" + ToAddressString(address?.end ?? 0);
|
||||
|
||||
// Output a value in C#-friendly syntax
|
||||
public static string ToCSharpValue(this object value) {
|
||||
if (value is bool)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Il2CppInspector.Reflection
|
||||
// IL2CPP-specific data
|
||||
public Il2CppMethodDefinition Definition { get; }
|
||||
public int Index { get; }
|
||||
public ulong VirtualAddress { get; }
|
||||
public (ulong Start, ulong End)? VirtualAddress { get; }
|
||||
|
||||
// Information/flags about the method
|
||||
public MethodAttributes Attributes { get; protected set; }
|
||||
|
||||
Reference in New Issue
Block a user