diff --git a/pcsx2-qt/Tools/InputRecording/InputRecordingViewer.cpp b/pcsx2-qt/Tools/InputRecording/InputRecordingViewer.cpp index 50850b3fb9..6d242d0c00 100644 --- a/pcsx2-qt/Tools/InputRecording/InputRecordingViewer.cpp +++ b/pcsx2-qt/Tools/InputRecording/InputRecordingViewer.cpp @@ -47,7 +47,7 @@ void InputRecordingViewer::loadTable() m_ui.tableWidget->setHorizontalHeaderLabels(headers); int frameNum = 0; - for (auto& const frame : data) + for (const auto& frame : data) { // TODO - disgusting, clean it up m_ui.tableWidget->setItem(frameNum, 0, new QTableWidgetItem(tr("%1 %2").arg(frame.leftAnalogX).arg(frame.leftAnalogY))); diff --git a/pcsx2/Recording/InputRecording.cpp b/pcsx2/Recording/InputRecording.cpp index 12d6af9306..0b8a02f25f 100644 --- a/pcsx2/Recording/InputRecording.cpp +++ b/pcsx2/Recording/InputRecording.cpp @@ -701,11 +701,6 @@ u64 InputRecording::getFrameCounter() const return m_frameCounter; } -bool InputRecording::isInitialSavestateLoadComplete() const -{ - return m_initialSavestateLoadComplete; -} - bool InputRecording::isActive() const { return m_isActive; @@ -716,7 +711,7 @@ void InputRecording::handleExceededFrameCounter() // if we go past the end, switch to recording mode so nothing is lost if (m_frameCounter >= m_file.getTotalFrames() && m_controls.isReplaying()) { - m_controls.setRecordMode(); + m_controls.setRecordMode(false); } } @@ -729,15 +724,15 @@ 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() && !isInitialSavestateLoadComplete()) + if (isTypeSavestate() && !m_initialSavestateLoadComplete) { setStartingFrame(g_FrameCount); - setInitialSavestateLoaded(); + m_initialSavestateLoadComplete = true; } else { adjustFrameCounterOnReRecord(g_FrameCount); - watchForRerecords(); + m_watchingForRerecords = true; } } @@ -756,11 +751,6 @@ void InputRecording::setStartingFrame(u64 startingFrame) m_startingFrame = startingFrame; } -void InputRecording::setInitialSavestateLoaded() -{ - m_initialSavestateLoadComplete = true; -} - void InputRecording::adjustFrameCounterOnReRecord(u64 newFrameCounter) { if (newFrameCounter > m_startingFrame + (u64)m_file.getTotalFrames()) @@ -792,11 +782,6 @@ void InputRecording::adjustFrameCounterOnReRecord(u64 newFrameCounter) m_frameCounter = newFrameCounter - m_startingFrame; } -void InputRecording::watchForRerecords() -{ - m_watchingForRerecords = true; -} - InputRecordingControls& InputRecording::getControls() { return m_controls; diff --git a/pcsx2/Recording/InputRecording.h b/pcsx2/Recording/InputRecording.h index 3300c4b0df..5334547ed6 100644 --- a/pcsx2/Recording/InputRecording.h +++ b/pcsx2/Recording/InputRecording.h @@ -169,7 +169,6 @@ public: void controllerInterrupt(u8& data, u8& port, u16& BufCount, u8 buf[]); void incFrameCounter(); u64 getFrameCounter() const; - bool isInitialSavestateLoadComplete() const; bool isActive() const; // Main handler for ingesting input data and either saving it to the recording file (recording) @@ -178,15 +177,9 @@ public: void handleExceededFrameCounter(); void handleLoadingSavestate(); - bool isTypeSavestate() const; - - void setStartingFrame(u64 startingFrame); - void setInitialSavestateLoaded(); void adjustFrameCounterOnReRecord(u64 newFrameCounter); - void watchForRerecords(); - InputRecordingControls& getControls(); const InputRecordingFile& getData() const; @@ -211,6 +204,7 @@ private: u64 m_startingFrame = 0; void initializeState(); + void setStartingFrame(u64 startingFrame); private: // Resolve the name and region of the game currently loaded using the GameDB diff --git a/pcsx2/Recording/InputRecordingControls.cpp b/pcsx2/Recording/InputRecordingControls.cpp index 40d718b8f4..937a6be146 100644 --- a/pcsx2/Recording/InputRecordingControls.cpp +++ b/pcsx2/Recording/InputRecordingControls.cpp @@ -244,9 +244,9 @@ void InputRecordingControls::toggleRecordMode() } } -void InputRecordingControls::setRecordMode() +void InputRecordingControls::setRecordMode(bool waitForFrameToEnd) { - if (VMManager::GetState() == VMState::Paused) + if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused) { m_state = Mode::Recording; InputRec::log("Record mode ON"); @@ -260,9 +260,9 @@ void InputRecordingControls::setRecordMode() } } -void InputRecordingControls::setReplayMode() +void InputRecordingControls::setReplayMode(bool waitForFrameToEnd) { - if (VMManager::GetState() == VMState::Paused) + if (!waitForFrameToEnd || VMManager::GetState() == VMState::Paused) { m_state = Mode::Replaying; InputRec::log("Replay mode ON"); diff --git a/pcsx2/Recording/InputRecordingControls.h b/pcsx2/Recording/InputRecordingControls.h index 6fb1b1818d..f076ebfaf8 100644 --- a/pcsx2/Recording/InputRecordingControls.h +++ b/pcsx2/Recording/InputRecordingControls.h @@ -116,8 +116,8 @@ public: }; void toggleRecordMode(); - void setRecordMode(); - void setReplayMode(); + void setRecordMode(bool waitForFrameToEnd = true); + void setReplayMode(bool waitForFrameToEnd = true); bool isRecording() const; bool isReplaying() const;