private void VistaViewer_Load(object sender, EventArgs e) { map = new MapStream(@"D:\h2v\ascension.map"); listBox1.BeginUpdate(); tags = new List<Tag>(); foreach (var item in map.Tags) { if (item.Type.ToString() == "mode" && item.VirtualAddress != 0) tags.Add(item); } listBox1.DataSource = tags; listBox1.EndUpdate(); }
public TagWrapper(TagBlock tag, MapStream map, Tag meta) { tag_ = tag; /* Enumerate through all the StringIDs in this tag, check to see if they exist in the Globals list, * if not we should add them locally and update the StringID value to point to the list*/ foreach (StringID string_id in tag as IEnumerable<StringID>) { if (Halo2.Strings.Contains(string_id)) continue; else { var string_value = map.Strings[string_id.Index]; var entry = new KeyValuePair<StringID, string>(string_id, string_value); local_strings_.Add(entry); var index = local_strings_.IndexOf(entry); short string_id_index = (short)(index |= 0x8000); sbyte string_length = (sbyte)Encoding.UTF8.GetByteCount(string_value); var bytes = BitConverter.GetBytes((int)new StringID(string_id_index, string_length)); (string_id as IField).SetFieldData(bytes); } } foreach (TagIdentifier tag_id in tag as IEnumerable<TagIdentifier>) { tag_ids_.Add(tag_id); } /*Intent: to build a list of all tagblock addresses in tag */ foreach (var array in tag as IEnumerable<IFieldArray>) { var address = array.Address; if (array.Fields.Count() > 0) { var item = new { Address = address, Size = array.Fields[0].Size, Count = array.Fields.Count() }; tag_blocks.Add(item); if (meta.Contains(item.Address)) { } } } /* Intent: check every tag_block in the list for being external * if it is external build a reference list and add information about the tag_block * to that list. * address => [count, size]? * */ }
static void Main(string[] args) { var form1 = new VistaViewer(); form1.ShowDialog(); return; Console.WriteLine("Moonfish Core:"); Log.OnLog = new Log.LogMessageHandler(Console.WriteLine); var map = new MapStream(@"D:\h2v\ascension.map"); return; var tag = map["mode", "warthog"].Export() as model; map.Close(); Moonfish.WavefrontLoader.WavefrontOBJ obj = new WavefrontLoader.WavefrontOBJ(); obj.Parse(@"D:\halo_2\plane.obj"); using (var file = File.Create(@"D:\tag_block_export.bin")) { tag.Serialize(file); } return; }
public static void Scan(MapStream input) { BinaryReader bin = new BinaryReader(input); input.Position = 0; var start_address = input.IndexVirtualAddress; List<object> possible_pointers = new List<object>(); for (int i = 0; i < input.Length / 8; i++) { var count = bin.ReadInt32(); var address = bin.ReadInt32(); if (count > 0 && address > start_address && address < start_address + input.Length) { possible_pointers.Add(new { Count = count, Address = address }); } } }