Пример #1
0
        private void insertIntoRomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = new DialogResult();

            mlss.Inserter dia = new mlss.Inserter();
showdia:
            dr = dia.ShowDialog();
            if (dr == DialogResult.OK)
            {
                if (dia.pointer != 0)
                {
                    string temp = AppDomain.CurrentDomain.BaseDirectory + "//temp.bin";
                    music.saveFile(new BinaryWriter(File.OpenWrite(temp)));
                    if (File.Exists(temp))
                    {
                        BinaryReader file  = new BinaryReader(new FileStream(AppDomain.CurrentDomain.BaseDirectory + "//temp.bin", FileMode.Open));
                        byte[]       bytes = file.ReadBytes((int)file.BaseStream.Length);
                        file.Close();
                        File.Delete(temp);
                        if (bytes.Length < dia.size)
                        {
                            ReplaceData(rom.Path, dia.pointer, bytes);
                            ReplaceData(rom.Path, 0x21CB70 + (4 * dia.index), BitConverter.GetBytes(dia.pointer + 0x08000000));
                            MessageBox.Show("Sequence succesfully inserted!");
                        }
                        else
                        {
                            MessageBox.Show("Sequence is too big.\nPlease use a custom offset for large sequences.");
                            goto showdia;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Cannot import into the first slot, it needs to be empty.");
                    goto showdia;
                }
            }
        }
Пример #2
0
 private void insertIntoRomToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DialogResult dr = new DialogResult();
     mlss.Inserter dia = new mlss.Inserter();
     showdia:
     dr = dia.ShowDialog();
     if (dr == DialogResult.OK)
     {
         if (dia.pointer != 0)
         {
             string temp = AppDomain.CurrentDomain.BaseDirectory + "//temp.bin";
             music.saveFile(new BinaryWriter(File.OpenWrite(temp)));
             if (File.Exists(temp))
             {
                 BinaryReader file = new BinaryReader(new FileStream(AppDomain.CurrentDomain.BaseDirectory + "//temp.bin", FileMode.Open));
                 byte[] bytes = file.ReadBytes((int)file.BaseStream.Length);
                 file.Close();
                 File.Delete(temp);
                 if (bytes.Length < dia.size)
                 {
                     ReplaceData(rom.Path, dia.pointer, bytes);
                     ReplaceData(rom.Path, 0x21CB70 + (4 * dia.index), BitConverter.GetBytes(dia.pointer + 0x08000000));
                     MessageBox.Show("Sequence succesfully inserted");
                 }
                 else
                 {
                     MessageBox.Show("Sequence is too big\nuse custom offset for large sequences");
                     goto showdia;
                 }
             }
         }
         else
         {
             MessageBox.Show("Cannot import at first slot, its used for 'no music'");
             goto showdia;
         }
     }
 }