Пример #1
0
        /// <summary>
        /// Takes the input stream and does any version specific
        /// data operations to get the tag manager ready for reading
        /// </summary>
        void CalculateVersion()
        {
            InputStream.Seek(60);
            InputStream.State = BlamLib.IO.EndianState.Little;
            uint      group_tag = InputStream.ReadTagUInt();
            BlamBuild bb        = FromSignature(group_tag);

            #region Endian handling
            if (bb == BlamBuild.Halo1)
            {
                endianState = BlamLib.IO.EndianState.Big;
            }
            else
            {
                endianState = BlamLib.IO.EndianState.Little;
            }

            if (InputStream != null)
            {
                InputStream.State = endianState;
            }
            if (OutputStream != null)
            {
                OutputStream.State = endianState;
            }
            #endregion

            if (engine == BlamVersion.Unknown)
            {
                engine = bb.ToVersion();

                ManageSetupTagGroup();
            }
        }
 private void SetEndianState(IO.EndianState state)
 {
     endianState = state;
     if (InputStream != null)
     {
         InputStream.State = state;
     }
     if (OutputStream != null)
     {
         OutputStream.State = state;
     }
 }
Пример #3
0
        void DetermineEndianState(bool in_cache)
        {
            if (!in_cache)             // for tag files
            {
                // NOTE: We store Halo3, etc in big-endian because we don't know their entire formats
                // yet and don't want to f**k up any data if we extract
                // Also, the only platform for the game is the 360, so hell, why not?

                if ((engine & BlamVersion.Halo1) != 0)
                {
                    this.endianState = IO.EndianState.Big;
                }
                else if ((engine & BlamVersion.Halo2) != 0)
                {
                    this.endianState = IO.EndianState.Little;
                }
                else if ((engine & BlamVersion.Halo3) != 0)
                {
                    this.endianState = IO.EndianState.Big;
                }
                else if ((engine & BlamVersion.Stubbs) != 0)
                {
                    this.endianState = IO.EndianState.Big;
                }
                else if ((engine & BlamVersion.HaloOdst) != 0)
                {
                    this.endianState = IO.EndianState.Big;
                }
                else if ((engine & BlamVersion.HaloReach) != 0)
                {
                    this.endianState = IO.EndianState.Big;
                }
                else
                {
                    this.endianState = IO.EndianState.Big;
                }
            }
            else             // for cache files
            {
                if (engine.IsXbox360())
                {
                    this.endianState = IO.EndianState.Big;
                }
                else
                {
                    this.endianState = IO.EndianState.Little;
                }
            }
        }
Пример #4
0
		private void SetEndianState(IO.EndianState state)
		{
			endianState = state;
			if (InputStream != null) InputStream.State = state;
			if (OutputStream != null) OutputStream.State = state;
		}
Пример #5
0
		/// <summary>
		/// Manage the file <paramref name="path"/>, defaulting to the endian ordering of <paramref name="endian_state"/>
		/// </summary>
		/// <param name="path">path to file we are to manage</param>
		/// <param name="endian_state">endian ordering to default to</param>
		public FileManager(string path, IO.EndianState endian_state) : this(path) { endianState = endian_state; }
Пример #6
0
 /// <summary>
 /// Resets a tag manager based on a tag index and a
 /// endian state for the internal tag I\O streams
 /// </summary>
 /// <param name="owner">Index this tag belong to</param>
 /// <param name="endian_state">The endian format of the tag file</param>
 /// <remarks>Generally used for creating\writing</remarks>
 void Reset(ITagIndex owner, IO.EndianState endian_state)
 {
     Reset(owner); this.endianState = endian_state;
 }
 /// <summary>
 /// Manage the file <paramref name="path"/>, defaulting to the endian ordering of <paramref name="endian_state"/>,
 /// using <paramref name="owner"/> as this file manager's owner
 /// </summary>
 /// <param name="path">path to file we are to manage</param>
 /// <param name="endian_state">endian ordering to default to</param>
 /// <param name="owner">owner object of this manager</param>
 public FileManager(string path, IO.EndianState endian_state, object owner) : this(path, endian_state)
 {
     this.owner = owner;
 }
 /// <summary>
 /// Manage the file <paramref name="path"/>, defaulting to the endian ordering of <paramref name="endian_state"/>
 /// </summary>
 /// <param name="path">path to file we are to manage</param>
 /// <param name="endian_state">endian ordering to default to</param>
 public FileManager(string path, IO.EndianState endian_state) : this(path) { endianState = endian_state; }
Пример #9
0
 /// <summary>Get the inverse of this byte order</summary>
 /// <param name="ef"></param>
 /// <returns></returns>
 public static IO.EndianState Invert(this IO.EndianState ef)
 {
     return(ef == IO.EndianState.Little ? IO.EndianState.Big : IO.EndianState.Little);
 }