diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index ba489dfcf6..435694c32d 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -217,6 +217,11 @@ bool IsJustStartingRecordingInputFromSaveState() return IsRecordingInputFromSaveState() && g_currentFrame == 0; } +bool IsJustStartingPlayingInputFromSaveState() +{ + return tmpHeader.bFromSaveState && g_currentFrame == 1; +} + bool IsPlayingInput() { return (g_playMode == MODE_PLAYING); @@ -287,6 +292,13 @@ bool BeginRecordingInput(int controllers) if(g_playMode != MODE_NONE || controllers == 0) return false; + g_numPads = controllers; + g_currentFrame = g_totalFrames = 0; + g_currentLagCount = g_totalLagCount = 0; + g_currentInputCount = g_totalInputCount = 0; + g_recordingStartTime = Common::Timer::GetLocalTimeSinceJan1970(); + g_rerecords = 0; + if (Core::IsRunning()) { if(File::Exists(tmpStateFilename)) @@ -295,13 +307,6 @@ bool BeginRecordingInput(int controllers) State::SaveAs(tmpStateFilename.c_str()); g_bRecordingFromSaveState = true; } - - g_numPads = controllers; - g_currentFrame = g_totalFrames = 0; - g_currentLagCount = g_totalLagCount = 0; - g_currentInputCount = g_totalInputCount = 0; - g_recordingStartTime = Common::Timer::GetLocalTimeSinceJan1970(); - g_rerecords = 0; g_playMode = MODE_RECORDING; delete [] tmpInput; @@ -548,6 +553,8 @@ bool PlayInput(const char *filename) if(File::Exists(stateFilename)) Core::SetStateFileName(stateFilename); g_bRecordingFromSaveState = true; + Movie::LoadInput(filename); + g_currentFrame = 0; } /* TODO: Put this verification somewhere we have the gameID of the played game @@ -877,6 +884,7 @@ void EndPlayInput(bool cont) g_currentByte = 0; g_playMode = MODE_NONE; Core::DisplayMessage("Movie End.", 2000); + tmpHeader.bFromSaveState = 0; // we don't clear these things because otherwise we can't resume playback if we load a movie state later //g_totalFrames = g_totalBytes = 0; //delete tmpInput; diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 09a0f5d84a..ac28733221 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -113,6 +113,7 @@ bool IsAutoFiring(); bool IsRecordingInput(); bool IsRecordingInputFromSaveState(); bool IsJustStartingRecordingInputFromSaveState(); +bool IsJustStartingPlayingInputFromSaveState(); bool IsPlayingInput(); bool IsReadOnly(); u64 GetRecordingStartTime(); diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 8ef47467e8..f7d6523b05 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -413,7 +413,7 @@ void LoadAs(const std::string& filename) Core::DisplayMessage(StringFromFormat("Loaded state from %s", filename.c_str()).c_str(), 2000); if (File::Exists(filename + ".dtm")) Movie::LoadInput((filename + ".dtm").c_str()); - else if (!Movie::IsJustStartingRecordingInputFromSaveState()) + else if (!Movie::IsJustStartingRecordingInputFromSaveState() && !Movie::IsJustStartingPlayingInputFromSaveState()) Movie::EndPlayInput(false); } else