yuzu: Always ask when closing game with controller
This commit is contained in:
parent
bd05ace08d
commit
c797ba1865
4 changed files with 22 additions and 9 deletions
|
@ -181,6 +181,10 @@ bool ControllerShortcut::IsEnabled() const {
|
||||||
return is_enabled;
|
return is_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ControllerShortcut::IsActive() const {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) {
|
void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) {
|
||||||
if (!is_enabled) {
|
if (!is_enabled) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
void SetEnabled(bool enable);
|
void SetEnabled(bool enable);
|
||||||
bool IsEnabled() const;
|
bool IsEnabled() const;
|
||||||
|
bool IsActive() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void Activated();
|
void Activated();
|
||||||
|
|
|
@ -3449,7 +3449,19 @@ void GMainWindow::OnStopGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GMainWindow::ConfirmShutdownGame() {
|
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 (system->GetExitLocked()) {
|
||||||
if (!ConfirmForceLockedExit()) {
|
if (!ConfirmForceLockedExit()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3459,15 +3471,11 @@ bool GMainWindow::ConfirmShutdownGame() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (confirm_action == ConfirmStop::Ask_Based_On_Game && system->GetExitLocked()) {
|
||||||
if (UISettings::values.confirm_before_stopping.GetValue() ==
|
|
||||||
ConfirmStop::Ask_Based_On_Game &&
|
|
||||||
system->GetExitLocked()) {
|
|
||||||
if (!ConfirmForceLockedExit()) {
|
if (!ConfirmForceLockedExit()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ struct Values {
|
||||||
true, true};
|
true, true};
|
||||||
|
|
||||||
SwitchableSetting<ConfirmStop> confirm_before_stopping{linkage,
|
SwitchableSetting<ConfirmStop> confirm_before_stopping{linkage,
|
||||||
ConfirmStop::Ask_Always,
|
ConfirmStop::Ask_Based_On_Game,
|
||||||
"confirmStop",
|
"confirmStop",
|
||||||
Category::UiGeneral,
|
Category::UiGeneral,
|
||||||
Settings::Specialization::Default,
|
Settings::Specialization::Default,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue