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

        public void Write(Stream stream)
        {
            //Brute force solution
            //RenumberElements(HAMType.EClip);
            //RenumberElements(HAMType.Weapon);
            //RenumberElements(HAMType.Robot);
            //RenumberElements(HAMType.Model);
            //Science experiment
            GenerateObjectBitmapTables(CompatObjBitmaps);
            NumRobotJoints = 0;
            Console.WriteLine("Loaded {0} joints", Joints.Count);
            Joints.Clear();
            foreach (Robot robot in Robots)
            {
                LoadAnimations(robot, Models[robot.ModelNum]);
            }
            Console.WriteLine("Constructed {0} joints", Joints.Count);
            foreach (Reactor reactor in Reactors)
            {
                LoadReactorGuns(reactor);
            }
            LoadShipGuns(PlayerShip);

            CreateDataLists();
            BaseFile.Write(stream);
        }
Exemplo n.º 2
0
        public override void SetSize(long size)
        {
            Header.SetSize(size, VerificationKey);

            BaseFile.Write(Header.ToBytes(false), 0);

            BaseStorage.SetSize(size);
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------
        // SAVING
        //---------------------------------------------------------------------

        /// <summary>
        /// Saves the HXM file to a given stream.
        /// </summary>
        /// <param name="stream">The stream to write to.</param>
        public void Write(Stream stream)
        {
            ReplacedJoints.Clear();
            foreach (Robot robot in ReplacedRobots)
            {
                LoadAnimations(robot, GetModel(robot.ModelNum));
            }
            LoadModelTextures();
            CreateDataLists();
            BaseFile.Write(stream);
        }
Exemplo n.º 4
0
        protected override Result SetSizeImpl(long size)
        {
            Header.SetSize(size, VerificationKey);

            Result rc = BaseFile.Write(0, Header.ToBytes(false));

            if (rc.IsFailure())
            {
                return(rc);
            }

            return(BaseStorage.SetSize(Util.AlignUp(size, 0x10)));
        }
Exemplo n.º 5
0
        protected override Result DoWrite(long offset, ReadOnlySpan <byte> source)
        {
            if (source.Length == 0)
            {
                return(Result.Success);
            }

            Result rc = UpdateSize();

            if (rc.IsFailure())
            {
                return(rc);
            }

            if (!IsRangeValid(offset, source.Length, FileSize))
            {
                return(ResultFs.OutOfRange.Log());
            }

            return(BaseFile.Write(offset, source, WriteOption.None));
        }
Exemplo n.º 6
0
 protected override Result WriteImpl(long offset, ReadOnlySpan <byte> source, WriteOption options)
 {
     return(BaseFile.Write(offset, source, options));
 }
Exemplo n.º 7
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            BaseFile.Write(buffer.AsSpan(offset, count), Position);

            Position += count;
        }
Exemplo n.º 8
0
 public override void Write(ReadOnlySpan <byte> source, long offset, WriteOption options)
 {
     BaseFile.Write(source, offset, options);
 }