示例#1
0
文件: SDAT.cs 项目: MetLob/tinke
        private sSDAT Read_SDAT(sFile file)
        {
            sSDAT sdat = new sSDAT();
            sdat.id = file.id;
            sdat.archivo = file.path;
            BinaryReader br = new BinaryReader(new FileStream(file.path, FileMode.Open));
            string h = new String(br.ReadChars(4));

            if (h == "SWAV")
            {
                sdat.files.root.id = 0x0F000;
                sdat.files.root.name = "SWAV";
                sdat.files.root.files = new List<Sound>();

                Sound swavFile = new Sound();
                swavFile.id = 0x00;
                swavFile.name = file.name;
                swavFile.offset = 0x00;
                swavFile.size = file.size;
                swavFile.type = FormatSound.SWAV;
                swavFile.path = sdat.archivo;
                sdat.files.root.files.Add(swavFile);

                br.Close();
                return sdat;
            }
            if (h == "STRM")  // Quick fix
            {
                sdat.files.root.id = 0x0F000;
                sdat.files.root.name = "STRM";
                sdat.files.root.files = new List<Sound>();

                Sound swavFile = new Sound();
                swavFile.id = 0x00;
                swavFile.name = file.name;
                swavFile.offset = 0x00;
                swavFile.size = file.size;
                swavFile.type = FormatSound.STRM;
                swavFile.path = sdat.archivo;
                sdat.files.root.files.Add(swavFile);

                br.Close();
                return sdat;
            }

            br.BaseStream.Position = 0x00;

            #region Cabecera genérica
            sdat.generico.id = br.ReadChars(4);
            sdat.generico.endianess = br.ReadUInt16();
            sdat.generico.constant = br.ReadUInt16();
            sdat.generico.file_size = br.ReadUInt32();
            sdat.generico.header_size = br.ReadUInt16();
            sdat.generico.nSection = br.ReadUInt16();
            #endregion
            #region Cabecera SDAT
            sdat.cabecera.symbOffset = br.ReadUInt32();
            sdat.cabecera.symbSize = br.ReadUInt32();
            sdat.cabecera.infoOffset = br.ReadUInt32();
            sdat.cabecera.infoSize = br.ReadUInt32();
            sdat.cabecera.fatOffset = br.ReadUInt32();
            sdat.cabecera.fatSize = br.ReadUInt32();
            sdat.cabecera.fileOffset = br.ReadUInt32();
            sdat.cabecera.fileSize = br.ReadUInt32();
            sdat.cabecera.reserved = br.ReadBytes(16);
            #endregion
            #region Bloque Symbol
            if (sdat.cabecera.symbSize == 0x00) // no hay sección Symbol
                goto Info;
            br.BaseStream.Position = sdat.cabecera.symbOffset;
            sdat.symbol.id = br.ReadChars(4);
            sdat.symbol.size = br.ReadUInt32();
            sdat.symbol.offsetSeq = br.ReadUInt32();
            sdat.symbol.offsetSeqArc = br.ReadUInt32();
            sdat.symbol.offsetBank = br.ReadUInt32();
            sdat.symbol.offsetWaveArch = br.ReadUInt32();
            sdat.symbol.offsetPlayer = br.ReadUInt32();
            sdat.symbol.offsetGroup = br.ReadUInt32();
            sdat.symbol.offsetPlayer2 = br.ReadUInt32();
            sdat.symbol.offsetStream = br.ReadUInt32();
            sdat.symbol.reserved = br.ReadBytes(24);

            // Lectura de las entradas de cada record
            sdat.symbol.records = new Record[7];
            uint[] offsets = new uint[7] { sdat.symbol.offsetSeq,
                sdat.symbol.offsetBank, sdat.symbol.offsetWaveArch, sdat.symbol.offsetPlayer,
                sdat.symbol.offsetGroup, sdat.symbol.offsetPlayer2, sdat.symbol.offsetStream
            };

            #region Other Record
            for (int i = 0; i < offsets.Length; i++)
            {
                br.BaseStream.Position = 0x40 + offsets[i];
                sdat.symbol.records[i] = new Record();
                sdat.symbol.records[i].nEntries = br.ReadUInt32();
                sdat.symbol.records[i].entriesOffset = new uint[sdat.symbol.records[i].nEntries];
                sdat.symbol.records[i].entries = new string[sdat.symbol.records[i].nEntries];
                for (int j = 0; j < sdat.symbol.records[i].nEntries; j++)
                    sdat.symbol.records[i].entriesOffset[j] = br.ReadUInt32();
                for (int k = 0; k < sdat.symbol.records[i].nEntries; k++)
                {
                    if (sdat.symbol.records[i].entriesOffset[k] == 0x00)
                        continue;
                    br.BaseStream.Position = 0x40 + sdat.symbol.records[i].entriesOffset[k];

                    char c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        sdat.symbol.records[i].entries[k] += c;
                    } while (c != 0x0);
                }
            }
            #endregion
            #region SEQARC Record
            br.BaseStream.Position = 0x40 + sdat.symbol.offsetSeqArc;
            sdat.symbol.record2 = new Record2();
            sdat.symbol.record2.nEntries = br.ReadUInt32();
            sdat.symbol.record2.group = new Group[sdat.symbol.record2.nEntries];
            // Lee los offset de cada grupo
            for (int i = 0; i < sdat.symbol.record2.nEntries; i++)
            {
                sdat.symbol.record2.group[i].groupOffset = br.ReadUInt32();
                sdat.symbol.record2.group[i].subRecOffset = br.ReadUInt32();
            }
            // Lee los subgrupos de cada grupo
            for (int i = 0; i < sdat.symbol.record2.nEntries; i++)
            {
                char c = '\0';

                if (sdat.symbol.record2.group[i].groupOffset == 0x00) // En caso de que no exista el nombre
                    sdat.symbol.record2.group[i].groupName = "SEQARC_" + i.ToString();
                else
                {
                    // Lee el nombre del grupo
                    br.BaseStream.Position = 0x40 + sdat.symbol.record2.group[i].groupOffset;
                    c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        sdat.symbol.record2.group[i].groupName += c;
                    } while (c != 0x0);
                }

                // Lee los offset de las entradas del subgrupo
                if (sdat.symbol.record2.group[i].subRecOffset == 0x00) // En caso de que no haya subgrupos
                {
                    sdat.symbol.record2.group[i].subRecord = new Record();
                    continue;
                }

                br.BaseStream.Position = 0x40 + sdat.symbol.record2.group[i].subRecOffset;
                Record subRecord = new Record();
                subRecord.nEntries = br.ReadUInt32();
                subRecord.entriesOffset = new uint[subRecord.nEntries];
                subRecord.entries = new string[subRecord.nEntries];
                for (int j = 0; j < subRecord.nEntries; j++)
                    subRecord.entriesOffset[j] = br.ReadUInt32();
                // Lee las entradas del subgrupo
                for (int j = 0; j < subRecord.nEntries; j++)
                {
                    if (subRecord.entriesOffset[j] == 0x00)
                        continue;
                    br.BaseStream.Position = 0x40 + subRecord.entriesOffset[j];
                    c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        subRecord.entries[j] += c;
                    } while (c != 0x0);
                }
                sdat.symbol.record2.group[i].subRecord = subRecord;
            }
            #endregion
            #endregion
            #region Bloque Info
            Info:

            br.BaseStream.Position = sdat.cabecera.infoOffset;
            Info info = new Info();
            // Header
            info.header.id = br.ReadChars(4);
            info.header.size = br.ReadUInt32();
            info.header.offsetRecords = new uint[8];
            for (int i = 0; i < 8; i++)
                info.header.offsetRecords[i] = br.ReadUInt32();
            info.header.reserved = br.ReadBytes(24);

            // Blocks
            info.block = new Info.Block[8];
            for (int i = 0; i < 8; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.header.offsetRecords[i];
                info.block[i].nEntries = br.ReadUInt32();
                info.block[i].offsetEntries = new uint[info.block[i].nEntries];
                info.block[i].entries = new object[info.block[i].nEntries];
                for (int j = 0; j < info.block[i].nEntries; j++)
                    info.block[i].offsetEntries[j] = br.ReadUInt32();
            }

            // Entries
            // SEQ
            for (int i = 0; i < info.block[0].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[0].offsetEntries[i];

                Info.SEQ seq = new Info.SEQ();
                seq.fileID = br.ReadUInt16();
                seq.unknown = br.ReadUInt16();
                seq.bnk = br.ReadUInt16();
                seq.vol = br.ReadByte();
                seq.cpr = br.ReadByte();
                seq.ppr = br.ReadByte();
                seq.ply = br.ReadByte();
                seq.unknown2 = br.ReadBytes(2);
                info.block[0].entries[i] = seq;
            }
            // SEQARC
            for (int i = 0; i < info.block[1].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[1].offsetEntries[i];

                Info.SEQARC seq = new Info.SEQARC();
                seq.fileID = br.ReadUInt16();
                seq.unknown = br.ReadUInt16();
                info.block[1].entries[i] = seq;
            }
            // BANK
            for (int i = 0; i < info.block[2].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[2].offsetEntries[i];

                Info.BANK bank = new Info.BANK();
                bank.fileID = br.ReadUInt16();
                bank.unknown = br.ReadUInt16();
                bank.wa = new ushort[4];
                for (int j = 0; j < 4; j++)
                    bank.wa[j] = br.ReadUInt16();
                info.block[2].entries[i] = bank;
            }
            // WAVEARC
            for (int i = 0; i < info.block[3].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[3].offsetEntries[i];

                Info.WAVEARC wave = new Info.WAVEARC();
                wave.fileID = br.ReadUInt16();
                wave.unknown = br.ReadUInt16();
                info.block[3].entries[i] = wave;
            }
            // PLAYER
            for (int i = 0; i < info.block[4].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[4].offsetEntries[i];

                Info.PLAYER player = new Info.PLAYER();
                player.unknown = br.ReadByte();
                player.padding = br.ReadBytes(3);
                player.unknown2 = br.ReadUInt32();
                info.block[4].entries[i] = player;
            }
            // GROUP
            for (int i = 0; i < info.block[5].nEntries; i++)
            {
                if (info.block[5].offsetEntries[i] == 0x00)
                {
                    info.block[5].entries[i] = new Info.GROUP();
                    continue;
                }

                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[5].offsetEntries[i];

                Info.GROUP group = new Info.GROUP();
                group.nCount = br.ReadUInt32();
                group.subgroup = new Info.GROUP.Subgroup[group.nCount];
                for (int j = 0; j < group.nCount; j++)
                {
                    group.subgroup[j].type = br.ReadUInt32();
                    group.subgroup[j].nEntry = br.ReadUInt32();
                }
                info.block[5].entries[i] = group;
            }
            // PLAYER2
            for (int i = 0; i < info.block[6].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[6].offsetEntries[i];

                Info.PLAYER2 player = new Info.PLAYER2();
                player.nCount = br.ReadByte();
                player.v = br.ReadBytes(16);
                player.reserved = br.ReadBytes(7);
                info.block[6].entries[i] = player;
            }
            // STRM
            for (int i = 0; i < info.block[7].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[7].offsetEntries[i];

                Info.STRM strm = new Info.STRM();
                strm.fileID = br.ReadUInt16();
                strm.unknown = br.ReadUInt16();
                strm.vol = br.ReadByte();
                strm.pri = br.ReadByte();
                strm.ply = br.ReadByte();
                strm.reserved = br.ReadBytes(5);
                info.block[7].entries[i] = strm;
            }
            sdat.info = info;
            #endregion
            #region Bloque FAT
            br.BaseStream.Position = sdat.cabecera.fatOffset;
            FAT fat = new FAT();

            // Header
            fat.header.id = br.ReadChars(4);
            fat.header.size = br.ReadUInt32();
            fat.header.nRecords = br.ReadUInt32();

            // Records
            fat.records = new FAT.Record[fat.header.nRecords];
            for (int i = 0; i < fat.header.nRecords; i++)
            {
                fat.records[i].offset = br.ReadUInt32();
                fat.records[i].size = br.ReadUInt32();
                fat.records[i].reserved = br.ReadBytes(8);
            }
            sdat.fat = fat;
            #endregion
            #region Bloque File
            br.BaseStream.Position = sdat.cabecera.fileOffset;

            // Header
            sdat.files.header.id = br.ReadChars(4);
            sdat.files.header.size = br.ReadUInt32();
            sdat.files.header.nSounds = br.ReadUInt32();
            sdat.files.header.reserved = br.ReadUInt32();
            #endregion

            br.Close();

            try
            {
                System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(Application.StartupPath + Path.DirectorySeparatorChar +
                    "Plugins" + Path.DirectorySeparatorChar + "SDATLang.xml");
                xml = xml.Element(pluginHost.Get_Language()).Element("Messages");
                Console.WriteLine(xml.Element("S00").Value);
                Console.WriteLine(xml.Element("S01").Value, sdat.files.header.nSounds.ToString());
            }
            catch { throw new Exception("There was an error reading the XML file of language."); }

            FileSystem(ref sdat, file.path);

            Set_Data(ref sdat);

            return sdat;
        }
示例#2
0
        private sSDAT Read_SDAT(sFile file)
        {
            sSDAT sdat = new sSDAT();

            sdat.id      = file.id;
            sdat.archivo = file.path;
            BinaryReader br = new BinaryReader(new FileStream(file.path, FileMode.Open));
            string       h  = new String(br.ReadChars(4));

            if (h == "SWAV")
            {
                sdat.files.root.id    = 0x0F000;
                sdat.files.root.name  = "SWAV";
                sdat.files.root.files = new List <Sound>();

                Sound swavFile = new Sound();
                swavFile.id     = 0x00;
                swavFile.name   = file.name;
                swavFile.offset = 0x00;
                swavFile.size   = file.size;
                swavFile.type   = FormatSound.SWAV;
                swavFile.path   = sdat.archivo;
                sdat.files.root.files.Add(swavFile);

                br.Close();
                return(sdat);
            }
            if (h == "STRM")  // Quick fix
            {
                sdat.files.root.id    = 0x0F000;
                sdat.files.root.name  = "STRM";
                sdat.files.root.files = new List <Sound>();

                Sound swavFile = new Sound();
                swavFile.id     = 0x00;
                swavFile.name   = file.name;
                swavFile.offset = 0x00;
                swavFile.size   = file.size;
                swavFile.type   = FormatSound.STRM;
                swavFile.path   = sdat.archivo;
                sdat.files.root.files.Add(swavFile);

                br.Close();
                return(sdat);
            }


            br.BaseStream.Position = 0x00;

            #region Cabecera genérica
            sdat.generico.id          = br.ReadChars(4);
            sdat.generico.endianess   = br.ReadUInt16();
            sdat.generico.constant    = br.ReadUInt16();
            sdat.generico.file_size   = br.ReadUInt32();
            sdat.generico.header_size = br.ReadUInt16();
            sdat.generico.nSection    = br.ReadUInt16();
            #endregion
            #region Cabecera SDAT
            sdat.cabecera.symbOffset = br.ReadUInt32();
            sdat.cabecera.symbSize   = br.ReadUInt32();
            sdat.cabecera.infoOffset = br.ReadUInt32();
            sdat.cabecera.infoSize   = br.ReadUInt32();
            sdat.cabecera.fatOffset  = br.ReadUInt32();
            sdat.cabecera.fatSize    = br.ReadUInt32();
            sdat.cabecera.fileOffset = br.ReadUInt32();
            sdat.cabecera.fileSize   = br.ReadUInt32();
            sdat.cabecera.reserved   = br.ReadBytes(16);
            #endregion
            #region Bloque Symbol
            if (sdat.cabecera.symbSize == 0x00) // no hay sección Symbol
            {
                goto Info;
            }
            br.BaseStream.Position     = sdat.cabecera.symbOffset;
            sdat.symbol.id             = br.ReadChars(4);
            sdat.symbol.size           = br.ReadUInt32();
            sdat.symbol.offsetSeq      = br.ReadUInt32();
            sdat.symbol.offsetSeqArc   = br.ReadUInt32();
            sdat.symbol.offsetBank     = br.ReadUInt32();
            sdat.symbol.offsetWaveArch = br.ReadUInt32();
            sdat.symbol.offsetPlayer   = br.ReadUInt32();
            sdat.symbol.offsetGroup    = br.ReadUInt32();
            sdat.symbol.offsetPlayer2  = br.ReadUInt32();
            sdat.symbol.offsetStream   = br.ReadUInt32();
            sdat.symbol.reserved       = br.ReadBytes(24);

            // Lectura de las entradas de cada record
            sdat.symbol.records = new Record[7];
            uint[] offsets = new uint[7] {
                sdat.symbol.offsetSeq,
                sdat.symbol.offsetBank, sdat.symbol.offsetWaveArch, sdat.symbol.offsetPlayer,
                sdat.symbol.offsetGroup, sdat.symbol.offsetPlayer2, sdat.symbol.offsetStream
            };

            #region Other Record
            for (int i = 0; i < offsets.Length; i++)
            {
                br.BaseStream.Position               = 0x40 + offsets[i];
                sdat.symbol.records[i]               = new Record();
                sdat.symbol.records[i].nEntries      = br.ReadUInt32();
                sdat.symbol.records[i].entriesOffset = new uint[sdat.symbol.records[i].nEntries];
                sdat.symbol.records[i].entries       = new string[sdat.symbol.records[i].nEntries];
                for (int j = 0; j < sdat.symbol.records[i].nEntries; j++)
                {
                    sdat.symbol.records[i].entriesOffset[j] = br.ReadUInt32();
                }
                for (int k = 0; k < sdat.symbol.records[i].nEntries; k++)
                {
                    if (sdat.symbol.records[i].entriesOffset[k] == 0x00)
                    {
                        continue;
                    }
                    br.BaseStream.Position = 0x40 + sdat.symbol.records[i].entriesOffset[k];

                    char c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        sdat.symbol.records[i].entries[k] += c;
                    } while (c != 0x0);
                }
            }
            #endregion
            #region SEQARC Record
            br.BaseStream.Position       = 0x40 + sdat.symbol.offsetSeqArc;
            sdat.symbol.record2          = new Record2();
            sdat.symbol.record2.nEntries = br.ReadUInt32();
            sdat.symbol.record2.group    = new Group[sdat.symbol.record2.nEntries];
            // Lee los offset de cada grupo
            for (int i = 0; i < sdat.symbol.record2.nEntries; i++)
            {
                sdat.symbol.record2.group[i].groupOffset  = br.ReadUInt32();
                sdat.symbol.record2.group[i].subRecOffset = br.ReadUInt32();
            }
            // Lee los subgrupos de cada grupo
            for (int i = 0; i < sdat.symbol.record2.nEntries; i++)
            {
                char c = '\0';

                if (sdat.symbol.record2.group[i].groupOffset == 0x00) // En caso de que no exista el nombre
                {
                    sdat.symbol.record2.group[i].groupName = "SEQARC_" + i.ToString();
                }
                else
                {
                    // Lee el nombre del grupo
                    br.BaseStream.Position = 0x40 + sdat.symbol.record2.group[i].groupOffset;
                    c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        sdat.symbol.record2.group[i].groupName += c;
                    } while (c != 0x0);
                }

                // Lee los offset de las entradas del subgrupo
                if (sdat.symbol.record2.group[i].subRecOffset == 0x00) // En caso de que no haya subgrupos
                {
                    sdat.symbol.record2.group[i].subRecord = new Record();
                    continue;
                }

                br.BaseStream.Position = 0x40 + sdat.symbol.record2.group[i].subRecOffset;
                Record subRecord = new Record();
                subRecord.nEntries      = br.ReadUInt32();
                subRecord.entriesOffset = new uint[subRecord.nEntries];
                subRecord.entries       = new string[subRecord.nEntries];
                for (int j = 0; j < subRecord.nEntries; j++)
                {
                    subRecord.entriesOffset[j] = br.ReadUInt32();
                }
                // Lee las entradas del subgrupo
                for (int j = 0; j < subRecord.nEntries; j++)
                {
                    if (subRecord.entriesOffset[j] == 0x00)
                    {
                        continue;
                    }
                    br.BaseStream.Position = 0x40 + subRecord.entriesOffset[j];
                    c = '\0';
                    do
                    {
                        c = (char)br.ReadByte();
                        subRecord.entries[j] += c;
                    } while (c != 0x0);
                }
                sdat.symbol.record2.group[i].subRecord = subRecord;
            }
            #endregion
            #endregion
            #region Bloque Info
Info:

            br.BaseStream.Position = sdat.cabecera.infoOffset;
            Info info = new Info();
            // Header
            info.header.id            = br.ReadChars(4);
            info.header.size          = br.ReadUInt32();
            info.header.offsetRecords = new uint[8];
            for (int i = 0; i < 8; i++)
            {
                info.header.offsetRecords[i] = br.ReadUInt32();
            }
            info.header.reserved = br.ReadBytes(24);

            // Blocks
            info.block = new Info.Block[8];
            for (int i = 0; i < 8; i++)
            {
                br.BaseStream.Position      = sdat.cabecera.infoOffset + info.header.offsetRecords[i];
                info.block[i].nEntries      = br.ReadUInt32();
                info.block[i].offsetEntries = new uint[info.block[i].nEntries];
                info.block[i].entries       = new object[info.block[i].nEntries];
                for (int j = 0; j < info.block[i].nEntries; j++)
                {
                    info.block[i].offsetEntries[j] = br.ReadUInt32();
                }
            }

            // Entries
            // SEQ
            for (int i = 0; i < info.block[0].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[0].offsetEntries[i];

                Info.SEQ seq = new Info.SEQ();
                seq.fileID               = br.ReadUInt16();
                seq.unknown              = br.ReadUInt16();
                seq.bnk                  = br.ReadUInt16();
                seq.vol                  = br.ReadByte();
                seq.cpr                  = br.ReadByte();
                seq.ppr                  = br.ReadByte();
                seq.ply                  = br.ReadByte();
                seq.unknown2             = br.ReadBytes(2);
                info.block[0].entries[i] = seq;
            }
            // SEQARC
            for (int i = 0; i < info.block[1].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[1].offsetEntries[i];

                Info.SEQARC seq = new Info.SEQARC();
                seq.fileID  = br.ReadUInt16();
                seq.unknown = br.ReadUInt16();
                info.block[1].entries[i] = seq;
            }
            // BANK
            for (int i = 0; i < info.block[2].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[2].offsetEntries[i];

                Info.BANK bank = new Info.BANK();
                bank.fileID  = br.ReadUInt16();
                bank.unknown = br.ReadUInt16();
                bank.wa      = new ushort[4];
                for (int j = 0; j < 4; j++)
                {
                    bank.wa[j] = br.ReadUInt16();
                }
                info.block[2].entries[i] = bank;
            }
            // WAVEARC
            for (int i = 0; i < info.block[3].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[3].offsetEntries[i];

                Info.WAVEARC wave = new Info.WAVEARC();
                wave.fileID              = br.ReadUInt16();
                wave.unknown             = br.ReadUInt16();
                info.block[3].entries[i] = wave;
            }
            // PLAYER
            for (int i = 0; i < info.block[4].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[4].offsetEntries[i];

                Info.PLAYER player = new Info.PLAYER();
                player.unknown           = br.ReadByte();
                player.padding           = br.ReadBytes(3);
                player.unknown2          = br.ReadUInt32();
                info.block[4].entries[i] = player;
            }
            // GROUP
            for (int i = 0; i < info.block[5].nEntries; i++)
            {
                if (info.block[5].offsetEntries[i] == 0x00)
                {
                    info.block[5].entries[i] = new Info.GROUP();
                    continue;
                }

                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[5].offsetEntries[i];

                Info.GROUP group = new Info.GROUP();
                group.nCount   = br.ReadUInt32();
                group.subgroup = new Info.GROUP.Subgroup[group.nCount];
                for (int j = 0; j < group.nCount; j++)
                {
                    group.subgroup[j].type   = br.ReadUInt32();
                    group.subgroup[j].nEntry = br.ReadUInt32();
                }
                info.block[5].entries[i] = group;
            }
            // PLAYER2
            for (int i = 0; i < info.block[6].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[6].offsetEntries[i];

                Info.PLAYER2 player = new Info.PLAYER2();
                player.nCount            = br.ReadByte();
                player.v                 = br.ReadBytes(16);
                player.reserved          = br.ReadBytes(7);
                info.block[6].entries[i] = player;
            }
            // STRM
            for (int i = 0; i < info.block[7].nEntries; i++)
            {
                br.BaseStream.Position = sdat.cabecera.infoOffset + info.block[7].offsetEntries[i];

                Info.STRM strm = new Info.STRM();
                strm.fileID              = br.ReadUInt16();
                strm.unknown             = br.ReadUInt16();
                strm.vol                 = br.ReadByte();
                strm.pri                 = br.ReadByte();
                strm.ply                 = br.ReadByte();
                strm.reserved            = br.ReadBytes(5);
                info.block[7].entries[i] = strm;
            }
            sdat.info = info;
            #endregion
            #region Bloque FAT
            br.BaseStream.Position = sdat.cabecera.fatOffset;
            FAT fat = new FAT();

            // Header
            fat.header.id       = br.ReadChars(4);
            fat.header.size     = br.ReadUInt32();
            fat.header.nRecords = br.ReadUInt32();

            // Records
            fat.records = new FAT.Record[fat.header.nRecords];
            for (int i = 0; i < fat.header.nRecords; i++)
            {
                fat.records[i].offset   = br.ReadUInt32();
                fat.records[i].size     = br.ReadUInt32();
                fat.records[i].reserved = br.ReadBytes(8);
            }
            sdat.fat = fat;
            #endregion
            #region Bloque File
            br.BaseStream.Position = sdat.cabecera.fileOffset;

            // Header
            sdat.files.header.id       = br.ReadChars(4);
            sdat.files.header.size     = br.ReadUInt32();
            sdat.files.header.nSounds  = br.ReadUInt32();
            sdat.files.header.reserved = br.ReadUInt32();
            #endregion

            br.Close();

            try
            {
                System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(Application.StartupPath + Path.DirectorySeparatorChar +
                                                                             "Plugins" + Path.DirectorySeparatorChar + "SDATLang.xml");
                xml = xml.Element(pluginHost.Get_Language()).Element("Messages");
                Console.WriteLine(xml.Element("S00").Value);
                Console.WriteLine(xml.Element("S01").Value, sdat.files.header.nSounds.ToString());
            }
            catch { throw new Exception("There was an error reading the XML file of language."); }

            FileSystem(ref sdat, file.path);

            Set_Data(ref sdat);

            return(sdat);
        }