diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-01-13 13:14:48 +0100 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-01-15 08:05:30 +0100 |
| commit | 95cba6be2beda7fbf4fb597b0aa4cbb8912d8265 (patch) | |
| tree | 30c854ca14e32320334914d6c48e4f99e0a17233 /Source/Core/DolphinQt/MainWindow.cpp | |
| parent | c76dee7807c331582cfb36376329e760eab3f704 (diff) | |
Core/Movie: Refactor to class, move to System.
A bit of global state remains (the `header` in `BeginRecordingInput()`) due to unclear lifetime requirements.
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/MainWindow.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 74e6198c84..b644c9df07 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -277,7 +277,7 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters, if (!movie_path.empty()) { std::optional<std::string> savestate_path; - if (Movie::PlayInput(movie_path, &savestate_path)) + if (Core::System::GetInstance().GetMovie().PlayInput(movie_path, &savestate_path)) { m_pending_boot->boot_session_data.SetSavestateData(std::move(savestate_path), DeleteSavestateAfterBoot::No); @@ -646,8 +646,9 @@ void MainWindow::ConnectHotkeys() connect(m_hotkey_scheduler, &HotkeyScheduler::ConnectWiiRemote, this, &MainWindow::OnConnectWiiRemote); connect(m_hotkey_scheduler, &HotkeyScheduler::ToggleReadOnlyMode, [this] { - bool read_only = !Movie::IsReadOnly(); - Movie::SetReadOnly(read_only); + auto& movie = Core::System::GetInstance().GetMovie(); + bool read_only = !movie.IsReadOnly(); + movie.SetReadOnly(read_only); emit ReadOnlyModeChanged(read_only); }); @@ -1011,9 +1012,10 @@ void MainWindow::ForceStop() void MainWindow::Reset() { - if (Movie::IsRecordingInput()) - Movie::SetReset(true); auto& system = Core::System::GetInstance(); + auto& movie = system.GetMovie(); + if (movie.IsRecordingInput()) + movie.SetReset(true); system.GetProcessorInterface().ResetButton_Tap(); } @@ -1853,15 +1855,16 @@ void MainWindow::OnPlayRecording() if (dtm_file.isEmpty()) return; - if (!Movie::IsReadOnly()) + auto& movie = Core::System::GetInstance().GetMovie(); + if (!movie.IsReadOnly()) { // let's make the read-only flag consistent at the start of a movie. - Movie::SetReadOnly(true); + movie.SetReadOnly(true); emit ReadOnlyModeChanged(true); } std::optional<std::string> savestate_path; - if (Movie::PlayInput(dtm_file.toStdString(), &savestate_path)) + if (movie.PlayInput(dtm_file.toStdString(), &savestate_path)) { emit RecordingStatusChanged(true); @@ -1871,14 +1874,17 @@ void MainWindow::OnPlayRecording() void MainWindow::OnStartRecording() { - if ((!Core::IsRunningAndStarted() && Core::IsRunning()) || Movie::IsRecordingInput() || - Movie::IsPlayingInput()) + auto& movie = Core::System::GetInstance().GetMovie(); + if ((!Core::IsRunningAndStarted() && Core::IsRunning()) || movie.IsRecordingInput() || + movie.IsPlayingInput()) + { return; + } - if (Movie::IsReadOnly()) + if (movie.IsReadOnly()) { // The user just chose to record a movie, so that should take precedence - Movie::SetReadOnly(false); + movie.SetReadOnly(false); emit ReadOnlyModeChanged(true); } @@ -1897,7 +1903,7 @@ void MainWindow::OnStartRecording() wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None; } - if (Movie::BeginRecordingInput(controllers, wiimotes)) + if (movie.BeginRecordingInput(controllers, wiimotes)) { emit RecordingStatusChanged(true); @@ -1908,10 +1914,11 @@ void MainWindow::OnStartRecording() void MainWindow::OnStopRecording() { - if (Movie::IsRecordingInput()) + auto& movie = Core::System::GetInstance().GetMovie(); + if (movie.IsRecordingInput()) OnExportRecording(); - if (Movie::IsMovieActive()) - Movie::EndPlayInput(false); + if (movie.IsMovieActive()) + movie.EndPlayInput(false); emit RecordingStatusChanged(false); } @@ -1921,7 +1928,7 @@ void MainWindow::OnExportRecording() QString dtm_file = DolphinFileDialog::getSaveFileName( this, tr("Save Recording File As"), QString(), tr("Dolphin TAS Movies (*.dtm)")); if (!dtm_file.isEmpty()) - Movie::SaveRecording(dtm_file.toStdString()); + Core::System::GetInstance().GetMovie().SaveRecording(dtm_file.toStdString()); }); } |
