@@ -208,6 +208,25 @@ namespace Il2CppInspector
|
||||
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
|
||||
MetadataRegistration = Image.ReadMappedObject<Il2CppMetadataRegistration>(metadataRegistration);
|
||||
|
||||
// Do basic validatation that MetadataRegistration and CodeRegistration are sane
|
||||
/*
|
||||
* TODO: Validation can be greatly expanded upon later, eg. pointers in these two structs should actually be pointers
|
||||
* GlobalMethodPointers (<= 24.1) must be a series of pointers in il2cpp or .text, and in sequential order
|
||||
* FieldOffsetPointers (>= 21.1) must be a series of pointers in __const or zero, and in sequential order
|
||||
* typeRefPointers must be a series of pointers in __const
|
||||
* MethodInvokePointers must be a series of pointers in __text or .text, and in sequential order
|
||||
*/
|
||||
if (MetadataRegistration.typesCount < MetadataRegistration.typeDefinitionsSizesCount
|
||||
|| MetadataRegistration.genericClassesCount < MetadataRegistration.genericInstsCount
|
||||
|| MetadataRegistration.genericMethodTableCount < MetadataRegistration.genericInstsCount
|
||||
|| CodeRegistration.reversePInvokeWrapperCount > 0x1000
|
||||
|| CodeRegistration.unresolvedVirtualCallCount > 0x4000 // >= 22
|
||||
|| CodeRegistration.interopDataCount > 0x1000 // >= 23
|
||||
|| (Image.Version <= 24.1 && CodeRegistration.invokerPointersCount > CodeRegistration.methodPointersCount))
|
||||
throw new NotSupportedException("The detected Il2CppCodeRegistration / Il2CppMetadataRegistration structs do not pass validation. This may mean that their fields have been re-ordered as a form of obfuscation - this scenario is not currently supported by Il2CppInspector. Consider re-ordering the fields in Il2CppBinaryClasses.cs and try again.");
|
||||
|
||||
// TODO: Determine the correct field order for MetadataRegistration and CodeRegistration (#44, #98)
|
||||
|
||||
// The global method pointer list was deprecated in v24.2 in favour of Il2CppCodeGenModule
|
||||
if (Image.Version <= 24.1)
|
||||
GlobalMethodPointers = Image.ReadMappedArray<ulong>(CodeRegistration.pmethodPointers, (int) CodeRegistration.methodPointersCount);
|
||||
|
||||
Reference in New Issue
Block a user