Exemplo n.º 1
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     string[] names = Enum.GetNames(typeof(TextureFormat));
     for (int i = 0; i < names.Length; i++)
     {
         if (comboBox1.Text == names[i].ToString())
         {
             if (listView1.FocusedItem != null)
             {
                 map.RawInformation.ExternalMaps.OpenIOs();
                 map.OpenIO();
                 int           tag           = (int)listView1.FocusedItem.Tag;
                 TextureFormat textureFormat = (TextureFormat)Enum.Parse(typeof(TextureFormat), names[i]);
                 try
                 {
                     OutputMessenger.OutputMessage("Trying to view bitmap as format: " + textureFormat.ToString(), this);
                     pictureBox1.Image = bi.GeneratePreview(tag, textureFormat);
                 }
                 catch
                 {
                     Bitmap   image    = new Bitmap(200, 200);
                     Graphics graphics = Graphics.FromImage(image);
                     graphics.Clear(Color.Gray);
                     string text = "Error Previewing!";
                     SizeF  ef   = graphics.MeasureString(text, new Font(FontFamily.GenericSerif, 15f));
                     graphics.DrawString(text, new Font(FontFamily.GenericSerif, 15f), Brushes.Black, new PointF(100f - (ef.Width / 2f), 100f - (ef.Height / 2f)));
                     pictureBox1.Image = image;
                 }
                 map.CloseIO();
                 map.RawInformation.ExternalMaps.CloseIOs();
             }
             break;
         }
     }
 }
Exemplo n.º 2
0
 private void extractBitmapToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.FocusedItem != null)
     {
         int            tag    = (int)listView1.FocusedItem.Tag;
         SaveFileDialog dialog = new SaveFileDialog {
             Filter = "DDS File (*.dds)|*.dds|Tif Image (*.tif)|*.tif"
         };
         string[] strArray = map.Index_Items[tagIndex].Name.Split(new char[] { '\\' });
         dialog.FileName = strArray[strArray.Length - 1];
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             map.RawInformation.ExternalMaps.OpenIOs();
             if (dialog.FilterIndex == 1)
             {
                 bi.Extract(dialog.FileName, tag);
             }
             else
             {
                 bi.GeneratePreview(tag).Save(dialog.FileName, ImageFormat.Tiff);
             }
             map.RawInformation.ExternalMaps.CloseIOs();
             OutputMessenger.OutputMessage("Texture extracted to: \"" + dialog.FileName + "\"", this);
         }
     }
 }
Exemplo n.º 3
0
 private void displayInfoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (cmbxChunks.Enabled)
     {
         int num = ReflexiveData.Pointer + (cmbxChunks.SelectedIndex * ReflexiveData.Size);
         OutputMessenger.OutputMessage("Name: \"" + ReflexiveData.Name + "\"\nType: \"" + ReflexiveData.Attributes.ToString() + "\"\nPlugin Offset: \"" + ReflexiveData.Offset.ToString() + "\"\nFile Offset: \"0x" + fullOffset.ToString("X") + "\"\nChunk Count: \"" + ReflexiveData.ChunkCount.ToString() + "\"\nPointer: \"0x" + ReflexiveData.Pointer.ToString("X") + "\"\nMemory Pointer \"0x" + ReflexiveData.MemoryPointer.ToString("X") + "\"\nCurrent Chunk Offset: \"0x" + num.ToString("X") + "\"\n", this);
     }
 }
Exemplo n.º 4
0
 private void btnSelectIdent_Click(object sender, EventArgs e)
 {
     if (btnSelectIdent.Text == "...")
     {
         string text = txtIdent.Text;
         try
         {
             string         str2    = text.Substring(0, text.Length - 5);
             uiIdentSwapper swapper = new uiIdentSwapper(this, IDENTIFIER, str2);
             swapper.ShowDialog();
         }
         catch
         {
             string str3 = text;
             new uiIdentSwapper(this, IDENTIFIER, str3).ShowDialog();
         }
     }
     if (btnSelectIdent.Text == "Save")
     {
         string tagPath = "";
         try
         {
             int iDENTIFIER = IDENTIFIER;
             if (AppSettings.Settings.Old_Ident_Swapper)
             {
                 tagPath = cmbxName.Text;
                 OutputMessenger.OutputMessage("Current Ident Editor Cant Save Tags. Please edit in Tree.", this);
             }
             else
             {
                 tagPath = txtIdent.Text;
                 tagNameList.SetPath(iDENTIFIER, tagPath);
             }
             tagNameList.Save();
         }
         catch
         {
             OutputMessenger.OutputMessage("Unable to rename file.", this);
         }
         if (AppSettings.Settings.Old_Ident_Swapper)
         {
             btnSelectIdent.Visible = false;
             LoadNames();
             cmbxName.Text         = "";
             cmbxName.SelectedText = tagPath;
             cmbxName.BackColor    = Color.White;
         }
         else
         {
             btnSelectIdent.Text = "...";
             txtIdent.ReadOnly   = true;
             txtIdent.Text       = txtIdent.Text + renamedCLASS;
             txtIdent.BackColor  = Color.White;
         }
     }
 }
Exemplo n.º 5
0
 private void button2_Click(object sender, EventArgs e)
 {
     Map.OpenIO();
     Map.IO.Out.BaseStream.Position = parentoffset + ReflexiveData.Offset;
     Map.IO.Out.Write(int.Parse(txtcount.Text));
     Map.IO.Out.Write((int)(int.Parse(txtoffset.Text) + Map.Map_Header.mapMagic));
     Map.CloseIO();
     LoadStructure(Map, parentoffset);
     OutputMessenger.OutputMessage("Saved Chunk Values", this);
 }
Exemplo n.º 6
0
        private void displayInformationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    num = fullOffset + HMap.Map_Header.mapMagic;
            string str = "Color order: \n";

            for (int i = 0; i < ValueData.Color_Order.Count; i++)
            {
                str = str + ValueData.Color_Order[i].ToString() + "\n";
            }
            OutputMessenger.OutputMessage("Name: \"" + ValueData.Name + "\"\nType: \"" + ValueData.Attributes.ToString() + "\"\nPlugin Offset: \"" + ValueData.Offset.ToString() + "\"\nFile Offset: \"0x" + fullOffset.ToString("X") + "\"\nMemory Pointer \"0x" + num.ToString("X") + "\"\n" + str, this);
        }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (base.Enabled)
     {
         if (txtArrayBox.Text.Length != txtArrayBox.MaxLength)
         {
             OutputMessenger.OutputMessage("Data array \"" + ValueData.Name + "\" could not be saved due to an invalid length of bytes.", this);
         }
         try
         {
             if (AppSettings.Settings.IP_and_XDK_Name == "")
             {
                 MessageBox.Show("XDK Name/IP not set");
             }
             else
             {
                 XboxDebugCommunicator communicator = new XboxDebugCommunicator(AppSettings.Settings.IP_and_XDK_Name);
                 if (!communicator.Connected)
                 {
                     try
                     {
                         communicator.Connect();
                     }
                     catch
                     {
                     }
                 }
                 XboxMemoryStream        stream = communicator.ReturnXboxMemoryStream();
                 HaloReach3d.IO.EndianIO nio    = new HaloReach3d.IO.EndianIO(stream, HaloReach3d.IO.EndianType.BigEndian);
                 nio.Open();
                 nio.Out.BaseStream.Position = ValueData.Pointer + HMap.Map_Header.mapMagic;
                 try
                 {
                     nio.Out.Write(ExtraFunctions.HexStringToBytes(txtArrayBox.Text), 0, txtArrayBox.Text.Length / 2);
                 }
                 catch
                 {
                     OutputMessenger.OutputMessage("Some invalid byte characters were intered in data array \"" + ValueData.Name + "\".\n They will not be saved.", this);
                     return;
                 }
                 nio.Close();
                 stream.Close();
                 communicator.Disconnect();
                 OutputMessenger.OutputMessage("Poked Chunk Values", this);
             }
         }
         catch
         {
             OutputMessenger.OutputMessage("Couldn't Poke Chunks", this);
         }
     }
 }
Exemplo n.º 8
0
        private void displayInformationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string str = "";

            foreach (mBitOption option in BitmaskData.Options)
            {
                string str2 = str;
                str = str2 + "Option Name: \"" + option.Name + "\" / Index: \"" + option.BitIndex.ToString() + "\"\n";
            }
            int num = fullOffset + HMap.Map_Header.mapMagic;

            OutputMessenger.OutputMessage("Name: \"" + BitmaskData.Name + "\"\nType: \"" + BitmaskData.Attributes.ToString() + "\"\nPlugin Offset: \"" + BitmaskData.Offset.ToString() + "\"\nFile Offset: \"0x" + fullOffset.ToString("X") + "\"\nMemory Pointer \"0x" + num.ToString("X") + "\"\nBit options: \n" + str, this);
        }
Exemplo n.º 9
0
 private void cmbxChunks_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbxChunks.SelectedIndex >= 0)
     {
         try
         {
             int parentOffset = ReflexiveData.Pointer + (cmbxChunks.SelectedIndex * SIZE);
             TagEditorHandler.LoadPluginValues(Map, pnlValues, parentOffset);
             Map.CloseIO();
         }
         catch
         {
             OutputMessenger.OutputMessage("Could not load values for Reflexive/Structure: " + ReflexiveData.Name, this);
         }
     }
 }
Exemplo n.º 10
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (AppSettings.Settings.IP_and_XDK_Name == "")
     {
         OutputMessenger.OutputMessage("XDK Name not set. Please set it in settings before continuing.", this);
     }
     else
     {
         XboxDebugCommunicator communicator = new XboxDebugCommunicator(AppSettings.Settings.IP_and_XDK_Name);
         communicator.Connect();
         communicator.Freeze();
         XboxMemoryStream stream = communicator.ReturnXboxMemoryStream();
         EndianIO         nio    = new EndianIO(stream, EndianType.BigEndian);
         nio.Open();
         int    tagIndexByClassAndName = Map.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text);
         string str  = "Null";
         string name = "Null";
         if (tagIndexByClassAndName != -1)
         {
             str  = Map.Index_Items[tagIndexByClassAndName].Class;
             name = Map.Index_Items[tagIndexByClassAndName].Name;
         }
         for (int i = 0; i < IdentGrid.SelectedItems.Count; i++)
         {
             int num3 = int.Parse(IdentGrid.SelectedItems[i].SubItems[1].Text.Substring(2), NumberStyles.HexNumber) + Map.Map_Header.mapMagic;
             if (tagIndexByClassAndName != -1)
             {
                 nio.Out.BaseStream.Position = num3;
                 nio.Out.WriteAsciiString(str, 4);
             }
             nio.Out.BaseStream.Position = num3 + 12;
             if (tagIndexByClassAndName != -1)
             {
                 nio.Out.Write(Map.Index_Items[tagIndexByClassAndName].Ident);
             }
             else
             {
                 nio.Out.Write(-1);
             }
         }
         nio.Close();
         stream.Close();
         communicator.Unfreeze();
         communicator.Disconnect();
         OutputMessenger.OutputMessage("Sucessfully poked " + IdentGrid.SelectedItems.Count.ToString() + " tag references to: \"" + name + "." + str + "\"", IdentGrid);
     }
 }
Exemplo n.º 11
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            string    fileName = AppSettings.Settings.PluginPath + Meta.Class.Replace(" ", "").Replace("<", "_").Replace(">", "_") + ".asc";
            XmlParser parser   = new XmlParser();

            parser.ParsePlugin(fileName);
            int headerSize = parser.HeaderSize;

            HaloMap.TagItem item = Meta.Map.Index_Items[Meta.Map.GetTagIndexByClassAndName(Meta.Class, comboBox1.Text)];
            Meta.Map.OpenIO();
            Meta.Map.IO.In.BaseStream.Position = item.Offset;
            byte[] buffer = Meta.Map.IO.In.ReadBytes(headerSize);
            Meta.Map.IO.Out.BaseStream.Position = Meta.Offset;
            Meta.Map.IO.Out.Write(buffer);
            Meta.Map.CloseIO();
            base.Close();
            OutputMessenger.OutputMessage("Tag header successfully swapped to: \"" + Meta.Name + "." + Meta.Class + "\"", (Control)form);
        }
Exemplo n.º 12
0
 public void SaveValue(EndianIO IO, int parentOffset)
 {
     if (txtArrayBox.Text.Length != txtArrayBox.MaxLength)
     {
         OutputMessenger.OutputMessage("Data array \"" + ValueData.Name + "\" could not be saved due to an invalid length of bytes.", this);
     }
     byte[] buffer = null;
     try
     {
         buffer = ExtraFunctions.HexStringToBytes(txtArrayBox.Text);
     }
     catch
     {
         OutputMessenger.OutputMessage("Some invalid byte characters were intered in data array \"" + ValueData.Name + "\".\n They will not be saved.", this);
         return;
     }
     IO.Out.BaseStream.Position = parentOffset + ValueData.Offset;
     IO.Out.Write(buffer);
 }
Exemplo n.º 13
0
 private void extractRawToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.FocusedItem != null)
     {
         int            tag    = (int)listView1.FocusedItem.Tag;
         SaveFileDialog dialog = new SaveFileDialog {
             Filter = "Bin File (*.bin)|*.bin"
         };
         string[] strArray = map.Index_Items[tagIndex].Name.Split(new char[] { '\\' });
         dialog.FileName = strArray[strArray.Length - 1];
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             map.RawInformation.ExternalMaps.OpenIOs();
             bi.ExtractRaw(dialog.FileName, tag);
             map.RawInformation.ExternalMaps.CloseIOs();
             OutputMessenger.OutputMessage("Texture extracted to: \"" + dialog.FileName + "\"", this);
         }
     }
 }
Exemplo n.º 14
0
 public void PokeValue(HaloReach3d.IO.EndianIO IO, int parentOffset)
 {
     if (base.Enabled)
     {
         if (txtArrayBox.Text.Length != txtArrayBox.MaxLength)
         {
             OutputMessenger.OutputMessage("Data array \"" + ValueData.Name + "\" could not be saved due to an invalid length of bytes.", this);
         }
         IO.Out.BaseStream.Position = ValueData.Pointer + HMap.Map_Header.mapMagic;
         try
         {
             IO.Out.Write(ExtraFunctions.HexStringToBytes(txtArrayBox.Text), 0, ExtraFunctions.HexStringToBytes(txtArrayBox.Text).Length);
         }
         catch
         {
             OutputMessenger.OutputMessage("Some invalid byte characters were intered in data array \"" + ValueData.Name + "\".\n They will not be saved.", this);
         }
     }
 }
Exemplo n.º 15
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            Map.OpenIO();
            int    tagIndexByClassAndName = Map.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text);
            string str  = "Null";
            string name = "Null";

            if (tagIndexByClassAndName != -1)
            {
                str  = Map.Index_Items[tagIndexByClassAndName].Class;
                name = Map.Index_Items[tagIndexByClassAndName].Name;
            }
            for (int i = 0; i < IdentGrid.SelectedItems.Count; i++)
            {
                int num3 = int.Parse(IdentGrid.SelectedItems[i].SubItems[1].Text.Substring(2), NumberStyles.HexNumber);
                if (tagIndexByClassAndName != -1)
                {
                    Map.IO.Out.BaseStream.Position = num3;
                    Map.IO.Out.WriteAsciiString(str, 4);
                }
                Map.IO.Out.BaseStream.Position = num3 + 12;
                if (tagIndexByClassAndName != -1)
                {
                    Map.IO.Out.Write(Map.Index_Items[tagIndexByClassAndName].Ident);
                    IdentGrid.SelectedItems[i].SubItems[2].Text = "0x" + Map.Index_Items[tagIndexByClassAndName].Ident.ToString("X");
                    IdentGrid.SelectedItems[i].SubItems[3].Text = str;
                    IdentGrid.SelectedItems[i].SubItems[4].Text = name;
                }
                else
                {
                    Map.IO.Out.Write(-1);
                    IdentGrid.SelectedItems[i].SubItems[2].Text = "0xFFFFFFFF";
                    IdentGrid.SelectedItems[i].SubItems[3].Text = "Null";
                    IdentGrid.SelectedItems[i].SubItems[4].Text = "Null";
                }
            }
            Map.CloseIO();
            OutputMessenger.OutputMessage("Sucessfully swapped " + IdentGrid.SelectedItems.Count.ToString() + " tag references to: \"" + name + "." + str + "\"", IdentGrid);
            base.Close();
        }
Exemplo n.º 16
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (AppSettings.Settings.IP_and_XDK_Name == "")
         {
             MessageBox.Show("XDK Name/IP not set");
         }
         else
         {
             XboxDebugCommunicator communicator = new XboxDebugCommunicator(AppSettings.Settings.IP_and_XDK_Name);
             if (!communicator.Connected)
             {
                 try
                 {
                     communicator.Connect();
                 }
                 catch
                 {
                 }
             }
             XboxMemoryStream        stream = communicator.ReturnXboxMemoryStream();
             HaloReach3d.IO.EndianIO nio    = new HaloReach3d.IO.EndianIO(stream, HaloReach3d.IO.EndianType.BigEndian);
             nio.Open();
             nio.Out.BaseStream.Position = (parentoffset + ReflexiveData.Offset) + Map.Map_Header.mapMagic;
             nio.Out.Write(int.Parse(txtcount.Text));
             nio.Out.Write((int)(int.Parse(txtoffset.Text) + Map.Map_Header.mapMagic));
             nio.Close();
             stream.Close();
             communicator.Disconnect();
             OutputMessenger.OutputMessage("Poked Chunk Values", this);
         }
     }
     catch
     {
         OutputMessenger.OutputMessage("Couldn't Poke Chunks", this);
     }
 }
Exemplo n.º 17
0
 private void SelectGridToShow(ToolStripMenuItem buttonItem)
 {
     foreach (ToolStripMenuItem item in menuItemShow.DropDownItems)
     {
         item.Checked = false;
     }
     buttonItem.Checked = true;
     if (structuresAndVoidsToolStripMenuItem.Checked)
     {
         lstStructuresGrid.Dock = DockStyle.Fill;
         lstStructuresGrid.BringToFront();
         AppSettings.Settings.LastGridView = Ascension.Settings.Settings.LastGridViews.Structure;
         OutputMessenger.OutputMessage("Loaded \"structure & voids\" grid.", this);
     }
     if (tagDataVoidsToolStripMenuItem.Checked)
     {
         lstVoidsGrid.Dock = DockStyle.Fill;
         lstVoidsGrid.BringToFront();
         AppSettings.Settings.LastGridView = Ascension.Settings.Settings.LastGridViews.Voids;
         OutputMessenger.OutputMessage("Loaded \"tagdata/voids\" grid.", this);
     }
     if (tagReferencesToolStripMenuItem.Checked)
     {
         lstIdentGrid.Dock = DockStyle.Fill;
         lstIdentGrid.BringToFront();
         AppSettings.Settings.LastGridView = Ascension.Settings.Settings.LastGridViews.Ident;
         OutputMessenger.OutputMessage("Loaded \"tag references\" grid.", this);
     }
     if (stringIdentifiersToolStripMenuItem.Checked)
     {
         lstStringIdentifiersGrid.Dock = DockStyle.Fill;
         lstStringIdentifiersGrid.BringToFront();
         AppSettings.Settings.LastGridView = Ascension.Settings.Settings.LastGridViews.Strings;
         OutputMessenger.OutputMessage("Loaded \"string identifiers\" grid.", this);
     }
 }
Exemplo n.º 18
0
        private void displayInformationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int num = fullOffset + HMap.Map_Header.mapMagic;

            OutputMessenger.OutputMessage("Name: \"" + ValueData.Name + "\"\nType: \"" + ValueData.Attributes.ToString() + "\"\nPlugin Offset: \"" + ValueData.Offset.ToString() + "\"\nFile Offset: \"0x" + fullOffset.ToString("X") + "\"\nMemory Pointer \"0x" + num.ToString("X") + "\"\n", this);
        }