diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index e679bed2c7..bd8f92f04a 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -260,6 +260,7 @@ private: void OnReset(wxCommandEvent& event); void OnRecord(wxCommandEvent& event); void OnPlayRecording(wxCommandEvent& event); + void OnStopRecording(wxCommandEvent& event); void OnRecordExport(wxCommandEvent& event); void OnRecordReadOnly(wxCommandEvent& event); void OnTASInput(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 94b91179c5..5c435da2f3 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -141,6 +141,7 @@ void CFrame::BindMenuBarEvents() // Movie menu Bind(wxEVT_MENU, &CFrame::OnRecord, this, IDM_RECORD); Bind(wxEVT_MENU, &CFrame::OnPlayRecording, this, IDM_PLAY_RECORD); + Bind(wxEVT_MENU, &CFrame::OnStopRecording, this, IDM_STOP_RECORD); Bind(wxEVT_MENU, &CFrame::OnRecordExport, this, IDM_RECORD_EXPORT); Bind(wxEVT_MENU, &CFrame::OnRecordReadOnly, this, IDM_RECORD_READ_ONLY); Bind(wxEVT_MENU, &CFrame::OnTASInput, this, IDM_TAS_INPUT); @@ -496,6 +497,30 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED(event)) BootGame(""); } +void CFrame::OnStopRecording(wxCommandEvent& WXUNUSED(event)) +{ + if (Movie::IsRecordingInput()) + { + const bool was_paused = Core::GetState() == Core::State::Paused; + DoRecordingSave(); + const bool is_paused = Core::GetState() == Core::State::Paused; + if (is_paused && !was_paused) + CPU::EnableStepping(false); + } + + if (!Movie::IsReadOnly()) + { + // let's make the read-only flag consistent at the start of a movie. + Movie::SetReadOnly(true); + GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Check(); + } + + Movie::EndPlayInput(false); + + GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive()); + GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsMovieActive()); +} + void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED(event)) { DoRecordingSave(); @@ -1404,6 +1429,7 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused); GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput()); GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable(!Initialized); + GetMenuBar()->FindItem(IDM_STOP_RECORD)->Enable(Movie::IsMovieActive()); GetMenuBar()->FindItem(IDM_RECORD_EXPORT)->Enable(Movie::IsMovieActive()); GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused); GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused); @@ -1488,6 +1514,9 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_RECORD)->Enable(); GetMenuBar()->FindItem(IDM_PLAY_RECORD)->Enable(); } + + // Reset the stop playing/recording input menu item + GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input")); } else if (Initialized) { @@ -1497,6 +1526,14 @@ void CFrame::UpdateGUI() // Reset game loading flag m_bGameLoading = false; + + // Rename the stop playing/recording menu item depending on current movie state + if (Movie::IsRecordingInput()) + GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Recording Input")); + else if (Movie::IsPlayingInput()) + GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing Input")); + else + GetMenuBar()->FindItem(IDM_STOP_RECORD)->SetItemLabel(_("Stop Playing/Recording Input")); } GetToolBar()->Refresh(false); diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 3ab8c809cd..28e560d6bc 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -70,6 +70,7 @@ enum // Movie menu IDM_RECORD, IDM_PLAY_RECORD, + IDM_STOP_RECORD, IDM_RECORD_EXPORT, IDM_RECORD_READ_ONLY, IDM_TAS_INPUT, diff --git a/Source/Core/DolphinWX/MainMenuBar.cpp b/Source/Core/DolphinWX/MainMenuBar.cpp index ca41a94df1..6cf1240b30 100644 --- a/Source/Core/DolphinWX/MainMenuBar.cpp +++ b/Source/Core/DolphinWX/MainMenuBar.cpp @@ -140,6 +140,7 @@ wxMenu* MainMenuBar::CreateMovieMenu() const movie_menu->Append(IDM_RECORD, _("Start Re&cording Input")); movie_menu->Append(IDM_PLAY_RECORD, _("P&lay Input Recording...")); + movie_menu->Append(IDM_STOP_RECORD, _("Stop Playing/Recording Input")); movie_menu->Append(IDM_RECORD_EXPORT, _("Export Recording...")); movie_menu->AppendCheckItem(IDM_RECORD_READ_ONLY, _("&Read-Only Mode")); movie_menu->Append(IDM_TAS_INPUT, _("TAS Input"));