Recording: handle cancel (at the GS[dx] dialog) gracefully

Without this patch, if a user initiates a recording and then cancels at the GSdx
dialog, the audio was recording anyway, which is probably highly unexpected.

However, while probably highly unexpected, it could still be useful to record
only audio, but with this patch it's now impossible.

We can reconsider if it turns out that people are actually using this "feature",
though one might as well set the video setting to be very unobtrusive (very low
resolution/bitrate) such that it uses very little CPU.
This commit is contained in:
Avi Halachmi (:avih) 2015-09-21 06:17:30 +03:00
parent 4474d4391b
commit cee0b795ee
2 changed files with 25 additions and 3 deletions

View File

@ -383,8 +383,26 @@ namespace Implementations
g_Pcsx2Recording ^= 1;
GetMTGS().WaitGS(); // make sure GS is in sync with the audio stream when we start.
if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL);
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
if (g_Pcsx2Recording) {
// start recording
if (GSsetupRecording) {
// GSsetupRecording can be aborted/canceled by the user. Don't go on to record the audio if that happens.
if (GSsetupRecording(g_Pcsx2Recording, NULL)) {
if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL);
} else {
// recording dialog canceled by the user. align our state
g_Pcsx2Recording ^= 1;
}
} else {
// the GS doesn't support recording.
if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL);
}
} else {
// stop recording
if (GSsetupRecording) GSsetupRecording(g_Pcsx2Recording, NULL);
if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL);
}
}
void Cpu_DumpRegisters()

View File

@ -873,8 +873,12 @@ EXPORT_C_(int) GSsetupRecording(int start, void* data)
if(start & 1)
{
printf("GSdx: Recording start command\n");
if( s_gs->BeginCapture() )
if (s_gs->BeginCapture()) {
pt(" - Capture started\n");
} else {
pt(" - Capture cancelled\n");
return 0;
}
}
else
{