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;
|
||||
}
|
||||
|
||||
bool ControllerShortcut::IsActive() const {
|
||||
return active;
|
||||
}
|
||||
|
||||
void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) {
|
||||
if (!is_enabled) {
|
||||
return;
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
void SetEnabled(bool enable);
|
||||
bool IsEnabled() const;
|
||||
bool IsActive() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void Activated();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -98,7 +98,7 @@ struct Values {
|
|||
true, true};
|
||||
|
||||
SwitchableSetting<ConfirmStop> confirm_before_stopping{linkage,
|
||||
ConfirmStop::Ask_Always,
|
||||
ConfirmStop::Ask_Based_On_Game,
|
||||
"confirmStop",
|
||||
Category::UiGeneral,
|
||||
Settings::Specialization::Default,
|
||||
|
|
Loading…
Add table
Reference in a new issue