add new struct definitions
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using ImageIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public partial struct Il2CppAssemblyDefinition
|
||||
{
|
||||
[FieldOffset(20)]
|
||||
[VersionCondition(LessThan = "15.0")]
|
||||
public Il2CppAssemblyNameDefinition LegacyAname;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public ImageIndex ImageIndex;
|
||||
|
||||
[FieldOffset(4)]
|
||||
[VersionCondition(GreaterThan = "24.1")]
|
||||
public uint Token;
|
||||
|
||||
[FieldOffset(8)]
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex;
|
||||
|
||||
[FieldOffset(12)]
|
||||
[VersionCondition(GreaterThan = "20.0")]
|
||||
public int ReferencedAssemblyStart;
|
||||
|
||||
[FieldOffset(16)]
|
||||
[VersionCondition(GreaterThan = "20.0")]
|
||||
public int ReferencedAssemblyCount;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public Il2CppAssemblyNameDefinition Aname;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
|
||||
[InlineArray(PublicKeyLength)]
|
||||
public struct PublicKeyToken
|
||||
{
|
||||
private const int PublicKeyLength = 8;
|
||||
|
||||
private byte _value;
|
||||
}
|
||||
|
||||
[VersionedStruct]
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public partial struct Il2CppAssemblyNameDefinition
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public StringIndex NameIndex;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public StringIndex CultureIndex;
|
||||
|
||||
[FieldOffset(8)]
|
||||
[VersionCondition(LessThan = "24.3")]
|
||||
public int HashValueIndex;
|
||||
|
||||
[FieldOffset(12)]
|
||||
public StringIndex PublicKeyIndex;
|
||||
|
||||
[FieldOffset(44)]
|
||||
[VersionCondition(LessThan = "15.0")]
|
||||
[CustomSerialization("reader.Read<PublicKeyToken>();", "8")]
|
||||
private PublicKeyToken _legacyPublicKeyToken;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public AssemblyHashAlgorithm HashAlg;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public int HashLen;
|
||||
|
||||
[FieldOffset(24)]
|
||||
public AssemblyNameFlags Flags;
|
||||
|
||||
[FieldOffset(28)]
|
||||
public int Major;
|
||||
|
||||
[FieldOffset(32)]
|
||||
public int Minor;
|
||||
|
||||
[FieldOffset(36)]
|
||||
public int Build;
|
||||
|
||||
[FieldOffset(40)]
|
||||
public int Revision;
|
||||
|
||||
[FieldOffset(44)]
|
||||
[CustomSerialization("reader.Read<PublicKeyToken>();", "8")]
|
||||
public PublicKeyToken PublicKeyToken;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppCustomAttributeDataRange
|
||||
{
|
||||
public uint Token { get; private set; }
|
||||
public uint StartOffset { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppCustomAttributeTypeRange
|
||||
{
|
||||
[VersionCondition(GreaterThan = "24.1")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
public int Start { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
using TypeIndex = int;
|
||||
using MethodIndex = int;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppEventDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
public MethodIndex Add { get; private set; }
|
||||
public MethodIndex Remove { get; private set; }
|
||||
public MethodIndex Raise { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using FieldIndex = int;
|
||||
using TypeIndex = int;
|
||||
using DefaultValueDataIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppFieldDefaultValue
|
||||
{
|
||||
public FieldIndex FieldIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
public DefaultValueDataIndex DataIndex { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using StringIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppFieldDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using FieldIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppFieldMarshaledSize
|
||||
{
|
||||
public FieldIndex FieldIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
public int MarshaledSize { get; private set; }
|
||||
}
|
||||
13
Il2CppInspector.Common/Next/Metadata/Il2CppFieldRef.cs
Normal file
13
Il2CppInspector.Common/Next/Metadata/Il2CppFieldRef.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using FieldIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppFieldRef
|
||||
{
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
public FieldIndex FieldIndex { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using GenericParameterIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericContainer
|
||||
{
|
||||
public int OwnerIndex { get; private set; }
|
||||
public int TypeArgc { get; private set; }
|
||||
public int IsMethod { get; private set; }
|
||||
public GenericParameterIndex GenericParameterStart { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Reflection;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using GenericContainerIndex = int;
|
||||
using StringIndex = int;
|
||||
using GenericParameterConstraintIndex = short;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericParameter
|
||||
{
|
||||
public GenericContainerIndex OwnerIndex { get; private set; }
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public GenericParameterConstraintIndex ConstraintsStart { get; private set; }
|
||||
public short ConstraintsCount { get; private set; }
|
||||
public ushort Num { get; private set; }
|
||||
public ushort Flags { get; private set; }
|
||||
|
||||
public readonly GenericParameterAttributes Attributes => (GenericParameterAttributes)Flags;
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
// Unity 4.6.1p5 - first release, no global-metadata.dat
|
||||
// Unity 5.2.0f3 -> v15
|
||||
// Unity 5.3.0f4 -> v16
|
||||
// Unity 5.3.2f1 -> v19
|
||||
// Unity 5.3.3f1 -> v20
|
||||
// Unity 5.3.5f1 -> v21
|
||||
// Unity 5.5.0f3 -> v22
|
||||
// Unity 5.6.0f3 -> v23
|
||||
// Unity 2017.1.0f3 -> v24
|
||||
// Unity 2018.3.0f2 -> v24.1
|
||||
// Unity 2019.1.0f2 -> v24.2
|
||||
// Unity 2019.3.7f1 -> v24.3
|
||||
// Unity 2019.4.15f1 -> v24.4
|
||||
// Unity 2019.4.21f1 -> v24.5
|
||||
// Unity 2020.1.0f1 -> v24.3
|
||||
// Unity 2020.1.11f1 -> v24.4
|
||||
// Unity 2020.2.0f1 -> v27
|
||||
// Unity 2020.2.4f1 -> v27.1
|
||||
// Unity 2021.1.0f1 -> v27.2
|
||||
// https://unity3d.com/get-unity/download/archive
|
||||
// Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll)
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGlobalMetadataHeader
|
||||
{
|
||||
public int Sanity { get; private set; }
|
||||
public int Version { get; private set; }
|
||||
public int StringLiteralOffset { get; private set; }
|
||||
public int StringLiteralSize { get; private set; }
|
||||
public int StringLiteralDataOffset { get; private set; }
|
||||
public int StringLiteralDataSize { get; private set; }
|
||||
public int StringOffset { get; private set; }
|
||||
public int StringSize { get; private set; }
|
||||
public int EventsOffset { get; private set; }
|
||||
public int EventsSize { get; private set; }
|
||||
public int PropertiesOffset { get; private set; }
|
||||
public int PropertiesSize { get; private set; }
|
||||
public int MethodsOffset { get; private set; }
|
||||
public int MethodsSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
[VersionCondition(EqualTo = "16.0")]
|
||||
public int ParameterDefaultValuesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
[VersionCondition(EqualTo = "16.0")]
|
||||
public int ParameterDefaultValuesSize { get; private set; }
|
||||
public int FieldDefaultValuesOffset { get; private set; }
|
||||
public int FieldDefaultValuesSize { get; private set; }
|
||||
public int FieldAndParameterDefaultValueDataOffset { get; private set; }
|
||||
public int FieldAndParameterDefaultValueDataSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int FieldMarshaledSizesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int FieldMarshaledSizesSize { get; private set; }
|
||||
public int ParametersOffset { get; private set; }
|
||||
public int ParametersSize { get; private set; }
|
||||
public int FieldsOffset { get; private set; }
|
||||
public int FieldsSize { get; private set; }
|
||||
public int GenericParametersOffset { get; private set; }
|
||||
public int GenericParametersSize { get; private set; }
|
||||
public int GenericParameterConstraintsOffset { get; private set; }
|
||||
public int GenericParameterConstraintsSize { get; private set; }
|
||||
public int GenericContainersOffset { get; private set; }
|
||||
public int GenericContainersSize { get; private set; }
|
||||
public int NestedTypesOffset { get; private set; }
|
||||
public int NestedTypesSize { get; private set; }
|
||||
public int InterfacesOffset { get; private set; }
|
||||
public int InterfacesSize { get; private set; }
|
||||
public int VTableMethodsOffset { get; private set; }
|
||||
public int VTableMethodsSize { get; private set; }
|
||||
public int InterfaceOffsetsOffset { get; private set; }
|
||||
public int InterfaceOffsetsSize { get; private set; }
|
||||
public int TypeDefinitionsOffset { get; private set; }
|
||||
public int TypeDefinitionsSize { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxEntriesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxEntriesCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int ImagesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int ImagesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int AssembliesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public int AssembliesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0", LessThan = "24.5")]
|
||||
public int MetadataUsageListsOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0", LessThan = "24.5")]
|
||||
public int MetadataUsageListsCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0", LessThan = "24.5")]
|
||||
public int MetadataUsagePairsOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0", LessThan = "24.5")]
|
||||
public int MetadataUsagePairsCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public int FieldRefsOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public int FieldRefsSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "20.0")]
|
||||
public int ReferencedAssembliesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "20.0")]
|
||||
public int ReferencedAssembliesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "27.2")]
|
||||
public int AttributesInfoOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "27.2")]
|
||||
public int AttributesInfoCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "27.2")]
|
||||
public int AttributesTypesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "27.2")]
|
||||
public int AttributesTypesCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "29.0")]
|
||||
public int AttributeDataOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "29.0")]
|
||||
public int AttributeDataSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "29.0")]
|
||||
public int AttributeDataRangeOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "29.0")]
|
||||
public int AttributeDataRangeSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
public int UnresolvedIndirectCallParameterTypesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
public int UnresolvedIndirectCallParameterTypesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
public int UnresolvedIndirectCallParameterRangesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
public int UnresolvedIndirectCallParameterRangesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "23.0")]
|
||||
public int WindowsRuntimeTypeNamesOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "23.0")]
|
||||
public int WindowsRuntimeTypeNamesSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
public int WindowsRuntimeStringsOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
public int WindowsRuntimeStringsSize { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.0")]
|
||||
public int ExportedTypeDefinitionsOffset { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.0")]
|
||||
public int ExportedTypeDefinitionsSize { get; private set; }
|
||||
|
||||
|
||||
public const int ExpectedSanity = unchecked((int)0xFAB11BAF);
|
||||
public readonly bool SanityValid => Sanity == ExpectedSanity;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
using AssemblyIndex = int;
|
||||
using TypeDefinitionIndex = int;
|
||||
using MethodIndex = int;
|
||||
using CustomAttributeIndex = int;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppImageDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public AssemblyIndex AssemblyIndex { get; private set; }
|
||||
|
||||
public TypeDefinitionIndex TypeStart { get; private set; }
|
||||
public uint TypeCount { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.0")]
|
||||
public TypeDefinitionIndex ExportedTypeStart { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.0")]
|
||||
public uint ExportedTypeCount { get; private set; }
|
||||
|
||||
public MethodIndex EntryPointIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.1")]
|
||||
public CustomAttributeIndex CustomAttributeStart { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "24.1")]
|
||||
public uint CustomAttributeCount { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppInterfaceOffsetPair
|
||||
{
|
||||
public TypeIndex InterfaceTypeIndex { get; private set; }
|
||||
public int Offset { get; private set; }
|
||||
}
|
||||
10
Il2CppInspector.Common/Next/Metadata/Il2CppMetadataRange.cs
Normal file
10
Il2CppInspector.Common/Next/Metadata/Il2CppMetadataRange.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMetadataRange
|
||||
{
|
||||
public int Start { get; private set; }
|
||||
public int Length { get; private set; }
|
||||
}
|
||||
64
Il2CppInspector.Common/Next/Metadata/Il2CppMetadataUsage.cs
Normal file
64
Il2CppInspector.Common/Next/Metadata/Il2CppMetadataUsage.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Diagnostics;
|
||||
using VersionedSerialization;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using EncodedMethodIndex = uint;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMetadataUsage
|
||||
{
|
||||
private const uint TypeMask = 0b111u << 29;
|
||||
private const uint InflatedMask = 0b1;
|
||||
private const uint IndexMask = ~(TypeMask | InflatedMask);
|
||||
|
||||
public readonly Il2CppMetadataUsageType Type => (Il2CppMetadataUsageType)((EncodedValue & TypeMask) >> 29);
|
||||
public readonly uint Index => (EncodedValue & IndexMask) >> 1;
|
||||
public readonly bool Inflated => (EncodedValue & InflatedMask) == 1;
|
||||
|
||||
public EncodedMethodIndex EncodedValue;
|
||||
|
||||
public static Il2CppMetadataUsage FromValue(in StructVersion version, uint encodedValue)
|
||||
{
|
||||
if (version >= MetadataVersions.V270)
|
||||
{
|
||||
return new Il2CppMetadataUsage
|
||||
{
|
||||
EncodedValue = encodedValue
|
||||
};
|
||||
}
|
||||
|
||||
if (version >= MetadataVersions.V190)
|
||||
{
|
||||
// Below v27 we need to fake the 'inflated' flag, so shift the value by one
|
||||
|
||||
var type = (encodedValue & TypeMask) >> 29;
|
||||
var value = encodedValue & (IndexMask | 1);
|
||||
Debug.Assert((value & 0x10000000) == 0);
|
||||
|
||||
return new Il2CppMetadataUsage
|
||||
{
|
||||
EncodedValue = (type << 29) | (value << 1)
|
||||
};
|
||||
}
|
||||
|
||||
/* These encoded indices appear only in vtables, and are decoded by IsGenericMethodIndex/GetDecodedMethodIndex */
|
||||
var methodType = (encodedValue >> 31) != 0
|
||||
? Il2CppMetadataUsageType.MethodRef
|
||||
: Il2CppMetadataUsageType.MethodDef;
|
||||
|
||||
var index = encodedValue & 0x7FFFFFFF;
|
||||
Debug.Assert((index & 0x60000000) == 0);
|
||||
|
||||
return new Il2CppMetadataUsage
|
||||
{
|
||||
EncodedValue = ((uint)methodType << 29) | (index << 1)
|
||||
};
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"{Type} @ 0x{Index:X}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMetadataUsageList
|
||||
{
|
||||
public int Start { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMetadataUsagePair
|
||||
{
|
||||
public uint DestinationIndex { get; private set; }
|
||||
public uint EncodedSourceIndex { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
public enum Il2CppMetadataUsageType
|
||||
{
|
||||
Invalid = 0b000,
|
||||
TypeInfo = 0b001,
|
||||
Il2CppType = 0b010,
|
||||
MethodDef = 0b011,
|
||||
FieldInfo = 0b100,
|
||||
StringLiteral = 0b101,
|
||||
MethodRef = 0b110,
|
||||
FieldRva = 0b111,
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.Reflection;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
using TypeDefinitionIndex = int;
|
||||
using TypeIndex = int;
|
||||
using ParameterIndex = int;
|
||||
using GenericContainerIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMethodDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "16.0")]
|
||||
public TypeDefinitionIndex DeclaringType { get; private set; }
|
||||
public TypeIndex ReturnType { get; private set; }
|
||||
|
||||
[VersionCondition(EqualTo = "31.0")]
|
||||
[VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "31.2")]
|
||||
public uint ReturnParameterToken { get; private set; }
|
||||
|
||||
public ParameterIndex ParameterStart { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
public GenericContainerIndex GenericContainerIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int MethodIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int InvokerIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int ReversePInvokeWrapperIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxStartIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxCount { get; private set; }
|
||||
|
||||
public uint Token { get; private set; }
|
||||
public ushort Flags { get; private set; }
|
||||
public ushort ImplFlags { get; private set; }
|
||||
public ushort Slot { get; private set; }
|
||||
public ushort ParameterCount { get; private set; }
|
||||
|
||||
[VersionCondition(EqualTo = "29.2")]
|
||||
[VersionCondition(EqualTo = "31.2")]
|
||||
public bool IsUnmanagedCallersOnly { get; private set; }
|
||||
|
||||
public readonly MethodAttributes Attributes => (MethodAttributes)Flags;
|
||||
public readonly MethodImplAttributes ImplAttributes => (MethodImplAttributes)ImplFlags;
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using ParameterIndex = int;
|
||||
using TypeIndex = int;
|
||||
using DefaultValueDataIndex = int;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppParameterDefaultValue
|
||||
{
|
||||
public ParameterIndex ParameterIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
public DefaultValueDataIndex DataIndex { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using StringIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppParameterDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public uint Token { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Reflection;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
using MethodIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppPropertyDefinition
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public MethodIndex Get { get; private set; }
|
||||
public MethodIndex Set { get; private set; }
|
||||
public PropertyAttributes Attrs { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
11
Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs
Normal file
11
Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using StringLiteralIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppStringLiteral
|
||||
{
|
||||
public uint Length { get; private set; }
|
||||
public StringLiteralIndex DataIndex { get; private set; }
|
||||
}
|
||||
83
Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs
Normal file
83
Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System.Reflection;
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using StringIndex = int;
|
||||
using TypeIndex = int;
|
||||
using GenericContainerIndex = int;
|
||||
using FieldIndex = int;
|
||||
using MethodIndex = int;
|
||||
using EventIndex = int;
|
||||
using PropertyIndex = int;
|
||||
using NestedTypeIndex = int;
|
||||
using InterfacesIndex = int;
|
||||
using VTableIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTypeDefinition
|
||||
{
|
||||
public const TypeIndex InvalidTypeIndex = -1;
|
||||
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public StringIndex NamespaceIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.0")]
|
||||
public int CustomAttributeIndex { get; private set; }
|
||||
|
||||
public TypeIndex ByValTypeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.5")]
|
||||
public TypeIndex ByRefTypeIndex { get; private set; }
|
||||
|
||||
public TypeIndex DeclaringTypeIndex { get; private set; }
|
||||
public TypeIndex ParentIndex { get; private set; }
|
||||
public TypeIndex ElementTypeIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxStartIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public int RgctxCount { get; private set; }
|
||||
|
||||
public GenericContainerIndex GenericContainerIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public int ReversePInvokeWrapperIndex { get; private set; }
|
||||
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public int MarshalingFunctionsIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public int CcwFunctionIndex { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public int GuidIndex { get; private set; }
|
||||
|
||||
public TypeAttributes Flags { get; private set; }
|
||||
|
||||
public FieldIndex FieldIndex { get; private set; }
|
||||
public MethodIndex MethodIndex { get; private set; }
|
||||
public EventIndex EventIndex { get; private set; }
|
||||
public PropertyIndex PropertyIndex { get; private set; }
|
||||
public NestedTypeIndex NestedTypeIndex { get; private set; }
|
||||
public InterfacesIndex InterfacesIndex { get; private set; }
|
||||
public VTableIndex VTableIndex { get; private set; }
|
||||
public InterfacesIndex InterfaceOffsetsStart { get; private set; }
|
||||
|
||||
public ushort MethodCount { get; private set; }
|
||||
public ushort PropertyCount { get; private set; }
|
||||
public ushort FieldCount { get; private set; }
|
||||
public ushort EventCount { get; private set; }
|
||||
public ushort NestedTypeCount { get; private set; }
|
||||
public ushort VTableCount { get; private set; }
|
||||
public ushort InterfacesCount { get; private set; }
|
||||
public ushort InterfaceOffsetsCount { get; private set; }
|
||||
|
||||
public Il2CppTypeDefinitionBitfield Bitfield { get; private set; }
|
||||
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public uint Token { get; private set; }
|
||||
|
||||
public readonly bool IsValid => NameIndex != 0;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using VersionedSerialization.Attributes;
|
||||
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTypeDefinitionBitfield
|
||||
{
|
||||
private uint _value;
|
||||
|
||||
public bool ValueType => ((_value >> 0) & 1) == 1;
|
||||
public bool EnumType => ((_value >> 1) & 1) == 1;
|
||||
public bool HasFinalize => ((_value >> 2) & 1) == 1;
|
||||
public bool HasCctor => ((_value >> 3) & 1) == 1;
|
||||
public bool IsBlittable => ((_value >> 4) & 1) == 1;
|
||||
public bool IsImportOrWindowsRuntime => ((_value >> 5) & 1) == 1;
|
||||
public PackingSize PackingSize => (PackingSize)((_value >> 6) & 0b1111);
|
||||
public bool DefaultPackingSize => ((_value >> 10) & 1) == 1;
|
||||
public bool DefaultClassSize => ((_value >> 11) & 1) == 1;
|
||||
public PackingSize ClassSize => (PackingSize)((_value >> 12) & 0b1111);
|
||||
public bool IsByRefLike => ((_value >> 13) & 1) == 1;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
using VersionedSerialization.Attributes;
|
||||
using StringIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppWindowsRuntimeTypeNamePair
|
||||
{
|
||||
public StringIndex NameIndex { get; private set; }
|
||||
public TypeIndex TypeIndex { get; private set; }
|
||||
}
|
||||
14
Il2CppInspector.Common/Next/Metadata/PackingSize.cs
Normal file
14
Il2CppInspector.Common/Next/Metadata/PackingSize.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Il2CppInspector.Next.Metadata;
|
||||
|
||||
public enum PackingSize
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Two,
|
||||
Four,
|
||||
Eight,
|
||||
Sixteen,
|
||||
ThirtyTwo,
|
||||
SixtyFour,
|
||||
OneHundredTwentyEight
|
||||
}
|
||||
Reference in New Issue
Block a user