Пример #1
0
        public override void Read(byte[] data)
        {
            using (var ms = new MemoryStream(data))
                using (var reader = new EndianBinReader(ms, EndianType.LITTLE_ENDIAN))
                {
                    reader.BaseStream.Position = 0;
                    if (reader.ReadString(4) != Magic)
                    {
                        throw new Exception($"Invalid magic, doesn't match {Magic}.");
                    }

                    int entryCount = reader.ReadInt32();

                    // Relocation ptr is at 0x10

                    // Data starts at 0x20

                    for (int i = 0; i < entryCount; i++)
                    {
                        ms.Position = HeaderSize + (i * (_gt7 ? 0x18 : 0x10));
                        var page = new RT05Page(_logWriter, gt7: _gt7);
                        page.Read(reader);
                        _pages.Add(page.Name, page);
                    }
                }
        }
Пример #2
0
        public override void Read(byte[] data)
        {
            using (var ms = new MemoryStream(data))
                using (var reader = new EndianBinReader(ms, EndianType.LITTLE_ENDIAN))
                {
                    reader.BaseStream.Position = 0;
                    if (reader.ReadString(4) != Magic)
                    {
                        throw new Exception("Invalid magic, doesn't match RT03.");
                    }

                    reader.ReadInt32();  // Relocation Ptr
                    reader.ReadUInt32(); // Empty - skipped by GT4
                    int entryCount = reader.ReadInt32();

                    for (int i = 0; i < entryCount; i++)
                    {
                        ms.Position = HeaderSize + (i * 0x10);
                        var page = new RT03Page(_logWriter);
                        page.Read(reader);
                        _pages.Add(page.Name, page);
                    }
                }
        }