private void CommandUnpackROM() { OpenFileDialog ofd = new OpenFileDialog { Title = "Select source ROM", Filter = "Nintendo DS ROMs (*.nds)|*.nds|All Files (*.*)|*.*", InitialDirectory = Path.GetDirectoryName(ApplicationConfig.Instance.LastROMPath), FileName = Path.GetFileName(ApplicationConfig.Instance.LastROMPath) }; if (ofd.ShowDialog() == DialogResult.OK) { string outputPath; if (GUIHelpers.ShowFolderBrowser("Select output folder", "Please select folder for extracted game data.", ApplicationConfig.Instance.LastDataPath, out outputPath) != System.Windows.Forms.DialogResult.OK) { return; } if (Directory.EnumerateFileSystemEntries(outputPath).Any() && MessageBox.Show("The selected folder is not empty. Continue anyway?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No) { return; } Program.Logger.LogMessage(true, "Extracting game data from file {0}...", Path.GetFileName(ofd.FileName)); RunNdstool(string.Format( @"-x ""{0}"" -9 ""{1}\\arm9.bin"" -7 ""{1}\\arm7.bin"" -y9 ""{1}\\y9.bin"" -y7 ""{1}\\y7.bin"" -d ""{1}\\data"" -y ""{1}\\overlay"" -t ""{1}\\banner.bin"" -h ""{1}\\header.bin""", ofd.FileName, outputPath)); ApplicationConfig.Instance.LastROMPath = ofd.FileName; LoadGameData(outputPath); } }
private void CommandOpenFolder() { string selectedPath; if (GUIHelpers.ShowFolderBrowser("Select game folder", "Please select folder with extracted Etrian Odyssey game data.", ApplicationConfig.Instance.LastDataPath, out selectedPath) == System.Windows.Forms.DialogResult.OK) { LoadGameData(selectedPath); } }
private void CommandRepackROM() { string inputPath; if (GUIHelpers.ShowFolderBrowser("Select game folder", "Please select folder with extracted game data.", ApplicationConfig.Instance.LastDataPath, out inputPath) != System.Windows.Forms.DialogResult.OK) { return; } if (gameDataManager.IsInitialized && inputPath == gameDataManager.DataPath && (gameDataManager.AnyDataHasChanged)) { if (MessageBox.Show("Data has been changed. Save changes before creating ROM file?", "Unsaved Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { CommandSave(); } } SaveFileDialog sfd = new SaveFileDialog { Title = "Select destination ROM", Filter = "Nintendo DS ROMs (*.nds)|*.nds|All Files (*.*)|*.*", InitialDirectory = Path.GetDirectoryName(ApplicationConfig.Instance.LastROMPath), FileName = Path.GetFileName(ApplicationConfig.Instance.LastROMPath) }; if (sfd.ShowDialog() == DialogResult.OK) { List <string> files = Directory.EnumerateFileSystemEntries(inputPath).ToList(); if (!files.Contains(Path.Combine(inputPath, "arm9.bin")) || !files.Contains(Path.Combine(inputPath, "arm7.bin")) || !files.Contains(Path.Combine(inputPath, "y9.bin")) || !files.Contains(Path.Combine(inputPath, "y7.bin")) || !files.Contains(Path.Combine(inputPath, "data")) || !files.Contains(Path.Combine(inputPath, "overlay")) || !files.Contains(Path.Combine(inputPath, "banner.bin")) || !files.Contains(Path.Combine(inputPath, "header.bin"))) { throw new FileNotFoundException("File required to repack ROM was not found"); } Program.Logger.LogMessage(true, "Creating ROM file {0} from extracted data...", Path.GetFileName(sfd.FileName)); RunNdstool(string.Format( @"-c ""{0}"" -9 ""{1}\\arm9.bin"" -7 ""{1}\\arm7.bin"" -y9 ""{1}\\y9.bin"" -y7 ""{1}\\y7.bin"" -d ""{1}\\data"" -y ""{1}\\overlay"" -t ""{1}\\banner.bin"" -h ""{1}\\header.bin""", sfd.FileName, inputPath)); ApplicationConfig.Instance.LastROMPath = sfd.FileName; Program.Logger.LogMessage(true, "Ready; file created"); } }