IL2CPP: Implement Il2CppAssemblyNameDefinition change (metadata v24.4)

This commit is contained in:
Katy Coe
2020-11-26 21:42:03 +01:00
parent 17ab66adf4
commit 479aeb7bcd
8 changed files with 23 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ namespace Il2CppInspector
public long[] FieldOffsetPointers { get; private set; }
// Generated functions which call constructors on custom attributes
// Only for <=24.3
// Only for < 27
public ulong[] CustomAttributeGenerators { get; private set; }
// IL2CPP-generated functions which implement MethodBase.Invoke with a unique signature per invoker, defined in Il2CppInvokerTable.cpp

View File

@@ -41,9 +41,9 @@ namespace Il2CppInspector
public ulong invokerPointers;
// Removed in metadata v27
[Version(Max = 24.3)]
[Version(Max = 24.4)]
public long customAttributeCount;
[Version(Max = 24.3)]
[Version(Max = 24.4)]
public ulong customAttributeGenerators;
// Removed in metadata v23
@@ -199,7 +199,7 @@ namespace Il2CppInspector
public class Il2CppGenericClass
{
[Version(Max = 24.3)]
[Version(Max = 24.4)]
public long typeDefinitionIndex; /* the generic type definition */
[Version(Min = 27)]
public ulong type; // Il2CppType* /* the generic type definition */

View File

@@ -137,7 +137,7 @@ namespace Il2CppInspector
if (Version >= 27)
return buildLateBindingMetadataUsages();
// Version >= 19 && <= 24.3
// Version >= 19 && < 27
var usages = new Dictionary<uint, MetadataUsage>();
foreach (var metadataUsageList in Metadata.MetadataUsageLists)
{

View File

@@ -162,7 +162,7 @@ namespace Il2CppInspector
var mrSize = (ulong) Metadata.Sizeof(typeof(Il2CppMetadataRegistration), Image.Version, Image.Bits / 8);
vas = FindAllMappedWords(imageBytes, (ulong) metadata.Types.Length).Select(a => a - mrSize + ptrSize * 4);
// >= 19 && <= 24.3
// >= 19 && < 27
if (Image.Version < 27)
foreach (var va in vas) {
var mr = Image.ReadMappedObject<Il2CppMetadataRegistration>(va);

View File

@@ -119,7 +119,14 @@ namespace Il2CppInspector
VTableMethodIndices = ReadArray<uint>(Header.vtableMethodsOffset, Header.vtableMethodsCount / sizeof(uint));
if (Version >= 16) {
Assemblies = ReadArray<Il2CppAssemblyDefinition>(Header.assembliesOffset, Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition)));
// In v24.4 hashValueIndex was removed from Il2CppAssemblyNameDefinition, which is a field in Il2CppAssemblyDefinition
// The number of images and assemblies should be the same. If they are not, we deduce that we are using v24.4
// Note the version comparison matches both 24.2 and 24.3 here since 24.3 is tested for during binary loading
var assemblyCount = Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition));
if (Version == 24.2 && assemblyCount < Images.Length)
Version = 24.4;
Assemblies = ReadArray<Il2CppAssemblyDefinition>(Header.assembliesOffset, Images.Length);
ParameterDefaultValues = ReadArray<Il2CppParameterDefaultValue>(Header.parameterDefaultValuesOffset, Header.parameterDefaultValuesCount / Sizeof(typeof(Il2CppParameterDefaultValue)));
}
if (Version >= 19 && Version < 27) {

View File

@@ -27,6 +27,9 @@ namespace Il2CppInspector
// Unity 2019.1.0f2 -> v24.2
// Unity 2019.2.8f1 -> v24.2
// Unity 2019.3.7f1 -> v24.3
// Unity 2019.4.15f1 -> v24.4
// Unity 2020.1.0f1 -> v24.3
// Unity 2020.1.11f1 -> v24.4
// Unity 2020.2.0f1 -> v27
// https://unity3d.com/get-unity/download/archive
// Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll)
@@ -100,13 +103,13 @@ namespace Il2CppInspector
[Version(Min = 16)]
public int assembliesCount;
[Version(Min = 19, Max = 24.3)]
[Version(Min = 19, Max = 24.4)]
public int metadataUsageListsOffset; // Il2CppMetadataUsageList
[Version(Min = 19, Max = 24.3)]
[Version(Min = 19, Max = 24.4)]
public int metadataUsageListsCount;
[Version(Min = 19, Max = 24.3)]
[Version(Min = 19, Max = 24.4)]
public int metadataUsagePairsOffset; // Il2CppMetadataUsagePair
[Version(Min = 19, Max = 24.3)]
[Version(Min = 19, Max = 24.4)]
public int metadataUsagePairsCount;
[Version(Min = 19)]
public int fieldRefsOffset; // Il2CppFieldRef
@@ -214,6 +217,7 @@ namespace Il2CppInspector
public int nameIndex;
public int cultureIndex;
[Version(Max = 24.3)]
public int hashValueIndex;
public int publicKeyIndex;
[Version(Max = 15), ArrayLength(FixedSize = 8)]
@@ -239,7 +243,7 @@ namespace Il2CppInspector
public int customAttributeIndex;
public int byvalTypeIndex;
[Version(Max = 24.3)]
[Version(Max = 24.4)]
public int byrefTypeIndex;
public int declaringTypeIndex;