private void LoadFile(string file) { string romFile = file; if (!File.Exists(romFile)) { //Error message MessageBox.Show("File not found, please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!HasRomExtension(romFile)) { //Error message MessageBox.Show("Specified file is not a rom file, please check the extension and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!SF64ROM.LoadFromROM(romFile)) { MessageBox.Show("Unable to properly load the ROM, please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SF64ROM.ResetRom(); return; } //This will happen if it did not find an appropriate GameID/Version match if (!SF64ROM.Instance.IsValidRom) { MessageBox.Show("Unable to identify the ROM, please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SF64ROM.ResetRom(); return; } tsStatus.Text = STATUS_FILE_LOADED; string fileName = Path.GetFileName(romFile); saveFileDialog.DefaultExt = Path.GetExtension(romFile); saveFileDialog.FileName = fileName; ToolSettings.Instance.AddRecentlyOpened(romFile); //We need a way to discriminate the endianess of the system, and keep the data // right side forward. EDIT: Endianness is described at header of ROM file, see // http://www.emutalk.net/archive/index.php/t-16045.html if (ToolSettings.Instance.AutoDecompress) { SF64ROM.Instance.Decompress(); } }
private void menuStripFileSave_Click(object sender, EventArgs e) { if (!SF64ROM.Instance.IsROMLoaded || !SF64ROM.Instance.IsValidRom) { //Error message MessageBox.Show("No valid ROM file loaded currently, please load a ROM and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!SF64ROM.Instance.HasGoodChecksum) { DialogResult result; if (ToolSettings.Instance.AutoCRCFix) { result = System.Windows.Forms.DialogResult.Yes; } else { result = MessageBox.Show("ROM has bad CRCs, fix?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); } if (result == System.Windows.Forms.DialogResult.Yes) { SF64ROM.Instance.FixCRC(); } else if (result == System.Windows.Forms.DialogResult.Cancel) { return; } } if (saveFileDialog.ShowDialog() != DialogResult.OK) { return; } SF64ROM.SaveRomTo(saveFileDialog.FileName); if (!ToolSettings.Instance.RecentlyOpened.Contains(saveFileDialog.FileName)) { ToolSettings.Instance.AddRecentlyOpened(saveFileDialog.FileName); UpdateFormSettings(); } }
public SF64RomInfo(SF64ROM rom) { _rom = rom; }