示例#1
0
        /// <summary>
        /// Write the Ninja Camera to a file.
        /// </summary>
        /// <param name="writer">The binary writer for this SegaNN file.</param>
        public void Write(BinaryWriterEx writer)
        {
            // Write NXCA header.
            writer.Write("NXCA");
            writer.Write("SIZE"); // Temporary entry, is filled in later once we know this chunk's size.
            long HeaderSizePosition = writer.BaseStream.Position;

            writer.AddOffset("dataOffset");
            writer.FixPadding(0x10);

            // Write camera data.
            uint CameraPosition = (uint)writer.BaseStream.Position;

            writer.Write(UnknownUInt32_1);
            writer.Write(UnknownUInt32_2);
            writer.Write(UnknownVector3_1);
            writer.Write(UnknownVector3_2);
            writer.Write(UnknownFloat_1);
            writer.Write(UnknownFloat_2);
            writer.Write(UnknownFloat_3);
            writer.Write(UnknownFloat_4);

            // Write chunk data.
            writer.FillOffset("dataOffset", true);
            writer.Write((uint)Type);
            writer.AddOffset($"CameraData", 0);
            writer.Write(CameraPosition - 0x20);

            // Alignment.
            writer.FixPadding(0x10);

            // Write chunk size.
            long ChunkEndPosition = writer.BaseStream.Position;
            uint ChunkSize        = (uint)(ChunkEndPosition - HeaderSizePosition);

            writer.BaseStream.Position = HeaderSizePosition - 4;
            writer.Write(ChunkSize);
            writer.BaseStream.Position = ChunkEndPosition;
        }