From a638e86c381f7ade78f0d4660d3965876138b6bb Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Wed, 16 Oct 2019 16:30:49 +0200 Subject: [PATCH] Add ReadMappedObjectPointerArray --- Il2CppInspector/FileFormatReader.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) { } }