gui: recording dialog modality: more resilience

A very slight refactor of commit 9eadf3 to also handle a future case where the
audio has a dialog but the GS doesn't (currently both conditions are false).
This commit is contained in:
Avi Halachmi (:avih) 2015-10-05 21:15:52 +03:00
parent 9eadf353d9
commit 1093c816d0
1 changed files with 12 additions and 9 deletions

View File

@ -385,12 +385,16 @@ namespace Implementations
GetMTGS().WaitGS(); // make sure GS is in sync with the audio stream when we start. GetMTGS().WaitGS(); // make sure GS is in sync with the audio stream when we start.
if (g_Pcsx2Recording) { if (g_Pcsx2Recording) {
// start recording // start recording
if (GSsetupRecording) {
// make the recording-config dialog[s] pseudo-modal also for the main PCSX2 window
// (it's already properly modal for the GS window)
if (GetMainFramePtr())
GetMainFramePtr()->Disable();
// make the recording setup dialog[s] pseudo-modal also for the main PCSX2 window
// (the GSdx dialog is already properly modal for the GS window)
bool needsMainFrameEnable = false;
if (GetMainFramePtr() && GetMainFramePtr()->IsEnabled()) {
needsMainFrameEnable = true;
GetMainFramePtr()->Disable();
}
if (GSsetupRecording) {
// GSsetupRecording can be aborted/canceled by the user. Don't go on to record the audio if that happens. // 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 (GSsetupRecording(g_Pcsx2Recording, NULL)) {
if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL); if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL);
@ -398,15 +402,14 @@ namespace Implementations
// recording dialog canceled by the user. align our state // recording dialog canceled by the user. align our state
g_Pcsx2Recording ^= 1; g_Pcsx2Recording ^= 1;
} }
if (GetMainFramePtr())
GetMainFramePtr()->Enable();
} else { } else {
// the GS doesn't support recording. // the GS doesn't support recording.
if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL); if (SPU2setupRecording) SPU2setupRecording(g_Pcsx2Recording, NULL);
} }
if (GetMainFramePtr() && needsMainFrameEnable)
GetMainFramePtr()->Enable();
} else { } else {
// stop recording // stop recording
if (GSsetupRecording) GSsetupRecording(g_Pcsx2Recording, NULL); if (GSsetupRecording) GSsetupRecording(g_Pcsx2Recording, NULL);