mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-06 03:25:36 +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) {
|
ConfirmIfSavingMemoryCards(FSUI_STR("shut down"), [save_state](bool result) {
|
||||||
if (result)
|
if (result)
|
||||||
Host::RunOnCPUThread([save_state]() { Host::RequestSystemShutdown(false, save_state); });
|
Host::RunOnCPUThread([save_state]() { Host::RequestSystemShutdown(false, save_state, false); });
|
||||||
else
|
else
|
||||||
ClosePauseMenuImmediately();
|
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"),
|
DEFINE_HOTKEY("PowerOff", TRANSLATE_NOOP("Hotkeys", "General"), TRANSLATE_NOOP("Hotkeys", "Power Off System"),
|
||||||
[](s32 pressed) {
|
[](s32 pressed) {
|
||||||
if (!pressed && CanPause())
|
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"),
|
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 {
|
namespace Host {
|
||||||
|
|
||||||
/// Requests shut down of the current virtual machine.
|
/// 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
|
} // namespace Host
|
||||||
|
@ -1291,7 +1291,7 @@ void Host::RequestExitBigPicture()
|
|||||||
// sorry dude
|
// 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
|
// TODO: Confirm
|
||||||
if (System::IsValid())
|
if (System::IsValid())
|
||||||
|
@ -140,7 +140,7 @@ void DisplayWidget::handleCloseEvent(QCloseEvent* event)
|
|||||||
if (QtHost::IsSystemValid() && !isActuallyFullscreen())
|
if (QtHost::IsSystemValid() && !isActuallyFullscreen())
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, true),
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -2072,9 +2072,9 @@ void MainWindow::connectSignals()
|
|||||||
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
|
||||||
[this]() { getSettingsWindow()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
[this]() { getSettingsWindow()->getGameListSettingsWidget()->addSearchDirectory(this); });
|
||||||
connect(m_ui.actionPowerOff, &QAction::triggered, 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,
|
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.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.actionPause, &QAction::toggled, this, [](bool active) { g_emu_thread->setSystemPaused(active); });
|
||||||
connect(m_ui.actionScreenshot, &QAction::triggered, g_emu_thread, &EmuThread::saveScreenshot);
|
connect(m_ui.actionScreenshot, &QAction::triggered, g_emu_thread, &EmuThread::saveScreenshot);
|
||||||
@ -2499,7 +2499,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||||||
event->ignore();
|
event->ignore();
|
||||||
|
|
||||||
// Exit cancelled?
|
// Exit cancelled?
|
||||||
if (!requestShutdown(true, true, g_settings.save_state_on_exit))
|
if (!requestShutdown(true, true, g_settings.save_state_on_exit, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Application will be exited in VM stopped handler.
|
// Application will be exited in VM stopped handler.
|
||||||
@ -2619,8 +2619,7 @@ void MainWindow::runOnUIThread(const std::function<void()>& func)
|
|||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_save_to_state /* = true */,
|
bool MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, bool save_state, bool check_memcard_busy)
|
||||||
bool save_state /* = true */)
|
|
||||||
{
|
{
|
||||||
if (!s_system_valid)
|
if (!s_system_valid)
|
||||||
return true;
|
return true;
|
||||||
@ -2666,14 +2665,14 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav
|
|||||||
updateWindowState(true);
|
updateWindowState(true);
|
||||||
|
|
||||||
// Now we can actually shut down the VM.
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::requestExit(bool allow_confirm /* = true */)
|
void MainWindow::requestExit(bool allow_confirm /* = true */)
|
||||||
{
|
{
|
||||||
// this is block, because otherwise closeEvent() will also prompt
|
// 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;
|
return;
|
||||||
|
|
||||||
// VM stopped signal won't have fired yet, so queue an exit if we still have one.
|
// 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 cancelGameListRefresh();
|
||||||
|
|
||||||
void runOnUIThread(const std::function<void()>& func);
|
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 requestExit(bool allow_confirm = true);
|
||||||
void checkForSettingChanges();
|
void checkForSettingChanges();
|
||||||
std::optional<WindowInfo> getWindowInfo();
|
std::optional<WindowInfo> getWindowInfo();
|
||||||
|
@ -2567,20 +2567,13 @@ bool QtHost::ShouldShowDebugOptions()
|
|||||||
return Host::GetBaseBoolSettingValue("Main", "ShowDebugMenu", false);
|
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())
|
if (!System::IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!allow_confirm)
|
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, check_memcard_busy));
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::RequestResetSettings(bool system, bool controller)
|
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