Example #1
0
        /// <summary>
        /// Postprocess tag data that has been streamed to a cache block
        /// </summary>
        /// <param name="locator">Offset of the tag data header in the section</param>
        /// <param name="data"></param>
        /// <returns></returns>
        internal bool ReconstructTagData(short locator, TagInterface.Data data)
        {
            int index = 0;

            IO.EndianReader er;

            if (GeometryBlock == null)
            {
                return(false);
            }

            foreach (geometry_block_resource_block gb in Resources)
            {
                er = new BlamLib.IO.EndianReader(GeometryBlock[index]);

                switch (gb.Type.Value)
                {
                    #region TagData
                case (int)geometry_block_resource_type.TagData:
                    if (gb.PrimaryLocater.Value == locator)
                    {
                        data.Reset(er.ReadBytes(gb.Size));
                    }
                    break;
                    #endregion
                }

                index++;
                er.Close();
                er = null;
            }

            return(true);
        }
Example #2
0
            void DisallowTags()
            {
                BlamLib.IO.EndianReader input = new BlamLib.IO.EndianReader(output.FileName);
                input.BaseAddress = Program.PeAddressMask;
                input.Seek(AddressOf.TagGroupDefinitions[Platform.Guerilla] - Program.PeAddressMask);

                uint[] offsets = new uint[Constants.StockTagGroupCount];
                for (int x = 0; x < offsets.Length; x++)
                {
                    offsets[x] = input.ReadPointer();
                }

                for (int x = 0; x < offsets.Length; x++)
                {
                    input.Seek(offsets[x]);
                    string name = Program.ReadCString(input.ReadPointer(), input);
                    if (IsDisallowedTag(name))
                    {
                        input.Seek(0x20, System.IO.SeekOrigin.Current);
                        output.Seek(input.Position - 2);
                        output.Write((short)1);
                        output.Seek(input.ReadPointer() + 0x14);
                        output.Write(0);
                        output.Write(0);
                        output.Write(0);
                    }
                }
                input.Close();
            }
Example #3
0
			void DisallowTags()
			{
				BlamLib.IO.EndianReader input = new BlamLib.IO.EndianReader(output.FileName);
				input.BaseAddress = Program.PeAddressMask;
				input.Seek(AddressOf.TagGroupDefinitions[Platform.Guerilla] - Program.PeAddressMask);

				uint[] offsets = new uint[Constants.StockTagGroupCount];
				for (int x = 0; x < offsets.Length; x++)
					offsets[x] = input.ReadPointer();

				for (int x = 0; x < offsets.Length; x++)
				{
					input.Seek(offsets[x]);
					string name = Program.ReadCString(input.ReadPointer(), input);
					if (IsDisallowedTag(name))
					{
						input.Seek(0x20, System.IO.SeekOrigin.Current);
						output.Seek(input.Position - 2);
						output.Write((short)1);
						output.Seek(input.ReadPointer() + 0x14);
						output.Write(0);
						output.Write(0);
						output.Write(0);
					}
				}
				input.Close();
			}
Example #4
0
		/// <summary>
		/// Postprocess tag data that has been streamed to a cache block
		/// </summary>
		/// <param name="locator">Offset of the tag data header in the section</param>
		/// <param name="data"></param>
		/// <returns></returns>
		internal bool ReconstructTagData(short locator, TagInterface.Data data)
		{
			int index = 0;
			IO.EndianReader er;

			if (GeometryBlock == null) return false;

			foreach (geometry_block_resource_block gb in Resources)
			{
				er = new BlamLib.IO.EndianReader(GeometryBlock[index]);

				switch (gb.Type.Value)
				{
					#region TagData
					case (int)geometry_block_resource_type.TagData:
						if(gb.PrimaryLocater.Value == locator)
								data.Reset(er.ReadBytes(gb.Size));
						break;
					#endregion
				}

				index++;
				er.Close();
				er = null;
			}

			return true;
		}