diff --git a/pcsx2/Recording/InputRecording.cpp b/pcsx2/Recording/InputRecording.cpp index baa75bdd84..4170111848 100644 --- a/pcsx2/Recording/InputRecording.cpp +++ b/pcsx2/Recording/InputRecording.cpp @@ -517,7 +517,7 @@ bool InputRecording::create(const std::string& fileName, const bool fromSaveStat { FileSystem::CopyFilePath(savestatePath.c_str(), fmt::format("{}.bak", savestatePath).c_str(), true); } - m_initial_savestate_load_complete = false; + m_initial_load_complete = false; m_type = Type::FROM_SAVESTATE; m_is_active = true; // TODO - error handling @@ -527,6 +527,7 @@ bool InputRecording::create(const std::string& fileName, const bool fromSaveStat { m_starting_frame = 0; m_type = Type::POWER_ON; + m_initial_load_complete = false; m_is_active = true; // TODO - should this be an explicit [full] boot instead of a reset? VMManager::Reset(); @@ -561,7 +562,7 @@ bool InputRecording::play(const std::string& filename) return false; } m_type = Type::FROM_SAVESTATE; - m_initial_savestate_load_complete = false; + m_initial_load_complete = false; m_is_active = true; const auto loaded = VMManager::LoadState(savestatePath.c_str()); if (!loaded) @@ -576,6 +577,7 @@ bool InputRecording::play(const std::string& filename) { m_starting_frame = 0; m_type = Type::POWER_ON; + m_initial_load_complete = false; m_is_active = true; // TODO - should this be an explicit [full] boot instead of a reset? VMManager::Reset(); @@ -695,6 +697,13 @@ void InputRecording::handleExceededFrameCounter() } } +void InputRecording::handleReset() +{ + if (m_initial_load_complete) + adjustFrameCounterOnReRecord(0); + m_initial_load_complete = true; +} + void InputRecording::handleLoadingSavestate() { // We need to keep track of the starting internal frame of the recording @@ -704,10 +713,10 @@ void InputRecording::handleLoadingSavestate() // Why? // - When you re-record you load another save-state which has it's own frame counter // stored within, we use this to adjust the frame we are replaying/recording to - if (isTypeSavestate() && !m_initial_savestate_load_complete) + if (isTypeSavestate() && !m_initial_load_complete) { setStartingFrame(g_FrameCount); - m_initial_savestate_load_complete = true; + m_initial_load_complete = true; } else { diff --git a/pcsx2/Recording/InputRecording.h b/pcsx2/Recording/InputRecording.h index 1101dc6e2e..aa269a62c3 100644 --- a/pcsx2/Recording/InputRecording.h +++ b/pcsx2/Recording/InputRecording.h @@ -178,6 +178,7 @@ public: void ControllerInterrupt(u8 port, size_t fifoSize, u8 dataIn, u8 dataOut); void handleExceededFrameCounter(); + void handleReset(); void handleLoadingSavestate(); bool isTypeSavestate() const; void adjustFrameCounterOnReRecord(u32 newFrameCounter); @@ -196,7 +197,7 @@ private: Type m_type; - bool m_initial_savestate_load_complete = false; + bool m_initial_load_complete = false; bool m_is_active = false; bool m_pad_data_available = false; bool m_watching_for_rerecords = false; diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index fdad287137..d9477e3da0 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -1125,6 +1125,11 @@ void VMManager::Reset() // gameid change, so apply settings if (game_was_started) UpdateRunningGame(true, false); + + if (g_InputRecording.isActive()) + { + g_InputRecording.handleReset(); + } } std::string VMManager::GetSaveStateFileName(const char* game_serial, u32 game_crc, s32 slot)