Exemplo n.º 1
0
 private void injectRom(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Title = "Select NES ROM";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             using (SaveFileDialog sfd = new SaveFileDialog())
             {
                 sfd.Title = "Select Save Location";
                 if (sfd.ShowDialog() == DialogResult.OK)
                 {
                     byte[]     rom = File.ReadAllBytes(ofd.FileName);
                     FileOutput f   = new FileOutput();
                     f.endian = Endianness.Little;
                     f.WriteInt(0);
                     f.WriteInt(0x30 + rom.Length);
                     f.WriteInt(0x30);
                     f.WriteInt(0x10 + rom.Length);
                     f.WriteInt(0x30 + rom.Length);
                     f.WriteInt(0);
                     f.WriteInt(0x1B + rom.Length);
                     f.WriteInt(0x1B + rom.Length);
                     f.WriteString("JAM WAS HERE");
                     f.WriteInt(0);
                     f.WriteBytes(rom);
                     f.WriteHex("3C00000000001000090002080000000100000000000000000000000000000000");
                     f.Save(sfd.FileName);
                 }
             }
         }
     }
 }