add classes for ver 29, fix some stuff for v24

This commit is contained in:
LukeFZ
2023-11-29 21:22:51 +01:00
parent e3e0382e8c
commit a6d9291303
2 changed files with 741 additions and 711 deletions

View File

@@ -1,250 +1,266 @@
/* /*
Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper
Copyright 2017-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty Copyright 2017-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
All rights reserved. All rights reserved.
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using NoisyCowStudios.Bin2Object; using NoisyCowStudios.Bin2Object;
namespace Il2CppInspector namespace Il2CppInspector
{ {
public class Metadata : BinaryObjectStream public class Metadata : BinaryObjectStream
{ {
public Il2CppGlobalMetadataHeader Header { get; set; } public Il2CppGlobalMetadataHeader Header { get; set; }
public Il2CppAssemblyDefinition[] Assemblies { get; set; } public Il2CppAssemblyDefinition[] Assemblies { get; set; }
public Il2CppImageDefinition[] Images { get; set; } public Il2CppImageDefinition[] Images { get; set; }
public Il2CppTypeDefinition[] Types { get; set; } public Il2CppTypeDefinition[] Types { get; set; }
public Il2CppMethodDefinition[] Methods { get; set; } public Il2CppMethodDefinition[] Methods { get; set; }
public Il2CppParameterDefinition[] Params { get; set; } public Il2CppParameterDefinition[] Params { get; set; }
public Il2CppFieldDefinition[] Fields { get; set; } public Il2CppFieldDefinition[] Fields { get; set; }
public Il2CppFieldDefaultValue[] FieldDefaultValues { get; set; } public Il2CppFieldDefaultValue[] FieldDefaultValues { get; set; }
public Il2CppParameterDefaultValue[] ParameterDefaultValues { get; set; } public Il2CppParameterDefaultValue[] ParameterDefaultValues { get; set; }
public Il2CppPropertyDefinition[] Properties { get; set; } public Il2CppPropertyDefinition[] Properties { get; set; }
public Il2CppEventDefinition[] Events { get; set; } public Il2CppEventDefinition[] Events { get; set; }
public Il2CppGenericContainer[] GenericContainers { get; set; } public Il2CppGenericContainer[] GenericContainers { get; set; }
public Il2CppGenericParameter[] GenericParameters { get; set; } public Il2CppGenericParameter[] GenericParameters { get; set; }
public Il2CppCustomAttributeTypeRange[] AttributeTypeRanges { get; set; } public Il2CppCustomAttributeTypeRange[] AttributeTypeRanges { get; set; }
public Il2CppInterfaceOffsetPair[] InterfaceOffsets { get; set; } public Il2CppCustomAttributeDataRange[] AttributeDataRanges { get; set; }
public Il2CppMetadataUsageList[] MetadataUsageLists { get; set; } public Il2CppInterfaceOffsetPair[] InterfaceOffsets { get; set; }
public Il2CppMetadataUsagePair[] MetadataUsagePairs { get; set; } public Il2CppMetadataUsageList[] MetadataUsageLists { get; set; }
public Il2CppFieldRef[] FieldRefs { get; set; } public Il2CppMetadataUsagePair[] MetadataUsagePairs { get; set; }
public Il2CppFieldRef[] FieldRefs { get; set; }
public int[] InterfaceUsageIndices { get; set; }
public int[] NestedTypeIndices { get; set; } public int[] InterfaceUsageIndices { get; set; }
public int[] AttributeTypeIndices { get; set; } public int[] NestedTypeIndices { get; set; }
public int[] GenericConstraintIndices { get; set; } public int[] AttributeTypeIndices { get; set; }
public uint[] VTableMethodIndices { get; set; } public int[] GenericConstraintIndices { get; set; }
public string[] StringLiterals { get; set; } public uint[] VTableMethodIndices { get; set; }
public string[] StringLiterals { get; set; }
public Dictionary<int, string> Strings { get; private set; } = new Dictionary<int, string>();
public Dictionary<int, string> Strings { get; private set; } = new Dictionary<int, string>();
// Set if something in the metadata has been modified / decrypted
public bool IsModified { get; private set; } = false; // Set if something in the metadata has been modified / decrypted
public bool IsModified { get; private set; } = false;
// Status update callback
private EventHandler<string> OnStatusUpdate { get; set; } // Status update callback
private void StatusUpdate(string status) => OnStatusUpdate?.Invoke(this, status); private EventHandler<string> OnStatusUpdate { get; set; }
private void StatusUpdate(string status) => OnStatusUpdate?.Invoke(this, status);
// Initialize metadata object from a stream
public static Metadata FromStream(MemoryStream stream, EventHandler<string> statusCallback = null) { // Initialize metadata object from a stream
// TODO: This should really be placed before the Metadata object is created, public static Metadata FromStream(MemoryStream stream, EventHandler<string> statusCallback = null) {
// but for now this ensures it is called regardless of which client is in use // TODO: This should really be placed before the Metadata object is created,
PluginHooks.LoadPipelineStarting(); // but for now this ensures it is called regardless of which client is in use
PluginHooks.LoadPipelineStarting();
var metadata = new Metadata(statusCallback);
stream.Position = 0; var metadata = new Metadata(statusCallback);
stream.CopyTo(metadata); stream.Position = 0;
metadata.Position = 0; stream.CopyTo(metadata);
metadata.Initialize(); metadata.Position = 0;
return metadata; metadata.Initialize();
} return metadata;
}
private Metadata(EventHandler<string> statusCallback = null) : base() => OnStatusUpdate = statusCallback;
private Metadata(EventHandler<string> statusCallback = null) : base() => OnStatusUpdate = statusCallback;
private void Initialize()
{ private void Initialize()
// Pre-processing hook {
var pluginResult = PluginHooks.PreProcessMetadata(this); // Pre-processing hook
IsModified = pluginResult.IsStreamModified; var pluginResult = PluginHooks.PreProcessMetadata(this);
IsModified = pluginResult.IsStreamModified;
StatusUpdate("Processing metadata");
StatusUpdate("Processing metadata");
// Read metadata header
Header = ReadObject<Il2CppGlobalMetadataHeader>(0); // Read metadata header
Header = ReadObject<Il2CppGlobalMetadataHeader>(0);
// Check for correct magic bytes
if (Header.signature != Il2CppConstants.MetadataSignature) { // Check for correct magic bytes
throw new InvalidOperationException("The supplied metadata file is not valid."); if (Header.signature != Il2CppConstants.MetadataSignature) {
} throw new InvalidOperationException("The supplied metadata file is not valid.");
}
// Set object versioning for Bin2Object from metadata version
Version = Header.version; // Set object versioning for Bin2Object from metadata version
Version = Header.version;
if (Version < 16 || Version > 27) {
throw new InvalidOperationException($"The supplied metadata file is not of a supported version ({Header.version})."); if (Version < 16 || Version > 29.1) {
} throw new InvalidOperationException($"The supplied metadata file is not of a supported version ({Header.version}).");
}
// Rewind and read metadata header with the correct version settings
Header = ReadObject<Il2CppGlobalMetadataHeader>(0); // Rewind and read metadata header with the correct version settings
Header = ReadObject<Il2CppGlobalMetadataHeader>(0);
// Sanity checking
// Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata always writes the metadata information in the same order it appears in the header, // Sanity checking
// with each block always coming directly after the previous block, 4-byte aligned. We can use this to check the integrity of the data and // Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata always writes the metadata information in the same order it appears in the header,
// detect sub-versions. // with each block always coming directly after the previous block, 4-byte aligned. We can use this to check the integrity of the data and
// detect sub-versions.
// For metadata v24.0, the header can either be either 0x110 (24.0, 24.1) or 0x108 (24.2) bytes long. Since 'stringLiteralOffset' is the first thing
// in the header after the sanity and version fields, and since it will always point directly to the first byte after the end of the header, // For metadata v24.0, the header can either be either 0x110 (24.0, 24.1) or 0x108 (24.2) bytes long. Since 'stringLiteralOffset' is the first thing
// we can use this value to determine the actual header length and therefore narrow down the metadata version to 24.0/24.1 or 24.2. // in the header after the sanity and version fields, and since it will always point directly to the first byte after the end of the header,
// we can use this value to determine the actual header length and therefore narrow down the metadata version to 24.0/24.1 or 24.2.
if (!pluginResult.SkipValidation) {
var realHeaderLength = Header.stringLiteralOffset; if (!pluginResult.SkipValidation) {
var realHeaderLength = Header.stringLiteralOffset;
if (realHeaderLength != Sizeof(typeof(Il2CppGlobalMetadataHeader))) {
if (Version == 24.0) { if (realHeaderLength != Sizeof(typeof(Il2CppGlobalMetadataHeader))) {
Version = 24.2; if (Version == 24.0) {
Header = ReadObject<Il2CppGlobalMetadataHeader>(0); Version = 24.2;
} Header = ReadObject<Il2CppGlobalMetadataHeader>(0);
} }
}
if (realHeaderLength != Sizeof(typeof(Il2CppGlobalMetadataHeader))) {
throw new InvalidOperationException("Could not verify the integrity of the metadata file or accurately identify the metadata sub-version"); if (realHeaderLength != Sizeof(typeof(Il2CppGlobalMetadataHeader))) {
} throw new InvalidOperationException("Could not verify the integrity of the metadata file or accurately identify the metadata sub-version");
} }
}
// Load all the relevant metadata using offsets provided in the header
if (Version >= 16) // Load all the relevant metadata using offsets provided in the header
Images = ReadArray<Il2CppImageDefinition>(Header.imagesOffset, Header.imagesCount / Sizeof(typeof(Il2CppImageDefinition))); if (Version >= 16)
Images = ReadArray<Il2CppImageDefinition>(Header.imagesOffset, Header.imagesCount / Sizeof(typeof(Il2CppImageDefinition)));
// As an additional sanity check, all images in the metadata should have Mono.Cecil.MetadataToken == 1
// In metadata v24.1, two extra fields were added which will cause the below test to fail. // As an additional sanity check, all images in the metadata should have Mono.Cecil.MetadataToken == 1
// In that case, we can then adjust the version number and reload // In metadata v24.1, two extra fields were added which will cause the below test to fail.
// Tokens were introduced in v19 - we don't bother testing earlier versions // In that case, we can then adjust the version number and reload
if (Version >= 19 && Images.Any(x => x.token != 1)) // Tokens were introduced in v19 - we don't bother testing earlier versions
if (Version == 24.0) { if (Version >= 19 && Images.Any(x => x.token != 1))
Version = 24.1; if (Version == 24.0) {
Version = 24.1;
// No need to re-read the header, it's the same for both sub-versions
Images = ReadArray<Il2CppImageDefinition>(Header.imagesOffset, Header.imagesCount / Sizeof(typeof(Il2CppImageDefinition))); // No need to re-read the header, it's the same for both sub-versions
Images = ReadArray<Il2CppImageDefinition>(Header.imagesOffset, Header.imagesCount / Sizeof(typeof(Il2CppImageDefinition)));
if (Images.Any(x => x.token != 1))
throw new InvalidOperationException("Could not verify the integrity of the metadata file image list"); if (Images.Any(x => x.token != 1))
} throw new InvalidOperationException("Could not verify the integrity of the metadata file image list");
}
Types = ReadArray<Il2CppTypeDefinition>(Header.typeDefinitionsOffset, Header.typeDefinitionsCount / Sizeof(typeof(Il2CppTypeDefinition)));
Methods = ReadArray<Il2CppMethodDefinition>(Header.methodsOffset, Header.methodsCount / Sizeof(typeof(Il2CppMethodDefinition))); Types = ReadArray<Il2CppTypeDefinition>(Header.typeDefinitionsOffset, Header.typeDefinitionsCount / Sizeof(typeof(Il2CppTypeDefinition)));
Params = ReadArray<Il2CppParameterDefinition>(Header.parametersOffset, Header.parametersCount / Sizeof(typeof(Il2CppParameterDefinition))); Methods = ReadArray<Il2CppMethodDefinition>(Header.methodsOffset, Header.methodsCount / Sizeof(typeof(Il2CppMethodDefinition)));
Fields = ReadArray<Il2CppFieldDefinition>(Header.fieldsOffset, Header.fieldsCount / Sizeof(typeof(Il2CppFieldDefinition))); Params = ReadArray<Il2CppParameterDefinition>(Header.parametersOffset, Header.parametersCount / Sizeof(typeof(Il2CppParameterDefinition)));
FieldDefaultValues = ReadArray<Il2CppFieldDefaultValue>(Header.fieldDefaultValuesOffset, Header.fieldDefaultValuesCount / Sizeof(typeof(Il2CppFieldDefaultValue))); Fields = ReadArray<Il2CppFieldDefinition>(Header.fieldsOffset, Header.fieldsCount / Sizeof(typeof(Il2CppFieldDefinition)));
Properties = ReadArray<Il2CppPropertyDefinition>(Header.propertiesOffset, Header.propertiesCount / Sizeof(typeof(Il2CppPropertyDefinition))); FieldDefaultValues = ReadArray<Il2CppFieldDefaultValue>(Header.fieldDefaultValuesOffset, Header.fieldDefaultValuesCount / Sizeof(typeof(Il2CppFieldDefaultValue)));
Events = ReadArray<Il2CppEventDefinition>(Header.eventsOffset, Header.eventsCount / Sizeof(typeof(Il2CppEventDefinition))); Properties = ReadArray<Il2CppPropertyDefinition>(Header.propertiesOffset, Header.propertiesCount / Sizeof(typeof(Il2CppPropertyDefinition)));
InterfaceUsageIndices = ReadArray<int>(Header.interfacesOffset, Header.interfacesCount / sizeof(int)); Events = ReadArray<Il2CppEventDefinition>(Header.eventsOffset, Header.eventsCount / Sizeof(typeof(Il2CppEventDefinition)));
NestedTypeIndices = ReadArray<int>(Header.nestedTypesOffset, Header.nestedTypesCount / sizeof(int)); InterfaceUsageIndices = ReadArray<int>(Header.interfacesOffset, Header.interfacesCount / sizeof(int));
GenericContainers = ReadArray<Il2CppGenericContainer>(Header.genericContainersOffset, Header.genericContainersCount / Sizeof(typeof(Il2CppGenericContainer))); NestedTypeIndices = ReadArray<int>(Header.nestedTypesOffset, Header.nestedTypesCount / sizeof(int));
GenericParameters = ReadArray<Il2CppGenericParameter>(Header.genericParametersOffset, Header.genericParametersCount / Sizeof(typeof(Il2CppGenericParameter))); GenericContainers = ReadArray<Il2CppGenericContainer>(Header.genericContainersOffset, Header.genericContainersCount / Sizeof(typeof(Il2CppGenericContainer)));
GenericConstraintIndices = ReadArray<int>(Header.genericParameterConstraintsOffset, Header.genericParameterConstraintsCount / sizeof(int)); GenericParameters = ReadArray<Il2CppGenericParameter>(Header.genericParametersOffset, Header.genericParametersCount / Sizeof(typeof(Il2CppGenericParameter)));
InterfaceOffsets = ReadArray<Il2CppInterfaceOffsetPair>(Header.interfaceOffsetsOffset, Header.interfaceOffsetsCount / Sizeof(typeof(Il2CppInterfaceOffsetPair))); GenericConstraintIndices = ReadArray<int>(Header.genericParameterConstraintsOffset, Header.genericParameterConstraintsCount / sizeof(int));
VTableMethodIndices = ReadArray<uint>(Header.vtableMethodsOffset, Header.vtableMethodsCount / sizeof(uint)); InterfaceOffsets = ReadArray<Il2CppInterfaceOffsetPair>(Header.interfaceOffsetsOffset, Header.interfaceOffsetsCount / Sizeof(typeof(Il2CppInterfaceOffsetPair)));
VTableMethodIndices = ReadArray<uint>(Header.vtableMethodsOffset, Header.vtableMethodsCount / sizeof(uint));
if (Version >= 16) {
// In v24.4 hashValueIndex was removed from Il2CppAssemblyNameDefinition, which is a field in Il2CppAssemblyDefinition if (Version >= 16) {
// The number of images and assemblies should be the same. If they are not, we deduce that we are using v24.4 // In v24.4 hashValueIndex was removed from Il2CppAssemblyNameDefinition, which is a field in Il2CppAssemblyDefinition
// Note the version comparison matches both 24.2 and 24.3 here since 24.3 is tested for during binary loading // The number of images and assemblies should be the same. If they are not, we deduce that we are using v24.4
var assemblyCount = Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition)); // Note the version comparison matches both 24.2 and 24.3 here since 24.3 is tested for during binary loading
if (Version == 24.2 && assemblyCount < Images.Length) var assemblyCount = Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition));
Version = 24.4; var changedAssemblyDefStruct = false;
if ((Version == 24.1 || Version == 24.2 || Version == 24.3) && assemblyCount < Images.Length)
Assemblies = ReadArray<Il2CppAssemblyDefinition>(Header.assembliesOffset, Images.Length); {
ParameterDefaultValues = ReadArray<Il2CppParameterDefaultValue>(Header.parameterDefaultValuesOffset, Header.parameterDefaultValuesCount / Sizeof(typeof(Il2CppParameterDefaultValue))); if (Version == 24.1)
} changedAssemblyDefStruct = true;
if (Version >= 19 && Version < 27) { Version = 24.4;
MetadataUsageLists = ReadArray<Il2CppMetadataUsageList>(Header.metadataUsageListsOffset, Header.metadataUsageListsCount / Sizeof(typeof(Il2CppMetadataUsageList))); }
MetadataUsagePairs = ReadArray<Il2CppMetadataUsagePair>(Header.metadataUsagePairsOffset, Header.metadataUsagePairsCount / Sizeof(typeof(Il2CppMetadataUsagePair)));
} Assemblies = ReadArray<Il2CppAssemblyDefinition>(Header.assembliesOffset, Images.Length);
if (Version >= 19) {
FieldRefs = ReadArray<Il2CppFieldRef>(Header.fieldRefsOffset, Header.fieldRefsCount / Sizeof(typeof(Il2CppFieldRef))); if (changedAssemblyDefStruct)
} Version = 24.1;
if (Version >= 21) {
AttributeTypeIndices = ReadArray<int>(Header.attributeTypesOffset, Header.attributeTypesCount / sizeof(int)); ParameterDefaultValues = ReadArray<Il2CppParameterDefaultValue>(Header.parameterDefaultValuesOffset, Header.parameterDefaultValuesCount / Sizeof(typeof(Il2CppParameterDefaultValue)));
AttributeTypeRanges = ReadArray<Il2CppCustomAttributeTypeRange>(Header.attributesInfoOffset, Header.attributesInfoCount / Sizeof(typeof(Il2CppCustomAttributeTypeRange))); }
} if (Version >= 19 && Version < 27) {
MetadataUsageLists = ReadArray<Il2CppMetadataUsageList>(Header.metadataUsageListsOffset, Header.metadataUsageListsCount / Sizeof(typeof(Il2CppMetadataUsageList)));
// Get all metadata strings MetadataUsagePairs = ReadArray<Il2CppMetadataUsagePair>(Header.metadataUsagePairsOffset, Header.metadataUsagePairsCount / Sizeof(typeof(Il2CppMetadataUsagePair)));
var pluginGetStringsResult = PluginHooks.GetStrings(this); }
if (pluginGetStringsResult.IsDataModified && !pluginGetStringsResult.IsInvalid) if (Version >= 19) {
Strings = pluginGetStringsResult.Strings; FieldRefs = ReadArray<Il2CppFieldRef>(Header.fieldRefsOffset, Header.fieldRefsCount / Sizeof(typeof(Il2CppFieldRef)));
}
else { if (Version >= 21 && Version < 29) {
Position = Header.stringOffset; AttributeTypeIndices = ReadArray<int>(Header.attributeTypesOffset, Header.attributeTypesCount / sizeof(int));
AttributeTypeRanges = ReadArray<Il2CppCustomAttributeTypeRange>(Header.attributesInfoOffset, Header.attributesInfoCount / Sizeof(typeof(Il2CppCustomAttributeTypeRange)));
while (Position < Header.stringOffset + Header.stringCount) }
Strings.Add((int) Position - Header.stringOffset, ReadNullTerminatedString());
} if (Version >= 29)
{
// Get all string literals AttributeDataRanges = ReadArray<Il2CppCustomAttributeDataRange>(Header.attributeDataRangeOffset,
var pluginGetStringLiteralsResult = PluginHooks.GetStringLiterals(this); Header.attributeDataRangeSize / Sizeof(typeof(Il2CppCustomAttributeDataRange)));
if (pluginGetStringLiteralsResult.IsDataModified) }
StringLiterals = pluginGetStringLiteralsResult.StringLiterals.ToArray();
// Get all metadata strings
else { var pluginGetStringsResult = PluginHooks.GetStrings(this);
var stringLiteralList = ReadArray<Il2CppStringLiteral>(Header.stringLiteralOffset, Header.stringLiteralCount / Sizeof(typeof(Il2CppStringLiteral))); if (pluginGetStringsResult.IsDataModified && !pluginGetStringsResult.IsInvalid)
Strings = pluginGetStringsResult.Strings;
StringLiterals = new string[stringLiteralList.Length];
for (var i = 0; i < stringLiteralList.Length; i++) else {
StringLiterals[i] = ReadFixedLengthString(Header.stringLiteralDataOffset + stringLiteralList[i].dataIndex, stringLiteralList[i].length); Position = Header.stringOffset;
}
while (Position < Header.stringOffset + Header.stringCount)
// Post-processing hook Strings.Add((int) Position - Header.stringOffset, ReadNullTerminatedString());
IsModified |= PluginHooks.PostProcessMetadata(this).IsStreamModified; }
}
// Get all string literals
// Save metadata to file, overwriting if necessary var pluginGetStringLiteralsResult = PluginHooks.GetStringLiterals(this);
public void SaveToFile(string pathname) { if (pluginGetStringLiteralsResult.IsDataModified)
Position = 0; StringLiterals = pluginGetStringLiteralsResult.StringLiterals.ToArray();
using (var outFile = new FileStream(pathname, FileMode.Create, FileAccess.Write))
CopyTo(outFile); else {
} var stringLiteralList = ReadArray<Il2CppStringLiteral>(Header.stringLiteralOffset, Header.stringLiteralCount / Sizeof(typeof(Il2CppStringLiteral)));
public int Sizeof(Type type) => Sizeof(type, Version); StringLiterals = new string[stringLiteralList.Length];
for (var i = 0; i < stringLiteralList.Length; i++)
public int Sizeof(Type type, double metadataVersion, int longSizeBytes = 8) { StringLiterals[i] = ReadFixedLengthString(Header.stringLiteralDataOffset + stringLiteralList[i].dataIndex, stringLiteralList[i].length);
}
if (Reader.ObjectMappings.TryGetValue(type, out var streamType))
type = streamType; // Post-processing hook
IsModified |= PluginHooks.PostProcessMetadata(this).IsStreamModified;
int size = 0; }
foreach (var i in type.GetTypeInfo().GetFields())
{ // Save metadata to file, overwriting if necessary
// Only process fields for our selected object versioning (always process if none supplied) public void SaveToFile(string pathname) {
var versions = i.GetCustomAttributes<VersionAttribute>(false).Select(v => (v.Min, v.Max)).ToList(); Position = 0;
if (versions.Any() && !versions.Any(v => (v.Min <= metadataVersion || v.Min == -1) && (v.Max >= metadataVersion || v.Max == -1))) using (var outFile = new FileStream(pathname, FileMode.Create, FileAccess.Write))
continue; CopyTo(outFile);
}
if (i.FieldType == typeof(long) || i.FieldType == typeof(ulong))
size += longSizeBytes; public int Sizeof(Type type) => Sizeof(type, Version);
else if (i.FieldType == typeof(int) || i.FieldType == typeof(uint))
size += 4; public int Sizeof(Type type, double metadataVersion, int longSizeBytes = 8) {
else if (i.FieldType == typeof(short) || i.FieldType == typeof(ushort))
size += 2; if (Reader.ObjectMappings.TryGetValue(type, out var streamType))
type = streamType;
// Fixed-length array
else if (i.FieldType.IsArray) { int size = 0;
var attr = i.GetCustomAttribute<ArrayLengthAttribute>(false) ?? foreach (var i in type.GetTypeInfo().GetFields())
throw new InvalidOperationException("Array field " + i.Name + " must have ArrayLength attribute"); {
size += attr.FixedSize; // Only process fields for our selected object versioning (always process if none supplied)
} var versions = i.GetCustomAttributes<VersionAttribute>(false).Select(v => (v.Min, v.Max)).ToList();
if (versions.Any() && !versions.Any(v => (v.Min <= metadataVersion || v.Min == -1) && (v.Max >= metadataVersion || v.Max == -1)))
// Embedded object continue;
else
size += Sizeof(i.FieldType, metadataVersion); if (i.FieldType == typeof(long) || i.FieldType == typeof(ulong))
} size += longSizeBytes;
return size; else if (i.FieldType == typeof(int) || i.FieldType == typeof(uint))
} size += 4;
} else if (i.FieldType == typeof(short) || i.FieldType == typeof(ushort))
} size += 2;
// Fixed-length array
else if (i.FieldType.IsArray) {
var attr = i.GetCustomAttribute<ArrayLengthAttribute>(false) ??
throw new InvalidOperationException("Array field " + i.Name + " must have ArrayLength attribute");
size += attr.FixedSize;
}
// Embedded object
else
size += Sizeof(i.FieldType, metadataVersion);
}
return size;
}
}
}

View File

@@ -1,461 +1,475 @@
/* /*
Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper
Copyright 2017-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty Copyright 2017-2021 Katy Coe - http://www.djkaty.com - https://github.com/djkaty
All rights reserved. All rights reserved.
*/ */
using NoisyCowStudios.Bin2Object; using NoisyCowStudios.Bin2Object;
namespace Il2CppInspector namespace Il2CppInspector
{ {
// Unity 4.6.1p5 - first release, no global-metadata.dat // Unity 4.6.1p5 - first release, no global-metadata.dat
// Unity 5.2.0f3 -> v15 // Unity 5.2.0f3 -> v15
// Unity 5.3.0f4 -> v16 // Unity 5.3.0f4 -> v16
// Unity 5.3.2f1 -> v19 // Unity 5.3.2f1 -> v19
// Unity 5.3.3f1 -> v20 // Unity 5.3.3f1 -> v20
// Unity 5.3.5f1 -> v21 // Unity 5.3.5f1 -> v21
// Unity 5.5.0f3 -> v22 // Unity 5.5.0f3 -> v22
// Unity 5.6.0f3 -> v23 // Unity 5.6.0f3 -> v23
// Unity 2017.1.0f3 -> v24 // Unity 2017.1.0f3 -> v24
// Unity 2018.3.0f2 -> v24.1 // Unity 2018.3.0f2 -> v24.1
// Unity 2019.1.0f2 -> v24.2 // Unity 2019.1.0f2 -> v24.2
// Unity 2019.3.7f1 -> v24.3 // Unity 2019.3.7f1 -> v24.3
// Unity 2019.4.15f1 -> v24.4 // Unity 2019.4.15f1 -> v24.4
// Unity 2019.4.21f1 -> v24.5 // Unity 2019.4.21f1 -> v24.5
// Unity 2020.1.0f1 -> v24.3 // Unity 2020.1.0f1 -> v24.3
// Unity 2020.1.11f1 -> v24.4 // Unity 2020.1.11f1 -> v24.4
// Unity 2020.2.0f1 -> v27 // Unity 2020.2.0f1 -> v27
// Unity 2020.2.4f1 -> v27.1 // Unity 2020.2.4f1 -> v27.1
// Unity 2021.1.0f1 -> v27.2 // Unity 2021.1.0f1 -> v27.2
// https://unity3d.com/get-unity/download/archive // https://unity3d.com/get-unity/download/archive
// Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll) // Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll)
// From il2cpp-metadata.h // From il2cpp-metadata.h
#pragma warning disable CS0649 #pragma warning disable CS0649
public class Il2CppGlobalMetadataHeader public class Il2CppGlobalMetadataHeader
{ {
public uint signature; public uint signature;
public int version; public int version;
public int stringLiteralOffset; // string data for managed code public int stringLiteralOffset; // string data for managed code
public int stringLiteralCount; public int stringLiteralCount;
public int stringLiteralDataOffset; public int stringLiteralDataOffset;
public int stringLiteralDataCount; public int stringLiteralDataCount;
public int stringOffset; // string data for metadata public int stringOffset; // string data for metadata
public int stringCount; public int stringCount;
public int eventsOffset; // Il2CppEventDefinition public int eventsOffset; // Il2CppEventDefinition
public int eventsCount; public int eventsCount;
public int propertiesOffset; // Il2CppPropertyDefinition public int propertiesOffset; // Il2CppPropertyDefinition
public int propertiesCount; public int propertiesCount;
public int methodsOffset; // Il2CppMethodDefinition public int methodsOffset; // Il2CppMethodDefinition
public int methodsCount; public int methodsCount;
[Version(Min = 16)] [Version(Min = 16)]
public int parameterDefaultValuesOffset; // Il2CppParameterDefaultValue public int parameterDefaultValuesOffset; // Il2CppParameterDefaultValue
[Version(Min = 16)] [Version(Min = 16)]
public int parameterDefaultValuesCount; public int parameterDefaultValuesCount;
public int fieldDefaultValuesOffset; // Il2CppFieldDefaultValue public int fieldDefaultValuesOffset; // Il2CppFieldDefaultValue
public int fieldDefaultValuesCount; public int fieldDefaultValuesCount;
public int fieldAndParameterDefaultValueDataOffset; // uint8_t public int fieldAndParameterDefaultValueDataOffset; // uint8_t
public int fieldAndParameterDefaultValueDataCount; public int fieldAndParameterDefaultValueDataCount;
[Version(Min = 16)] [Version(Min = 16)]
public int fieldMarshaledSizesOffset; // Il2CppFieldMarshaledSize public int fieldMarshaledSizesOffset; // Il2CppFieldMarshaledSize
[Version(Min = 16)] [Version(Min = 16)]
public int fieldMarshaledSizesCount; public int fieldMarshaledSizesCount;
public int parametersOffset; // Il2CppParameterDefinition public int parametersOffset; // Il2CppParameterDefinition
public int parametersCount; public int parametersCount;
public int fieldsOffset; // Il2CppFieldDefinition public int fieldsOffset; // Il2CppFieldDefinition
public int fieldsCount; public int fieldsCount;
public int genericParametersOffset; // Il2CppGenericParameter public int genericParametersOffset; // Il2CppGenericParameter
public int genericParametersCount; public int genericParametersCount;
public int genericParameterConstraintsOffset; // TypeIndex public int genericParameterConstraintsOffset; // TypeIndex
public int genericParameterConstraintsCount; public int genericParameterConstraintsCount;
public int genericContainersOffset; // Il2CppGenericContainer public int genericContainersOffset; // Il2CppGenericContainer
public int genericContainersCount; public int genericContainersCount;
public int nestedTypesOffset; // TypeDefinitionIndex public int nestedTypesOffset; // TypeDefinitionIndex
public int nestedTypesCount; public int nestedTypesCount;
public int interfacesOffset; // TypeIndex public int interfacesOffset; // TypeIndex
public int interfacesCount; public int interfacesCount;
public int vtableMethodsOffset; // EncodedMethodIndex public int vtableMethodsOffset; // EncodedMethodIndex
public int vtableMethodsCount; public int vtableMethodsCount;
public int interfaceOffsetsOffset; // Il2CppInterfaceOffsetPair public int interfaceOffsetsOffset; // Il2CppInterfaceOffsetPair
public int interfaceOffsetsCount; public int interfaceOffsetsCount;
public int typeDefinitionsOffset; // Il2CppTypeDefinition public int typeDefinitionsOffset; // Il2CppTypeDefinition
public int typeDefinitionsCount; public int typeDefinitionsCount;
[Version(Max = 24.1)] [Version(Max = 24.1)]
public int rgctxEntriesOffset; // Il2CppRGCTXDefinition public int rgctxEntriesOffset; // Il2CppRGCTXDefinition
[Version(Max = 24.1)] [Version(Max = 24.1)]
public int rgctxEntriesCount; public int rgctxEntriesCount;
[Version(Min = 16)] [Version(Min = 16)]
public int imagesOffset; // Il2CppImageDefinition public int imagesOffset; // Il2CppImageDefinition
[Version(Min = 16)] [Version(Min = 16)]
public int imagesCount; public int imagesCount;
[Version(Min = 16)] [Version(Min = 16)]
public int assembliesOffset; // Il2CppAssemblyDefinition public int assembliesOffset; // Il2CppAssemblyDefinition
[Version(Min = 16)] [Version(Min = 16)]
public int assembliesCount; public int assembliesCount;
[Version(Min = 19, Max = 24.5)] [Version(Min = 19, Max = 24.5)]
public int metadataUsageListsOffset; // Il2CppMetadataUsageList public int metadataUsageListsOffset; // Il2CppMetadataUsageList
[Version(Min = 19, Max = 24.5)] [Version(Min = 19, Max = 24.5)]
public int metadataUsageListsCount; public int metadataUsageListsCount;
[Version(Min = 19, Max = 24.5)] [Version(Min = 19, Max = 24.5)]
public int metadataUsagePairsOffset; // Il2CppMetadataUsagePair public int metadataUsagePairsOffset; // Il2CppMetadataUsagePair
[Version(Min = 19, Max = 24.5)] [Version(Min = 19, Max = 24.5)]
public int metadataUsagePairsCount; public int metadataUsagePairsCount;
[Version(Min = 19)] [Version(Min = 19)]
public int fieldRefsOffset; // Il2CppFieldRef public int fieldRefsOffset; // Il2CppFieldRef
[Version(Min = 19)] [Version(Min = 19)]
public int fieldRefsCount; public int fieldRefsCount;
[Version(Min = 20)] [Version(Min = 20)]
public int referencedAssembliesOffset; // int32_t public int referencedAssembliesOffset; // int32_t
[Version(Min = 20)] [Version(Min = 20)]
public int referencedAssembliesCount; public int referencedAssembliesCount;
[Version(Min = 21)] [Version(Min = 21, Max = 27.2)]
public int attributesInfoOffset; // Il2CppCustomAttributeTypeRange public int attributesInfoOffset; // Il2CppCustomAttributeTypeRange
[Version(Min = 21)] [Version(Min = 21, Max = 27.2)]
public int attributesInfoCount; public int attributesInfoCount;
[Version(Min = 21)] [Version(Min = 21, Max = 27.2)]
public int attributeTypesOffset; // TypeIndex public int attributeTypesOffset; // TypeIndex
[Version(Min = 21)] [Version(Min = 21, Max = 27.2)]
public int attributeTypesCount; public int attributeTypesCount;
[Version(Min = 29)]
// Added in metadata v22 public uint attributeDataOffset;
[Version(Min = 22)] [Version(Min = 29)]
public int unresolvedVirtualCallParameterTypesOffset; // TypeIndex public int attributeDataSize;
[Version(Min = 22)] [Version(Min = 29)]
public int unresolvedVirtualCallParameterTypesCount; public uint attributeDataRangeOffset;
[Version(Min = 22)] [Version(Min = 29)]
public int unresolvedVirtualCallParameterRangesOffset; // Il2CppRange public int attributeDataRangeSize;
[Version(Min = 22)]
public int unresolvedVirtualCallParameterRangesCount; // Added in metadata v22
[Version(Min = 22)]
// Added in metadata v23 public int unresolvedVirtualCallParameterTypesOffset; // TypeIndex
[Version(Min = 23)] [Version(Min = 22)]
public int windowsRuntimeTypeNamesOffset; // Il2CppWindowsRuntimeTypeNamePair public int unresolvedVirtualCallParameterTypesCount;
[Version(Min = 23)] [Version(Min = 22)]
public int windowsRuntimeTypeNamesSize; public int unresolvedVirtualCallParameterRangesOffset; // Il2CppRange
[Version(Min = 22)]
// Added in metadata v27 public int unresolvedVirtualCallParameterRangesCount;
[Version(Min = 27)]
public int windowsRuntimeStringsOffset; // const char* // Added in metadata v23
[Version(Min = 27)] [Version(Min = 23)]
public int windowsRuntimeStringsSize; public int windowsRuntimeTypeNamesOffset; // Il2CppWindowsRuntimeTypeNamePair
[Version(Min = 23)]
// Added in metadata v24 public int windowsRuntimeTypeNamesSize;
[Version(Min = 24)]
public int exportedTypeDefinitionsOffset; // TypeDefinitionIndex // Added in metadata v27
[Version(Min = 24)] [Version(Min = 27)]
public int exportedTypeDefinitionsCount; public int windowsRuntimeStringsOffset; // const char*
} [Version(Min = 27)]
public int windowsRuntimeStringsSize;
public class Il2CppImageDefinition
{ // Added in metadata v24
public int nameIndex; [Version(Min = 24)]
public int assemblyIndex; public int exportedTypeDefinitionsOffset; // TypeDefinitionIndex
[Version(Min = 24)]
public int typeStart; public int exportedTypeDefinitionsCount;
public uint typeCount; }
[Version(Min = 24)] public class Il2CppImageDefinition
public int exportedTypeStart; {
[Version(Min = 24)] public int nameIndex;
public uint exportedTypeCount; public int assemblyIndex;
public int entryPointIndex; public int typeStart;
public uint typeCount;
[Version(Min = 19)]
public uint token; [Version(Min = 24)]
public int exportedTypeStart;
[Version(Min = 24.1)] [Version(Min = 24)]
public int customAttributeStart; public uint exportedTypeCount;
[Version(Min = 24.1)]
public uint customAttributeCount; public int entryPointIndex;
}
#pragma warning restore CS0649 [Version(Min = 19)]
public uint token;
// Renamed from Il2CppAssembly somewhere after Unity 2017.2f3 up to Unity 2018.2.0f2
public class Il2CppAssemblyDefinition [Version(Min = 24.1)]
{ public int customAttributeStart;
// They moved the position of aname in v16 from the top to the bottom of the struct [Version(Min = 24.1)]
public Il2CppAssemblyNameDefinition aname => aname_pre16 ?? aname_post16; public uint customAttributeCount;
}
[Version(Max = 15)] #pragma warning restore CS0649
public Il2CppAssemblyNameDefinition aname_pre16;
// Renamed from Il2CppAssembly somewhere after Unity 2017.2f3 up to Unity 2018.2.0f2
public int imageIndex; public class Il2CppAssemblyDefinition
{
[Version(Min = 24.1)] // They moved the position of aname in v16 from the top to the bottom of the struct
public uint token; public Il2CppAssemblyNameDefinition aname => aname_pre16 ?? aname_post16;
[Version(Max = 24.0)] [Version(Max = 15)]
public int customAttributeIndex; public Il2CppAssemblyNameDefinition aname_pre16;
[Version(Min = 20)] public int imageIndex;
public int referencedAssemblyStart;
[Version(Min = 20)] [Version(Min = 24.1)]
public int referencedAssemblyCount; public uint token;
[Version(Min = 16)] [Version(Max = 24.0)]
public Il2CppAssemblyNameDefinition aname_post16; public int customAttributeIndex;
}
[Version(Min = 20)]
// Renamed from Il2CppAssemblyName somewhere after Unity 2017.2f3 up to Unity 2018.2.0f2 public int referencedAssemblyStart;
public class Il2CppAssemblyNameDefinition [Version(Min = 20)]
{ public int referencedAssemblyCount;
// They moved the position of publicKeyToken in v16 from the middle to the bottom of the struct
public byte[] publicKeyToken => publicKeyToken_post16; [Version(Min = 16)]
public Il2CppAssemblyNameDefinition aname_post16;
public int nameIndex; }
public int cultureIndex;
[Version(Max = 24.3)] // Renamed from Il2CppAssemblyName somewhere after Unity 2017.2f3 up to Unity 2018.2.0f2
public int hashValueIndex; public class Il2CppAssemblyNameDefinition
public int publicKeyIndex; {
[Version(Max = 15), ArrayLength(FixedSize = 8)] // They moved the position of publicKeyToken in v16 from the middle to the bottom of the struct
public byte[] publicKeyToken_pre16; public byte[] publicKeyToken => publicKeyToken_post16;
public uint hash_alg;
public int hash_len; public int nameIndex;
public uint flags; public int cultureIndex;
public int major; [Version(Max = 24.3)]
public int minor; public int hashValueIndex;
public int build; public int publicKeyIndex;
public int revision; [Version(Max = 15), ArrayLength(FixedSize = 8)]
[Version(Min = 16), ArrayLength(FixedSize = 8)] public byte[] publicKeyToken_pre16;
public byte[] publicKeyToken_post16; public uint hash_alg;
} public int hash_len;
public uint flags;
public class Il2CppTypeDefinition public int major;
{ public int minor;
public int nameIndex; public int build;
public int namespaceIndex; public int revision;
[Version(Min = 16), ArrayLength(FixedSize = 8)]
// Removed in metadata v24.1 public byte[] publicKeyToken_post16;
[Version(Max = 24.0)] }
public int customAttributeIndex;
public class Il2CppTypeDefinition
public int byvalTypeIndex; {
[Version(Max = 24.5)] public int nameIndex;
public int byrefTypeIndex; public int namespaceIndex;
public int declaringTypeIndex; // Removed in metadata v24.1
public int parentIndex; [Version(Max = 24.0)]
public int elementTypeIndex; // we can probably remove this one. Only used for enums public int customAttributeIndex;
[Version(Max = 24.1)] public int byvalTypeIndex;
public int rgctxStartIndex; [Version(Max = 24.5)]
[Version(Max = 24.1)] public int byrefTypeIndex;
public int rgctxCount;
public int declaringTypeIndex;
public int genericContainerIndex; public int parentIndex;
public int elementTypeIndex; // we can probably remove this one. Only used for enums
// Removed in metadata v23
[Version(Max = 22)] [Version(Max = 24.1)]
public int delegateWrapperFromManagedToNativeIndex; // (was renamed to reversePInvokeWrapperIndex in v22) public int rgctxStartIndex;
[Version(Max = 22)] [Version(Max = 24.1)]
public int marshalingFunctionsIndex; public int rgctxCount;
[Version(Min = 21, Max = 22)]
public int ccwFunctionIndex; public int genericContainerIndex;
[Version(Min = 21, Max = 22)]
public int guidIndex; // Removed in metadata v23
[Version(Max = 22)]
public uint flags; public int delegateWrapperFromManagedToNativeIndex; // (was renamed to reversePInvokeWrapperIndex in v22)
[Version(Max = 22)]
public int fieldStart; public int marshalingFunctionsIndex;
public int methodStart; [Version(Min = 21, Max = 22)]
public int eventStart; public int ccwFunctionIndex;
public int propertyStart; [Version(Min = 21, Max = 22)]
public int nestedTypesStart; public int guidIndex;
public int interfacesStart;
public int vtableStart; public uint flags;
public int interfaceOffsetsStart;
public int fieldStart;
public ushort method_count; public int methodStart;
public ushort property_count; public int eventStart;
public ushort field_count; public int propertyStart;
public ushort event_count; public int nestedTypesStart;
public ushort nested_type_count; public int interfacesStart;
public ushort vtable_count; public int vtableStart;
public ushort interfaces_count; public int interfaceOffsetsStart;
public ushort interface_offsets_count;
public ushort method_count;
// bitfield to portably encode boolean values as single bits public ushort property_count;
// 01 - valuetype; public ushort field_count;
// 02 - enumtype; public ushort event_count;
// 03 - has_finalize; public ushort nested_type_count;
// 04 - has_cctor; public ushort vtable_count;
// 05 - is_blittable; public ushort interfaces_count;
// 06 - is_import; (from v22: is_import_or_windows_runtime) public ushort interface_offsets_count;
// 07-10 - One of nine possible PackingSize values (0, 1, 2, 4, 8, 16, 32, 64, or 128)
public uint bitfield; // bitfield to portably encode boolean values as single bits
// 01 - valuetype;
[Version(Min = 19)] // 02 - enumtype;
public uint token; // 03 - has_finalize;
} // 04 - has_cctor;
// 05 - is_blittable;
public class Il2CppMethodDefinition // 06 - is_import; (from v22: is_import_or_windows_runtime)
{ // 07-10 - One of nine possible PackingSize values (0, 1, 2, 4, 8, 16, 32, 64, or 128)
public int nameIndex; public uint bitfield;
[Version(Min = 16)] [Version(Min = 19)]
public int declaringType; public uint token;
}
public int returnType;
public int parameterStart; public class Il2CppMethodDefinition
{
[Version(Max = 24.0)] public int nameIndex;
public int customAttributeIndex;
[Version(Min = 16)]
public int genericContainerIndex; public int declaringType;
[Version(Max = 24.1)] public int returnType;
public int methodIndex; public int parameterStart;
[Version(Max = 24.1)]
public int invokerIndex; [Version(Max = 24.0)]
[Version(Max = 24.1)] public int customAttributeIndex;
public int reversePInvokeWrapperIndex; // (was renamed from delegateWrapperIndex in v22)
[Version(Max = 24.1)] public int genericContainerIndex;
public int rgctxStartIndex;
[Version(Max = 24.1)] [Version(Max = 24.1)]
public int rgctxCount; public int methodIndex;
[Version(Max = 24.1)]
public uint token; public int invokerIndex;
public ushort flags; [Version(Max = 24.1)]
public ushort iflags; public int reversePInvokeWrapperIndex; // (was renamed from delegateWrapperIndex in v22)
public ushort slot; [Version(Max = 24.1)]
public ushort parameterCount; public int rgctxStartIndex;
} [Version(Max = 24.1)]
public int rgctxCount;
public class Il2CppParameterDefinition
{ public uint token;
public int nameIndex; public ushort flags;
public uint token; public ushort iflags;
public ushort slot;
[Version(Max = 24.0)] public ushort parameterCount;
public int customAttributeIndex; }
public int typeIndex; public class Il2CppParameterDefinition
} {
public int nameIndex;
public class Il2CppParameterDefaultValue public uint token;
{
public int parameterIndex; [Version(Max = 24.0)]
public int typeIndex; public int customAttributeIndex;
public int dataIndex;
} public int typeIndex;
}
public class Il2CppFieldDefinition
{ public class Il2CppParameterDefaultValue
public int nameIndex; {
public int typeIndex; public int parameterIndex;
public int typeIndex;
[Version(Max = 24.0)] public int dataIndex;
public int customAttributeIndex; }
[Version(Min = 19)] public class Il2CppFieldDefinition
public uint token; {
} public int nameIndex;
public int typeIndex;
public class Il2CppFieldDefaultValue
{ [Version(Max = 24.0)]
public int fieldIndex; public int customAttributeIndex;
public int typeIndex;
public int dataIndex; [Version(Min = 19)]
} public uint token;
}
public class Il2CppPropertyDefinition
{ public class Il2CppFieldDefaultValue
public int nameIndex; {
public int get; public int fieldIndex;
public int set; public int typeIndex;
public uint attrs; public int dataIndex;
}
[Version(Max = 24.0)]
public int customAttributeIndex; public class Il2CppPropertyDefinition
{
[Version(Min = 19)] public int nameIndex;
public uint token; public int get;
} public int set;
public uint attrs;
public class Il2CppEventDefinition
{ [Version(Max = 24.0)]
public int nameIndex; public int customAttributeIndex;
public int typeIndex;
public int add; [Version(Min = 19)]
public int remove; public uint token;
public int raise; }
[Version(Max = 24.0)] public class Il2CppEventDefinition
public int customAttributeIndex; {
public int nameIndex;
[Version(Min = 19)] public int typeIndex;
public uint token; public int add;
} public int remove;
public int raise;
public class Il2CppGenericContainer
{ [Version(Max = 24.0)]
/* index of the generic type definition or the generic method definition corresponding to this container */ public int customAttributeIndex;
public int ownerIndex; // either index into Il2CppClass metadata array or Il2CppMethodDefinition array
public int type_argc; [Version(Min = 19)]
/* If true, we're a generic method, otherwise a generic type definition. */ public uint token;
public int is_method; }
/* Our type parameters. */
public uint genericParameterStart; // GenericParameterIndex public class Il2CppGenericContainer
} {
/* index of the generic type definition or the generic method definition corresponding to this container */
public class Il2CppGenericParameter public int ownerIndex; // either index into Il2CppClass metadata array or Il2CppMethodDefinition array
{ public int type_argc;
public int ownerIndex; /* Type or method this parameter was defined in. */ // GenericContainerIndex /* If true, we're a generic method, otherwise a generic type definition. */
public int nameIndex; // StringIndex public int is_method;
public short constraintsStart; // GenericParameterConstraintIndex /* Our type parameters. */
public short constraintsCount; public uint genericParameterStart; // GenericParameterIndex
public ushort num; // Generic parameter position }
public ushort flags; // GenericParameterAttributes
} public class Il2CppGenericParameter
{
public class Il2CppCustomAttributeTypeRange public int ownerIndex; /* Type or method this parameter was defined in. */ // GenericContainerIndex
{ public int nameIndex; // StringIndex
[Version(Min = 24.1)] public short constraintsStart; // GenericParameterConstraintIndex
public uint token; public short constraintsCount;
public ushort num; // Generic parameter position
public int start; public ushort flags; // GenericParameterAttributes
public int count; }
}
public class Il2CppCustomAttributeTypeRange
public class Il2CppInterfaceOffsetPair {
{ [Version(Min = 24.1)]
public int interfaceTypeIndex; public uint token;
public int offset;
} public int start;
public int count;
// Removed in metadata v27 }
public class Il2CppMetadataUsageList
{ public class Il2CppInterfaceOffsetPair
public uint start; {
public uint count; public int interfaceTypeIndex;
} public int offset;
}
// Removed in metadata v27
public class Il2CppMetadataUsagePair // Removed in metadata v27
{ public class Il2CppMetadataUsageList
public uint destinationindex; {
public uint encodedSourceIndex; public uint start;
} public uint count;
}
public class Il2CppStringLiteral
{ // Removed in metadata v27
public int length; public class Il2CppMetadataUsagePair
public int dataIndex; {
} public uint destinationindex;
public uint encodedSourceIndex;
public class Il2CppFieldRef }
{
public int typeIndex; public class Il2CppStringLiteral
public int fieldIndex; // local offset into type fields {
} public int length;
} public int dataIndex;
}
public class Il2CppFieldRef
{
public int typeIndex;
public int fieldIndex; // local offset into type fields
}
public class Il2CppCustomAttributeDataRange
{
public uint token;
public uint startOffset;
}
}