コード例 #1
0
ファイル: SHARC.cs プロジェクト: week9/Switch-Toolbox
            public void Read(FileReader reader)
            {
                reader.ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian;
                reader.ReadSignature(4, "AAHS");
                Version = reader.ReadUInt32();
                uint FileSize   = reader.ReadUInt32();
                uint bom        = reader.ReadUInt32();
                uint FileLength = reader.ReadUInt32();

                Name = reader.ReadString((int)FileLength, true);


                var  pos = reader.Position;
                uint SourceArrayOffset = reader.ReadUInt32();
                uint ProgramCount      = reader.ReadUInt32();

                for (int i = 0; i < ProgramCount; i++)
                {
                    ShaderProgram program = new ShaderProgram();
                    program.Read(reader, this);
                    ShaderPrograms.Add(program);
                }

                reader.Seek(SourceArrayOffset + pos, System.IO.SeekOrigin.Begin);

                uint SourceSecSize   = reader.ReadUInt32(); //Seems to cover that section entirely
                uint SourceFileCount = reader.ReadUInt32();

                for (int i = 0; i < SourceFileCount; i++)
                {
                    SourceData source = new SourceData();
                    source.Read(reader);
                    SourceDatas.Add(source);
                }
            }