private void button1_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.Nodes.Count > 0) { for (int i = 0; i < treeView1.SelectedNode.Nodes.Count; i++) { map.OpenIO(); int ident = int.Parse(treeView1.SelectedNode.Nodes[i].Tag.ToString()); int num3 = int.Parse(textBox1.Text); int tagIndexByIdent = map.GetTagIndexByIdent(ident); int num5 = map.Index_Items[tagIndexByIdent].Offset + num3; map.IO.In.BaseStream.Position = num5; a1.Text = map.IO.In.ReadInt32().ToString(); a2.Text = map.IO.In.ReadInt32().ToString(); a3.Text = map.IO.In.ReadInt32().ToString(); a4.Text = map.IO.In.ReadInt32().ToString(); map.CloseIO(); for (int j = 0; j < treeView2.SelectedNode.Nodes.Count; j++) { map2.OpenIO(); ident = int.Parse(treeView2.SelectedNode.Nodes[j].Tag.ToString()); num3 = int.Parse(textBox1.Text); tagIndexByIdent = map2.GetTagIndexByIdent(ident); num5 = map2.Index_Items[tagIndexByIdent].Offset + num3; map2.IO.In.BaseStream.Position = num5; b1.Text = map2.IO.In.ReadInt32().ToString(); b2.Text = map2.IO.In.ReadInt32().ToString(); b3.Text = map2.IO.In.ReadInt32().ToString(); b4.Text = map2.IO.In.ReadInt32().ToString(); map2.CloseIO(); string text = a1.Text; string str2 = a2.Text; string str3 = a3.Text; string str4 = a4.Text; string str5 = b1.Text; string str6 = b2.Text; string str7 = b3.Text; string str8 = b4.Text; if ((((text == str5) && (str2 == str6)) && (str3 == str7)) && (str4 == str8)) { treeView2.LabelEdit = true; string str9 = treeView1.SelectedNode.Nodes[i].Text; treeView2.SelectedNode.Nodes[j].Text = str9; treeView2.SelectedNode.Nodes[j].BeginEdit(); treeView2.SelectedNode.Nodes[j].EndEdit(false); int tag = (int)treeView2.SelectedNode.Nodes[j].Tag; string tagPath = treeView2.SelectedNode.Nodes[j].Text; tagNameList2.SetPath(tag, tagPath); tagNameList2.Save(); treeView2.LabelEdit = false; break; } } } if (treeView1.SelectedNode.Nodes.Count == 0) { MessageBox.Show("Select a Class"); } } }
public void SaveValue(EndianIO IO, int parentOffset) { IO.Out.BaseStream.Position = parentOffset + IdentData.Offset; if (IDENTIFIER != -1) { int tagIndexByClassAndName = -1; if (AppSettings.Settings.Old_Ident_Swapper) { if (cmbxName.Text != "<<null>>") { try { tagIndexByClassAndName = HMap.GetTagIndexByClassAndName(cmbxClass.Text, tags[cmbxName.SelectedText]); if (tagIndexByClassAndName != -1) { IO.Out.WriteAsciiString(HMap.Index_Items[tagIndexByClassAndName].Class, 4); Stream stream1 = IO.Out.BaseStream; stream1.Position += 8L; IO.Out.Write(HMap.Index_Items[tagIndexByClassAndName].Ident); return; } } catch { } } } else { tagIndexByClassAndName = HMap.GetTagIndexByIdent(IDENTIFIER); if (tagIndexByClassAndName != -1) { try { IO.Out.WriteAsciiString(HMap.Index_Items[tagIndexByClassAndName].Class, 4); Stream stream2 = IO.Out.BaseStream; stream2.Position += 8L; IO.Out.Write(IDENTIFIER); } catch { } return; } } } Stream baseStream = IO.Out.BaseStream; baseStream.Position += 12L; IO.Out.Write(-1); }
public H3Shader(HaloMap map, int id, Renderer renderer) { int index = map.GetTagIndexByIdent(id); map.IO.SeekTo(map.IndexItems[index].Offset + 0x2c); int pointer = map.IO.In.ReadInt32() - map.MapHeader.mapMagic; map.IO.SeekTo(pointer + 0x14); pointer = map.IO.In.ReadInt32() - map.MapHeader.mapMagic; map.IO.SeekTo(pointer + 0xC); bitmapid = map.IO.In.ReadInt32(); bitmap_index = map.GetTagIndexByIdent(bitmapid); BitmapRaw.BitmapInfo bi = BitmapRaw.BitmapFunctions.GetBitmapInfo(map, bitmap_index); Bitmap b = bi.GeneratePreview(0); if (b != null) { texture = new Texture(renderer.Device, b, Usage.None, Pool.Managed); } }
public void LoadValue(HaloMap map, int parentOffset) { HMap = map; if (map.Map_Header.haloVersion == 11) { btnSelectIdent.Visible = false; } tagNameList = new TagNameList(string.Format("{0}\\Tag Lists\\{1}.taglist", (object)Application.StartupPath, (object)HMap.Map_Header.internalName)); HMap.tagNameList = tagNameList; HMap.IO.In.BaseStream.Position = (long)(parentOffset + IdentData.Offset); fullOffset = (int)HMap.IO.In.BaseStream.Position; HMap.IO.In.BaseStream.Position += 12L; int ident = HMap.IO.In.ReadInt32(); if (AppSettings.Settings.Old_Ident_Swapper) { txtIdent.Visible = false; btnSelectIdent.Visible = false; int tagIndexByIdent = HMap.GetTagIndexByIdent(ident); if (tagIndexByIdent != -1) { SelectItem(cmbxClass, map.Index_Items[tagIndexByIdent].Class); } else { cmbxClass.SelectedIndex = 0; } if (tagIndexByIdent != -1) { SelectItem(cmbxName, map.Index_Items[tagIndexByIdent].Name); } else { SelectItem(cmbxName, "<<null>>"); } } else { cmbxClass.Visible = false; cmbxName.Visible = false; } IDENTIFIER = ident; SetIdent(IDENTIFIER); Editted = false; if (!(btnSelectIdent.Text == "Save")) { return; } btnSelectIdent.Text = "..."; txtIdent.ReadOnly = true; txtIdent.Text += renamedCLASS; txtIdent.BackColor = Color.White; }
public void LoadValue(HaloMap map, int parentOffset) { //Set our instance of the HaloMap class HMap = map; //If we have no class if (cmbxClass.Items.Count == 0) { LoadClasses(); } //Go to the value position HMap.IO.In.BaseStream.Position = parentOffset + IdentData.Offset; //Set our last real offset lastRealOffset = (int)HMap.IO.In.BaseStream.Position; //Set our context menu. this.ContextMenuStrip = contextMenuStrip1; foreach (Control c in this.Controls) { c.ContextMenuStrip = contextMenuStrip1; } //Read the Ident int ident = HMap.IO.In.ReadInt32(); //Get the tagIndex by using the ident int index = HMap.GetTagIndexByIdent(ident); //Select the tagClass if (index != -1) { SelectItem(cmbxClass, map.IndexItems[index].Class); } else { cmbxClass.SelectedIndex = 0; } //Select the tagName if (index != -1) { SelectItem(cmbxName, map.IndexItems[index].Name); } else { SelectItem(cmbxName, "<<null>>"); } Editted = false; }
public RawEntryTable(HaloMap Map) { //Create our variable to hold the zone index int zoneIndex = -1; //Loop through all the tags for (int i = 0; i < Map.IndexItems.Count; i++) { //If the class is zone if (Map.IndexItems[i].Class == "zone") { //Set the zone index as this index zoneIndex = i; //Break out of the loop break; } } //If we didn't find a zone tag if (zoneIndex == -1) { return; } //Get our zone Offset int zoneOffset = Map.IndexItems[zoneIndex].Offset; //Go to the structure offset to read our count and pointer Map.IO.In.BaseStream.Position = zoneOffset + 88; int rawTableCount = Map.IO.In.ReadInt32(); int rawTablePointer = Map.IO.In.ReadInt32() - Map.MapHeader.mapMagic; //Loop through every RawBlock for (int i = 0; i < rawTableCount; i++) { //Go to our rawBlock offset //ChunkSize=0x40 Map.IO.In.BaseStream.Position = rawTablePointer + (i * 0x40); //Initialize a new RawBlock instance RawEntry rawBlock = new RawEntry(); //Set our chunk offset rawBlock.ZoneChunkOffset = (int)Map.IO.In.BaseStream.Position; //Set our index rawBlock.Index = i; //Read our tagref rawBlock.TagClass = Map.IO.In.ReadAsciiString(4); //Skip the 8 byte gap. Map.IO.In.BaseStream.Position += 8; //Read our tagident rawBlock.TagID = Map.IO.In.ReadInt32(); //Get our tag information from ident, so if its not null if (rawBlock.TagID != -1) { rawBlock.TagName = Map.IndexItems[Map.GetTagIndexByIdent(rawBlock.TagID)].Name; } else { rawBlock.TagName = "null"; rawBlock.TagClass = "null"; } //Read our raw identifier rawBlock.RawID = (Map.IO.In.ReadInt16() << 16) + i; //Go to our rawBlock offset //ChunkSize=0x40 Map.IO.In.BaseStream.Position = rawTablePointer + (i * 0x40) + 20; //Read our offset rawBlock.Offset = Map.IO.In.ReadUInt32(); rawBlock.Size = Map.IO.In.ReadUInt32(); //Skip the 6 byte gap. Map.IO.In.BaseStream.Position += 6; //Read our index rawBlock.RawLocationsIndex = Map.IO.In.ReadInt16(); //Jump 0x04 bytes forward to our Count0 offset Map.IO.In.BaseStream.Position += 0x04; rawBlock.Count0 = Map.IO.In.ReadInt32(); if (rawBlock.Count0 != 0) { rawBlock.Pointer0 = Map.IO.In.ReadInt32() - Map.MapHeader.mapMagic; } //Skip the 4 bytes of blank space after a reflexive. Map.IO.In.BaseStream.Position += 4; rawBlock.Count1 = Map.IO.In.ReadInt32(); if (rawBlock.Count1 != 0) { rawBlock.Pointer1 = Map.IO.In.ReadInt32() - Map.MapHeader.mapMagic; } //Add it to our rawblock list this.Add(rawBlock); } }