Exemplo n.º 1
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            Name = loader.LoadString();
            long   DataOffset = loader.ReadOffset();
            ushort count      = loader.ReadUInt16();

            Type = loader.ReadEnum <UserDataType>(true);

            //      UserDataData = loader.LoadCustom(() => loader.Load<UserDataData>(Type, count), DataOffset);
        }
Exemplo n.º 2
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            long uniformArrayOffset = loader.ReadInt64();

            UniformDict = loader.LoadDict();
            long defaultOffset = loader.ReadInt64();

            Index = loader.ReadByte();
            Type  = loader.ReadEnum <BlockType>(true);
            Size  = loader.ReadUInt16();
            ushort uniformCount = loader.ReadUInt16();
            ushort padding      = loader.ReadUInt16();

            Uniforms = loader.LoadList <UniformVar>(uniformCount, uniformArrayOffset);
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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
        }
Exemplo n.º 5
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(BfshaFileLoader loader)
        {
            loader.CheckSignature(_signature); //Same binary header as BNSH, BFRES, ETC
            uint padding = loader.ReadUInt32();

            VersionMajor      = loader.ReadInt16();
            VersionMinor      = loader.ReadByte();
            VersionMicro      = loader.ReadByte();
            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();
            uint OffsetPath            = loader.ReadUInt32();
            uint RelocationTableOffset = loader.ReadUInt32();
            uint sizFile              = loader.ReadUInt32();
            long shaderArchiveOffset  = loader.ReadOffset();
            long StringPoolOffset     = loader.ReadOffset();
            long ShaderingModelOffset = loader.ReadOffset();

            Name = loader.LoadString();
            Path = loader.LoadString();
            long ShaderModelArrayOffset = loader.ReadOffset();

            ShaderModelDict = loader.LoadDict();
            var padding2 = loader.ReadUInt64();
            var unk1     = loader.ReadUInt64();
            var unk2     = loader.ReadUInt64();

            ushort ModelCount = loader.ReadUInt16();
            ushort flag       = loader.ReadUInt16();

            loader.ReadUInt16();
            if (VersionMinor >= 7) //padding
            {
                loader.ReadUInt16();
            }

            ShaderModels = loader.LoadList <ShaderModel>(ModelCount, ShaderModelArrayOffset);
        }