diff --git a/Il2CppInspector/FileFormatReader.cs b/Il2CppInspector/FileFormatReader.cs index a91de42..6f1ee80 100644 --- a/Il2CppInspector/FileFormatReader.cs +++ b/Il2CppInspector/FileFormatReader.cs @@ -32,6 +32,7 @@ namespace Il2CppInspector ushort ReadUInt16(); byte ReadByte(); string ReadMappedNullTerminatedString(uint uiAddr); + List ReadMappedObjectPointerArray(uint uiAddr, int count) where U : new(); } internal class FileFormatReader : BinaryObjectReader, IFileFormatReader where T : FileFormatReader @@ -96,6 +97,15 @@ namespace Il2CppInspector return ReadNullTerminatedString(MapVATR(uiAddr)); } + // Reads a list of pointers, then reads each object pointed to + public List ReadMappedObjectPointerArray(uint uiAddr, int count) where U : new() { + var pointers = ReadMappedArray(uiAddr, count); + var array = new List(); + for (int i = 0; i < count; i++) + array.Add(ReadMappedObject(pointers[i])); + return array; + } + // Perform file format-based post-load manipulations to the IL2Cpp data public virtual void FinalizeInit(Il2CppBinary il2cpp) { } }