Command line: Added a /loadlastsession option to load the game's last known state after loading it

This commit is contained in:
Sour 2018-12-22 16:27:14 -05:00
parent 8bd292d8d5
commit 7814165bb8
11 changed files with 22 additions and 1 deletions

View File

@ -737,6 +737,7 @@
<Message ID="HelpFullscreen">/fullscreen - Inicia Mesen en pantalla completa</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Evita que els canvis es desin (útil per a evitar que les opcions de la línia d'ordres es converteixin en la configuració per defecte)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Continua</Message>
<Message ID="Pause">Pausa</Message>

View File

@ -767,6 +767,7 @@
<Message ID="HelpFullscreen">/fullscreen - Start Mesen in fullscreen mode</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Resume</Message>
<Message ID="Pause">Pause</Message>

View File

@ -754,6 +754,7 @@
<Message ID="HelpFullscreen">/fullscreen - Inicia Mesen en pantalla completa</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Previene que las opciones se graben en disco (útil para evitar que las opciones de la línea de comandos se conviertan en la configuración predeterminada)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Continuar</Message>
<Message ID="Pause">Pausa</Message>

View File

@ -767,7 +767,8 @@
<Message ID="HelpFullscreen">/fullscreen - Démarre Mesen en mode plein écran</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Empêche la sauvegarde des paramètres sur le disque (autrement les options données en ligne de commande seront permanentes)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="nom_du_film.mmo" - Démarre l'enregistrement d'un film pour le jeu spécifié en ligne de commande.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Reprend le jeu dans l'état où il était lors dans la dernière session de jeu.</Message>
<Message ID="Resume">Continuer</Message>
<Message ID="Pause">Pause</Message>
<Message ID="StartServer">Démarrer serveur</Message>

View File

@ -757,6 +757,7 @@
<Message ID="HelpFullscreen">/fullscreen - 全画面表示の状態で起動する</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - 設定のセーブ機能を無効にする</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - ゲームをロードしてから指定されたファイルに動画を録画する。</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - 前回ゲーム閉じた時の状況でゲームを始める</Message>
<Message ID="Resume">再開</Message>
<Message ID="Pause">ポーズ</Message>

View File

@ -767,6 +767,7 @@
<Message ID="HelpFullscreen">/fullscreen - Inicia o Mesen em modo tela cheia</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Impede que as configurações sejam salvas no disco (útil para evitar que as opções da linha de comando se tornem as configurações padrão)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Continuar</Message>
<Message ID="Pause">Pausar</Message>

View File

@ -755,6 +755,7 @@
<Message ID="HelpFullscreen">/fullscreen - Start Mesen in fullscreen mode</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Продолжить</Message>
<Message ID="Pause">Пауза</Message>

View File

@ -755,6 +755,7 @@
<Message ID="HelpFullscreen">/fullscreen - Запустити Mesen у повноекранному режимi</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - Заборонити збереження налаштувань на диску (корисно щоб запобігти становленню параметрів командного рядка за замовчуванням)</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">Продовжити</Message>
<Message ID="Pause">Пауза</Message>

View File

@ -757,6 +757,7 @@
<Message ID="HelpFullscreen">/fullscreen - 全屏模式启动 Mesen</Message>
<Message ID="HelpDoNotSaveSettings">/DoNotSaveSettings - 阻止命令行的选项替代 Mesen 原本的设置 (防止命令行选项成为默认设置).</Message>
<Message ID="HelpRecordMovie">/RecordMovie="filename.mmo" - Start recording a movie after the specified game is loaded.</Message>
<Message ID="HelpLoadLastSession">/LoadLastSession - Resumes the game in the state it was left in when it was last played.</Message>
<Message ID="Resume">恢复</Message>
<Message ID="Pause">暂停</Message>

View File

@ -51,6 +51,7 @@ namespace Mesen.GUI.Forms
ResourceHelper.GetMessage("HelpFullscreen") + Environment.NewLine +
ResourceHelper.GetMessage("HelpDoNotSaveSettings") + Environment.NewLine +
ResourceHelper.GetMessage("HelpRecordMovie") + Environment.NewLine +
ResourceHelper.GetMessage("HelpLoadLastSession") + Environment.NewLine +
sb.ToString().Trim()
);
}

View File

@ -36,6 +36,7 @@ namespace Mesen.GUI.Forms
private string _movieToRecord = null;
private List<string> _luaScriptsToLoad = new List<string>();
private bool _loadLastSessionRequested = false;
private Image _pauseButton = Resources.Pause;
private Image _playButton = Resources.Play;
@ -112,6 +113,10 @@ namespace Mesen.GUI.Forms
ConfigManager.DoNotSaveSettings = true;
}
if(switches.Contains("/loadlastsession")) {
_loadLastSessionRequested = true;
}
Regex recordMovieCommand = new Regex("/recordmovie=([^\"]+)");
foreach(string command in switches) {
Match match = recordMovieCommand.Match(command);
@ -146,6 +151,7 @@ namespace Mesen.GUI.Forms
//When no ROM is loaded, only process Lua scripts if a ROM was specified as a command line param
_luaScriptsToLoad.Clear();
_movieToRecord = null;
_loadLastSessionRequested = false;
} else {
//No game was specified, but a game is running already, load the scripts right away
ProcessPostLoadCommandSwitches();
@ -171,6 +177,11 @@ namespace Mesen.GUI.Forms
InteropEmu.MovieRecord(ref options);
_movieToRecord = null;
}
if(_loadLastSessionRequested) {
_loadLastSessionRequested = false;
LoadLastSession();
}
}
protected override void OnLoad(EventArgs e)