IL2CPP: Implement metadata usages for metadata v27

This commit is contained in:
Katy Coe
2020-08-16 04:18:17 +02:00
parent 5f7218f7df
commit 246809c0a4
2 changed files with 57 additions and 5 deletions

View File

@@ -24,12 +24,13 @@ namespace Il2CppInspector
public int SourceIndex { get; }
public ulong VirtualAddress { get; private set; }
public MetadataUsage(MetadataUsageType type, int sourceIndex) {
public MetadataUsage(MetadataUsageType type, int sourceIndex, ulong virtualAddress = 0) {
Type = type;
SourceIndex = sourceIndex;
VirtualAddress = virtualAddress;
}
public static MetadataUsage FromEncodedIndex(Il2CppInspector package, uint encodedIndex) {
public static MetadataUsage FromEncodedIndex(Il2CppInspector package, uint encodedIndex, ulong virtualAddress = 0) {
uint index;
MetadataUsageType usageType;
if (package.Version < 19) {
@@ -47,7 +48,7 @@ namespace Il2CppInspector
if (package.Version >= 27)
index >>= 1;
}
return new MetadataUsage(usageType, (int)index);
return new MetadataUsage(usageType, (int)index, virtualAddress);
}
public void SetAddress(ulong virtualAddress) => VirtualAddress = virtualAddress;