diff --git a/Il2CppInspector/Il2CppBinary.cs b/Il2CppInspector/Il2CppBinary.cs index a592675..a0b4bb1 100644 --- a/Il2CppInspector/Il2CppBinary.cs +++ b/Il2CppInspector/Il2CppBinary.cs @@ -18,7 +18,8 @@ namespace Il2CppInspector public Il2CppCodeRegistration CodeRegistration { get; protected set; } public Il2CppMetadataRegistration MetadataRegistration { get; protected set; } - public uint[] MethodPointers { get; set; } + // Only for <=v24.0 + public uint[] GlobalMethodPointers { get; set; } // NOTE: In versions <21 and earlier releases of v21, this array has the format: // global field index => field offset @@ -72,7 +73,7 @@ namespace Il2CppInspector // The global method pointer list was deprecated in later versions of v24 in favour of Il2CppCodeGenModule if (Image.Stream.Version <= 24.0) - MethodPointers = image.ReadMappedArray(CodeRegistration.pmethodPointers, (int) CodeRegistration.methodPointersCount); + GlobalMethodPointers = image.ReadMappedArray(CodeRegistration.pmethodPointers, (int) CodeRegistration.methodPointersCount); // After v24 method pointers and RGCTX data were stored in Il2CppCodeGenModules if (Image.Stream.Version >= 24.1) { @@ -86,7 +87,7 @@ namespace Il2CppInspector Modules.Add(name, module); } } - + // Field offset data. Metadata <=21.x uses a value-type array; >=21.x uses a pointer array FieldOffsetData = image.ReadMappedArray(MetadataRegistration.pfieldOffsets, MetadataRegistration.fieldOffsetsCount); diff --git a/Il2CppInspector/Il2CppInspector.cs b/Il2CppInspector/Il2CppInspector.cs index bfcc99b..3d5060a 100644 --- a/Il2CppInspector/Il2CppInspector.cs +++ b/Il2CppInspector/Il2CppInspector.cs @@ -34,10 +34,10 @@ namespace Il2CppInspector public List FieldOffsets { get; } public List TypeUsages => Binary.Types; public Dictionary Modules => Binary.Modules; - public uint[] MethodPointers => Binary.MethodPointers; + public uint[] GlobalMethodPointers => Binary.GlobalMethodPointers; // <=v24.0 only // TODO: Finish all file access in the constructor and eliminate the need for this - public IFileFormatReader BinaryImage { get; } + public IFileFormatReader BinaryImage => Binary.Image; public Il2CppInspector(Il2CppBinary binary, Metadata metadata) { // Store stream representations @@ -105,6 +105,7 @@ namespace Il2CppInspector value = Encoding.UTF8.GetString(Metadata.ReadBytes(uiLen)); break; } + FieldDefaultValue.Add(fdv.fieldIndex, value); } @@ -138,6 +139,7 @@ namespace Il2CppInspector offsets.Add(def.fieldStart + f, Binary.Image.Stream.ReadInt32()); } } + FieldOffsets = offsets.OrderBy(x => x.Key).Select(x => x.Value).ToList(); } } diff --git a/Il2CppInspector/Reflection/MethodInfo.cs b/Il2CppInspector/Reflection/MethodInfo.cs index fdaf842..44038b7 100644 --- a/Il2CppInspector/Reflection/MethodInfo.cs +++ b/Il2CppInspector/Reflection/MethodInfo.cs @@ -40,7 +40,7 @@ namespace Il2CppInspector.Reflection // Global method pointer array if (pkg.Version < 24.1) { - VirtualAddress = pkg.MethodPointers[Definition.methodIndex]; + VirtualAddress = pkg.GlobalMethodPointers[Definition.methodIndex]; } // Per-module method pointer array uses the bottom 24 bits of the method's metadata token