Advertisement
Astekk

my unfinished eboot builder C#

Jan 5th, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.78 KB | None | 0 0
  1. using System.Linq;
  2. using System.Text;
  3. using System.Threading.Tasks;
  4. using System.Windows.Forms;
  5. using System.IO;
  6. using System.Diagnostics;
  7.  
  8.  
  9. namespace test
  10. {
  11.     public partial class Form1 : Form
  12.     {
  13.         public Form1()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.        // private System.IO.BinaryWriter BW;
  18.         OpenFileDialog OFD = new OpenFileDialog();
  19.         #region Offsets
  20.         public static class Offsets
  21.         {
  22.             public static uint
  23.                 AdvancedUav = 0x130a3a,
  24.                 RedBoxes = 0x139134,
  25.                 GlowPlayers = 0x15ab63,
  26.                 NoRecoil = 0x6b65c0,
  27.                 LaserSight = 0x51dde7,
  28.                 UAV = 0x23538f8,
  29.                 Antiban1 = 0x6f0adc,
  30.                 Antiban2 = 0x6ef4d8,
  31.                 Antiban3 = 0x6ef164,
  32.                 Antiban4 = 0x6f0ad4,
  33.                 Antiban5 = 0x6f0ad8,
  34.                 Antiban6 = 0x6e41e8;
  35.             // need to do some more
  36.         }
  37.         #endregion
  38.         #region Bytes
  39.         public static class Bytes
  40.         {
  41.             public static byte[] AdvancedUav = new byte[] { 0x01 };
  42.             public static byte[] RedBoxes = new byte[] { 0x60, 0x00, 0x00, 0x00 };
  43.             public static byte[] GlowPlayers = new byte[] { 0xf7 };
  44.             public static byte[] NoRecoil = new byte[] { 0x60, 0x00, 0x00, 0x00 };
  45.             public static byte[] LaserSight = new byte[] { 0x01 };
  46.             public static byte[] UAV = new byte[] { 0x01 };
  47.             public static byte[] Antiban1 = new byte[] { 0x30, 0xA5 };
  48.             public static byte[] Antiban2 = new byte[] { 0x39 };
  49.             public static byte[] Antiban3 = new byte[] { 0x38, 0x60 };
  50.             public static byte[] Antiban4 = new byte[] { 0x38, 0xC0 };
  51.             public static byte[] Antiban5 = new byte[] { 0x30, 0xE7 };
  52.             public static byte[] Antiban6 = new byte[] { 0x3B, 160 };
  53.             // need to do more
  54.         }
  55.         #endregion
  56.         #region Program
  57.         private void openELFToolStripMenuItem_Click(object sender, EventArgs e)
  58.         {
  59.             OFD.Filter = ".ELF Files|* .elf";
  60.             if (OFD.ShowDialog() == DialogResult.OK)
  61.             {
  62.                 if (OFD.SafeFileName == "default_mp.elf")
  63.                 {
  64.                     MessageBox.Show("default_mp.elf Successfully loaded", "Notice", MessageBoxButtons.OK);
  65.                     toolStripLabel1.Text = ".elf loaded !";
  66.                 }
  67.                 else
  68.                 {
  69.                     MessageBox.Show("You're missing files needed to use this program !", "Error", MessageBoxButtons.OK);
  70.                 }
  71.             }
  72.             //
  73.         }
  74.         public void DoWork(uint offset, byte[] bytes)
  75.         {
  76.             BinaryWriter bw = new BinaryWriter(File.OpenWrite(OFD.FileName));
  77.             // bw.Seek((int)(offset), System.IO.SeekOrigin.Begin);
  78.             Array.Reverse(bytes);
  79.             bw.BaseStream.Position = offset;
  80.             bw.Write(bytes);
  81.             bw.Close();
  82.         }
  83.         private void buildEBOOTToolStripMenuItem_Click(object sender, EventArgs e)
  84.         {
  85.             Cursor.Current = Cursors.WaitCursor;
  86.             if (File.Exists("default_mp.elf.backup"))
  87.             {
  88.                 File.Delete("default_mp.elf.backup");
  89.             }
  90.             if (!File.Exists("default_mp.elf"))
  91.             {
  92.                 MessageBox.Show("default_mp.elf not found!", "Error", MessageBoxButtons.OK);
  93.             }
  94.             else
  95.             {
  96.                 File.Copy("default_mp.elf", "default_mp.elf.backup");
  97.             }
  98.  
  99.             if (File.Exists("EBOOT.BIN"))
  100.             {
  101.                 if (File.Exists("EBOOT.BIN.backup"))
  102.                 {
  103.                     File.Delete("EBOOT.BIN.backup");
  104.                 }
  105.                 else
  106.                 {
  107.                     File.Copy("EBOOT.BIN", "EBOOT.BIN.backup");
  108.                 }
  109.             }
  110.             if (AdvUavCheck.Checked)
  111.             {
  112.                 DoWork(Offsets.AdvancedUav, Bytes.AdvancedUav);
  113.             }
  114.             if (NoRecoilCheck.Checked)
  115.             {
  116.                 DoWork(Offsets.NoRecoil, Bytes.NoRecoil);
  117.             }
  118.             if (LaserSightCheck.Checked)
  119.             {
  120.                 DoWork(Offsets.LaserSight, Bytes.LaserSight);
  121.             }
  122.             if (UavCheck.Checked)
  123.             {
  124.                 DoWork(Offsets.UAV, Bytes.UAV);
  125.             }
  126.             if (AntibanCheck.Checked)
  127.             {
  128.                 DoWork(Offsets.Antiban1, Bytes.Antiban1);
  129.                 DoWork(Offsets.Antiban2, Bytes.Antiban2);
  130.                 DoWork(Offsets.Antiban3, Bytes.Antiban3);
  131.                 DoWork(Offsets.Antiban4, Bytes.Antiban4);
  132.                 DoWork(Offsets.Antiban5, Bytes.Antiban5);
  133.                 DoWork(Offsets.Antiban6, Bytes.Antiban6);
  134.             }
  135.             if (GlowPlayersCheck.Checked)
  136.             {
  137.                 DoWork(Offsets.GlowPlayers, Bytes.GlowPlayers);
  138.             }
  139.             // do more
  140.             if (File.Exists("Debug.bat"))
  141.             {
  142.                 System.Threading.Thread loading = new System.Threading.Thread(new System.Threading.ThreadStart(Thread));
  143.                 Process P = new Process();
  144.                 P.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
  145.                 P.StartInfo.FileName = "Debug.bat";
  146.                 P.Start();
  147.                 MessageBox.Show("EBOOT successfully created", "Notice", MessageBoxButtons.OK);
  148.                 toolStripLabel1.Text = "EBOOT Built !";
  149.             }
  150.             else
  151.             {
  152.                 MessageBox.Show("You're missing files needed to use this program !!", "Error", MessageBoxButtons.OK);
  153.             }
  154.         }
  155.         public static void Thread() { }
  156.  
  157.  
  158.         #endregion
  159.     }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement