From eec3798e00cd9d3de1c18df98305dba26dba2d68 Mon Sep 17 00:00:00 2001 From: Souryo Date: Tue, 19 Jul 2016 16:36:07 -0400 Subject: [PATCH] Movies: Disable loading save states when playing or recording movies --- Core/Console.cpp | 4 ++++ GUI.NET/Forms/frmMain.cs | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/Console.cpp b/Core/Console.cpp index f21a0ccb..6bc70a5e 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -422,6 +422,10 @@ void Console::SaveState(ostream &saveStream) void Console::LoadState(istream &loadStream) { if(Instance->_initialized) { + //Stop any movie that might have been playing/recording if a state is loaded + //(Note: Loading a state is disabled in the UI while a movie is playing/recording) + Movie::Stop(); + Instance->_cpu->LoadSnapshot(&loadStream); Instance->_ppu->LoadSnapshot(&loadStream); Instance->_memoryManager->LoadSnapshot(&loadStream); diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs index 664b8f1b..bc04492b 100644 --- a/GUI.NET/Forms/frmMain.cs +++ b/GUI.NET/Forms/frmMain.cs @@ -528,7 +528,9 @@ namespace Mesen.GUI.Forms bool isNetPlayClient = InteropEmu.IsConnected(); mnuPause.Enabled = mnuStop.Enabled = mnuReset.Enabled = (_emuThread != null && !isNetPlayClient); - mnuSaveState.Enabled = mnuLoadState.Enabled = (_emuThread != null && !isNetPlayClient && !InteropEmu.IsNsf()); + mnuSaveState.Enabled = (_emuThread != null && !isNetPlayClient && !InteropEmu.IsNsf()); + mnuLoadState.Enabled = (_emuThread != null && !isNetPlayClient && !InteropEmu.IsNsf() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording()); + mnuPause.Text = InteropEmu.IsPaused() ? ResourceHelper.GetMessage("Resume") : ResourceHelper.GetMessage("Pause"); mnuPause.Image = InteropEmu.IsPaused() ? Mesen.GUI.Properties.Resources.Play : Mesen.GUI.Properties.Resources.Pause; @@ -707,7 +709,9 @@ namespace Mesen.GUI.Forms if(forSave) { InteropEmu.SaveState(stateIndex); } else { - InteropEmu.LoadState(stateIndex); + if(!InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording()) { + InteropEmu.LoadState(stateIndex); + } } } };