UI: Added "Load Random Game" option

This commit is contained in:
Souryo 2016-12-09 12:49:17 -05:00
parent 393126f798
commit 2cbae24ded
17 changed files with 105 additions and 39 deletions

View file

@ -94,7 +94,7 @@ void Console::Initialize(string romFilename, stringstream *filestream, string ip
VideoDecoder::GetInstance()->StartThread(); VideoDecoder::GetInstance()->StartThread();
FolderUtilities::AddKnowGameFolder(FolderUtilities::GetFolderName(romFilename)); FolderUtilities::AddKnownGameFolder(FolderUtilities::GetFolderName(romFilename));
string modelName = _model == NesModel::PAL ? "PAL" : (_model == NesModel::Dendy ? "Dendy" : "NTSC"); string modelName = _model == NesModel::PAL ? "PAL" : (_model == NesModel::Dendy ? "Dendy" : "NTSC");
string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")"; string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")";
@ -126,7 +126,7 @@ bool Console::LoadROM(string filename, uint32_t crc32Hash)
} }
int32_t archiveFileIndex = -1; int32_t archiveFileIndex = -1;
for(string folder : FolderUtilities::GetKnowGameFolders()) { for(string folder : FolderUtilities::GetKnownGameFolders()) {
string match = RomLoader::FindMatchingRomInFolder(folder, filename, crc32Hash, true, archiveFileIndex); string match = RomLoader::FindMatchingRomInFolder(folder, filename, crc32Hash, true, archiveFileIndex);
if(!match.empty()) { if(!match.empty()) {
Console::LoadROM(match, nullptr, archiveFileIndex); Console::LoadROM(match, nullptr, archiveFileIndex);
@ -135,7 +135,7 @@ bool Console::LoadROM(string filename, uint32_t crc32Hash)
} }
//Perform slow CRC32 search for ROM //Perform slow CRC32 search for ROM
for(string folder : FolderUtilities::GetKnowGameFolders()) { for(string folder : FolderUtilities::GetKnownGameFolders()) {
string match = RomLoader::FindMatchingRomInFolder(folder, filename, crc32Hash, false, archiveFileIndex); string match = RomLoader::FindMatchingRomInFolder(folder, filename, crc32Hash, false, archiveFileIndex);
if(!match.empty()) { if(!match.empty()) {
Console::LoadROM(match, nullptr, archiveFileIndex); Console::LoadROM(match, nullptr, archiveFileIndex);

View file

@ -20,6 +20,8 @@
<Message ID="RomsFound">{0} roms found</Message> <Message ID="RomsFound">{0} roms found</Message>
<Message ID="RandomGameNoGameFound">Mesen could not find any games to load.</Message>
<Message ID="CheatsFound">{0} games and {1} cheats in database</Message> <Message ID="CheatsFound">{0} games and {1} cheats in database</Message>
<Message ID="CheatsImported">{0} cheats imported for {1}.</Message> <Message ID="CheatsImported">{0} cheats imported for {1}.</Message>

View file

@ -84,6 +84,7 @@
<Control ID="mnuDebugger">Depurar</Control> <Control ID="mnuDebugger">Depurar</Control>
<Control ID="mnuLogWindow">Ventana de log</Control> <Control ID="mnuLogWindow">Ventana de log</Control>
<Control ID="mnuTakeScreenshot">Captura de pantalla</Control> <Control ID="mnuTakeScreenshot">Captura de pantalla</Control>
<Control ID="mnuRandomGame">Load Random Game</Control>
<Control ID="mnuHelp">Ayuda</Control> <Control ID="mnuHelp">Ayuda</Control>
<Control ID="mnuCheckForUpdates">Buscar actualizaciones</Control> <Control ID="mnuCheckForUpdates">Buscar actualizaciones</Control>
<Control ID="mnuReportBug">Enviar un error</Control> <Control ID="mnuReportBug">Enviar un error</Control>
@ -476,7 +477,11 @@
<Message ID="CheatsFound">{0} y {1} trucos de juegos presentes en la base de datos</Message> <Message ID="CheatsFound">{0} y {1} trucos de juegos presentes en la base de datos</Message>
<Message ID="CheatsImported">{0} trucos se importaron para el juego {1}.</Message> <Message ID="CheatsImported">{0} trucos se importaron para el juego {1}.</Message>
<Message ID="RomsFound">{0} roms encontradas</Message> <Message ID="RomsFound">{0} roms encontradas</Message>
<Message ID="RandomGameNoGameFound">Mesen could not find any games to load.</Message>
<Message ID="NsfNextTrack">Pista siguiente (Espera para jugar más rápido)</Message> <Message ID="NsfNextTrack">Pista siguiente (Espera para jugar más rápido)</Message>
<Message ID="NsfUnnamedTrack">[sin nombre]</Message> <Message ID="NsfUnnamedTrack">[sin nombre]</Message>
<Message ID="NsfUnknownField">[desconocido]</Message> <Message ID="NsfUnknownField">[desconocido]</Message>

View file

@ -83,6 +83,7 @@
<Control ID="mnuRunAllTests">Run all tests</Control> <Control ID="mnuRunAllTests">Run all tests</Control>
<Control ID="mnuDebugger">Débogueur</Control> <Control ID="mnuDebugger">Débogueur</Control>
<Control ID="mnuLogWindow">Fenêtre de log</Control> <Control ID="mnuLogWindow">Fenêtre de log</Control>
<Control ID="mnuRandomGame">Ouvrir un jeu aléatoire</Control>
<Control ID="mnuTakeScreenshot">Capture d'écran</Control> <Control ID="mnuTakeScreenshot">Capture d'écran</Control>
<Control ID="mnuHelp">Aide</Control> <Control ID="mnuHelp">Aide</Control>
<Control ID="mnuCheckForUpdates">Recherche de mises-à-jour</Control> <Control ID="mnuCheckForUpdates">Recherche de mises-à-jour</Control>
@ -489,6 +490,8 @@
<Message ID="RomsFound">{0} roms trouvés</Message> <Message ID="RomsFound">{0} roms trouvés</Message>
<Message ID="RandomGameNoGameFound">Mesen n'a pas trouvé de jeu sur votre disque.</Message>
<Message ID="CheatsFound">{0} jeux et {1} codes présents dans la base de données</Message> <Message ID="CheatsFound">{0} jeux et {1} codes présents dans la base de données</Message>
<Message ID="CheatsImported">{0} codes ont été importés pour le jeu {1}.</Message> <Message ID="CheatsImported">{0} codes ont été importés pour le jeu {1}.</Message>

View file

@ -84,6 +84,7 @@
<Control ID="mnuDebugger">デバッガ</Control> <Control ID="mnuDebugger">デバッガ</Control>
<Control ID="mnuLogWindow">ログウィンドウ</Control> <Control ID="mnuLogWindow">ログウィンドウ</Control>
<Control ID="mnuTakeScreenshot">スクリーンショットを撮る</Control> <Control ID="mnuTakeScreenshot">スクリーンショットを撮る</Control>
<Control ID="mnuRandomGame">ランダムゲームを開く</Control>
<Control ID="mnuHelp">ヘルプ</Control> <Control ID="mnuHelp">ヘルプ</Control>
<Control ID="mnuCheckForUpdates">アップデートの確認</Control> <Control ID="mnuCheckForUpdates">アップデートの確認</Control>
<Control ID="mnuReportBug">バグレポート</Control> <Control ID="mnuReportBug">バグレポート</Control>
@ -471,6 +472,8 @@
<Message ID="RomsFound">{0}個</Message> <Message ID="RomsFound">{0}個</Message>
<Message ID="RandomGameNoGameFound">Mesenはゲームファイルを見つかりませんでした。</Message>
<Message ID="CheatsFound">ゲーム{0}個とチートコード{1}個を見つけました</Message> <Message ID="CheatsFound">ゲーム{0}個とチートコード{1}個を見つけました</Message>
<Message ID="CheatsImported">{1}用のチートコード{0}個がインポートされました。.</Message> <Message ID="CheatsImported">{1}用のチートコード{0}個がインポートされました。.</Message>

View file

@ -84,6 +84,7 @@
<Control ID="mnuDebugger">Отладчик</Control> <Control ID="mnuDebugger">Отладчик</Control>
<Control ID="mnuLogWindow">Лог</Control> <Control ID="mnuLogWindow">Лог</Control>
<Control ID="mnuTakeScreenshot">Сделать скриншот</Control> <Control ID="mnuTakeScreenshot">Сделать скриншот</Control>
<Control ID="mnuRandomGame">Load Random Game</Control>
<Control ID="mnuHelp">Помощь</Control> <Control ID="mnuHelp">Помощь</Control>
<Control ID="mnuCheckForUpdates">Проверить обновления</Control> <Control ID="mnuCheckForUpdates">Проверить обновления</Control>
<Control ID="mnuReportBug">Сообщить об ошибке</Control> <Control ID="mnuReportBug">Сообщить об ошибке</Control>
@ -480,6 +481,8 @@
<Message ID="RomsFound">{0} Найденные ROM файлы</Message> <Message ID="RomsFound">{0} Найденные ROM файлы</Message>
<Message ID="RandomGameNoGameFound">Mesen could not find any games to load.</Message>
<Message ID="CheatsFound">игр {0}, читов {1}</Message> <Message ID="CheatsFound">игр {0}, читов {1}</Message>
<Message ID="CheatsImported">{0} читов импортировано для {1}.</Message> <Message ID="CheatsImported">{0} читов импортировано для {1}.</Message>

View file

@ -84,6 +84,7 @@
<Control ID="mnuDebugger">Налагодження</Control> <Control ID="mnuDebugger">Налагодження</Control>
<Control ID="mnuLogWindow">Лог</Control> <Control ID="mnuLogWindow">Лог</Control>
<Control ID="mnuTakeScreenshot">Зробити скріншот</Control> <Control ID="mnuTakeScreenshot">Зробити скріншот</Control>
<Control ID="mnuRandomGame">Load Random Game</Control>
<Control ID="mnuHelp">Допомога</Control> <Control ID="mnuHelp">Допомога</Control>
<Control ID="mnuCheckForUpdates">Перевірити оновлення</Control> <Control ID="mnuCheckForUpdates">Перевірити оновлення</Control>
<Control ID="mnuReportBug">Повідомити про помилку</Control> <Control ID="mnuReportBug">Повідомити про помилку</Control>
@ -479,6 +480,8 @@
<Message ID="RomsFound">{0} Знайдені ROM файли</Message> <Message ID="RomsFound">{0} Знайдені ROM файли</Message>
<Message ID="RandomGameNoGameFound">Mesen could not find any games to load.</Message>
<Message ID="CheatsFound">iгр {0}, читiв {1}</Message> <Message ID="CheatsFound">iгр {0}, читiв {1}</Message>
<Message ID="CheatsImported">{0} читiв імпортовано для {1}.</Message> <Message ID="CheatsImported">{0} читiв імпортовано для {1}.</Message>

View file

@ -159,6 +159,7 @@ namespace Mesen.GUI.Forms
this.mnuDebugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuDebugger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuLogWindow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuLogWindow = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.mnuRandomGame = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTakeScreenshot = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTakeScreenshot = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem();
this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem(); this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem();
@ -258,50 +259,50 @@ namespace Mesen.GUI.Forms
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen; this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen;
this.mnuOpen.Name = "mnuOpen"; this.mnuOpen.Name = "mnuOpen";
this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.mnuOpen.Size = new System.Drawing.Size(146, 22); this.mnuOpen.Size = new System.Drawing.Size(152, 22);
this.mnuOpen.Text = "Open"; this.mnuOpen.Text = "Open";
this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click); this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
// //
// toolStripMenuItem4 // toolStripMenuItem4
// //
this.toolStripMenuItem4.Name = "toolStripMenuItem4"; this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 6); this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6);
// //
// mnuSaveState // mnuSaveState
// //
this.mnuSaveState.Name = "mnuSaveState"; this.mnuSaveState.Name = "mnuSaveState";
this.mnuSaveState.Size = new System.Drawing.Size(146, 22); this.mnuSaveState.Size = new System.Drawing.Size(152, 22);
this.mnuSaveState.Text = "Save State"; this.mnuSaveState.Text = "Save State";
this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening); this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
// //
// mnuLoadState // mnuLoadState
// //
this.mnuLoadState.Name = "mnuLoadState"; this.mnuLoadState.Name = "mnuLoadState";
this.mnuLoadState.Size = new System.Drawing.Size(146, 22); this.mnuLoadState.Size = new System.Drawing.Size(152, 22);
this.mnuLoadState.Text = "Load State"; this.mnuLoadState.Text = "Load State";
this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening); this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening);
// //
// toolStripMenuItem7 // toolStripMenuItem7
// //
this.toolStripMenuItem7.Name = "toolStripMenuItem7"; this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(143, 6); this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6);
// //
// mnuRecentFiles // mnuRecentFiles
// //
this.mnuRecentFiles.Name = "mnuRecentFiles"; this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22); this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22);
this.mnuRecentFiles.Text = "Recent Files"; this.mnuRecentFiles.Text = "Recent Files";
// //
// toolStripMenuItem6 // toolStripMenuItem6
// //
this.toolStripMenuItem6.Name = "toolStripMenuItem6"; this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 6); this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
// //
// mnuExit // mnuExit
// //
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit; this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuExit.Name = "mnuExit"; this.mnuExit.Name = "mnuExit";
this.mnuExit.Size = new System.Drawing.Size(146, 22); this.mnuExit.Size = new System.Drawing.Size(152, 22);
this.mnuExit.Text = "Exit"; this.mnuExit.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click); this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
// //
@ -448,7 +449,7 @@ namespace Mesen.GUI.Forms
this.mnuShowFPS}); this.mnuShowFPS});
this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed; this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed;
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed"; this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
this.mnuEmulationSpeed.Size = new System.Drawing.Size(135, 22); this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationSpeed.Text = "Speed"; this.mnuEmulationSpeed.Text = "Speed";
this.mnuEmulationSpeed.DropDownOpening += new System.EventHandler(this.mnuEmulationSpeed_DropDownOpening); this.mnuEmulationSpeed.DropDownOpening += new System.EventHandler(this.mnuEmulationSpeed_DropDownOpening);
// //
@ -550,7 +551,7 @@ namespace Mesen.GUI.Forms
this.mnuFullscreen}); this.mnuFullscreen});
this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen; this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen;
this.mnuVideoScale.Name = "mnuVideoScale"; this.mnuVideoScale.Name = "mnuVideoScale";
this.mnuVideoScale.Size = new System.Drawing.Size(135, 22); this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
this.mnuVideoScale.Text = "Video Size"; this.mnuVideoScale.Text = "Video Size";
// //
// mnuScale1x // mnuScale1x
@ -658,7 +659,7 @@ namespace Mesen.GUI.Forms
this.toolStripMenuItem19, this.toolStripMenuItem19,
this.mnuBilinearInterpolation}); this.mnuBilinearInterpolation});
this.mnuVideoFilter.Name = "mnuVideoFilter"; this.mnuVideoFilter.Name = "mnuVideoFilter";
this.mnuVideoFilter.Size = new System.Drawing.Size(135, 22); this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
this.mnuVideoFilter.Text = "Video Filter"; this.mnuVideoFilter.Text = "Video Filter";
// //
// mnuNoneFilter // mnuNoneFilter
@ -841,7 +842,7 @@ namespace Mesen.GUI.Forms
this.mnuRegionDendy}); this.mnuRegionDendy});
this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.Globe; this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.Globe;
this.mnuRegion.Name = "mnuRegion"; this.mnuRegion.Name = "mnuRegion";
this.mnuRegion.Size = new System.Drawing.Size(135, 22); this.mnuRegion.Size = new System.Drawing.Size(152, 22);
this.mnuRegion.Text = "Region"; this.mnuRegion.Text = "Region";
// //
// mnuRegionAuto // mnuRegionAuto
@ -875,13 +876,13 @@ namespace Mesen.GUI.Forms
// toolStripMenuItem10 // toolStripMenuItem10
// //
this.toolStripMenuItem10.Name = "toolStripMenuItem10"; this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(132, 6); this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6);
// //
// mnuAudioConfig // mnuAudioConfig
// //
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio; this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
this.mnuAudioConfig.Name = "mnuAudioConfig"; this.mnuAudioConfig.Name = "mnuAudioConfig";
this.mnuAudioConfig.Size = new System.Drawing.Size(135, 22); this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
this.mnuAudioConfig.Text = "Audio"; this.mnuAudioConfig.Text = "Audio";
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click); this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
// //
@ -889,7 +890,7 @@ namespace Mesen.GUI.Forms
// //
this.mnuInput.Image = global::Mesen.GUI.Properties.Resources.Controller; this.mnuInput.Image = global::Mesen.GUI.Properties.Resources.Controller;
this.mnuInput.Name = "mnuInput"; this.mnuInput.Name = "mnuInput";
this.mnuInput.Size = new System.Drawing.Size(135, 22); this.mnuInput.Size = new System.Drawing.Size(152, 22);
this.mnuInput.Text = "Input"; this.mnuInput.Text = "Input";
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click); this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
// //
@ -897,7 +898,7 @@ namespace Mesen.GUI.Forms
// //
this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.Video; this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.Video;
this.mnuVideoConfig.Name = "mnuVideoConfig"; this.mnuVideoConfig.Name = "mnuVideoConfig";
this.mnuVideoConfig.Size = new System.Drawing.Size(135, 22); this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
this.mnuVideoConfig.Text = "Video"; this.mnuVideoConfig.Text = "Video";
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click); this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
// //
@ -905,20 +906,20 @@ namespace Mesen.GUI.Forms
// //
this.mnuEmulationConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches; this.mnuEmulationConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches;
this.mnuEmulationConfig.Name = "mnuEmulationConfig"; this.mnuEmulationConfig.Name = "mnuEmulationConfig";
this.mnuEmulationConfig.Size = new System.Drawing.Size(135, 22); this.mnuEmulationConfig.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationConfig.Text = "Emulation"; this.mnuEmulationConfig.Text = "Emulation";
this.mnuEmulationConfig.Click += new System.EventHandler(this.mnuEmulationConfig_Click); this.mnuEmulationConfig.Click += new System.EventHandler(this.mnuEmulationConfig_Click);
// //
// toolStripMenuItem11 // toolStripMenuItem11
// //
this.toolStripMenuItem11.Name = "toolStripMenuItem11"; this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(132, 6); this.toolStripMenuItem11.Size = new System.Drawing.Size(149, 6);
// //
// mnuPreferences // mnuPreferences
// //
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog; this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog;
this.mnuPreferences.Name = "mnuPreferences"; this.mnuPreferences.Name = "mnuPreferences";
this.mnuPreferences.Size = new System.Drawing.Size(135, 22); this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
this.mnuPreferences.Text = "Preferences"; this.mnuPreferences.Text = "Preferences";
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click); this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
// //
@ -934,6 +935,7 @@ namespace Mesen.GUI.Forms
this.mnuDebugger, this.mnuDebugger,
this.mnuLogWindow, this.mnuLogWindow,
this.toolStripMenuItem1, this.toolStripMenuItem1,
this.mnuRandomGame,
this.mnuTakeScreenshot}); this.mnuTakeScreenshot});
this.mnuTools.Name = "mnuTools"; this.mnuTools.Name = "mnuTools";
this.mnuTools.Size = new System.Drawing.Size(48, 20); this.mnuTools.Size = new System.Drawing.Size(48, 20);
@ -950,7 +952,7 @@ namespace Mesen.GUI.Forms
this.mnuProfile}); this.mnuProfile});
this.mnuNetPlay.Image = global::Mesen.GUI.Properties.Resources.NetPlay; this.mnuNetPlay.Image = global::Mesen.GUI.Properties.Resources.NetPlay;
this.mnuNetPlay.Name = "mnuNetPlay"; this.mnuNetPlay.Name = "mnuNetPlay";
this.mnuNetPlay.Size = new System.Drawing.Size(185, 22); this.mnuNetPlay.Size = new System.Drawing.Size(231, 22);
this.mnuNetPlay.Text = "Net Play"; this.mnuNetPlay.Text = "Net Play";
// //
// mnuStartServer // mnuStartServer
@ -1048,7 +1050,7 @@ namespace Mesen.GUI.Forms
this.mnuStopMovie}); this.mnuStopMovie});
this.mnuMovies.Image = global::Mesen.GUI.Properties.Resources.Movie; this.mnuMovies.Image = global::Mesen.GUI.Properties.Resources.Movie;
this.mnuMovies.Name = "mnuMovies"; this.mnuMovies.Name = "mnuMovies";
this.mnuMovies.Size = new System.Drawing.Size(185, 22); this.mnuMovies.Size = new System.Drawing.Size(231, 22);
this.mnuMovies.Text = "Movies"; this.mnuMovies.Text = "Movies";
// //
// mnuPlayMovie // mnuPlayMovie
@ -1098,7 +1100,7 @@ namespace Mesen.GUI.Forms
this.mnuWaveStop}); this.mnuWaveStop});
this.mnuSoundRecorder.Image = global::Mesen.GUI.Properties.Resources.Microphone; this.mnuSoundRecorder.Image = global::Mesen.GUI.Properties.Resources.Microphone;
this.mnuSoundRecorder.Name = "mnuSoundRecorder"; this.mnuSoundRecorder.Name = "mnuSoundRecorder";
this.mnuSoundRecorder.Size = new System.Drawing.Size(185, 22); this.mnuSoundRecorder.Size = new System.Drawing.Size(231, 22);
this.mnuSoundRecorder.Text = "Sound Recorder"; this.mnuSoundRecorder.Text = "Sound Recorder";
// //
// mnuWaveRecord // mnuWaveRecord
@ -1121,14 +1123,14 @@ namespace Mesen.GUI.Forms
// //
this.mnuCheats.Image = global::Mesen.GUI.Properties.Resources.CheatCode; this.mnuCheats.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuCheats.Name = "mnuCheats"; this.mnuCheats.Name = "mnuCheats";
this.mnuCheats.Size = new System.Drawing.Size(185, 22); this.mnuCheats.Size = new System.Drawing.Size(231, 22);
this.mnuCheats.Text = "Cheats"; this.mnuCheats.Text = "Cheats";
this.mnuCheats.Click += new System.EventHandler(this.mnuCheats_Click); this.mnuCheats.Click += new System.EventHandler(this.mnuCheats_Click);
// //
// toolStripMenuItem12 // toolStripMenuItem12
// //
this.toolStripMenuItem12.Name = "toolStripMenuItem12"; this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem12.Size = new System.Drawing.Size(182, 6); this.toolStripMenuItem12.Size = new System.Drawing.Size(228, 6);
// //
// mnuTests // mnuTests
// //
@ -1139,7 +1141,7 @@ namespace Mesen.GUI.Forms
this.mnuRunAllTests, this.mnuRunAllTests,
this.mnuRunAllGameTests}); this.mnuRunAllGameTests});
this.mnuTests.Name = "mnuTests"; this.mnuTests.Name = "mnuTests";
this.mnuTests.Size = new System.Drawing.Size(185, 22); this.mnuTests.Size = new System.Drawing.Size(231, 22);
this.mnuTests.Text = "Tests"; this.mnuTests.Text = "Tests";
// //
// mnuTestRun // mnuTestRun
@ -1214,7 +1216,7 @@ namespace Mesen.GUI.Forms
// mnuDebugger // mnuDebugger
// //
this.mnuDebugger.Name = "mnuDebugger"; this.mnuDebugger.Name = "mnuDebugger";
this.mnuDebugger.Size = new System.Drawing.Size(185, 22); this.mnuDebugger.Size = new System.Drawing.Size(231, 22);
this.mnuDebugger.Text = "Debugger"; this.mnuDebugger.Text = "Debugger";
this.mnuDebugger.Click += new System.EventHandler(this.mnuDebugger_Click); this.mnuDebugger.Click += new System.EventHandler(this.mnuDebugger_Click);
// //
@ -1222,21 +1224,30 @@ namespace Mesen.GUI.Forms
// //
this.mnuLogWindow.Image = global::Mesen.GUI.Properties.Resources.LogWindow; this.mnuLogWindow.Image = global::Mesen.GUI.Properties.Resources.LogWindow;
this.mnuLogWindow.Name = "mnuLogWindow"; this.mnuLogWindow.Name = "mnuLogWindow";
this.mnuLogWindow.Size = new System.Drawing.Size(185, 22); this.mnuLogWindow.Size = new System.Drawing.Size(231, 22);
this.mnuLogWindow.Text = "Log Window"; this.mnuLogWindow.Text = "Log Window";
this.mnuLogWindow.Click += new System.EventHandler(this.mnuLogWindow_Click); this.mnuLogWindow.Click += new System.EventHandler(this.mnuLogWindow_Click);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(182, 6); this.toolStripMenuItem1.Size = new System.Drawing.Size(228, 6);
//
// mnuRandomGame
//
this.mnuRandomGame.Image = global::Mesen.GUI.Properties.Resources.Dice;
this.mnuRandomGame.Name = "mnuRandomGame";
this.mnuRandomGame.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
this.mnuRandomGame.Size = new System.Drawing.Size(231, 22);
this.mnuRandomGame.Text = "Load Random Game";
this.mnuRandomGame.Click += new System.EventHandler(this.mnuRandomGame_Click);
// //
// mnuTakeScreenshot // mnuTakeScreenshot
// //
this.mnuTakeScreenshot.Image = global::Mesen.GUI.Properties.Resources.Camera; this.mnuTakeScreenshot.Image = global::Mesen.GUI.Properties.Resources.Camera;
this.mnuTakeScreenshot.Name = "mnuTakeScreenshot"; this.mnuTakeScreenshot.Name = "mnuTakeScreenshot";
this.mnuTakeScreenshot.ShortcutKeys = System.Windows.Forms.Keys.F12; this.mnuTakeScreenshot.ShortcutKeys = System.Windows.Forms.Keys.F12;
this.mnuTakeScreenshot.Size = new System.Drawing.Size(185, 22); this.mnuTakeScreenshot.Size = new System.Drawing.Size(231, 22);
this.mnuTakeScreenshot.Text = "Take Screenshot"; this.mnuTakeScreenshot.Text = "Take Screenshot";
this.mnuTakeScreenshot.Click += new System.EventHandler(this.mnuTakeScreenshot_Click); this.mnuTakeScreenshot.Click += new System.EventHandler(this.mnuTakeScreenshot_Click);
// //
@ -1446,6 +1457,7 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem20; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem20;
private System.Windows.Forms.ToolStripMenuItem mnuReportBug; private System.Windows.Forms.ToolStripMenuItem mnuReportBug;
private System.Windows.Forms.ToolStripMenuItem mnuRunAllGameTests; private System.Windows.Forms.ToolStripMenuItem mnuRunAllGameTests;
private System.Windows.Forms.ToolStripMenuItem mnuRandomGame;
} }
} }

View file

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -207,7 +208,7 @@ namespace Mesen.GUI.Forms
{ {
InteropEmu.InitializeEmu(ConfigManager.HomeFolder, this.Handle, this.ctrlRenderer.Handle, _noAudio, _noVideo, _noInput); InteropEmu.InitializeEmu(ConfigManager.HomeFolder, this.Handle, this.ctrlRenderer.Handle, _noAudio, _noVideo, _noInput);
foreach(RecentItem recentItem in ConfigManager.Config.RecentFiles) { foreach(RecentItem recentItem in ConfigManager.Config.RecentFiles) {
InteropEmu.AddKnowGameFolder(Path.GetDirectoryName(recentItem.Path).ToLowerInvariant()); InteropEmu.AddKnownGameFolder(Path.GetDirectoryName(recentItem.Path).ToLowerInvariant());
} }
ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.InitializeDefaults();
@ -1581,5 +1582,25 @@ namespace Mesen.GUI.Forms
} }
} }
} }
private void mnuRandomGame_Click(object sender, EventArgs e)
{
IEnumerable<string> gameFolders = ConfigManager.Config.RecentFiles.Select(recentFile => Path.GetDirectoryName(recentFile.Path).ToLowerInvariant()).Distinct();
List<string> gameRoms = new List<string>();
foreach(string folder in gameFolders) {
gameRoms.AddRange(Directory.EnumerateFiles(folder, "*.nes", SearchOption.TopDirectoryOnly));
gameRoms.AddRange(Directory.EnumerateFiles(folder, "*.unf", SearchOption.TopDirectoryOnly));
gameRoms.AddRange(Directory.EnumerateFiles(folder, "*.fds", SearchOption.TopDirectoryOnly));
}
if(gameRoms.Count == 0) {
MesenMsgBox.Show("RandomGameNoGameFound", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else {
Random random = new Random();
string randomGame = gameRoms[random.Next(gameRoms.Count - 1)];
LoadFile(randomGame);
}
}
} }
} }

View file

@ -875,6 +875,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Icon.ico" /> <Content Include="Icon.ico" />
<None Include="Resources\Dice.png" />
<None Include="Resources\Warning.png" /> <None Include="Resources\Warning.png" />
<None Include="Resources\Import.png" /> <None Include="Resources\Import.png" />
<None Include="Resources\Export.png" /> <None Include="Resources\Export.png" />

View file

@ -27,7 +27,7 @@ namespace Mesen.GUI
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsRunning(); [DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsRunning();
[DllImport(DLLPath)] public static extern void LoadROM([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string filename, Int32 archiveFileIndex, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string ipsFile); [DllImport(DLLPath)] public static extern void LoadROM([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string filename, Int32 archiveFileIndex, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string ipsFile);
[DllImport(DLLPath)] public static extern void AddKnowGameFolder([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string folder); [DllImport(DLLPath)] public static extern void AddKnownGameFolder([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string folder);
[DllImport(DLLPath, EntryPoint = "GetArchiveRomList")] private static extern IntPtr GetArchiveRomListWrapper([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string filename); [DllImport(DLLPath, EntryPoint = "GetArchiveRomList")] private static extern IntPtr GetArchiveRomListWrapper([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string filename);
public static List<string> GetArchiveRomList(string filename) { return new List<string>(PtrToStringUtf8(InteropEmu.GetArchiveRomListWrapper(filename)).Split(new string[] { "[!|!]" }, StringSplitOptions.RemoveEmptyEntries)); } public static List<string> GetArchiveRomList(string filename) { return new List<string>(PtrToStringUtf8(InteropEmu.GetArchiveRomListWrapper(filename)).Split(new string[] { "[!|!]" }, StringSplitOptions.RemoveEmptyEntries)); }

View file

@ -150,6 +150,16 @@ namespace Mesen.GUI.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Dice {
get {
object obj = ResourceManager.GetObject("Dice", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View file

@ -238,4 +238,7 @@
<data name="Warning" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Dice" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Dice.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

BIN
GUI.NET/Resources/Dice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -87,7 +87,7 @@ namespace InteropEmu {
DllExport bool __stdcall IsRunning() { return Console::IsRunning(); } DllExport bool __stdcall IsRunning() { return Console::IsRunning(); }
DllExport void __stdcall LoadROM(char* filename, int32_t archiveFileIndex, char* ipsFile) { Console::LoadROM(filename, nullptr, archiveFileIndex, ipsFile); } DllExport void __stdcall LoadROM(char* filename, int32_t archiveFileIndex, char* ipsFile) { Console::LoadROM(filename, nullptr, archiveFileIndex, ipsFile); }
DllExport void __stdcall AddKnowGameFolder(char* folder) { FolderUtilities::AddKnowGameFolder(folder); } DllExport void __stdcall AddKnownGameFolder(char* folder) { FolderUtilities::AddKnownGameFolder(folder); }
DllExport const char* __stdcall GetArchiveRomList(char* filename) { DllExport const char* __stdcall GetArchiveRomList(char* filename) {
std::ostringstream out; std::ostringstream out;

View file

@ -24,7 +24,7 @@ string FolderUtilities::GetHomeFolder()
return _homeFolder; return _homeFolder;
} }
void FolderUtilities::AddKnowGameFolder(string gameFolder) void FolderUtilities::AddKnownGameFolder(string gameFolder)
{ {
bool alreadyExists = false; bool alreadyExists = false;
for(string folder : _gameFolders) { for(string folder : _gameFolders) {
@ -40,7 +40,7 @@ void FolderUtilities::AddKnowGameFolder(string gameFolder)
} }
} }
vector<string> FolderUtilities::GetKnowGameFolders() vector<string> FolderUtilities::GetKnownGameFolders()
{ {
return _gameFolders; return _gameFolders;
} }

View file

@ -12,8 +12,8 @@ public:
static void SetHomeFolder(string homeFolder); static void SetHomeFolder(string homeFolder);
static string GetHomeFolder(); static string GetHomeFolder();
static void AddKnowGameFolder(string gameFolder); static void AddKnownGameFolder(string gameFolder);
static vector<string> GetKnowGameFolders(); static vector<string> GetKnownGameFolders();
static string GetSaveFolder(); static string GetSaveFolder();
static string GetSaveStateFolder(); static string GetSaveStateFolder();