private void runTesttoolStripMenu_Click(object sender, EventArgs e) { if (loadedProject == "") { MessageBox.Show("You must have a project loaded first!", "Error"); return; } overworldForm.saveOverworld(); if (!File.Exists(loadedProject + "//TestROM//test.sfc")) { MessageBox.Show("To run a test you must have a zelda ROM called 'test.sfc' in your TestROM project folder", "Error"); return; } if (emulatorPath == "") { MessageBox.Show("You must set an emulator first under Options menu!", "Error"); return; } if (File.Exists(loadedProject + "//TestROM//working.sfc")) { File.Delete(loadedProject + "//TestROM//working.sfc"); } FileStream fs = new FileStream(loadedProject + "//TestROM//test.sfc", FileMode.Open, FileAccess.Read); int size = (int)fs.Length; if (size < SIZE) { size = SIZE; } byte[] temp = new byte[size]; fs.Read(temp, 0, (int)fs.Length); fs.Close(); ROM.SetRom(temp, out bool isHeadered); temp = null; Importer importer = new ZScream_Exporter.Importer(loadedProject, ZScream_Exporter.ROM.DATA); Process.Start(emulatorPath, loadedProject + "//TestROM//working.sfc"); }
private void patchROMWithLoadedProjectToolStripMenuItem_Click(object sender, EventArgs e) { if (loadedProject == "") { MessageBox.Show("You must have a project loaded first!", "Error"); return; } overworldForm.saveOverworld(); string fname = ""; using (OpenFileDialog of = new OpenFileDialog()) { of.ShowDialog(); of.Filter = "Snes ROM to patch (*.sfc)|*.sfc"; fname = of.FileName; if (!File.Exists(of.FileName)) { return; } } FileStream fs = new FileStream(fname, FileMode.Open, FileAccess.Read); int size = (int)fs.Length; if (size < SIZE) { size = SIZE; } byte[] temp = new byte[size]; fs.Read(temp, 0, (int)fs.Length); fs.Close(); ROM.SetRom(temp, out bool isHeadered); temp = null; Importer importer = new ZScream_Exporter.Importer(loadedProject, ZScream_Exporter.ROM.DATA, fname); MessageBox.Show("Patched successfully " + fname.ToString()); }