Exemplo n.º 1
0
        public void ChangeData(RuntimeData.Variants.GameEngineVariant newData)
        {
            Contract.Requires <ArgumentNullException>(newData != null);
            Contract.Requires <ArgumentException>(newData.GameBuild == GameTarget.Build);

            Data = newData;
        }
Exemplo n.º 2
0
        void ReadBitStream(IO.EndianReader s, byte[] hashBuffer)
        {
            int  max_bit_stream_size  = GetBitStreamSize();
            bool is_probably_from_mcc = hashBuffer.EqualsZero();

            byte[] bs_bytes;
            using (var hasher = Program.GetGen3RuntimeDataHasher())
            {
                int bs_length = ReadBitStreamSize(s, hasher, max_bit_stream_size, is_probably_from_mcc);
                bs_bytes = new byte[IntegerMath.Align(IntegerMath.kInt32AlignmentBit, bs_length)];
                s.Read(bs_bytes, bs_length);

                hasher.TransformFinalBlock(bs_bytes, 0, bs_length);
                InvalidData = hasher.Hash.EqualsArray(hashBuffer) == false;
            }

            if (RequireValidHashes && InvalidData)
            {
                Data = null;
            }
            else
            {
                using (var ms = new System.IO.MemoryStream(bs_bytes))
                    using (var bs = new IO.BitStream(ms, System.IO.FileAccess.Read, streamName: "GameVariant"))
                    {
                        bs.StreamMode = System.IO.FileAccess.Read;

                        Data.Serialize(bs);
                    }
            }
        }
Exemplo n.º 3
0
 protected override void InitializeExplicitlyForGame(Engine.BlamEngineTargetHandle gameTarget)
 {
     Data = new RuntimeData.Variants.GameEngineVariant(gameTarget.Build);
 }