UI: Added "Load Last Session" option to load the last available "recent game" data for the currently loaded game

This commit is contained in:
Sour 2018-03-20 23:17:39 -04:00
parent bdc7bd8b14
commit 8cb541a8a9
15 changed files with 60 additions and 11 deletions

View file

@ -81,9 +81,6 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
if(!_romFilepath.empty() && _mapper) { if(!_romFilepath.empty() && _mapper) {
//Ensure we save any battery file before loading a new game //Ensure we save any battery file before loading a new game
SaveBatteries(); SaveBatteries();
//Save current game state before loading another one
SaveStateManager::SaveRecentGame(GetMapperInfo().RomName, _romFilepath, _patchFilename);
} }
if(romFile.IsValid()) { if(romFile.IsValid()) {
@ -111,6 +108,11 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
} }
if(_romFilepath != (string)romFile || _patchFilename != (string)patchFile) { if(_romFilepath != (string)romFile || _patchFilename != (string)patchFile) {
//Save current game state before loading another one
if(_mapper) {
SaveStateManager::SaveRecentGame(GetMapperInfo().RomName, _romFilepath, _patchFilename);
}
_romFilepath = romFile; _romFilepath = romFile;
_patchFilename = patchFile; _patchFilename = patchFile;

View file

@ -471,6 +471,8 @@ enum class EmulatorShortcut
LoadStateSlotAuto, LoadStateSlotAuto,
LoadStateFromFile, LoadStateFromFile,
LoadLastSession,
OpenFile, OpenFile,
ShortcutCount ShortcutCount
}; };

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Obre</Control> <Control ID="mnuOpen">Obre</Control>
<Control ID="mnuSaveState">Desa</Control> <Control ID="mnuSaveState">Desa</Control>
<Control ID="mnuLoadState">Carrega</Control> <Control ID="mnuLoadState">Carrega</Control>
<Control ID="mnuLoadLastSession">Load Last Session</Control>
<Control ID="mnuRecentFiles">Fitxers recents</Control> <Control ID="mnuRecentFiles">Fitxers recents</Control>
<Control ID="mnuExit">Surt</Control> <Control ID="mnuExit">Surt</Control>
<Control ID="mnuGame">Joc</Control> <Control ID="mnuGame">Joc</Control>
@ -830,6 +831,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Carrega la partida - Posició 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Carrega la partida - Posició 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Carrega la partida des d'un fitxer</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Carrega la partida des d'un fitxer</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Obre un fitxer</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Obre un fitxer</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Obre el depurador</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Obre el depurador</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Obre l'assemblador</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Obre l'assemblador</Message>

View file

@ -161,6 +161,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Abrir</Control> <Control ID="mnuOpen">Abrir</Control>
<Control ID="mnuSaveState">Guardar</Control> <Control ID="mnuSaveState">Guardar</Control>
<Control ID="mnuLoadState">Cargar</Control> <Control ID="mnuLoadState">Cargar</Control>
<Control ID="mnuLoadLastSession">Load Last Session</Control>
<Control ID="mnuRecentFiles">Archivos recientes</Control> <Control ID="mnuRecentFiles">Archivos recientes</Control>
<Control ID="mnuExit">Salir</Control> <Control ID="mnuExit">Salir</Control>
<Control ID="mnuGame">Juego</Control> <Control ID="mnuGame">Juego</Control>
@ -847,6 +848,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Cargar partida - Hueco 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Cargar partida - Hueco 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Cargar partida de archivo</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Cargar partida de archivo</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Abrir archivo</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Abrir archivo</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Abrir depurador</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Abrir depurador</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Abrir ensamblador</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Abrir ensamblador</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Ouvrir</Control> <Control ID="mnuOpen">Ouvrir</Control>
<Control ID="mnuSaveState">Sauvegarder</Control> <Control ID="mnuSaveState">Sauvegarder</Control>
<Control ID="mnuLoadState">Charger</Control> <Control ID="mnuLoadState">Charger</Control>
<Control ID="mnuLoadLastSession">Charger la session précédente</Control>
<Control ID="mnuRecentFiles">Fichier récents</Control> <Control ID="mnuRecentFiles">Fichier récents</Control>
<Control ID="mnuExit">Quitter</Control> <Control ID="mnuExit">Quitter</Control>
<Control ID="mnuGame">Jeu</Control> <Control ID="mnuGame">Jeu</Control>
@ -860,6 +861,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Chargement d'état - Position 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Chargement d'état - Position 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Chargement d'état - Sauvegarde auto</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Chargement d'état - Sauvegarde auto</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Charger l'état à partir d'un fichier</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Charger l'état à partir d'un fichier</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Charger la session précédente</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Ouvrir un fichier</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Ouvrir un fichier</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Ouvrir le débogueur</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Ouvrir le débogueur</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Ouvrir l'assembleur</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Ouvrir l'assembleur</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">開く</Control> <Control ID="mnuOpen">開く</Control>
<Control ID="mnuSaveState">クイックセーブ</Control> <Control ID="mnuSaveState">クイックセーブ</Control>
<Control ID="mnuLoadState">クイックロード</Control> <Control ID="mnuLoadState">クイックロード</Control>
<Control ID="mnuLoadLastSession">前セッションをロードする</Control>
<Control ID="mnuRecentFiles">最近開いたファイル</Control> <Control ID="mnuRecentFiles">最近開いたファイル</Control>
<Control ID="mnuExit">終了</Control> <Control ID="mnuExit">終了</Control>
<Control ID="mnuGame">ゲーム</Control> <Control ID="mnuGame">ゲーム</Control>
@ -844,6 +845,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">クイックセーブスロット10からロードする</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">クイックセーブスロット10からロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">自動クイックセーブスロットからロードする</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">自動クイックセーブスロットからロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">クイックセーブデータをファイルからロードする</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">クイックセーブデータをファイルからロードする</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">前セッションをロードする</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">ファイルを開く</Message> <Message ID="EmulatorShortcutMappings_OpenFile">ファイルを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">デバッガを開く</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">デバッガを開く</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">アセンブラを開く</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">アセンブラを開く</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Abrir</Control> <Control ID="mnuOpen">Abrir</Control>
<Control ID="mnuSaveState">Salvar estado</Control> <Control ID="mnuSaveState">Salvar estado</Control>
<Control ID="mnuLoadState">Carregar estado</Control> <Control ID="mnuLoadState">Carregar estado</Control>
<Control ID="mnuLoadLastSession">Load Last Session</Control>
<Control ID="mnuRecentFiles">Arquivos recentes</Control> <Control ID="mnuRecentFiles">Arquivos recentes</Control>
<Control ID="mnuExit">Sair</Control> <Control ID="mnuExit">Sair</Control>
<Control ID="mnuGame">Jogo</Control> <Control ID="mnuGame">Jogo</Control>
@ -845,6 +846,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Carregar estado - Compartimento 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Carregar estado - Compartimento 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Carregar estado de arquivo</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Carregar estado de arquivo</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Abrir arquivo</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Abrir arquivo</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Abrir depurador</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Abrir depurador</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Abrir Assembler</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Abrir Assembler</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Открыть</Control> <Control ID="mnuOpen">Открыть</Control>
<Control ID="mnuSaveState">Сохранить</Control> <Control ID="mnuSaveState">Сохранить</Control>
<Control ID="mnuLoadState">Загрузить</Control> <Control ID="mnuLoadState">Загрузить</Control>
<Control ID="mnuLoadLastSession">Load Last Session</Control>
<Control ID="mnuRecentFiles">Недавние файлы</Control> <Control ID="mnuRecentFiles">Недавние файлы</Control>
<Control ID="mnuExit">Выход</Control> <Control ID="mnuExit">Выход</Control>
<Control ID="mnuGame">Игра</Control> <Control ID="mnuGame">Игра</Control>
@ -849,6 +850,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Load State from File</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Open File</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Open Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Open Assembler</Message>

View file

@ -6,6 +6,7 @@
<Control ID="mnuOpen">Відкрити</Control> <Control ID="mnuOpen">Відкрити</Control>
<Control ID="mnuSaveState">Зберегти</Control> <Control ID="mnuSaveState">Зберегти</Control>
<Control ID="mnuLoadState">Завантажити</Control> <Control ID="mnuLoadState">Завантажити</Control>
<Control ID="mnuLoadLastSession">Load Last Session</Control>
<Control ID="mnuRecentFiles">Недавнi файлы</Control> <Control ID="mnuRecentFiles">Недавнi файлы</Control>
<Control ID="mnuExit">Вихід</Control> <Control ID="mnuExit">Вихід</Control>
<Control ID="mnuGame">Гра</Control> <Control ID="mnuGame">Гра</Control>
@ -849,6 +850,7 @@
<Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlot10">Load State - Slot 10</Message>
<Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message> <Message ID="EmulatorShortcutMappings_LoadStateSlotAuto">Load State - Auto Save Slot</Message>
<Message ID="EmulatorShortcutMappings_LoadStateFromFile">Завантажити стан з файлу</Message> <Message ID="EmulatorShortcutMappings_LoadStateFromFile">Завантажити стан з файлу</Message>
<Message ID="EmulatorShortcutMappings_LoadLastSession">Load Last Session</Message>
<Message ID="EmulatorShortcutMappings_OpenFile">Відкрити файл</Message> <Message ID="EmulatorShortcutMappings_OpenFile">Відкрити файл</Message>
<Message ID="EmulatorShortcutMappings_OpenDebugger">Відкрити Debugger</Message> <Message ID="EmulatorShortcutMappings_OpenDebugger">Відкрити Debugger</Message>
<Message ID="EmulatorShortcutMappings_OpenAssembler">Відкрити Assembler</Message> <Message ID="EmulatorShortcutMappings_OpenAssembler">Відкрити Assembler</Message>

View file

@ -112,6 +112,7 @@ namespace Mesen.GUI.Forms.Config
EmulatorShortcut.LoadStateSlot10, EmulatorShortcut.LoadStateSlot10,
EmulatorShortcut.LoadStateSlotAuto, EmulatorShortcut.LoadStateSlotAuto,
EmulatorShortcut.LoadStateFromFile, EmulatorShortcut.LoadStateFromFile,
EmulatorShortcut.LoadLastSession,
}; };
HashSet<string> keyCombinations = new HashSet<string>(); HashSet<string> keyCombinations = new HashSet<string>();

View file

@ -204,6 +204,7 @@ namespace Mesen.GUI.Forms
this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem(); this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.mnuLoadLastSession = new System.Windows.Forms.ToolStripMenuItem();
this.panelRenderer.SuspendLayout(); this.panelRenderer.SuspendLayout();
this.panelInfo.SuspendLayout(); this.panelInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
@ -333,6 +334,7 @@ namespace Mesen.GUI.Forms
this.toolStripMenuItem4, this.toolStripMenuItem4,
this.mnuSaveState, this.mnuSaveState,
this.mnuLoadState, this.mnuLoadState,
this.mnuLoadLastSession,
this.toolStripMenuItem7, this.toolStripMenuItem7,
this.mnuRecentFiles, this.mnuRecentFiles,
this.toolStripMenuItem6, this.toolStripMenuItem6,
@ -347,50 +349,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.Size = new System.Drawing.Size(152, 22); this.mnuOpen.Size = new System.Drawing.Size(166, 22);
this.mnuOpen.Text = "Open"; this.mnuOpen.Text = "Open";
// //
// toolStripMenuItem4 // toolStripMenuItem4
// //
this.toolStripMenuItem4.Name = "toolStripMenuItem4"; this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6); this.toolStripMenuItem4.Size = new System.Drawing.Size(163, 6);
// //
// mnuSaveState // mnuSaveState
// //
this.mnuSaveState.Name = "mnuSaveState"; this.mnuSaveState.Name = "mnuSaveState";
this.mnuSaveState.Size = new System.Drawing.Size(152, 22); this.mnuSaveState.Size = new System.Drawing.Size(166, 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(152, 22); this.mnuLoadState.Size = new System.Drawing.Size(166, 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(149, 6); this.toolStripMenuItem7.Size = new System.Drawing.Size(163, 6);
// //
// mnuRecentFiles // mnuRecentFiles
// //
this.mnuRecentFiles.Name = "mnuRecentFiles"; this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22); this.mnuRecentFiles.Size = new System.Drawing.Size(166, 22);
this.mnuRecentFiles.Text = "Recent Files"; this.mnuRecentFiles.Text = "Recent Files";
this.mnuRecentFiles.DropDownOpening += new System.EventHandler(this.mnuRecentFiles_DropDownOpening); this.mnuRecentFiles.DropDownOpening += new System.EventHandler(this.mnuRecentFiles_DropDownOpening);
// //
// toolStripMenuItem6 // toolStripMenuItem6
// //
this.toolStripMenuItem6.Name = "toolStripMenuItem6"; this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6); this.toolStripMenuItem6.Size = new System.Drawing.Size(163, 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(152, 22); this.mnuExit.Size = new System.Drawing.Size(166, 22);
this.mnuExit.Text = "Exit"; this.mnuExit.Text = "Exit";
// //
// mnuGame // mnuGame
@ -1615,6 +1617,12 @@ namespace Mesen.GUI.Forms
this.mnuAbout.Text = "About"; this.mnuAbout.Text = "About";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click); this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
// //
// mnuLoadLastSession
//
this.mnuLoadLastSession.Name = "mnuLoadLastSession";
this.mnuLoadLastSession.Size = new System.Drawing.Size(166, 22);
this.mnuLoadLastSession.Text = "Load Last Session";
//
// frmMain // frmMain
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -1817,6 +1825,7 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripMenuItem mnuStopRecordTapeFile; private System.Windows.Forms.ToolStripMenuItem mnuStopRecordTapeFile;
private System.Windows.Forms.ToolStripMenuItem mnuApuViewer; private System.Windows.Forms.ToolStripMenuItem mnuApuViewer;
private System.Windows.Forms.ToolStripMenuItem mnuEventViewer; private System.Windows.Forms.ToolStripMenuItem mnuEventViewer;
private System.Windows.Forms.ToolStripMenuItem mnuLoadLastSession;
} }
} }

View file

@ -127,6 +127,14 @@ namespace Mesen.GUI.Forms
UpdateStateMenu(mnuLoadState, false); UpdateStateMenu(mnuLoadState, false);
} }
private void LoadLastSession()
{
string recentGameFile = Path.Combine(ConfigManager.RecentGamesFolder, Path.GetFileNameWithoutExtension(_currentRomPath.Value.FileName) + ".rgd");
if(File.Exists(recentGameFile)) {
InteropEmu.LoadRecentGame(recentGameFile, false);
}
}
private void OpenFile() private void OpenFile()
{ {
using(OpenFileDialog ofd = new OpenFileDialog()) { using(OpenFileDialog ofd = new OpenFileDialog()) {
@ -264,6 +272,7 @@ namespace Mesen.GUI.Forms
private void mnuFile_DropDownOpening(object sender, EventArgs e) private void mnuFile_DropDownOpening(object sender, EventArgs e)
{ {
mnuRecentFiles.Enabled = ConfigManager.Config.RecentFiles.Count > 0; mnuRecentFiles.Enabled = ConfigManager.Config.RecentFiles.Count > 0;
mnuLoadLastSession.Visible = !ConfigManager.Config.PreferenceInfo.DisableGameSelectionScreen;
} }
private void UpdateRecentFiles() private void UpdateRecentFiles()

View file

@ -629,6 +629,11 @@ namespace Mesen.GUI.Forms
Func<bool> runningVsSystem = () => { return _emuThread != null && InteropEmu.IsVsSystem() && !InteropEmu.MoviePlaying() && !InteropEmu.IsConnected(); }; Func<bool> runningVsSystem = () => { return _emuThread != null && InteropEmu.IsVsSystem() && !InteropEmu.MoviePlaying() && !InteropEmu.IsConnected(); };
Func<bool> hasBarcodeReader = () => { return InteropEmu.GetAvailableFeatures().HasFlag(ConsoleFeatures.BarcodeReader) && !InteropEmu.IsConnected(); }; Func<bool> hasBarcodeReader = () => { return InteropEmu.GetAvailableFeatures().HasFlag(ConsoleFeatures.BarcodeReader) && !InteropEmu.IsConnected(); };
Func<bool> enableLoadLastSession = () => {
string recentGameFile = _currentRomPath.HasValue ? Path.Combine(ConfigManager.RecentGamesFolder, Path.GetFileNameWithoutExtension(_currentRomPath.Value.FileName) + ".rgd") : "";
return _emuThread != null && File.Exists(recentGameFile) && !ConfigManager.Config.PreferenceInfo.DisableGameSelectionScreen;
};
BindShortcut(mnuOpen, EmulatorShortcut.OpenFile); BindShortcut(mnuOpen, EmulatorShortcut.OpenFile);
BindShortcut(mnuExit, EmulatorShortcut.Exit); BindShortcut(mnuExit, EmulatorShortcut.Exit);
BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient); BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient);
@ -659,6 +664,8 @@ namespace Mesen.GUI.Forms
BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen); BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);
BindShortcut(mnuLoadLastSession, EmulatorShortcut.LoadLastSession, enableLoadLastSession);
BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, runningNotNsf); BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, runningNotNsf);
BindShortcut(mnuRandomGame, EmulatorShortcut.LoadRandomGame); BindShortcut(mnuRandomGame, EmulatorShortcut.LoadRandomGame);
@ -788,6 +795,8 @@ namespace Mesen.GUI.Forms
case EmulatorShortcut.LoadStateSlot9: LoadState(9); break; case EmulatorShortcut.LoadStateSlot9: LoadState(9); break;
case EmulatorShortcut.LoadStateSlot10: LoadState(10); break; case EmulatorShortcut.LoadStateSlot10: LoadState(10); break;
case EmulatorShortcut.LoadStateSlotAuto: LoadState(11); break; case EmulatorShortcut.LoadStateSlotAuto: LoadState(11); break;
case EmulatorShortcut.LoadLastSession: LoadLastSession(); break;
} }
if(restoreFullscreen && _frmFullscreenRenderer == null) { if(restoreFullscreen && _frmFullscreenRenderer == null) {

View file

@ -1768,6 +1768,8 @@ namespace Mesen.GUI
LoadStateSlotAuto, LoadStateSlotAuto,
LoadStateFromFile, LoadStateFromFile,
LoadLastSession,
OpenFile, OpenFile,