Add stuff for v29
This commit is contained in:
@@ -292,6 +292,13 @@ namespace Il2CppInspector
|
|||||||
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
|
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Image.Version == 29 && CodeRegistration.genericMethodPointersCount > 0x50000)
|
||||||
|
{
|
||||||
|
Image.Version = 29.1;
|
||||||
|
codeRegistration -= 2 * pointerSize;
|
||||||
|
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
// Plugin hook to pre-process binary
|
// Plugin hook to pre-process binary
|
||||||
isModified |= PluginHooks.PreProcessBinary(this).IsStreamModified;
|
isModified |= PluginHooks.PreProcessBinary(this).IsStreamModified;
|
||||||
|
|
||||||
|
|||||||
@@ -57,11 +57,20 @@ namespace Il2CppInspector
|
|||||||
public ulong guids; // Il2CppGuid
|
public ulong guids; // Il2CppGuid
|
||||||
|
|
||||||
// Added in metadata v22
|
// Added in metadata v22
|
||||||
[Version(Min = 22)]
|
[Version(Min = 22, Max = 29)]
|
||||||
public ulong unresolvedVirtualCallCount;
|
public ulong unresolvedVirtualCallCount;
|
||||||
|
|
||||||
|
[Version(Min = 29.1)]
|
||||||
|
public ulong unresolvedIndirectCallCount;
|
||||||
|
|
||||||
[Version(Min = 22)]
|
[Version(Min = 22)]
|
||||||
public ulong unresolvedVirtualCallPointers;
|
public ulong unresolvedVirtualCallPointers;
|
||||||
|
|
||||||
|
[Version(Min = 29.1)]
|
||||||
|
public ulong unresolvedInstanceCallPointers;
|
||||||
|
[Version(Min = 29.1)]
|
||||||
|
public ulong unresolvedStaticCallPointers;
|
||||||
|
|
||||||
// Added in metadata v23
|
// Added in metadata v23
|
||||||
[Version(Min = 23)]
|
[Version(Min = 23)]
|
||||||
public ulong interopDataCount;
|
public ulong interopDataCount;
|
||||||
@@ -102,10 +111,15 @@ namespace Il2CppInspector
|
|||||||
public ulong debuggerMetadata;
|
public ulong debuggerMetadata;
|
||||||
|
|
||||||
// Added in metadata v27
|
// Added in metadata v27
|
||||||
|
[Version(Min = 27, Max = 27.2)]
|
||||||
public ulong customAttributeCacheGenerator; // CustomAttributesCacheGenerator*
|
public ulong customAttributeCacheGenerator; // CustomAttributesCacheGenerator*
|
||||||
|
[Version(Min = 27)]
|
||||||
public ulong moduleInitializer; // Il2CppMethodPointer
|
public ulong moduleInitializer; // Il2CppMethodPointer
|
||||||
|
[Version(Min = 27)]
|
||||||
public ulong staticConstructorTypeIndices; // TypeDefinitionIndex*
|
public ulong staticConstructorTypeIndices; // TypeDefinitionIndex*
|
||||||
|
[Version(Min = 27)]
|
||||||
public ulong metadataRegistration; // Il2CppMetadataRegistration* // Per-assembly mode only
|
public ulong metadataRegistration; // Il2CppMetadataRegistration* // Per-assembly mode only
|
||||||
|
[Version(Min = 27)]
|
||||||
public ulong codeRegistration; // Il2CppCodeRegistration* // Per-assembly mode only
|
public ulong codeRegistration; // Il2CppCodeRegistration* // Per-assembly mode only
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +193,8 @@ namespace Il2CppInspector
|
|||||||
IL2CPP_TYPE_SENTINEL = 0x41, /* Sentinel for varargs method signature */
|
IL2CPP_TYPE_SENTINEL = 0x41, /* Sentinel for varargs method signature */
|
||||||
IL2CPP_TYPE_PINNED = 0x45, /* Local var that points to pinned object */
|
IL2CPP_TYPE_PINNED = 0x45, /* Local var that points to pinned object */
|
||||||
|
|
||||||
IL2CPP_TYPE_ENUM = 0x55 /* an enumeration */
|
IL2CPP_TYPE_ENUM = 0x55, /* an enumeration */
|
||||||
|
IL2CPP_TYPE_IL2CPP_TYPE_INDEX = 0xff /* Type index metadata table */
|
||||||
}
|
}
|
||||||
|
|
||||||
// From metadata.h / il2cpp-runtime-metadata.h
|
// From metadata.h / il2cpp-runtime-metadata.h
|
||||||
@@ -199,6 +214,7 @@ namespace Il2CppInspector
|
|||||||
*/
|
*/
|
||||||
public ulong datapoint;
|
public ulong datapoint;
|
||||||
public ulong bits; // this should be private but we need it to be public for BinaryObjectReader to work
|
public ulong bits; // this should be private but we need it to be public for BinaryObjectReader to work
|
||||||
|
//public Union data { get; set; }
|
||||||
|
|
||||||
public uint attrs => (uint) bits & 0xffff; /* param attributes or field flags */
|
public uint attrs => (uint) bits & 0xffff; /* param attributes or field flags */
|
||||||
public Il2CppTypeEnum type => (Il2CppTypeEnum)((bits >> 16) & 0xff);
|
public Il2CppTypeEnum type => (Il2CppTypeEnum)((bits >> 16) & 0xff);
|
||||||
@@ -206,6 +222,39 @@ namespace Il2CppInspector
|
|||||||
public uint num_mods => (uint) (bits >> 24) & 0x3f; /* max 64 modifiers follow at the end */
|
public uint num_mods => (uint) (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; /* valid when included in a local var signature */
|
public bool pinned => (bits >> 31) == 1; /* valid when included in a local var signature */
|
||||||
|
|
||||||
|
/*public class Union
|
||||||
|
{
|
||||||
|
public ulong dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for VALUETYPE and CLASS
|
||||||
|
/// </summary>
|
||||||
|
public long klassIndex => (long)dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for VALUETYPE and CLASS at runtime
|
||||||
|
/// </summary>
|
||||||
|
public ulong typeHandle => dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for PTR and SZARRAY
|
||||||
|
/// </summary>
|
||||||
|
public ulong type => dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for ARRAY
|
||||||
|
/// </summary>
|
||||||
|
public ulong array => dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for VAR and MVAR
|
||||||
|
/// </summary>
|
||||||
|
public long genericParameterIndex => (long)dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for VAR and MVAR at runtime
|
||||||
|
/// </summary>
|
||||||
|
public ulong genericParameterHandle => dummy;
|
||||||
|
/// <summary>
|
||||||
|
/// for GENERICINST
|
||||||
|
/// </summary>
|
||||||
|
public ulong generic_class => dummy;
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Il2CppGenericClass
|
public class Il2CppGenericClass
|
||||||
|
|||||||
@@ -102,10 +102,14 @@ namespace Il2CppInspector
|
|||||||
value = Metadata.ReadInt16();
|
value = Metadata.ReadInt16();
|
||||||
break;
|
break;
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_U4:
|
case Il2CppTypeEnum.IL2CPP_TYPE_U4:
|
||||||
value = Metadata.ReadUInt32();
|
value = Metadata.Version >= 29
|
||||||
|
? Metadata.ReadCompressedUInt32()
|
||||||
|
: Metadata.ReadUInt32();
|
||||||
break;
|
break;
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_I4:
|
case Il2CppTypeEnum.IL2CPP_TYPE_I4:
|
||||||
value = Metadata.ReadInt32();
|
value = Metadata.Version >= 29
|
||||||
|
? Metadata.ReadCompressedInt32()
|
||||||
|
: Metadata.ReadInt32();
|
||||||
break;
|
break;
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_U8:
|
case Il2CppTypeEnum.IL2CPP_TYPE_U8:
|
||||||
value = Metadata.ReadUInt64();
|
value = Metadata.ReadUInt64();
|
||||||
@@ -120,7 +124,10 @@ namespace Il2CppInspector
|
|||||||
value = Metadata.ReadDouble();
|
value = Metadata.ReadDouble();
|
||||||
break;
|
break;
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_STRING:
|
case Il2CppTypeEnum.IL2CPP_TYPE_STRING:
|
||||||
var uiLen = Metadata.ReadInt32();
|
var uiLen = Metadata.Version >= 29
|
||||||
|
? Metadata.ReadCompressedInt32()
|
||||||
|
: Metadata.ReadInt32();
|
||||||
|
|
||||||
value = Encoding.UTF8.GetString(Metadata.ReadBytes(uiLen));
|
value = Encoding.UTF8.GetString(Metadata.ReadBytes(uiLen));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -310,7 +317,7 @@ namespace Il2CppInspector
|
|||||||
FunctionAddresses.Add(sortedFunctionPointers[^1], sortedFunctionPointers[^1]);
|
FunctionAddresses.Add(sortedFunctionPointers[^1], sortedFunctionPointers[^1]);
|
||||||
|
|
||||||
// Organize custom attribute indices
|
// Organize custom attribute indices
|
||||||
if (Version >= 24.1) {
|
if (Version >= 24.1 && Version < 29) {
|
||||||
AttributeIndicesByToken = new Dictionary<int, Dictionary<uint, int>>();
|
AttributeIndicesByToken = new Dictionary<int, Dictionary<uint, int>>();
|
||||||
foreach (var image in Images) {
|
foreach (var image in Images) {
|
||||||
var attsByToken = new Dictionary<uint, int>();
|
var attsByToken = new Dictionary<uint, int>();
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ namespace Il2CppInspector.Reflection
|
|||||||
yield return attribute;
|
yield return attribute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Skipping custom attributes for 29+");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static IList<CustomAttributeData> getCustomAttributes(Assembly asm, int token, int customAttributeIndex) =>
|
private static IList<CustomAttributeData> getCustomAttributes(Assembly asm, int token, int customAttributeIndex) =>
|
||||||
getCustomAttributes(asm, asm.Model.GetCustomAttributeIndex(asm, token, customAttributeIndex)).ToList();
|
getCustomAttributes(asm, asm.Model.GetCustomAttributeIndex(asm, token, customAttributeIndex)).ToList();
|
||||||
|
|||||||
@@ -311,6 +311,9 @@ namespace Il2CppInspector.Reflection
|
|||||||
if (Package.Version <= 24.0)
|
if (Package.Version <= 24.0)
|
||||||
return customAttributeIndex;
|
return customAttributeIndex;
|
||||||
|
|
||||||
|
if (Package.Version >= 29)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// From v24.1 onwards, token was added to Il2CppCustomAttributeTypeRange and each Il2CppImageDefinition noted the CustomAttributeTypeRanges for the image
|
// From v24.1 onwards, token was added to Il2CppCustomAttributeTypeRange and each Il2CppImageDefinition noted the CustomAttributeTypeRanges for the image
|
||||||
if (!Package.AttributeIndicesByToken[asm.ImageDefinition.customAttributeStart].TryGetValue((uint) token, out var index))
|
if (!Package.AttributeIndicesByToken[asm.ImageDefinition.customAttributeStart].TryGetValue((uint) token, out var index))
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user