recorrding: Resolve issues with starting a new file

This commit is contained in:
sonicfind 2020-09-17 17:39:22 -05:00 committed by refractionpcsx2
parent 23dba26ba3
commit 9936fc7f15
4 changed files with 14 additions and 14 deletions

View File

@ -64,7 +64,7 @@ void InputRecording::RecordingReset()
else if (g_InputRecording.IsActive()) else if (g_InputRecording.IsActive())
{ {
g_InputRecording.SetFrameCounter(0); g_InputRecording.SetFrameCounter(0);
g_InputRecordingControls.Lock(0, false); g_InputRecordingControls.Lock(0);
} }
else else
g_InputRecordingControls.Resume(); g_InputRecordingControls.Resume();
@ -227,7 +227,7 @@ void InputRecording::SetStartingFrame(u32 newStartingFrame)
recordingConLog(wxString::Format(L"[REC]: Internal Starting Frame: %d\n", startingFrame)); recordingConLog(wxString::Format(L"[REC]: Internal Starting Frame: %d\n", startingFrame));
frameCounter = 0; frameCounter = 0;
initialLoad = false; initialLoad = false;
g_InputRecordingControls.Lock(startingFrame, inputRecordingData.FromSaveState()); g_InputRecordingControls.Lock(startingFrame);
} }
void InputRecording::Stop() void InputRecording::Stop()

View File

@ -41,17 +41,18 @@ void InputRecordingControls::HandleFrameAdvanceAndPausing()
// has completed - signaled when g_framecount and frameCountTracker are equal. // has completed - signaled when g_framecount and frameCountTracker are equal.
if (frameLock) if (frameLock)
{ {
if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning()) if (g_FrameCount == frameCountTracker)
{
pauseEmulation = true;
emulationCurrentlyPaused = true;
CoreThread.PauseSelf();
}
else if (g_FrameCount == frameCountTracker)
{ {
frameLock = false; frameLock = false;
g_InputRecordingControls.Resume(); g_InputRecordingControls.Resume();
} }
else if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning())
{
pauseEmulation = true;
resumeEmulation = false;
emulationCurrentlyPaused = true;
CoreThread.PauseSelf();
}
return; return;
} }
// As a safeguard, use the global g_FrameCount to know when the frame counter has truly changed. // As a safeguard, use the global g_FrameCount to know when the frame counter has truly changed.
@ -188,12 +189,13 @@ void InputRecordingControls::RecordModeToggle()
switchToReplay = true; switchToReplay = true;
} }
void InputRecordingControls::Lock(u32 frame, bool savestate) void InputRecordingControls::Lock(u32 frame)
{ {
frameLock = true; frameLock = true;
frameCountTracker = frame; frameCountTracker = frame;
resumeEmulation = false;
//Ensures that g_frameCount can be used to resume emulation after a fast/full boot //Ensures that g_frameCount can be used to resume emulation after a fast/full boot
if (!savestate) if (!g_InputRecording.GetInputRecordingData().FromSaveState())
g_FrameCount = frame + 1; g_FrameCount = frame + 1;
} }
#endif #endif

View File

@ -56,7 +56,7 @@ public:
// Enables the frame locking mechanism so that when recordings are loaded // Enables the frame locking mechanism so that when recordings are loaded
// or when processing a reboot with a recording active that no frames are // or when processing a reboot with a recording active that no frames are
// lost in prior emulation // lost in prior emulation
void Lock(u32 frame, bool savestate); void Lock(u32 frame);
private: private:
// Indicates if the input recording controls have explicitly paused emulation or not // Indicates if the input recording controls have explicitly paused emulation or not

View File

@ -893,8 +893,6 @@ void MainEmuFrame::Menu_Recording_New_Click(wxCommandEvent &event)
} }
m_menuRecording.FindChildItem(MenuId_Recording_New)->Enable(false); m_menuRecording.FindChildItem(MenuId_Recording_New)->Enable(false);
m_menuRecording.FindChildItem(MenuId_Recording_Stop)->Enable(true); m_menuRecording.FindChildItem(MenuId_Recording_Stop)->Enable(true);
if (!g_InputRecording.GetInputRecordingData().FromSaveState())
g_InputRecordingControls.Resume();
} }
void MainEmuFrame::Menu_Recording_Play_Click(wxCommandEvent &event) void MainEmuFrame::Menu_Recording_Play_Click(wxCommandEvent &event)