mirror of https://github.com/PCSX2/pcsx2.git
input-rec: facilitate changing controls immediately for certain edge-cases
This commit is contained in:
parent
a38fbb157d
commit
6ae9e7edb5
|
@ -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)));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue