Update Il2CPP structs for new v24 iterations

This commit is contained in:
Katy Coe
2019-10-16 08:50:34 +02:00
parent d2a5f8c961
commit 79baebdb93
2 changed files with 73 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
/* /*
Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved. All rights reserved.
*/ */
@@ -9,6 +9,7 @@ using NoisyCowStudios.Bin2Object;
namespace Il2CppInspector namespace Il2CppInspector
{ {
// From class-internals.h / il2cpp-class-internals.h
public class Il2CppCodeRegistration public class Il2CppCodeRegistration
{ {
// Moved to Il2CppCodeGenModule in later versions of v24 // Moved to Il2CppCodeGenModule in later versions of v24
@@ -66,6 +67,22 @@ namespace Il2CppInspector
public uint pcodeGenModules; public uint pcodeGenModules;
} }
// Introduced in metadata v24.1 (replaces method pointers in Il2CppCodeRegistration)
public class Il2CppCodeGenModule
{
public uint moduleName;
public uint methodPointerCount;
public uint methodPointers;
public uint invokerIndices;
public uint reversePInvokeWrapperCount;
public uint reversePInvokeWrapperIndices;
public uint rgctxRangesCount;
public uint rgctxRanges;
public uint rgctxsCount;
public uint rgctxs;
public uint debuggerMetadata;
}
#pragma warning disable CS0649 #pragma warning disable CS0649
public class Il2CppMetadataRegistration public class Il2CppMetadataRegistration
{ {
@@ -90,6 +107,7 @@ namespace Il2CppInspector
} }
#pragma warning restore CS0649 #pragma warning restore CS0649
// From blob.h / il2cpp-blob.h
public enum Il2CppTypeEnum public enum Il2CppTypeEnum
{ {
IL2CPP_TYPE_END = 0x00, /* End of List */ IL2CPP_TYPE_END = 0x00, /* End of List */
@@ -132,16 +150,27 @@ namespace Il2CppInspector
IL2CPP_TYPE_ENUM = 0x55 /* an enumeration */ IL2CPP_TYPE_ENUM = 0x55 /* an enumeration */
} }
// From metadata.h / il2cpp-runtime-metadata.h
public class Il2CppType public class Il2CppType
{ {
/*
union
{
TypeDefinitionIndex klassIndex; // for VALUETYPE and CLASS
const Il2CppType* type; // for PTR and SZARRAY
Il2CppArrayType* array; // for ARRAY
GenericParameterIndex genericParameterIndex; // for VAR and MVAR
Il2CppGenericClass* generic_class; // for GENERICINST
}
*/
public uint datapoint; public uint datapoint;
public uint bits; public uint bits; // this should be private but we need it to be public for BinaryObjectReader to work
public uint attrs => bits & 0xffff; public uint attrs => bits & 0xffff; /* param attributes or field flags */
public Il2CppTypeEnum type => (Il2CppTypeEnum)((bits >> 16) & 0xff); public Il2CppTypeEnum type => (Il2CppTypeEnum)((bits >> 16) & 0xff);
public uint num_mods => (bits >> 24) & 0x3f; public uint num_mods => (bits >> 24) & 0x3f; /* max 64 modifiers follow at the end */
public bool byref => ((bits >> 30) & 1) == 1; public bool byref => ((bits >> 30) & 1) == 1;
public bool pinned => (bits >> 31) == 1; public bool pinned => (bits >> 31) == 1; /* valid when included in a local var signature */
} }
public class Il2CppGenericClass public class Il2CppGenericClass

View File

@@ -1,6 +1,6 @@
/* /*
Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved. All rights reserved.
*/ */
@@ -9,6 +9,12 @@ using NoisyCowStudios.Bin2Object;
namespace Il2CppInspector namespace Il2CppInspector
{ {
// Unity 5.6.2p3 -> v23
// Unity 5.6.4f1 -> v23
// Unity 2017.2f3 -> v24
// Unity 2019.2.8f1 -> v24.1
// From il2cpp-metadata.h
#pragma warning disable CS0649 #pragma warning disable CS0649
public class Il2CppGlobalMetadataHeader public class Il2CppGlobalMetadataHeader
{ {
@@ -112,6 +118,11 @@ namespace Il2CppInspector
public int entryPointIndex; public int entryPointIndex;
public uint token; public uint token;
[Version(Min = 24.1)]
public int customAttributeStart;
[Version(Min = 24.1)]
public uint customAttributeCount;
} }
#pragma warning restore CS0649 #pragma warning restore CS0649
@@ -119,7 +130,11 @@ namespace Il2CppInspector
{ {
public int nameIndex; public int nameIndex;
public int namespaceIndex; public int namespaceIndex;
// Removed in later versions of metadata v24
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public int byvalTypeIndex; public int byvalTypeIndex;
public int byrefTypeIndex; public int byrefTypeIndex;
@@ -180,13 +195,23 @@ namespace Il2CppInspector
public int declaringType; public int declaringType;
public int returnType; public int returnType;
public int parameterStart; public int parameterStart;
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public int genericContainerIndex; public int genericContainerIndex;
[Version(Max = 24.0)]
public int methodIndex; public int methodIndex;
[Version(Max = 24.0)]
public int invokerIndex; public int invokerIndex;
public int delegateWrapperIndex; // (was renamed to reversePInvokeWrapperIndex in v22) [Version(Max = 24.0)]
public int reversePInvokeWrapperIndex; // (was renamed from delegateWrapperIndex in v22)
[Version(Max = 24.0)]
public int rgctxStartIndex; public int rgctxStartIndex;
[Version(Max = 24.0)]
public int rgctxCount; public int rgctxCount;
public uint token; public uint token;
public ushort flags; public ushort flags;
public ushort iflags; public ushort iflags;
@@ -198,7 +223,10 @@ namespace Il2CppInspector
{ {
public int nameIndex; public int nameIndex;
public uint token; public uint token;
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public int typeIndex; public int typeIndex;
} }
@@ -206,7 +234,10 @@ namespace Il2CppInspector
{ {
public int nameIndex; public int nameIndex;
public int typeIndex; public int typeIndex;
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public uint token; public uint token;
} }
@@ -223,7 +254,10 @@ namespace Il2CppInspector
public int get; public int get;
public int set; public int set;
public uint attrs; public uint attrs;
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public uint token; public uint token;
} }
@@ -234,7 +268,10 @@ namespace Il2CppInspector
public int add; public int add;
public int remove; public int remove;
public int raise; public int raise;
[Version(Max = 24.0)]
public int customAttributeIndex; public int customAttributeIndex;
public uint token; public uint token;
} }
} }