diff --git a/Core/Console.cpp b/Core/Console.cpp
index 151a55a2..d8b2cad1 100644
--- a/Core/Console.cpp
+++ b/Core/Console.cpp
@@ -81,9 +81,6 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
if(!_romFilepath.empty() && _mapper) {
//Ensure we save any battery file before loading a new game
SaveBatteries();
-
- //Save current game state before loading another one
- SaveStateManager::SaveRecentGame(GetMapperInfo().RomName, _romFilepath, _patchFilename);
}
if(romFile.IsValid()) {
@@ -111,6 +108,11 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &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;
_patchFilename = patchFile;
diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h
index e3112eb6..045359f7 100644
--- a/Core/EmulationSettings.h
+++ b/Core/EmulationSettings.h
@@ -471,6 +471,8 @@ enum class EmulatorShortcut
LoadStateSlotAuto,
LoadStateFromFile,
+ LoadLastSession,
+
OpenFile,
ShortcutCount
};
diff --git a/GUI.NET/Dependencies/resources.ca.xml b/GUI.NET/Dependencies/resources.ca.xml
index 133ee3d4..a4e1ac0e 100644
--- a/GUI.NET/Dependencies/resources.ca.xml
+++ b/GUI.NET/Dependencies/resources.ca.xml
@@ -6,6 +6,7 @@
Obre
Desa
Carrega
+ Load Last Session
Fitxers recents
Surt
Joc
@@ -830,6 +831,7 @@
Carrega la partida - Posició 10
Load State - Auto Save Slot
Carrega la partida des d'un fitxer
+ Load Last Session
Obre un fitxer
Obre el depurador
Obre l'assemblador
diff --git a/GUI.NET/Dependencies/resources.en.xml b/GUI.NET/Dependencies/resources.en.xml
index 146d2222..4f0bf561 100644
--- a/GUI.NET/Dependencies/resources.en.xml
+++ b/GUI.NET/Dependencies/resources.en.xml
@@ -161,6 +161,7 @@
Load State - Slot 10
Load State - Auto Save Slot
Load State from File
+ Load Last Session
Open File
Open Debugger
Open Assembler
diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml
index 7e8314ca..fa36f962 100644
--- a/GUI.NET/Dependencies/resources.es.xml
+++ b/GUI.NET/Dependencies/resources.es.xml
@@ -6,6 +6,7 @@
Abrir
Guardar
Cargar
+ Load Last Session
Archivos recientes
Salir
Juego
@@ -847,6 +848,7 @@
Cargar partida - Hueco 10
Load State - Auto Save Slot
Cargar partida de archivo
+ Load Last Session
Abrir archivo
Abrir depurador
Abrir ensamblador
diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml
index e6a1f71a..b16a67af 100644
--- a/GUI.NET/Dependencies/resources.fr.xml
+++ b/GUI.NET/Dependencies/resources.fr.xml
@@ -6,6 +6,7 @@
Ouvrir
Sauvegarder
Charger
+ Charger la session précédente
Fichier récents
Quitter
Jeu
@@ -860,6 +861,7 @@
Chargement d'état - Position 10
Chargement d'état - Sauvegarde auto
Charger l'état à partir d'un fichier
+ Charger la session précédente
Ouvrir un fichier
Ouvrir le débogueur
Ouvrir l'assembleur
diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml
index d93beef6..93d82587 100644
--- a/GUI.NET/Dependencies/resources.ja.xml
+++ b/GUI.NET/Dependencies/resources.ja.xml
@@ -6,6 +6,7 @@
開く
クイックセーブ
クイックロード
+ 前セッションをロードする
最近開いたファイル
終了
ゲーム
@@ -844,6 +845,7 @@
クイックセーブスロット10からロードする
自動クイックセーブスロットからロードする
クイックセーブデータをファイルからロードする
+ 前セッションをロードする
ファイルを開く
デバッガを開く
アセンブラを開く
diff --git a/GUI.NET/Dependencies/resources.pt.xml b/GUI.NET/Dependencies/resources.pt.xml
index 72f7dbfb..cdec907f 100644
--- a/GUI.NET/Dependencies/resources.pt.xml
+++ b/GUI.NET/Dependencies/resources.pt.xml
@@ -6,6 +6,7 @@
Abrir
Salvar estado
Carregar estado
+ Load Last Session
Arquivos recentes
Sair
Jogo
@@ -845,6 +846,7 @@
Carregar estado - Compartimento 10
Load State - Auto Save Slot
Carregar estado de arquivo
+ Load Last Session
Abrir arquivo
Abrir depurador
Abrir Assembler
diff --git a/GUI.NET/Dependencies/resources.ru.xml b/GUI.NET/Dependencies/resources.ru.xml
index 632a9396..da1952d6 100644
--- a/GUI.NET/Dependencies/resources.ru.xml
+++ b/GUI.NET/Dependencies/resources.ru.xml
@@ -6,6 +6,7 @@
Открыть
Сохранить
Загрузить
+ Load Last Session
Недавние файлы
Выход
Игра
@@ -849,6 +850,7 @@
Load State - Slot 10
Load State - Auto Save Slot
Load State from File
+ Load Last Session
Open File
Open Debugger
Open Assembler
diff --git a/GUI.NET/Dependencies/resources.uk.xml b/GUI.NET/Dependencies/resources.uk.xml
index a6060e11..42aec225 100644
--- a/GUI.NET/Dependencies/resources.uk.xml
+++ b/GUI.NET/Dependencies/resources.uk.xml
@@ -6,6 +6,7 @@
Відкрити
Зберегти
Завантажити
+ Load Last Session
Недавнi файлы
Вихід
Гра
@@ -849,6 +850,7 @@
Load State - Slot 10
Load State - Auto Save Slot
Завантажити стан з файлу
+ Load Last Session
Відкрити файл
Відкрити Debugger
Відкрити Assembler
diff --git a/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs
index ed120ae4..7f2b2402 100644
--- a/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs
+++ b/GUI.NET/Forms/Config/ctrlEmulatorShortcuts.cs
@@ -112,6 +112,7 @@ namespace Mesen.GUI.Forms.Config
EmulatorShortcut.LoadStateSlot10,
EmulatorShortcut.LoadStateSlotAuto,
EmulatorShortcut.LoadStateFromFile,
+ EmulatorShortcut.LoadLastSession,
};
HashSet keyCombinations = new HashSet();
diff --git a/GUI.NET/Forms/frmMain.Designer.cs b/GUI.NET/Forms/frmMain.Designer.cs
index d6e7eec8..b3664bbe 100644
--- a/GUI.NET/Forms/frmMain.Designer.cs
+++ b/GUI.NET/Forms/frmMain.Designer.cs
@@ -204,6 +204,7 @@ namespace Mesen.GUI.Forms
this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuLoadLastSession = new System.Windows.Forms.ToolStripMenuItem();
this.panelRenderer.SuspendLayout();
this.panelInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
@@ -333,6 +334,7 @@ namespace Mesen.GUI.Forms
this.toolStripMenuItem4,
this.mnuSaveState,
this.mnuLoadState,
+ this.mnuLoadLastSession,
this.toolStripMenuItem7,
this.mnuRecentFiles,
this.toolStripMenuItem6,
@@ -347,50 +349,50 @@ namespace Mesen.GUI.Forms
//
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen;
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";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
- this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6);
+ this.toolStripMenuItem4.Size = new System.Drawing.Size(163, 6);
//
// 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.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
//
// 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.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
- this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6);
+ this.toolStripMenuItem7.Size = new System.Drawing.Size(163, 6);
//
// 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.DropDownOpening += new System.EventHandler(this.mnuRecentFiles_DropDownOpening);
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
- this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
+ this.toolStripMenuItem6.Size = new System.Drawing.Size(163, 6);
//
// mnuExit
//
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
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";
//
// mnuGame
@@ -1615,6 +1617,12 @@ namespace Mesen.GUI.Forms
this.mnuAbout.Text = "About";
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
//
this.AllowDrop = true;
@@ -1817,6 +1825,7 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripMenuItem mnuStopRecordTapeFile;
private System.Windows.Forms.ToolStripMenuItem mnuApuViewer;
private System.Windows.Forms.ToolStripMenuItem mnuEventViewer;
+ private System.Windows.Forms.ToolStripMenuItem mnuLoadLastSession;
}
}
diff --git a/GUI.NET/Forms/frmMain.File.cs b/GUI.NET/Forms/frmMain.File.cs
index 6f23dc1d..5c78cef8 100644
--- a/GUI.NET/Forms/frmMain.File.cs
+++ b/GUI.NET/Forms/frmMain.File.cs
@@ -127,6 +127,14 @@ namespace Mesen.GUI.Forms
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()
{
using(OpenFileDialog ofd = new OpenFileDialog()) {
@@ -264,6 +272,7 @@ namespace Mesen.GUI.Forms
private void mnuFile_DropDownOpening(object sender, EventArgs e)
{
mnuRecentFiles.Enabled = ConfigManager.Config.RecentFiles.Count > 0;
+ mnuLoadLastSession.Visible = !ConfigManager.Config.PreferenceInfo.DisableGameSelectionScreen;
}
private void UpdateRecentFiles()
diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs
index 78ca2b94..3cf117e6 100644
--- a/GUI.NET/Forms/frmMain.cs
+++ b/GUI.NET/Forms/frmMain.cs
@@ -629,6 +629,11 @@ namespace Mesen.GUI.Forms
Func runningVsSystem = () => { return _emuThread != null && InteropEmu.IsVsSystem() && !InteropEmu.MoviePlaying() && !InteropEmu.IsConnected(); };
Func hasBarcodeReader = () => { return InteropEmu.GetAvailableFeatures().HasFlag(ConsoleFeatures.BarcodeReader) && !InteropEmu.IsConnected(); };
+ Func 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(mnuExit, EmulatorShortcut.Exit);
BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient);
@@ -659,6 +664,8 @@ namespace Mesen.GUI.Forms
BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);
+ BindShortcut(mnuLoadLastSession, EmulatorShortcut.LoadLastSession, enableLoadLastSession);
+
BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, runningNotNsf);
BindShortcut(mnuRandomGame, EmulatorShortcut.LoadRandomGame);
@@ -788,6 +795,8 @@ namespace Mesen.GUI.Forms
case EmulatorShortcut.LoadStateSlot9: LoadState(9); break;
case EmulatorShortcut.LoadStateSlot10: LoadState(10); break;
case EmulatorShortcut.LoadStateSlotAuto: LoadState(11); break;
+
+ case EmulatorShortcut.LoadLastSession: LoadLastSession(); break;
}
if(restoreFullscreen && _frmFullscreenRenderer == null) {
diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs
index 6d834131..6e2bafa8 100644
--- a/GUI.NET/InteropEmu.cs
+++ b/GUI.NET/InteropEmu.cs
@@ -1768,6 +1768,8 @@ namespace Mesen.GUI
LoadStateSlotAuto,
LoadStateFromFile,
+ LoadLastSession,
+
OpenFile,