Fix fieldOffsetsArePointers logic on 64-bit builds
The logic for fieldOffsetsArePointers was always reading 32-bit units even on 64-bits. When fieldOffsetsArePointers is true, fieldOffsets is declared as int32_t**, so each element *must* be a pointer and therefore word-sized (64 bits on 64-bit machines). So it doesn't make sense to only read 32-bit words for this test. This fixes metadata extraction for 64-bit builds from Il2Cpp versions 5.3.7f1, 5.3.8f2, 5.4.1f1, 5.4.2f2, 5.4.3f1, 5.4.4f1, 5.4.5f1 and 5.4.6f3. Notably, 5.4.0f3 is an unusual outlier which uses int32_t * for fieldOffsets.
This commit is contained in:
@@ -207,8 +207,7 @@ namespace Il2CppInspector
|
|||||||
|
|
||||||
// Some variants of 21 also use an array of pointers
|
// Some variants of 21 also use an array of pointers
|
||||||
if (image.Version == 21) {
|
if (image.Version == 21) {
|
||||||
// Always 4-byte values even for 64-bit builds when array is NOT pointers
|
var fieldTest = image.ReadMappedWordArray(MetadataRegistration.pfieldOffsets, 6);
|
||||||
var fieldTest = image.ReadMappedArray<uint>(MetadataRegistration.pfieldOffsets, 6);
|
|
||||||
|
|
||||||
// We detect this by relying on the fact Module, Object, ValueType, Attribute, _Attribute and Int32
|
// We detect this by relying on the fact Module, Object, ValueType, Attribute, _Attribute and Int32
|
||||||
// are always the first six defined types, and that all but Int32 have no fields
|
// are always the first six defined types, and that all but Int32 have no fields
|
||||||
|
|||||||
Reference in New Issue
Block a user