예제 #1
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            ushort codeLength = loader.ReadUInt16();

            loader.Seek(6);
            uint[]  codeSizes   = loader.LoadCustom(() => loader.ReadUInt32s(codeLength));
            ulong[] codeOffsets = loader.LoadCustom(() => loader.ReadUInt64s(codeLength));
            loader.Seek(8); //reserved

            SourceData = new List <byte[]>();
            for (int i = 0; i < codeLength; i++)
            {
                loader.Seek((long)codeOffsets[i], System.IO.SeekOrigin.Begin);
                SourceData.Add(loader.ReadBytes((int)codeSizes[i]));
            }
        }
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            position = (uint)loader.Position;

            loader.CheckSignature(_signature);
            int pos          = loader.ReadInt32();
            int SectionCount = loader.ReadInt32();

            loader.Seek(4); //Padding
        }
예제 #3
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            uint size = loader.ReadUInt32();

            DecompressedSize = loader.ReadUInt32();
            ulong codePointer = loader.ReadUInt64();

            loader.Seek((int)codePointer, System.IO.SeekOrigin.Begin);
            CompressedData = loader.ReadBytes((int)size);
        }
예제 #4
0
        void IResData.Load(BfshaFileLoader loader)
        {
            ShaderVariations = new List <ShaderVariation>();
            StringTable      = new StringTable();

            loader.CheckSignature(_signature);
            uint padding = loader.ReadUInt32();

            SetVersionInfo(loader.ReadUInt32());
            ByteOrder         = loader.ReadEnum <ByteOrder>(false);
            Alignment         = loader.ReadByte();
            TargetAddressSize = loader.ReadByte(); //Thanks MasterF0X for pointing out the layout of the these
            uint   OffsetToFileName      = loader.ReadUInt32();
            ushort flag                  = loader.ReadUInt16();
            ushort blockOffset           = loader.ReadUInt16();
            uint   RelocationTableOffset = loader.ReadUInt32();
            uint   sizFile               = loader.ReadUInt32();

            loader.Seek(64); //Padding

            if (OffsetToFileName != 0)
            {
                using (loader.TemporarySeek(OffsetToFileName, SeekOrigin.Begin))
                {
                    Name = loader.ReadString(BinaryStringFormat.ZeroTerminated);
                }
            }

            //GRSC Section
            loader.CheckSignature(_grscSignature);
            loader.Seek(12); //Block header
            Unknown  = loader.ReadUInt16();
            Unknown2 = loader.ReadUInt16();
            Unknown3 = loader.ReadByte();
            Unknown4 = loader.ReadUInt32();
            uint VariationCount = loader.ReadUInt32();

            ShaderVariations = loader.LoadList <ShaderVariation>((int)VariationCount);
            loader.ReadInt64();
            Unknown5 = loader.ReadUInt64();
        }
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            loader.Seek(8); //always empty
            ulong[] codeOffsets = loader.ReadUInt64s(2);
            uint[]  codeSizes   = loader.ReadUInt32s(2);
            loader.Seek(32); //padding

            BinaryData = new List <byte[]>();
            for (int i = 0; i < 2; i++) //Fixed with 2 binaries
            {
                loader.Seek((long)codeOffsets[i], System.IO.SeekOrigin.Begin);
                if (i == 0)
                {
                    BinaryData.Add(loader.ReadBytes((int)codeSizes[1]));
                }
                else
                {
                    BinaryData.Add(loader.ReadBytes((int)codeSizes[0]));
                }
            }
        }
예제 #6
0
        void IResData.Load(BfshaFileLoader loader)
        {
            ShaderInfoData = loader.LoadSection <ShaderInfoData>();
            uint memorySize = loader.ReadUInt32();

            loader.ReadUInt32(); //padding
            //Stores a bunch of 0s
            MemoryData = loader.LoadCustom(() => loader.ReadBytes((int)memorySize));
            loader.ReadUInt64(); //offset to parent shader variation
            ShaderReflection = loader.Load <ShaderReflection>();
            loader.Seek(32);     //reserved
        }
예제 #7
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            Type   = loader.ReadByte();
            Format = loader.ReadEnum <ShaderFormat>(false);
            loader.Seek(2); //padding
            CompressionType  = loader.ReadUInt32();
            VertexShaderCode = ReadShaderCode(loader, Format);
            TessellationControlShaderCode    = ReadShaderCode(loader, Format);
            TessellationEvaluationShaderCode = ReadShaderCode(loader, Format);
            GeometryShaderCode = ReadShaderCode(loader, Format);
            PixelShaderCode    = ReadShaderCode(loader, Format);
            ComputeShaderCode  = ReadShaderCode(loader, Format);

            if (VertexShaderCode != null)
            {
                VertexShaderCode.ShaderType = ShaderType.VERTEX;
            }
            if (TessellationControlShaderCode != null)
            {
                TessellationControlShaderCode.ShaderType = ShaderType.TESS0;
            }
            if (TessellationEvaluationShaderCode != null)
            {
                TessellationEvaluationShaderCode.ShaderType = ShaderType.TESS1;
            }
            if (GeometryShaderCode != null)
            {
                GeometryShaderCode.ShaderType = ShaderType.GEOMETRY;
            }
            if (PixelShaderCode != null)
            {
                PixelShaderCode.ShaderType = ShaderType.PIXEL;
            }
            if (ComputeShaderCode != null)
            {
                ComputeShaderCode.ShaderType = ShaderType.COMPUTE;
            }

            loader.Seek(40); //padding
        }
예제 #8
0
        void IResData.Load(BfshaFileLoader loader)
        {
            Strings.Clear();
            loader.Seek(-0x14, System.IO.SeekOrigin.Current);
            uint Signature   = loader.ReadUInt32();
            uint blockOffset = loader.ReadUInt32();
            long BlockSize   = loader.ReadInt64();
            uint StringCount = loader.ReadUInt32();

            for (int i = 0; i < StringCount + 1; i++)
            {
                ushort size = loader.ReadUInt16();
                Strings.Add(loader.ReadString(BinaryStringFormat.ZeroTerminated));
                loader.Align(2);
            }
        }
예제 #9
0
        void IResData.Load(BfshaFileLoader loader)
        {
            long sourceProgramOffset = loader.ReadInt64();
            long padding             = loader.ReadInt64();
            long binaryProgramOffset = loader.ReadInt64();
            long parentOffset        = loader.ReadInt64();

            loader.Seek(32);

            if (sourceProgramOffset != 0)
            {
                SourceProgram = loader.Load <ShaderProgram>(sourceProgramOffset);
                SourceProgram.ParentShaderVariation = this;
            }
            if (binaryProgramOffset != 0)
            {
                BinaryProgram = loader.Load <ShaderProgram>(binaryProgramOffset);
                BinaryProgram.ParentShaderVariation = this;
            }
        }
예제 #10
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            Extra = loader.LoadString();
            Index = loader.ReadByte();
            loader.Seek(7);
        }