Exemplo n.º 1
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.º 2
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.º 3
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.º 4
0
 public RTHData.RTHDataBlock ReturnRTHDataBlock(int parentMemoryOffset)
 {
     //Initialize our RTH Data Block
     RTHData.RTHDataBlock RTH_Data_Block = new RTHData.RTHDataBlock();
     //Set our memory offset
     RTH_Data_Block.Memory_Offset = (uint)(parentMemoryOffset + IdentData.Offset) - 12;
     //Get our class data
     byte[] classData = ExtraFunctions.StringToBytes(cmbxClass.Text);
     //Get our blank data
     byte[] blankData = new byte[8];
     //Create our identData array
     byte[] identData = null;
     //If the value isn't null
     if (cmbxName.Text != "<<null>>")
     {
         //Assign our ident
         identData =
             ExtraFunctions.HexStringToBytes(
                 HMap.IndexItems[HMap.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text)].Ident.ToString("X"));
     }
     else
     {
         //Otherwise, if it is, we assign a null value
         identData = new byte[4] {
             0xFF, 0xFF, 0xFF, 0xFF
         };
     }
     RTH_Data_Block.Data_Block =
         ExtraFunctions.HexStringToBytes(ExtraFunctions.BytesToHexString(classData) +
                                         ExtraFunctions.BytesToHexString(blankData) +
                                         ExtraFunctions.BytesToHexString(identData));
     //Set our block size
     RTH_Data_Block.Block_Size = 16;
     //Return the RTH Data Block instance
     return(RTH_Data_Block);
 }
 public void pokeXbox(uint offset, string poketype, string ammount)
 {
     if (!checkBox1.Checked)
     {
         ammount = int.Parse(ammount).ToString("X");
     }
     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 = offset;
             if (poketype == "Unicode String")
             {
                 nio.Out.WriteUnicodeString(ammount, ammount.Length);
             }
             if (poketype == "ASCII String")
             {
                 nio.Out.WriteUnicodeString(ammount, ammount.Length);
             }
             if ((poketype == "String") | (poketype == "string"))
             {
                 nio.Out.Write(ammount);
             }
             if ((poketype == "Float") | (poketype == "float"))
             {
                 nio.Out.Write(float.Parse(ammount));
             }
             if ((poketype == "Double") | (poketype == "double"))
             {
                 nio.Out.Write(double.Parse(ammount));
             }
             if ((poketype == "Short") | (poketype == "short"))
             {
                 nio.Out.Write((short)Convert.ToUInt32(ammount, 0x10));
             }
             if ((poketype == "Byte") | (poketype == "byte"))
             {
                 nio.Out.Write((byte)Convert.ToUInt32(ammount, 0x10));
             }
             if ((poketype == "Long") | (poketype == "long"))
             {
                 nio.Out.Write((long)Convert.ToUInt32(ammount, 0x10));
             }
             if ((poketype == "Quad") | (poketype == "quad"))
             {
                 nio.Out.Write((long)Convert.ToUInt64(ammount, 0x10));
             }
             if ((poketype == "Int") | (poketype == "int"))
             {
                 nio.Out.Write(Convert.ToUInt32(ammount, 0x10));
             }
             if ((poketype == "Bytes") | (poketype == "bytes"))
             {
                 nio.Out.Write(ExtraFunctions.HexStringToBytes(ammount), 0, ExtraFunctions.HexStringToBytes(ammount).Count <byte>());
             }
             nio.Close();
             stream.Close();
             communicator.Disconnect();
         }
     }
     catch
     {
     }
 }