Rework metadata struct loading to use new struct versioning
This commit is contained in:
@@ -3,16 +3,13 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppArrayType
|
||||
public partial record struct Il2CppArrayType
|
||||
{
|
||||
public Pointer<Il2CppType> ElementType;
|
||||
public byte Rank;
|
||||
public byte NumSizes;
|
||||
public byte NumLowerBound;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong Sizes; // int*
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong LoBounds; // int*
|
||||
public PrimitivePointer<int> Sizes;
|
||||
public PrimitivePointer<int> LoBounds;
|
||||
}
|
||||
@@ -3,17 +3,16 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppCodeGenModule
|
||||
public partial record struct Il2CppCodeGenModule
|
||||
{
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong ModuleName; // const char*
|
||||
public PrimitivePointer<byte> ModuleName; // const char*
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint MethodPointerCount;
|
||||
|
||||
public Pointer<Il2CppMethodPointer> MethodPointers;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(EqualTo = "24.5")]
|
||||
[VersionCondition(GreaterThan = "27.1")]
|
||||
public uint AdjustorThunksCount;
|
||||
@@ -22,24 +21,22 @@ public partial struct Il2CppCodeGenModule
|
||||
[VersionCondition(GreaterThan = "27.1")]
|
||||
public Pointer<Il2CppTokenAdjustorThunkPair> AdjustorThunks;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong InvokerIndices; // int*
|
||||
public PrimitivePointer<int> InvokerIndices; // int*
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint ReversePInvokeWrapperCount;
|
||||
|
||||
public Pointer<Il2CppTokenIndexMethodTuple> ReversePInvokeWrapperIndices;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint RgctxRangesCount;
|
||||
public Pointer<Il2CppTokenRangePair> RgctxRanges;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint RgctxsCount;
|
||||
public Pointer<Il2CppRgctxDefinition> Rgctxs;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong DebuggerMetadata; // Pointer<Il2CppDebuggerMetadataRegistration> DebuggerMetadata;
|
||||
public PrimitivePointer<byte> DebuggerMetadata; // Pointer<Il2CppDebuggerMetadataRegistration> DebuggerMetadata;
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0", LessThan = "27.2")]
|
||||
public Pointer<Il2CppMethodPointer> CustomAttributeCacheGenerator;
|
||||
@@ -48,14 +45,11 @@ public partial struct Il2CppCodeGenModule
|
||||
public Il2CppMethodPointer ModuleInitializer;
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
[Aligned(0)]
|
||||
public ulong StaticConstructorTypeIndices; // TypeDefinitionIndex*
|
||||
public PrimitivePointer<int> StaticConstructorTypeIndices; // TypeDefinitionIndex*
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong MetadataRegistration; // Pointer<Il2CppMetadataRegistration>
|
||||
public PrimitivePointer<byte> MetadataRegistration; // Pointer<Il2CppMetadataRegistration>
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong CodeRegistration; // Pointer<Il2CppCodeRegistration>
|
||||
public PrimitivePointer<byte> CodeRegistration; // Pointer<Il2CppCodeRegistration>
|
||||
}
|
||||
@@ -5,38 +5,42 @@ namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
using InvokerMethod = Il2CppMethodPointer;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppCodeRegistration
|
||||
public partial record struct Il2CppCodeRegistration
|
||||
{
|
||||
[VersionCondition(LessThan = "24.1"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public uint MethodPointersCount;
|
||||
|
||||
[VersionCondition(LessThan = "24.1")]
|
||||
public Pointer<Il2CppMethodPointer> MethodPointers;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint ReversePInvokeWrapperCount;
|
||||
|
||||
public Pointer<Il2CppMethodPointer> ReversePInvokeWrappers;
|
||||
|
||||
[VersionCondition(LessThan = "22.0"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public uint DelegateWrappersFromManagedToNativeCount;
|
||||
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public Pointer<Il2CppMethodPointer> DelegateWrappersFromManagedToNative;
|
||||
|
||||
[VersionCondition(LessThan = "22.0"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public uint MarshalingFunctionsCount;
|
||||
|
||||
[VersionCondition(LessThan = "22.0")]
|
||||
public Pointer<Il2CppMethodPointer> MarshalingFunctions;
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public uint CcwMarshalingFunctionsCount;
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public Pointer<Il2CppMethodPointer> CcwMarshalingFunctions;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint GenericMethodPointersCount;
|
||||
|
||||
public Pointer<Il2CppMethodPointer> GenericMethodPointers;
|
||||
@@ -45,29 +49,32 @@ public partial struct Il2CppCodeRegistration
|
||||
[VersionCondition(GreaterThan = "27.1")]
|
||||
public Pointer<Il2CppMethodPointer> GenericAdjustorThunks;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint InvokerPointersCount;
|
||||
|
||||
public Pointer<InvokerMethod> InvokerPointers;
|
||||
|
||||
[VersionCondition(LessThan = "24.5"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "24.5")]
|
||||
public int CustomAttributeCount;
|
||||
|
||||
[VersionCondition(LessThan = "24.5")]
|
||||
public Pointer<Il2CppMethodPointer> CustomAttributeGenerators;
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public int GuidCount;
|
||||
|
||||
[VersionCondition(GreaterThan = "21.0", LessThan = "22.0")]
|
||||
public Pointer<Il2CppGuid> Guids;
|
||||
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "22.0", LessThan = "29.0")]
|
||||
public int UnresolvedVirtualCallCount;
|
||||
|
||||
[NativeInteger]
|
||||
[VersionCondition(EqualTo = "29.1"), VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "29.2"), VersionCondition(EqualTo = "31.2")]
|
||||
[Aligned(0)]
|
||||
public uint UnresolvedIndirectCallCount; // UnresolvedVirtualCallCount pre 29.1
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
@@ -81,19 +88,22 @@ public partial struct Il2CppCodeRegistration
|
||||
[VersionCondition(EqualTo = "29.2"), VersionCondition(EqualTo = "31.2")]
|
||||
public Pointer<Il2CppMethodPointer> UnresolvedStaticCallPointers;
|
||||
|
||||
[VersionCondition(GreaterThan = "23.0"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "23.0")]
|
||||
public uint InteropDataCount;
|
||||
|
||||
[VersionCondition(GreaterThan = "23.0")]
|
||||
public Pointer<Il2CppInteropData> InteropData;
|
||||
|
||||
[VersionCondition(GreaterThan = "24.3"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "24.3")]
|
||||
public uint WindowsRuntimeFactoryCount;
|
||||
|
||||
[VersionCondition(GreaterThan = "24.3")]
|
||||
public Pointer<Il2CppWindowsRuntimeFactoryTableEntry> WindowsRuntimeFactoryTable;
|
||||
|
||||
[VersionCondition(GreaterThan = "24.2"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "24.2")]
|
||||
public uint CodeGenModulesCount;
|
||||
|
||||
[VersionCondition(GreaterThan = "24.2")]
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericClass
|
||||
public partial record struct Il2CppGenericClass
|
||||
{
|
||||
[VersionCondition(LessThan = "24.5"), Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "24.5")]
|
||||
public int TypeDefinitionIndex;
|
||||
|
||||
[VersionCondition(GreaterThan = "27.0")]
|
||||
@@ -13,6 +14,5 @@ public partial struct Il2CppGenericClass
|
||||
|
||||
public Il2CppGenericContext Context;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong CachedClass; // Il2CppClass*, optional
|
||||
public PrimitivePointer<byte> CachedClass; // Il2CppClass*, optional
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericContext
|
||||
public partial record struct Il2CppGenericContext
|
||||
{
|
||||
public Pointer<Il2CppGenericInst> ClassInst;
|
||||
public Pointer<Il2CppGenericInst> MethodInst;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericInst
|
||||
public partial record struct Il2CppGenericInst
|
||||
{
|
||||
public readonly bool Valid => TypeArgc > 0;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint TypeArgc;
|
||||
|
||||
public Pointer<Pointer<Il2CppType>> TypeArgv;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
using GenericMethodIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericMethodFunctionsDefinitions
|
||||
public partial record struct Il2CppGenericMethodFunctionsDefinitions
|
||||
{
|
||||
public GenericMethodIndex GenericMethodIndex;
|
||||
public Il2CppGenericMethodIndices Indices;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
using MethodIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppGenericMethodIndices
|
||||
public partial record struct Il2CppGenericMethodIndices
|
||||
{
|
||||
public MethodIndex MethodIndex;
|
||||
public MethodIndex InvokerIndex;
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
|
||||
public struct Il2CppGuid : IReadable
|
||||
public record struct Il2CppGuid : IReadable
|
||||
{
|
||||
public Guid Value;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using PInvokeMarshalCleanupFunc = Il2CppMethodPointer;
|
||||
using CreateCCWFunc = Il2CppMethodPointer;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppInteropData
|
||||
public partial record struct Il2CppInteropData
|
||||
{
|
||||
public Il2CppMethodPointer DelegatePInvokeWrapperFunction;
|
||||
public PInvokeMarshalToNativeFunc PInvokeMarshalToNativeFunction;
|
||||
|
||||
@@ -7,51 +7,50 @@ using FieldIndex = int;
|
||||
using TypeDefinitionIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMetadataRegistration
|
||||
public partial record struct Il2CppMetadataRegistration
|
||||
{
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public int GenericClassesCount;
|
||||
|
||||
public Pointer<Pointer<Il2CppGenericClass>> GenericClasses;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public int GenericInstsCount;
|
||||
|
||||
public Pointer<Pointer<Il2CppGenericInst>> GenericInsts;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public int GenericMethodTableCount;
|
||||
|
||||
public Pointer<Il2CppGenericMethodFunctionsDefinitions> GenericMethodTable;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public int TypesCount;
|
||||
|
||||
public Pointer<Pointer<Il2CppType>> Types;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public int MethodSpecsCount;
|
||||
|
||||
public Pointer<Il2CppMethodSpec> MethodSpecs;
|
||||
|
||||
[NativeInteger]
|
||||
[VersionCondition(LessThan = "16.0")]
|
||||
public int MethodReferencesCount;
|
||||
|
||||
[VersionCondition(LessThan = "16.0")]
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong MethodReferences; // uint**
|
||||
public PrimitivePointer<PrimitivePointer<uint>> MethodReferences; // uint**
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public FieldIndex FieldOffsetsCount;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong FieldOffsets; // int**
|
||||
public PrimitivePointer<PrimitivePointer<int>> FieldOffsets; // int**
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public TypeDefinitionIndex TypeDefinitionsSizesCount;
|
||||
public Pointer<Pointer<Il2CppTypeDefinitionSizes>> TypeDefinitionsSizes;
|
||||
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "19.0")]
|
||||
public ulong MetadataUsagesCount;
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMethodPointer(ulong addr = 0)
|
||||
public partial record struct Il2CppMethodPointer(ulong addr = 0)
|
||||
{
|
||||
public static readonly Il2CppMethodPointer Null = new();
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
[NativeInteger]
|
||||
public ulong Value { get; set; } = addr;
|
||||
|
||||
public readonly bool IsNull => Value == 0;
|
||||
|
||||
@@ -6,7 +6,7 @@ using MethodIndex = int;
|
||||
using GenericInstIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppMethodSpec
|
||||
public partial record struct Il2CppMethodSpec
|
||||
{
|
||||
public MethodIndex MethodDefinitionIndex;
|
||||
public GenericInstIndex ClassIndexIndex;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppRange
|
||||
public partial record struct Il2CppRange
|
||||
{
|
||||
public int Start;
|
||||
public int Length;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppRgctxConstrainedData
|
||||
public partial record struct Il2CppRgctxConstrainedData
|
||||
{
|
||||
public TypeIndex TypeIndex;
|
||||
public Il2CppMetadataUsage EncodedMethodIndex;
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppRgctxDefinition
|
||||
public partial record struct Il2CppRgctxDefinition
|
||||
{
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public Il2CppRgctxDataType Type;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong Data; // void*
|
||||
public PrimitivePointer<byte> Data; // void*
|
||||
|
||||
public readonly Pointer<Il2CppRgctxDefinitionData> Definition => Data;
|
||||
public readonly Pointer<Il2CppRgctxConstrainedData> Constrained => Data;
|
||||
public readonly Pointer<Il2CppRgctxDefinitionData> Definition => Data.PointerValue;
|
||||
public readonly Pointer<Il2CppRgctxConstrainedData> Constrained => Data.PointerValue;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using MethodIndex = int;
|
||||
using TypeIndex = int;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppRgctxDefinitionData
|
||||
public partial record struct Il2CppRgctxDefinitionData
|
||||
{
|
||||
public int Value;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTokenAdjustorThunkPair
|
||||
public partial record struct Il2CppTokenAdjustorThunkPair
|
||||
{
|
||||
[Aligned(0)]
|
||||
[NativeInteger]
|
||||
public uint Token;
|
||||
|
||||
public Il2CppMethodPointer AdjustorThunk;
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTokenIndexMethodTuple
|
||||
public partial record struct Il2CppTokenIndexMethodTuple
|
||||
{
|
||||
public uint Token;
|
||||
public int Index;
|
||||
|
||||
[CustomSerialization("reader.ReadNUInt();", "is32Bit ? 4 : 8")]
|
||||
public ulong Method; // void**
|
||||
public PrimitivePointer<Il2CppMethodPointer> Method; // void**
|
||||
|
||||
public uint GenericMethodIndex;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTokenRangePair
|
||||
public partial record struct Il2CppTokenRangePair
|
||||
{
|
||||
public uint Token;
|
||||
public Il2CppRange Range;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppTypeDefinitionSizes
|
||||
public partial record struct Il2CppTypeDefinitionSizes
|
||||
{
|
||||
public uint InstanceSize;
|
||||
public int NativeSize;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Il2CppInspector.Next.BinaryMetadata;
|
||||
|
||||
[VersionedStruct]
|
||||
public partial struct Il2CppWindowsRuntimeFactoryTableEntry
|
||||
public partial record struct Il2CppWindowsRuntimeFactoryTableEntry
|
||||
{
|
||||
public Pointer<Il2CppType> Type;
|
||||
public Il2CppMethodPointer CreateFactoryFunction;
|
||||
|
||||
Reference in New Issue
Block a user