mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-06 19:45:33 +00:00
Qt: Fix shutdown from Big Picture exiting application
This commit is contained in:
parent
46ae1780c5
commit
47e941cdc2
@ -1600,7 +1600,7 @@ void FullscreenUI::RequestShutdown(bool save_state)
|
||||
|
||||
ConfirmIfSavingMemoryCards(FSUI_STR("shut down"), [save_state](bool result) {
|
||||
if (result)
|
||||
Host::RunOnCPUThread([save_state]() { Host::RequestSystemShutdown(false, save_state); });
|
||||
Host::RunOnCPUThread([save_state]() { Host::RequestSystemShutdown(false, save_state, false); });
|
||||
else
|
||||
ClosePauseMenuImmediately();
|
||||
});
|
||||
|
@ -200,7 +200,7 @@ DEFINE_HOTKEY("TogglePause", TRANSLATE_NOOP("Hotkeys", "General"), TRANSLATE_NOO
|
||||
DEFINE_HOTKEY("PowerOff", TRANSLATE_NOOP("Hotkeys", "General"), TRANSLATE_NOOP("Hotkeys", "Power Off System"),
|
||||
[](s32 pressed) {
|
||||
if (!pressed && CanPause())
|
||||
Host::RequestSystemShutdown(true, g_settings.save_state_on_exit);
|
||||
Host::RequestSystemShutdown(true, g_settings.save_state_on_exit, true);
|
||||
})
|
||||
|
||||
DEFINE_HOTKEY("OpenPauseMenu", TRANSLATE_NOOP("Hotkeys", "General"), TRANSLATE_NOOP("Hotkeys", "Open Pause Menu"),
|
||||
|
@ -445,6 +445,6 @@ void UpdateRichPresence(bool update_session_time);
|
||||
namespace Host {
|
||||
|
||||
/// Requests shut down of the current virtual machine.
|
||||
void RequestSystemShutdown(bool allow_confirm, bool save_state);
|
||||
void RequestSystemShutdown(bool allow_confirm, bool save_state, bool check_memcard_busy);
|
||||
|
||||
} // namespace Host
|
||||
|
@ -1291,7 +1291,7 @@ void Host::RequestExitBigPicture()
|
||||
// sorry dude
|
||||
}
|
||||
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state)
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state, bool check_memcard_busy)
|
||||
{
|
||||
// TODO: Confirm
|
||||
if (System::IsValid())
|
||||
|
@ -140,7 +140,7 @@ void DisplayWidget::handleCloseEvent(QCloseEvent* event)
|
||||
if (QtHost::IsSystemValid() && !isActuallyFullscreen())
|
||||
{
|
||||
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, true),
|
||||
Q_ARG(bool, true), Q_ARG(bool, false));
|
||||
Q_ARG(bool, true), Q_ARG(bool, false), Q_ARG(bool, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2072,9 +2072,9 @@ void MainWindow::connectSignals()
|
||||
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
||||
[this]() { getSettingsWindow()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
||||
connect(m_ui.actionPowerOff, &QAction::triggered, this,
|
||||
[this]() { requestShutdown(true, true, g_settings.save_state_on_exit); });
|
||||
[this]() { requestShutdown(true, true, g_settings.save_state_on_exit, true); });
|
||||
connect(m_ui.actionPowerOffWithoutSaving, &QAction::triggered, this,
|
||||
[this]() { requestShutdown(false, false, false); });
|
||||
[this]() { requestShutdown(false, false, false, true); });
|
||||
connect(m_ui.actionReset, &QAction::triggered, this, []() { g_emu_thread->resetSystem(true); });
|
||||
connect(m_ui.actionPause, &QAction::toggled, this, [](bool active) { g_emu_thread->setSystemPaused(active); });
|
||||
connect(m_ui.actionScreenshot, &QAction::triggered, g_emu_thread, &EmuThread::saveScreenshot);
|
||||
@ -2499,7 +2499,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
event->ignore();
|
||||
|
||||
// Exit cancelled?
|
||||
if (!requestShutdown(true, true, g_settings.save_state_on_exit))
|
||||
if (!requestShutdown(true, true, g_settings.save_state_on_exit, true))
|
||||
return;
|
||||
|
||||
// Application will be exited in VM stopped handler.
|
||||
@ -2619,8 +2619,7 @@ void MainWindow::runOnUIThread(const std::function<void()>& func)
|
||||
func();
|
||||
}
|
||||
|
||||
bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_save_to_state /* = true */,
|
||||
bool save_state /* = true */)
|
||||
bool MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, bool save_state, bool check_memcard_busy)
|
||||
{
|
||||
if (!s_system_valid)
|
||||
return true;
|
||||
@ -2666,14 +2665,14 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav
|
||||
updateWindowState(true);
|
||||
|
||||
// Now we can actually shut down the VM.
|
||||
g_emu_thread->shutdownSystem(save_state, true);
|
||||
g_emu_thread->shutdownSystem(save_state, check_memcard_busy);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::requestExit(bool allow_confirm /* = true */)
|
||||
{
|
||||
// this is block, because otherwise closeEvent() will also prompt
|
||||
if (!requestShutdown(allow_confirm, true, g_settings.save_state_on_exit))
|
||||
if (!requestShutdown(allow_confirm, true, g_settings.save_state_on_exit, true))
|
||||
return;
|
||||
|
||||
// VM stopped signal won't have fired yet, so queue an exit if we still have one.
|
||||
|
@ -117,7 +117,7 @@ public Q_SLOTS:
|
||||
void cancelGameListRefresh();
|
||||
|
||||
void runOnUIThread(const std::function<void()>& func);
|
||||
bool requestShutdown(bool allow_confirm = true, bool allow_save_to_state = true, bool save_state = true);
|
||||
bool requestShutdown(bool allow_confirm, bool allow_save_to_state, bool save_state, bool check_memcard_busy);
|
||||
void requestExit(bool allow_confirm = true);
|
||||
void checkForSettingChanges();
|
||||
std::optional<WindowInfo> getWindowInfo();
|
||||
|
@ -2567,20 +2567,13 @@ bool QtHost::ShouldShowDebugOptions()
|
||||
return Host::GetBaseBoolSettingValue("Main", "ShowDebugMenu", false);
|
||||
}
|
||||
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state)
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state, bool check_memcard_busy)
|
||||
{
|
||||
if (!System::IsValid())
|
||||
return;
|
||||
|
||||
if (!allow_confirm)
|
||||
{
|
||||
g_emu_thread->shutdownSystem(save_state, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, allow_confirm),
|
||||
Q_ARG(bool, true), Q_ARG(bool, save_state));
|
||||
}
|
||||
Q_ARG(bool, true), Q_ARG(bool, save_state), Q_ARG(bool, check_memcard_busy));
|
||||
}
|
||||
|
||||
void Host::RequestResetSettings(bool system, bool controller)
|
||||
|
@ -360,7 +360,7 @@ void Host::RequestExitBigPicture()
|
||||
//
|
||||
}
|
||||
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state)
|
||||
void Host::RequestSystemShutdown(bool allow_confirm, bool save_state, bool check_memcard_busy)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user