Exemple #1
0
        public void Read(X360Reader reader)
        {
            long ftexBaseOffset = reader.BaseStream.Position;
            int magicNumber = reader.ReadInt32(); // FTEX
            int size = reader.ReadInt32();
            Hash = reader.ReadUInt64();
            int count = reader.ReadInt32();
            int unknown1 = reader.ReadInt32(); // 0
            int unknown2 = reader.ReadInt32(); // 0
            int unknown3 = reader.ReadInt32(); // 0

            Entries = new List<PftxsFtexsFileEntry>();
            for (int i = 0; i < count; i++)
            {
                PftxsFtexsFileEntry entry = new PftxsFtexsFileEntry();
                entry.Read(reader);

                string name;
                Hashing.TryGetFileNameFromHash(entry.Hash, out name, false);
                entry.FilePath = Hashing.NormalizeFilePath(name);
                Entries.Add(entry);
            }

            foreach (var entry in Entries)
            {
                reader.BaseStream.Position = ftexBaseOffset + entry.Offset;
                entry.Data = reader.ReadBytes(entry.Size);
            }
        }
Exemple #2
0
        public void Read(Stream input)
        {
            X360Reader reader = new X360Reader(input, Encoding.Default, true, true);
            int unknown1 = reader.ReadInt32();
            int hashCount = reader.ReadInt32();
            int folderCount = reader.ReadInt32();
            int fileCount = reader.ReadInt32();
            int unknown2 = reader.ReadInt32();
            int unknown3 = reader.ReadInt32();
            int unknown4 = reader.ReadInt32();
            int unknown5 = reader.ReadInt32();
            for (int i = 0; i < hashCount; i++)
            {
                _hashes.Add(FileHash.ReadFileHash(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < hashCount; i++)
            {
                _folderInfos.Add(FolderInfo.ReadFolderInfo(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < folderCount; i++)
            {
                _folderStringIndices.Add(StringIndex.ReadStringIndex(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < fileCount; i++)
            {
                _fileStringIndices.Add(StringIndex.ReadStringIndex(input));
            }
            input.AlignRead(16);

            long stringTableOffset = input.Position;
            foreach (var folderStringIndex in _folderStringIndices)
            {
                input.Position = stringTableOffset + folderStringIndex.Offset;
                string folderName = reader.ReadNullTerminatedString();
                _folderNames.Add(folderName);
            }
            foreach (var fileStringIndex in _fileStringIndices)
            {
                input.Position = stringTableOffset + fileStringIndex.Offset;
                string fileName = reader.ReadNullTerminatedString();
                _fileNames.Add(fileName);
            }
        }
 public void Read(X360Reader reader)
 {
     Hash = reader.ReadUInt64();
     Offset = reader.ReadInt32();
     Size = reader.ReadInt32();
 }
Exemple #4
0
        private void Read(X360Reader reader)
        {
            StringOffset = reader.ReadInt64();
            StringLength = reader.ReadInt32();
            reader.Skip(4);

            long endPosition = reader.BaseStream.Position;
            reader.BaseStream.Position = StringOffset;
            Value = reader.ReadString(StringLength);
            reader.BaseStream.Position = endPosition;
        }
Exemple #5
0
        public override void Read(Stream input)
        {
            X360Reader reader = new X360Reader(input, Encoding.Default, true, false);
            int pftxsMagicNumber = reader.ReadInt32(); // PFTXS
            if (pftxsMagicNumber != PftxMagicNumber)
                return;

            int unknown1 = reader.ReadInt32(); // 0x40 00 00 00
            if (unknown1 != 0x40000000)
            {
                if(unknown1 != 0x40)
                    return;
                reader.BaseStream.Position -= 4;
                reader.FlipEndian = true;
                unknown1 = reader.ReadInt32();
            }
            Endianness = reader.FlipEndian ? "Big" : "Little";

            int unknown2 = reader.ReadInt32(); // 0x10
            if (unknown2 != 0x10)
                return;
            int unknown3 = reader.ReadInt32(); // 0x1
            if (unknown3 != 0x1)
                return;

            int texlistMagicNumber = reader.ReadInt32(); // TEXL
            Size = reader.ReadInt32();
            FileCount = reader.ReadInt32();
            int unknown4 = reader.ReadInt32();

            for (int i = 0; i < FileCount; i++)
            {
                PftxsFtexFile pftxsFtexFile = new PftxsFtexFile();
                pftxsFtexFile.Read(reader);
                Files.Add(pftxsFtexFile);
            }
        }