예제 #1
0
        protected override ChunkList InternalGetChildren()
        {
            ChunkList result = new ChunkList();

            file.Position = Offset + 8;

            uint fileCount           = file.ReadU32LE();
            uint nameDirectorySize   = file.ReadU32LE();
            uint nameDirectoryOffset = file.ReadU32LE();

            byte nameEncryption = 0;

            if (nameDirectoryOffset == 0)
            {
                // GF bundle:
                // We actually just read the first file name offset, so retreat:
                file.Position      -= 4;
                nameDirectoryOffset = 0x10 + fileCount * 0x10;
            }
            else
            {
                // EMI bundle:
                // Names are encrypted:
                nameEncryption = 0x96;
                // Looks like an attempt to make reverse engineering harder:
                nameDirectoryOffset -= 0x13D0F;
            }

            uint[] nameOffsets = new uint[fileCount];
            uint[] offsets     = new uint[fileCount];
            uint[] sizes       = new uint[fileCount];

            for (uint i = 0; i < fileCount; i++)
            {
                nameOffsets[i] = file.ReadU32LE();
                offsets[i]     = file.ReadU32LE();
                sizes[i]       = file.ReadU32LE();
                uint reserved = file.ReadU32LE();
                Debug.Assert(reserved == 0, String.Format("Reserved directory value {0} isn't 0", i));
            }

            for (uint i = 0; i < fileCount; i++)
            {
                file.Position = nameDirectoryOffset + nameOffsets[i];

                string name  = nameEncryption == 0 ? file.ReadStringZ() : file.ReadStringZ(nameEncryption);
                Chunk  chunk = new FileChunk(file, this, name, offsets[i], sizes[i]);
                result.Add(chunk);
            }
            return(result);
        }
예제 #2
0
        protected override ChunkList InternalGetChildren()
        {
            ChunkList result = new ChunkList();

            file.Position = Offset + 4;

            uint   dirOffset = file.ReadU32BE();
            uint   fileCount = file.ReadU32BE();
            string date      = file.ReadString(12);

            file.Position = dirOffset;

            for (uint i = 0; i < fileCount; i++)
            {
                string name = "";

                byte b;
                for (int index = 0; index <= 11; index++)
                {
                    b = file.ReadU8();
                    if (b != 0)
                    {
                        if (index == 8)
                        {
                            name += ".";
                        }
                        name += (char)b;
                    }
                }

                uint  offset = file.ReadU32BE();
                uint  size   = file.ReadU32BE();
                Chunk chunk  = new FileChunk(file, this, name, offset, size);
                result.Add(chunk);
            }

            return(result);
        }
예제 #3
0
        protected override ChunkList InternalGetChildren()
        {
            ChunkList result = new ChunkList();

            file.Position = Offset + 4;

            float version         = file.ReadU32LE();
            uint  crcOffset       = file.ReadU32LE();
            uint  dirOffset       = file.ReadU32LE();
            uint  nameTableOffset = file.ReadU32LE();
            uint  dataOffset      = file.ReadU32LE();
            uint  crcSize         = file.ReadU32LE();
            uint  dirSize         = file.ReadU32LE();
            uint  nameTableSize   = file.ReadU32LE();
            uint  dataSize        = file.ReadU32LE();

            uint dirPosition = dirOffset;

            while (dirPosition < nameTableOffset)
            {
                file.Position = dirPosition;
                uint offset     = dataOffset + file.ReadU32LE();
                uint nameOffset = nameTableOffset + file.ReadU32LE();
                uint size       = file.ReadU32LE();
                uint otherSize  = file.ReadU32LE();
                uint flags      = file.ReadU32LE();

                file.Position = nameOffset;
                string name = file.ReadStringZ();

                Chunk chunk = new FileChunk(file, this, name, offset, size);
                result.Add(chunk);

                dirPosition += 20;
            }

            return(result);
        }