diff --git a/android/app/src/cpp/android_host_interface.cpp b/android/app/src/cpp/android_host_interface.cpp
index 21c1a92cd..f422ff3be 100644
--- a/android/app/src/cpp/android_host_interface.cpp
+++ b/android/app/src/cpp/android_host_interface.cpp
@@ -374,6 +374,10 @@ void AndroidHostInterface::EmulationThreadEntryPoint(jobject emulation_activity,
EmulationThreadLoop();
thread_env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_onEmulationStopped);
+
+ if (g_settings.save_state_on_exit)
+ SaveResumeSaveState();
+
PowerOffSystem();
DestroyImGuiContext();
thread_env->DeleteGlobalRef(m_emulation_activity_object);
diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp
index 693abc27c..247441f77 100644
--- a/src/duckstation-qt/mainwindow.cpp
+++ b/src/duckstation-qt/mainwindow.cpp
@@ -810,6 +810,7 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
m_ui.actionResumeLastState->setDisabled(starting || running);
m_ui.actionPowerOff->setDisabled(starting || !running);
+ m_ui.actionPowerOffWithoutSaving->setDisabled(starting || !running);
m_ui.actionReset->setDisabled(starting || !running);
m_ui.actionPause->setDisabled(starting || !running);
m_ui.actionChangeDisc->setDisabled(starting || !running);
@@ -926,6 +927,8 @@ void MainWindow::connectSignals()
connect(m_ui.actionAddGameDirectory, &QAction::triggered,
[this]() { getSettingsDialog()->getGameListSettingsWidget()->addSearchDirectory(this); });
connect(m_ui.actionPowerOff, &QAction::triggered, m_host_interface, &QtHostInterface::powerOffSystem);
+ connect(m_ui.actionPowerOffWithoutSaving, &QAction::triggered, m_host_interface,
+ &QtHostInterface::powerOffSystemWithoutSaving);
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
connect(m_ui.actionPause, &QAction::toggled, [this](bool active) { m_host_interface->pauseSystem(active); });
connect(m_ui.actionScreenshot, &QAction::triggered, m_host_interface, &QtHostInterface::saveScreenshot);
diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui
index b1eba0743..2edf3b0e7 100644
--- a/src/duckstation-qt/mainwindow.ui
+++ b/src/duckstation-qt/mainwindow.ui
@@ -87,6 +87,7 @@
+
@@ -177,7 +178,7 @@
-
+
@@ -790,6 +791,15 @@
Open Data Directory...
+
+
+
+ :/icons/process-stop.png:/icons/process-stop.png
+
+
+ Power Off &Without Saving
+
+
diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp
index 7a0a5bc3a..1d26202d2 100644
--- a/src/duckstation-qt/qthostinterface.cpp
+++ b/src/duckstation-qt/qthostinterface.cpp
@@ -808,6 +808,20 @@ void QtHostInterface::powerOffSystem()
return;
}
+ if (g_settings.save_state_on_exit)
+ SaveResumeSaveState();
+
+ PowerOffSystem();
+}
+
+void QtHostInterface::powerOffSystemWithoutSaving()
+{
+ if (!isOnWorkerThread())
+ {
+ QMetaObject::invokeMethod(this, "powerOffSystemWithoutSaving", Qt::QueuedConnection);
+ return;
+ }
+
PowerOffSystem();
}
diff --git a/src/duckstation-qt/qthostinterface.h b/src/duckstation-qt/qthostinterface.h
index 383bb33f4..19a9f7383 100644
--- a/src/duckstation-qt/qthostinterface.h
+++ b/src/duckstation-qt/qthostinterface.h
@@ -154,6 +154,7 @@ public Q_SLOTS:
void resumeSystemFromState(const QString& filename, bool boot_on_failure);
void resumeSystemFromMostRecentState();
void powerOffSystem();
+ void powerOffSystemWithoutSaving();
void synchronousPowerOffSystem();
void resetSystem();
void pauseSystem(bool paused, bool wait_until_paused = false);
diff --git a/src/duckstation-qt/resources/icons/process-stop.png b/src/duckstation-qt/resources/icons/process-stop.png
new file mode 100644
index 000000000..290a46d5b
Binary files /dev/null and b/src/duckstation-qt/resources/icons/process-stop.png differ
diff --git a/src/duckstation-qt/resources/icons/process-stop@2x.png b/src/duckstation-qt/resources/icons/process-stop@2x.png
new file mode 100644
index 000000000..9b86dff6d
Binary files /dev/null and b/src/duckstation-qt/resources/icons/process-stop@2x.png differ
diff --git a/src/duckstation-qt/resources/resources.qrc b/src/duckstation-qt/resources/resources.qrc
index d5362cc07..7138f84e5 100644
--- a/src/duckstation-qt/resources/resources.qrc
+++ b/src/duckstation-qt/resources/resources.qrc
@@ -92,6 +92,8 @@
icons/preferences-desktop-keyboard-shortcuts@2x.png
icons/preferences-system.png
icons/preferences-system@2x.png
+ icons/process-stop.png
+ icons/process-stop@2x.png
icons/software-update-available.png
icons/software-update-available@2x.png
icons/star-0.png
diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp
index 0a4ab44fa..5de776675 100644
--- a/src/duckstation-sdl/sdl_host_interface.cpp
+++ b/src/duckstation-sdl/sdl_host_interface.cpp
@@ -673,7 +673,11 @@ void SDLHostInterface::DrawMainMenuBar()
if (ImGui::MenuItem("Power Off", nullptr, false, system_enabled))
{
- RunLater([this]() { DestroySystem(); });
+ RunLater([this]() {
+ if (g_settings.save_state_on_exit)
+ SaveResumeSaveState();
+ PowerOffSystem();
+ });
ClearImGuiFocus();
}
diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp
index 1666ff926..7696ffe68 100644
--- a/src/frontend-common/common_host_interface.cpp
+++ b/src/frontend-common/common_host_interface.cpp
@@ -174,9 +174,6 @@ void CommonHostInterface::PowerOffSystem()
if (System::IsShutdown())
return;
- if (g_settings.save_state_on_exit)
- SaveResumeSaveState();
-
HostInterface::PowerOffSystem();
if (InBatchMode())
@@ -1489,6 +1486,9 @@ void CommonHostInterface::RegisterGeneralHotkeys()
}
}
+ if (g_settings.save_state_on_exit)
+ SaveResumeSaveState();
+
PowerOffSystem();
}
});