mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 16:49:58 -06:00
Core/Movie: Refactor to class, move to System.
A bit of global state remains (the `header` in `BeginRecordingInput()`) due to unclear lifetime requirements.
This commit is contained in:
@ -171,7 +171,7 @@ static void DoState(PointerWrap& p)
|
||||
|
||||
// Movie must be done before the video backend, because the window is redrawn in the video backend
|
||||
// state load, and the frame number must be up-to-date.
|
||||
Movie::DoState(p);
|
||||
system.GetMovie().DoState(p);
|
||||
p.DoMarker("Movie");
|
||||
|
||||
// Begin with video backend, so that it gets a chance to clear its caches and writeback modified
|
||||
@ -443,9 +443,10 @@ static void CompressAndDumpState(CompressAndDumpState_args& save_args)
|
||||
}
|
||||
}
|
||||
|
||||
if ((Movie::IsMovieActive()) && !Movie::IsJustStartingRecordingInputFromSaveState())
|
||||
Movie::SaveRecording(dtmname);
|
||||
else if (!Movie::IsMovieActive())
|
||||
auto& movie = Core::System::GetInstance().GetMovie();
|
||||
if ((movie.IsMovieActive()) && !movie.IsJustStartingRecordingInputFromSaveState())
|
||||
movie.SaveRecording(dtmname);
|
||||
else if (!movie.IsMovieActive())
|
||||
File::Delete(dtmname);
|
||||
|
||||
// Move written state to final location.
|
||||
@ -867,13 +868,14 @@ void LoadAs(const std::string& filename)
|
||||
Core::RunOnCPUThread(
|
||||
[&] {
|
||||
// Save temp buffer for undo load state
|
||||
if (!Movie::IsJustStartingRecordingInputFromSaveState())
|
||||
auto& movie = Core::System::GetInstance().GetMovie();
|
||||
if (!movie.IsJustStartingRecordingInputFromSaveState())
|
||||
{
|
||||
std::lock_guard lk2(s_undo_load_buffer_mutex);
|
||||
SaveToBuffer(s_undo_load_buffer);
|
||||
const std::string dtmpath = File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm";
|
||||
if (Movie::IsMovieActive())
|
||||
Movie::SaveRecording(dtmpath);
|
||||
if (movie.IsMovieActive())
|
||||
movie.SaveRecording(dtmpath);
|
||||
else if (File::Exists(dtmpath))
|
||||
File::Delete(dtmpath);
|
||||
}
|
||||
@ -904,10 +906,10 @@ void LoadAs(const std::string& filename)
|
||||
Core::DisplayMessage(
|
||||
fmt::format("Loaded State from {}", tempfilename.filename().string()), 2000);
|
||||
if (File::Exists(filename + ".dtm"))
|
||||
Movie::LoadInput(filename + ".dtm");
|
||||
else if (!Movie::IsJustStartingRecordingInputFromSaveState() &&
|
||||
!Movie::IsJustStartingPlayingInputFromSaveState())
|
||||
Movie::EndPlayInput(false);
|
||||
movie.LoadInput(filename + ".dtm");
|
||||
else if (!movie.IsJustStartingRecordingInputFromSaveState() &&
|
||||
!movie.IsJustStartingPlayingInputFromSaveState())
|
||||
movie.EndPlayInput(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1015,13 +1017,14 @@ void UndoLoadState()
|
||||
std::lock_guard lk(s_undo_load_buffer_mutex);
|
||||
if (!s_undo_load_buffer.empty())
|
||||
{
|
||||
if (Movie::IsMovieActive())
|
||||
auto& movie = Core::System::GetInstance().GetMovie();
|
||||
if (movie.IsMovieActive())
|
||||
{
|
||||
const std::string dtmpath = File::GetUserPath(D_STATESAVES_IDX) + "undo.dtm";
|
||||
if (File::Exists(dtmpath))
|
||||
{
|
||||
LoadFromBuffer(s_undo_load_buffer);
|
||||
Movie::LoadInput(dtmpath);
|
||||
movie.LoadInput(dtmpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user