public void ToStream(XmlWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            s.WriteStartElement("ggol");
            s.WriteAttributeString("name", tag.Name);
            {
                s.WriteStartElement("types");
                foreach (var element in OrdnanceList)
                {
                    s.WriteStartElement("entry");
                    s.WriteAttributeString("name", element.Name.ToString());
                    s.WriteAttributeString("lookupName", element.LookupName.ToString());
                    s.WriteAttributeString("typeName", element.ObjectType.ToString());
                    s.WriteEndElement();
                }
                s.WriteEndElement();

                s.WriteStartElement("sets");
                foreach (var element in OrdnanceSets)
                {
                    s.WriteStartElement("entry");
                    s.WriteAttributeString("name", element.Name.ToString());
                    s.WriteAttributeString("lookupName", element.LookupName.ToString());
                    s.WriteEndElement();
                }
                s.WriteEndElement();
            }
            s.WriteEndElement();
        }
 public void ToStream(StreamWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteLine("{0}\t{1}\t{2}\t{3}",
                 Unknown8, Points,
                 Name, Unknown4);
 }
            public void ToStream(XmlWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                s.WriteStartElement("entry");
                s.WriteAttributeString("name", Name.ToString());

                if (!AppSlot1.Handle.IsNull)
                {
                    s.WriteAttributeString("appSlot1", AppSlot1.ToString());
                }
                if (!AppSlot2.Handle.IsNull)
                {
                    s.WriteAttributeString("appSlot2", AppSlot2.ToString());
                }
                if (!PrimaryWeapon.Handle.IsNull)
                {
                    s.WriteAttributeString("primary", PrimaryWeapon.ToString());
                }
                if (!SecondaryWeapon.Handle.IsNull)
                {
                    s.WriteAttributeString("secondary", SecondaryWeapon.ToString());
                }
                if (!Equipment.Handle.IsNull)
                {
                    s.WriteAttributeString("equipment", Equipment.ToString());
                }

                s.WriteEndElement();
            }
        public void ToStream(StreamWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            const string k_ident = "\t";

            s.WriteLine(k_ident + "Names");
            for (int x = 0; x < Names.Count; x++)
            {
                s.Write(k_ident + "\t");
                s.Write(x.ToString("X4"));
                s.Write("\t");
                s.WriteLine(Names[x]);
            }
            s.WriteLine();

            s.WriteLine(k_ident + "BlockC");
            for (int x = 0; x < BlockC.Count; x++)
            {
                s.Write(k_ident + "\t");
                s.Write(x.ToString("X4"));
                s.Write("\t");
                BlockC[x].ToStream(s, tag, this);
            }
            s.WriteLine();
        }
        public void ToStream(StreamWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            const string k_ident = "\t";

            s.WriteLine(k_ident + "Categories");
            for (int x = 0; x < Categories.Count; x++)
            {
                s.Write(k_ident + "\t");
                s.Write(x.ToString("X4"));
                s.Write("\t");
                Categories[x].ToStream(s, tag, this);
            }
            s.WriteLine();

            s.WriteLine(k_ident + "Medals");
            for (int x = 0; x < Medals.Count; x++)
            {
                s.Write(k_ident + "\t");
                s.Write(x.ToString("X4"));
                s.Write("\t");
                Medals[x].ToStream(s, tag, this);
            }
            s.WriteLine();
        }
 public void ToStream(XmlWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteStartElement("entry");
     s.WriteAttributeString("name", Name.ToString());
     s.WriteEndElement();
 }
 public void ToStream(StreamWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteLine("{0}\t{1}",
                 ObjectMappingIndex.Value.ToString("X4"),
                 Unknown0.Value.ToString("X8"));
 }
 public void ToStream(StreamWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.Write("{0}\t", Name);
     DefinitionToStream(s);
     s.WriteLine();
 }
                public void ToStream(StreamWriter s,
                                     Managers.TagManager tag, TI.Definition owner)
                {
                    const string k_ident = "\t\t\t\t";

                    if (Unknown20 != 0)
                    {
                        s.Write("{0}\t", Unknown20.Value.ToString("X8"));
                    }
                    if (!Title.Handle.IsNull)
                    {
                        s.Write("{0}", Title);
                    }
                    s.WriteLine();
                    if (!Settings.Datum.IsNull)
                    {
                        s.Write(k_ident + "\tSettings\t"); ReferenceToStream(s, Settings);
                        s.WriteLine();
                    }
                    if (!Template.Datum.IsNull)
                    {
                        s.Write(k_ident + "\tTemplate\t"); ReferenceToStream(s, Template);
                        s.WriteLine();
                    }
                    if (!ValuePairs.Datum.IsNull)
                    {
                        s.Write(k_ident + "\tValuePairs\t"); ReferenceToStream(s, ValuePairs);
                        s.WriteLine();
                    }
                }
Пример #10
0
        public void ToStream(XmlWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            s.WriteStartElement("sily");
            s.WriteAttributeString("name", tag.Name);
            {
                s.WriteAttributeString("titleId", Title.ToString());
                if (!Description.Handle.IsNull)
                {
                    s.WriteAttributeString("descId", Description.ToString());
                }
                s.WriteAttributeString("param", Parameter.ToString());

                SettingParameters[Parameter.Value] = tag.Name;

                s.WriteStartElement("values");
                s.WriteAttributeString("type", Type.ToString());
                foreach (var vp in Values)
                {
                    vp.ToStream(s, tag, this, Type.Value);
                }
                s.WriteEndElement();
            }
            s.WriteEndElement();
        }
Пример #11
0
            public void ToStream(XmlWriter s,
                                 Managers.TagManager tag, TI.Definition owner, int type)
            {
                s.WriteStartElement("entry");

                s.WriteAttributeString("labelId", Name.ToString());
                if (!Description.Handle.IsNull)
                {
                    s.WriteAttributeString("descId", Description.ToString());
                }
                switch (type)
                {
                case 0: s.WriteAttributeString("int", Integer.Value.ToString()); break;

                case 1: s.WriteAttributeString("stringId", StringId.ToString()); break;

                case 2: System.Diagnostics.Debugger.Break(); break;

                case 3: s.WriteAttributeString("real", Real.Value.ToString("r")); break;
                }
                if (Flags.Value != 0)
                {
                    s.WriteAttributeString("flags", Flags.ToString());
                }

                s.WriteEndElement();
            }
Пример #12
0
        public void ToStream(XmlWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            s.WriteStartElement("unic");
            s.WriteAttributeString("name", tag.Name);
            {
                s.WriteStartElement("references");
                foreach (var sr in StringRefs)
                {
                    sr.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                if (false && BlockC.Count > 0)
                {
                    s.WriteStartElement("unkC");
                    foreach (var sr in BlockC)
                    {
                        sr.ToStream(s, tag, this);
                    }
                    s.WriteEndElement();
                }
            }
            s.WriteEndElement();
        }
Пример #13
0
        public void ToStream(XmlWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            s.WriteStartElement("lgtd");
            s.WriteAttributeString("name", tag.Name);
            {
                s.WriteStartElement("types");
                foreach (var element in Loadouts)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("sets");
                foreach (var element in LoadoutSets)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("names");
                foreach (var element in LoadoutNames)
                {
                    s.WriteStartElement("entry");
                    s.WriteAttributeString("name", element.Value.ToString());
                    s.WriteEndElement();
                }
                s.WriteEndElement();
            }
            s.WriteEndElement();
        }
 public void ToStream(StreamWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}",
                 Name,
                 Unknown8.Value.ToString("X4"), UnknownA.Value.ToString("X2"),
                 CategoryIndex, UnknownC, Points);
 }
Пример #15
0
 public void ToStream(XmlWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteStartElement("entry");
     s.WriteAttributeString("component", Component.ToString());
     s.WriteAttributeString("prop", Property.ToString());
     s.WriteEndElement();
 }
Пример #16
0
 public void ToStream(StreamWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}",
                 Name,
                 Unknown8.Value.ToString(), UnknownC.Value.ToString(),
                 Unknown10.Value.ToString("X4"), Unknown12.Value.ToString("X2"),
                 Unknown14.Value.ToString("X8"));
 }
Пример #17
0
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t\t";

                s.WriteLine(k_ident +
                            "Component={0}\t" + "Property={1}",
                            Component, Property);
            }
Пример #18
0
        public void ToStream(XmlWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            s.WriteStartElement("motl");
            s.WriteAttributeString("name", tag.Name);
            {
                s.WriteStartElement("types");
                foreach (var element in TypeList)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("weapons");
                foreach (var element in WeaponsList)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("vehicles");
                foreach (var element in VehiclesList)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("grenades");
                foreach (var element in GrenadesList)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("equipment");
                foreach (var element in EquipmentList)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("weaponSets");
                foreach (var element in WeaponSets)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();

                s.WriteStartElement("vehicleSets");
                foreach (var element in VehicleSets)
                {
                    element.ToStream(s, tag, this);
                }
                s.WriteEndElement();
            }
            s.WriteEndElement();
        }
Пример #19
0
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t\t\t";

                s.WriteLine(Name);
                s.WriteLine(k_ident +
                            "Type={0}\t" + "Integer={1}\t" + "StringId={2}\t" + "Flags={3}\t",
                            Type, Integer.Value.ToString("X8"), StringId, Flags);
            }
Пример #20
0
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t\t";
                var          unic    = owner as multilingual_unicode_string_list_group;

                s.WriteLine(StringId);
                s.Write(k_ident);
                s.WriteLine(unic.GetStringUtf8(LanguageOffsets[(int)LanguageType.English]));
            }
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t\t\t";

                s.WriteLine(Name);
                s.WriteLine(k_ident +
                            "Block0C={0}\t" + "Block18={1}\t" + "Block24={2}\t" +
                            "Block30={3}\t" + "Block3C={4}",
                            BlockC.Count, Block18.Count, Block24.Count,
                            Block30.Count, Block3C.Count);
            }
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t";

                s.WriteLine(Name);
                for (int x = 0; x < Entries.Count; x++)
                {
                    s.Write(k_ident);
                    s.Write("\t");
                    Entries[x].ToStream(s, tag, this);
                }
            }
 /// <summary>
 /// Initialize the language pack to a tag definition or as a stand-alone
 /// </summary>
 /// <param name="parent"></param>
 public CacheFileLanguagePackResourceGen2(TI.Definition parent)
 {
     if (parent != null)
     {
         parent.Add(new TI.Pad(4 + 4));                 // runtime pointers
         // s_cache_unicode_string_reference* references_buffer
         // byte* strings_buffer
         parent.Add(Count);
         parent.Add(Size);
         parent.Add(OffsetReferences);
         parent.Add(OffsetStrings);
         parent.Add(new TI.Pad(1 + 3));
     }
 }
Пример #24
0
                public void ToStream(XmlWriter s,
                                     Managers.TagManager tag, TI.Definition owner)
                {
                    s.WriteStartElement("entry");

                    if (!Title.Handle.IsNull)
                    {
                        s.WriteAttributeString("titleId", Title.ToString());
                    }
                    if (!Description.Handle.IsNull)
                    {
                        s.WriteAttributeString("descId", Description.ToString());
                    }
                    if (Unknown20 != 0)
                    {
                        s.WriteAttributeString("settingCategory", Unknown20.ToString());
                        if (!SettingCategories.ContainsKey(Unknown20.Value))
                        {
                            string title   = Title.ToString();
                            string tagname = null;

                            if (!Settings.Datum.IsNull)
                            {
                                tagname = Settings.GetTagPath();
                            }
                            else if (!Template.Datum.IsNull)
                            {
                                tagname = Template.GetTagPath();
                            }

                            SettingCategories[Unknown20.Value] = new CategoryInfo(title, tagname);
                        }
                    }

                    if (!Settings.Datum.IsNull)
                    {
                        s.WriteElementString("settings", Settings.GetTagPath());
                    }
                    if (!Template.Datum.IsNull)
                    {
                        s.WriteElementString("template", Template.GetTagPath());
                    }
                    if (!ValuePairs.Datum.IsNull)
                    {
                        s.WriteElementString("values", ValuePairs.GetTagPath());
                    }

                    s.WriteEndElement();
                }
Пример #25
0
 public s_cache_language_pack(TI.Definition parent)
 {
     parent.Add(new TI.Pad(
                    4      // Index runtime hashing handle
                    +
                    4      // Table runtime hashing handle
                    ));
     parent.Add(Count       = new TI.LongInteger());
     parent.Add(Size        = new TI.LongInteger());
     parent.Add(OffsetIndex = new TI.LongInteger());
     parent.Add(OffsetTable = new TI.LongInteger());
     parent.Add(new TI.Skip(20));             // index SHA1 hash
     parent.Add(new TI.Skip(20));             // strings SHA1 hash
     parent.Add(new TI.Pad(1 + 3));
 }
Пример #26
0
 public void ToStream(XmlWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteStartElement("goof");
     s.WriteAttributeString("name", tag.Name);
     {
         s.WriteStartElement("categories");
         foreach (var cat in Categories)
         {
             cat.ToStream(s, tag, this);
         }
         s.WriteEndElement();
     }
     s.WriteEndElement();
 }
 public void ToStream(XmlWriter s,
                      Managers.TagManager tag, TI.Definition owner)
 {
     s.WriteStartElement("entry");
     s.WriteAttributeString("name", Name.ToString());
     if (Definition.GroupTag != TI.TagGroup.Null)
     {
         s.WriteAttributeString("groupTag", Definition.GroupTag.TagToString());
         if (!Definition.Datum.IsNull)
         {
             s.WriteAttributeString("tagName", Definition.GetTagPath());
         }
     }
     s.WriteEndElement();
 }
Пример #28
0
            public void ToStream(StreamWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                const string k_ident = "\t\t\t";

                if (Unknown8.Value != 0)
                {
                    System.Diagnostics.Debugger.Break();
                }
                s.WriteLine(k_ident +
                            "Unknown8={2}\t" +
                            "Component={0}\t" + "Property={1}",
                            Component, Property,
                            Unknown8.Value.ToString("X8"));
            }
        public void ToStream(StreamWriter s,
                             Managers.TagManager tag, TI.Definition owner)
        {
            const string k_ident = "\t";

            s.WriteLine(k_ident + "Effects");
            for (int x = 0; x < Effects.Count; x++)
            {
                s.Write(k_ident + "\t");
                s.Write(x.ToString("X4"));
                s.Write("\t");
                Effects[x].ToStream(s, tag, this);
            }
            s.WriteLine();
        }
Пример #30
0
            public void ToStream(XmlWriter s,
                                 Managers.TagManager tag, TI.Definition owner)
            {
                s.WriteStartElement("entry");
                int type_index = TypeIndex.Value;

                if (type_index >= 0)
                {
                    var types = (owner as multiplayer_object_type_list_group).TypeList;

                    s.WriteAttributeString("typeIndex", type_index.ToString());
                    s.WriteAttributeString("typeName", types[type_index].Name.ToString());
                }
                s.WriteEndElement();
            }
Пример #31
0
			internal TI.Definition LoadResources(CacheFileGen3 c, cache_file_resource_gestalt_group owner, cache_file_resource_layout_table cache_layout, bool mega_hack)
			{
				if (Reference.Datum == DatumIndex.Null) return null; // this is a null entry
				if (loadedResources != null) return loadedResources; // data already loaded, return

				var rdf = c.GetCacheFileResourceDefinitionFactory();

				// pre-process cache for resource loading
				cache_layout.BuildInteropData();
				owner.BuildInteropData();

				int resource_stream_definition_size = BlockSize.Value;
				
				// sound resource case hack
				bool use_sound_resource_hack = false;
				if (resource_stream_definition_size == 0)
				{
					Debug.Assert.If(ResourceType.Value == owner.resource_index_sound_resource_definition);
					resource_stream_definition_size = sound_resource_definition.kSizeOf;
					use_sound_resource_hack = true;
				}

				int resource_stream_size_required = resource_stream_definition_size;
				// base address to use on cache fixups, cache data will be appended 
				// later on
				uint cache_required_base_address = 0, cache_optional_base_address = 0;
				byte[] resource_stream_data;

				#region create resource buffer
				{// Get our page segment data so we can build our resource buffer for loading
					int seg_index = SegmentIndex.Value;
					cache_file_resource_layout_table.page_segment_block page_segment = cache_layout.PageSegments[seg_index];
					int required_size = page_segment.GetRequiredSize();
					int optional_size = page_segment.GetOptionalSize();

					cache_required_base_address = (uint)resource_stream_size_required;
					if (required_size > 0) resource_stream_size_required += required_size;

					if (optional_size > 0) // optional isn't always used so don't set the base address if it isn't
					{
						cache_optional_base_address = (uint)resource_stream_size_required;
						resource_stream_size_required += optional_size;
					}

					// get our definition data buffer
					resource_stream_data = new byte[resource_stream_size_required];
					if (use_sound_resource_hack) // sound_resources don't occupy space in the resource-definition-data, so we have to create faux def data
					{
						int data_size = 0;
						if (required_size > 0) data_size += required_size;
						if (optional_size > 0) data_size += optional_size;
						if (data_size > 0) rdf.InsertDataSizeIntoFauxDefinitionData(resource_stream_data, (uint)data_size);
					}
					else
						Array.Copy(owner.ResourceDefinitionData.Value, BlockOffset.Value, resource_stream_data, 0, resource_stream_definition_size);

					{ // get cache data and append it
						byte[] page_data = 
							cache_layout.Pages[page_segment.RequiredPageIndex.Value].GetSegmentData(c, cache_layout, page_segment.RequiredSegmentOffset.Value);

						Array.Copy(page_data, 0, resource_stream_data, (int)cache_required_base_address, required_size);

						if (page_segment.OptionalPageIndex.Value >=0 && cache_optional_base_address > 0)
						{
							page_data = cache_layout.Pages[page_segment.OptionalPageIndex.Value].GetSegmentData(c, cache_layout, page_segment.OptionalSegmentOffset.Value);
							Array.Copy(page_data, 0, resource_stream_data, (int)cache_optional_base_address, optional_size);
						}
					}
				}
				#endregion

				Util.OptionalValue optv = new Util.OptionalValue((byte)resource_fixup_type.Count);

				#region perform fixups
				using (var ms = new System.IO.MemoryStream(resource_stream_data, true))
				{
					foreach (resource_fixup_block def in ResourceFixups)
					{
						uint address = (uint)def.Address.Value;
						uint address_offset = optv.GetValue(address);
						ms.Seek(def.BlockOffset.Value, System.IO.SeekOrigin.Begin);
						resource_fixup_type rft = (resource_fixup_type)optv.GetOption(address);

						switch (rft)
						{
							case resource_fixup_type.Data: break;
							case resource_fixup_type.CacheRequired: address_offset += cache_required_base_address; break;
							case resource_fixup_type.CacheOptional: address_offset += cache_optional_base_address; break;

							default: throw new Debug.Exceptions.UnreachableException();
						}

						IO.ByteSwap.SwapUDWordAndWrite(address_offset, ms);
						
						// hack identifier for StructReference fields when the definition is at offset '0' 
						// as that f***s with the init code
						//if (address_offset == 0) IO.ByteSwap.SwapUDWordAndWrite(1, ms);
					}

//					foreach (resource_definition_fixup_block def in ResourceDefinitionFixups)
//					{
//					}
				}
				#endregion

				#region create and stream definition
				using (var s = new IO.EndianReader(resource_stream_data, IO.EndianState.Big, null))
				{
					int res_type = ResourceType.Value;
					if (res_type == owner.resource_index_render_geometry_api_resource_definition)			loadedResources = rdf.GenerateRenderGeometryApiResource();
					else if (res_type == owner.resource_index_bitmap_texture_interop_resource)				loadedResources = rdf.GenerateBitmapTextureInteropResource();
					else if (res_type == owner.resource_index_model_animation_tag_resource)					loadedResources = rdf.GenerateModelAnimationTagResource();
					// TODO: haven't quite figured this one out yet. Currently using hacked up code (see [use_sound_resource_hack])
					else if (res_type == owner.resource_index_sound_resource_definition)					loadedResources = rdf.GenerateSoundResourceResource();
					else if (res_type == owner.resource_index_bitmap_texture_interleaved_interop_resource)	loadedResources = rdf.GenerateBitmapTextureInterleavedInteropResource();
					else if (res_type == owner.resource_index_structure_bsp_tag_resources)					loadedResources = rdf.GenerateStructureBspTagResource();
					// TODO: haven't figured this one out yet
					else if (res_type == owner.resource_index_structure_bsp_cache_file_tag_resources)		loadedResources = rdf.GenerateStructureBspCacheFileTagResource();
					else throw new Debug.Exceptions.UnreachableException();

					s.Seek(optv.GetValue((uint)DefinitionOffset.Value));
					IO.ITagStream ts = new resource_tag_stream(c, Reference.Datum, s);

					ts.Flags.Add(
						IO.ITagStreamFlags.UseStreamPositions |
						IO.ITagStreamFlags.DontStreamStringData |
						IO.ITagStreamFlags.DontStreamFieldSetHeader |
						IO.ITagStreamFlags.DontPostprocess);
					if (mega_hack) ts.Flags.Add(IO.ITagStreamFlags.Halo3VertexBufferMegaHack);
					loadedResources.Read(ts);
				}
				#endregion

				return loadedResources;
			}