diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp index 6530186c10..2b87b999ee 100644 --- a/src/yuzu/hotkeys.cpp +++ b/src/yuzu/hotkeys.cpp @@ -181,6 +181,10 @@ bool ControllerShortcut::IsEnabled() const { return is_enabled; } +bool ControllerShortcut::IsActive() const { + return active; +} + void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) { if (!is_enabled) { return; diff --git a/src/yuzu/hotkeys.h b/src/yuzu/hotkeys.h index 56eee8d821..bfe1f19177 100644 --- a/src/yuzu/hotkeys.h +++ b/src/yuzu/hotkeys.h @@ -39,6 +39,7 @@ public: void SetEnabled(bool enable); bool IsEnabled() const; + bool IsActive() const; Q_SIGNALS: void Activated(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 1431cf2fee..fddfc3d699 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3449,7 +3449,19 @@ void GMainWindow::OnStopGame() { } bool GMainWindow::ConfirmShutdownGame() { - if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) { + static const QString main_window = QStringLiteral("Main Window"); + static const QString action = QStringLiteral("Stop Emulation"); + auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); + auto* hotkey = hotkey_registry.GetControllerHotkey(main_window, action, controller); + + ConfirmStop confirm_action = UISettings::values.confirm_before_stopping.GetValue(); + + // Always ask when using the controller hotkey + if (hotkey != nullptr && hotkey->IsActive()) { + confirm_action = ConfirmStop::Ask_Always; + } + + if (confirm_action == ConfirmStop::Ask_Always) { if (system->GetExitLocked()) { if (!ConfirmForceLockedExit()) { return false; @@ -3459,13 +3471,9 @@ bool GMainWindow::ConfirmShutdownGame() { return false; } } - } else { - if (UISettings::values.confirm_before_stopping.GetValue() == - ConfirmStop::Ask_Based_On_Game && - system->GetExitLocked()) { - if (!ConfirmForceLockedExit()) { - return false; - } + } else if (confirm_action == ConfirmStop::Ask_Based_On_Game && system->GetExitLocked()) { + if (!ConfirmForceLockedExit()) { + return false; } } return true; diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index b62ff620ce..6a3f215865 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -98,7 +98,7 @@ struct Values { true, true}; SwitchableSetting confirm_before_stopping{linkage, - ConfirmStop::Ask_Always, + ConfirmStop::Ask_Based_On_Game, "confirmStop", Category::UiGeneral, Settings::Specialization::Default,