mirror of https://github.com/PCSX2/pcsx2.git
Capture: Stop a capture at the end of an input recording
This commit is contained in:
parent
45c1579a15
commit
1e056ca3fa
|
@ -1 +1 @@
|
||||||
Subproject commit d8e4c256e5941d9951c3f155b15258b5be714022
|
Subproject commit 42bfcb0ca002ebbad13657ac4d71ebad4cc6afa1
|
|
@ -48,11 +48,11 @@ void InputRecordingControls::CheckPauseStatus()
|
||||||
switchToReplay = false;
|
switchToReplay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pauseEmulation &&
|
if (IsFinishedReplaying() || g_InputRecording.GetFrameCounter() == INT_MAX)
|
||||||
g_InputRecording.IsReplaying() &&
|
|
||||||
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
|
||||||
{
|
{
|
||||||
|
if (!pauseEmulation)
|
||||||
pauseEmulation = true;
|
pauseEmulation = true;
|
||||||
|
StopCapture();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_InputRecording.LogAndRedraw();
|
g_InputRecording.LogAndRedraw();
|
||||||
|
@ -93,16 +93,15 @@ void InputRecordingControls::ResumeCoreThreadIfStarted()
|
||||||
|
|
||||||
void InputRecordingControls::FrameAdvance()
|
void InputRecordingControls::FrameAdvance()
|
||||||
{
|
{
|
||||||
if (g_InputRecording.IsReplaying() &&
|
if (!IsFinishedReplaying())
|
||||||
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
|
||||||
{
|
{
|
||||||
g_InputRecording.SetToRecordMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
frameAdvancing = true;
|
frameAdvancing = true;
|
||||||
frame_advance_frame_counter = 0;
|
frame_advance_frame_counter = 0;
|
||||||
Resume();
|
Resume();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_InputRecording.SetToRecordMode();
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::setFrameAdvanceAmount(int amount)
|
void InputRecordingControls::setFrameAdvanceAmount(int amount)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +115,7 @@ bool InputRecordingControls::IsFrameAdvancing()
|
||||||
|
|
||||||
bool InputRecordingControls::IsPaused()
|
bool InputRecordingControls::IsPaused()
|
||||||
{
|
{
|
||||||
return (emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsPaused());
|
return emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputRecordingControls::Pause()
|
void InputRecordingControls::Pause()
|
||||||
|
@ -127,8 +126,8 @@ void InputRecordingControls::Pause()
|
||||||
|
|
||||||
void InputRecordingControls::PauseImmediately()
|
void InputRecordingControls::PauseImmediately()
|
||||||
{
|
{
|
||||||
if (CoreThread.IsPaused())
|
if (!CoreThread.IsPaused())
|
||||||
return;
|
{
|
||||||
Pause();
|
Pause();
|
||||||
if (CoreThread.IsOpen() && CoreThread.IsRunning())
|
if (CoreThread.IsOpen() && CoreThread.IsRunning())
|
||||||
{
|
{
|
||||||
|
@ -136,59 +135,56 @@ void InputRecordingControls::PauseImmediately()
|
||||||
CoreThread.PauseSelf();
|
CoreThread.PauseSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::Resume()
|
void InputRecordingControls::Resume()
|
||||||
{
|
{
|
||||||
if (g_InputRecording.IsReplaying() &&
|
if (!IsFinishedReplaying())
|
||||||
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
|
||||||
{
|
{
|
||||||
g_InputRecording.SetToRecordMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pauseEmulation = false;
|
pauseEmulation = false;
|
||||||
resumeEmulation = true;
|
resumeEmulation = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_InputRecording.SetToRecordMode();
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::ResumeImmediately()
|
void InputRecordingControls::ResumeImmediately()
|
||||||
{
|
{
|
||||||
if (!CoreThread.IsPaused())
|
if (CoreThread.IsPaused())
|
||||||
return;
|
{
|
||||||
Resume();
|
Resume();
|
||||||
if (CoreThread.IsPaused() && CoreThread.IsRunning())
|
if (CoreThread.IsRunning())
|
||||||
{
|
{
|
||||||
emulationCurrentlyPaused = false;
|
emulationCurrentlyPaused = false;
|
||||||
CoreThread.Resume();
|
CoreThread.Resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::TogglePause()
|
void InputRecordingControls::TogglePause()
|
||||||
{
|
{
|
||||||
if (pauseEmulation &&
|
if (!pauseEmulation || !IsFinishedReplaying())
|
||||||
g_InputRecording.IsReplaying() &&
|
|
||||||
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
|
||||||
{
|
{
|
||||||
g_InputRecording.SetToRecordMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
resumeEmulation = pauseEmulation;
|
resumeEmulation = pauseEmulation;
|
||||||
pauseEmulation = !pauseEmulation;
|
pauseEmulation = !pauseEmulation;
|
||||||
inputRec::log(pauseEmulation ? "Paused Emulation" : "Resumed Emulation");
|
inputRec::log(pauseEmulation ? "Paused Emulation" : "Resumed Emulation");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_InputRecording.SetToRecordMode();
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::RecordModeToggle()
|
void InputRecordingControls::RecordModeToggle()
|
||||||
{
|
|
||||||
if (IsPaused() ||
|
|
||||||
g_InputRecording.IsReplaying() ||
|
|
||||||
g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
|
||||||
{
|
{
|
||||||
if (g_InputRecording.IsReplaying())
|
if (g_InputRecording.IsReplaying())
|
||||||
g_InputRecording.SetToRecordMode();
|
g_InputRecording.SetToRecordMode();
|
||||||
else if (g_InputRecording.IsRecording())
|
else if (g_InputRecording.IsRecording())
|
||||||
|
{
|
||||||
|
if (IsPaused() || g_InputRecording.GetFrameCounter() < g_InputRecording.GetInputRecordingData().GetTotalFrames())
|
||||||
g_InputRecording.SetToReplayMode();
|
g_InputRecording.SetToReplayMode();
|
||||||
}
|
else
|
||||||
else if (g_InputRecording.IsRecording())
|
|
||||||
switchToReplay = true;
|
switchToReplay = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InputRecordingControls::Lock(u32 frame)
|
void InputRecordingControls::Lock(u32 frame)
|
||||||
{
|
{
|
||||||
|
@ -201,4 +197,22 @@ void InputRecordingControls::Lock(u32 frame)
|
||||||
else
|
else
|
||||||
sMainFrame.StartInputRecording();
|
sMainFrame.StartInputRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InputRecordingControls::IsFinishedReplaying() const
|
||||||
|
{
|
||||||
|
return g_InputRecording.IsReplaying() &&
|
||||||
|
g_InputRecording.GetFrameCounter() >= g_InputRecording.GetInputRecordingData().GetTotalFrames();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputRecordingControls::StopCapture() const
|
||||||
|
{
|
||||||
|
if (MainEmuFrame* mainFrame = GetMainFramePtr())
|
||||||
|
{
|
||||||
|
if (mainFrame->IsCapturing())
|
||||||
|
{
|
||||||
|
mainFrame->VideoCaptureToggle();
|
||||||
|
inputRec::log("Capture completed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,6 +90,10 @@ private:
|
||||||
bool frameLock = false;
|
bool frameLock = false;
|
||||||
// The frame value to use as the frame lock reset point
|
// The frame value to use as the frame lock reset point
|
||||||
u32 frameLockTracker = 0;
|
u32 frameLockTracker = 0;
|
||||||
|
|
||||||
|
bool IsFinishedReplaying() const;
|
||||||
|
// Calls mainEmuFrame's videoCaptureToggle to end a capture if active
|
||||||
|
void StopCapture() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern InputRecordingControls g_InputRecordingControls;
|
extern InputRecordingControls g_InputRecordingControls;
|
||||||
|
|
|
@ -124,6 +124,8 @@ public:
|
||||||
void AppendShortcutToMenuOption(wxMenuItem& item, wxString keyCodeStr);
|
void AppendShortcutToMenuOption(wxMenuItem& item, wxString keyCodeStr);
|
||||||
void UpdateStatusBar();
|
void UpdateStatusBar();
|
||||||
void VideoCaptureToggle();
|
void VideoCaptureToggle();
|
||||||
|
bool IsCapturing() const noexcept { return m_capturingVideo; }
|
||||||
|
|
||||||
#ifndef DISABLE_RECORDING
|
#ifndef DISABLE_RECORDING
|
||||||
void initializeRecordingMenuItem(MenuIdentifiers menuId, wxString keyCodeStr, bool enable = true);
|
void initializeRecordingMenuItem(MenuIdentifiers menuId, wxString keyCodeStr, bool enable = true);
|
||||||
void enableRecordingMenuItem(MenuIdentifiers menuId, bool enable);
|
void enableRecordingMenuItem(MenuIdentifiers menuId, bool enable);
|
||||||
|
|
Loading…
Reference in New Issue