From 2c2ef9a96197dd047be021c004c16f42be05663f Mon Sep 17 00:00:00 2001 From: nitsuja Date: Sun, 11 Dec 2011 21:08:26 -0800 Subject: [PATCH] made frame advance act normal (so it advances 1 frame each time instead of waiting for further unpause commands), and did some minor improvements to the read-only command (making the UI behavior a little nicer, no actual changes to what read-only does at this point) --- Source/Core/Core/Src/Movie.cpp | 20 ++++++++++++++++++-- Source/Core/Core/Src/Movie.h | 2 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 17 +++++++++++++---- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 818d77cd35..8df17b5910 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -77,7 +77,10 @@ void FrameUpdate() g_lagCounter++; if (g_bFrameStep) + { Core::SetState(Core::CORE_PAUSE); + g_bFrameStep = false; + } // ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily. // after that we set it back to CPU_RUNNING and continue as normal. @@ -113,9 +116,19 @@ void SetPolledDevice() g_bPolled = true; } -void SetFrameStepping(bool bEnabled) +void DoFrameStep() { - g_bFrameStep = bEnabled; + if(Core::GetState() == Core::CORE_PAUSE) + { + // if already paused, frame advance for 1 frame + Core::SetState(Core::CORE_RUN); + g_bFrameStep = true; + } + else + { + // if not paused yet, pause immediately instead + Core::SetState(Core::CORE_PAUSE); + } } void SetFrameStopping(bool bEnabled) @@ -125,6 +138,9 @@ void SetFrameStopping(bool bEnabled) void SetReadOnly(bool bEnabled) { + if (g_bReadOnly != bEnabled) + Core::DisplayMessage(bEnabled ? "Read-only mode." : "Read+Write mode.", 1000); + g_bReadOnly = bEnabled; } diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 55ccf3a8da..4956c59de9 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -111,7 +111,7 @@ bool IsUsingWiimote(int wiimote); void ChangePads(bool instantly = false); void ChangeWiiPads(bool instantly = false); -void SetFrameStepping(bool bEnabled); +void DoFrameStep(); void SetFrameStopping(bool bEnabled); void SetReadOnly(bool bEnabled); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 32b7d48477..eddaae4748 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -145,7 +145,7 @@ void CFrame::CreateMenu() emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); - emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString, wxITEM_CHECK); + emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString); wxMenu *skippingMenu = new wxMenu; emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping")); @@ -704,7 +704,13 @@ void CFrame::OnTASInput(wxCommandEvent& event) void CFrame::OnFrameStep(wxCommandEvent& event) { - Movie::SetFrameStepping(event.IsChecked()); + bool wasPaused = (Core::GetState() == Core::CORE_PAUSE); + + Movie::DoFrameStep(); + + bool isPaused = (Core::GetState() == Core::CORE_PAUSE); + if(isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when pausing next frame + UpdateGUI(); } void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event)) @@ -718,8 +724,11 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event)) if (Movie::IsReadOnly()) { - PanicAlertT("Cannot record movies in read-only mode."); - return; + //PanicAlertT("Cannot record movies in read-only mode."); + //return; + // the user just chose to record a movie, so that should take precedence + Movie::SetReadOnly(false); + GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false); } for (int i = 0; i < 4; i++) {