VM: Queue shutdown message when called from inside emulation.

This commit is contained in:
refractionpcsx2 2023-01-22 17:23:24 +00:00 committed by lightningterror
parent f628795b3f
commit 8773ebf64b
2 changed files with 13 additions and 6 deletions

View File

@ -1237,9 +1237,16 @@ void Host::RequestVMShutdown(bool allow_confirm, bool allow_save_state, bool def
if (!VMManager::HasValidVM())
return;
// Run it on the host thread, that way we get the confirm prompt (if enabled).
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, allow_confirm),
Q_ARG(bool, allow_save_state), Q_ARG(bool, default_save_state), Q_ARG(bool, false));
if (allow_confirm)
{
// Run it on the host thread, that way we get the confirm prompt (if enabled).
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, allow_confirm),
Q_ARG(bool, allow_save_state), Q_ARG(bool, default_save_state), Q_ARG(bool, false));
}
else
{
g_emu_thread->shutdownVM(allow_save_state && default_save_state);
}
}
bool Host::IsFullscreen()

View File

@ -37,7 +37,7 @@
#include "Elfheader.h"
#include "ps2/BiosTools.h"
#include "Recording/InputRecording.h"
#include "VMManager.h"
#include "Host.h"
// This typically reflects the Sony-assigned serial code for the Disc, if one exists.
// (examples: SLUS-2113, etc).
@ -2440,8 +2440,8 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
case 0x0F: // sceCdPowerOff (0:1)- Call74 from Xcdvdman
Console.WriteLn(Color_StrongBlack, "sceCdPowerOff called. Resetting VM.");
VMManager::Reset();
Console.WriteLn(Color_StrongBlack, "sceCdPowerOff called. Shutting down VM.");
Host::RequestVMShutdown(false, false, false);
break;
case 0x12: // sceCdReadILinkId (0:9)