summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.cpp5
-rw-r--r--src/common/settings.h5
-rw-r--r--src/common/settings_enums.h2
-rw-r--r--src/yuzu/configuration/shared_translation.cpp9
-rw-r--r--src/yuzu/main.cpp8
-rw-r--r--src/yuzu/uisettings.h16
6 files changed, 36 insertions, 9 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 3fde3cae6..98b43e49c 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -45,6 +45,7 @@ SWITCHABLE(CpuAccuracy, true);
45SWITCHABLE(FullscreenMode, true); 45SWITCHABLE(FullscreenMode, true);
46SWITCHABLE(GpuAccuracy, true); 46SWITCHABLE(GpuAccuracy, true);
47SWITCHABLE(Language, true); 47SWITCHABLE(Language, true);
48SWITCHABLE(MemoryLayout, true);
48SWITCHABLE(NvdecEmulation, false); 49SWITCHABLE(NvdecEmulation, false);
49SWITCHABLE(Region, true); 50SWITCHABLE(Region, true);
50SWITCHABLE(RendererBackend, true); 51SWITCHABLE(RendererBackend, true);
@@ -61,6 +62,10 @@ SWITCHABLE(u32, false);
61SWITCHABLE(u8, false); 62SWITCHABLE(u8, false);
62SWITCHABLE(u8, true); 63SWITCHABLE(u8, true);
63 64
65// Used in UISettings
66// TODO see if we can move this to uisettings.cpp
67SWITCHABLE(ConfirmStop, true);
68
64#undef SETTING 69#undef SETTING
65#undef SWITCHABLE 70#undef SWITCHABLE
66#endif 71#endif
diff --git a/src/common/settings.h b/src/common/settings.h
index 98ab0ec2e..236e33bee 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -67,6 +67,7 @@ SWITCHABLE(CpuAccuracy, true);
67SWITCHABLE(FullscreenMode, true); 67SWITCHABLE(FullscreenMode, true);
68SWITCHABLE(GpuAccuracy, true); 68SWITCHABLE(GpuAccuracy, true);
69SWITCHABLE(Language, true); 69SWITCHABLE(Language, true);
70SWITCHABLE(MemoryLayout, true);
70SWITCHABLE(NvdecEmulation, false); 71SWITCHABLE(NvdecEmulation, false);
71SWITCHABLE(Region, true); 72SWITCHABLE(Region, true);
72SWITCHABLE(RendererBackend, true); 73SWITCHABLE(RendererBackend, true);
@@ -83,6 +84,10 @@ SWITCHABLE(u32, false);
83SWITCHABLE(u8, false); 84SWITCHABLE(u8, false);
84SWITCHABLE(u8, true); 85SWITCHABLE(u8, true);
85 86
87// Used in UISettings
88// TODO see if we can move this to uisettings.h
89SWITCHABLE(ConfirmStop, true);
90
86#undef SETTING 91#undef SETTING
87#undef SWITCHABLE 92#undef SWITCHABLE
88#endif 93#endif
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h
index 815cafe15..11429d7a8 100644
--- a/src/common/settings_enums.h
+++ b/src/common/settings_enums.h
@@ -133,6 +133,8 @@ ENUM(CpuAccuracy, Auto, Accurate, Unsafe, Paranoid);
133 133
134ENUM(MemoryLayout, Memory_4Gb, Memory_6Gb, Memory_8Gb); 134ENUM(MemoryLayout, Memory_4Gb, Memory_6Gb, Memory_8Gb);
135 135
136ENUM(ConfirmStop, Ask_Always, Ask_Based_On_Game, Ask_Never);
137
136ENUM(FullscreenMode, Borderless, Exclusive); 138ENUM(FullscreenMode, Borderless, Exclusive);
137 139
138ENUM(NvdecEmulation, Off, Cpu, Gpu); 140ENUM(NvdecEmulation, Off, Cpu, Gpu);
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp
index 9e65525ca..3fe448f27 100644
--- a/src/yuzu/configuration/shared_translation.cpp
+++ b/src/yuzu/configuration/shared_translation.cpp
@@ -157,7 +157,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
157 INSERT(UISettings, select_user_on_boot, "Prompt for user on game boot", ""); 157 INSERT(UISettings, select_user_on_boot, "Prompt for user on game boot", "");
158 INSERT(UISettings, pause_when_in_background, "Pause emulation when in background", ""); 158 INSERT(UISettings, pause_when_in_background, "Pause emulation when in background", "");
159 INSERT(UISettings, confirm_before_closing, "Confirm exit while emulation is running", ""); 159 INSERT(UISettings, confirm_before_closing, "Confirm exit while emulation is running", "");
160 INSERT(UISettings, confirm_before_stopping, "Confirm stopping emulation", ""); 160 INSERT(UISettings, confirm_before_stopping, "Confirm before stopping emulation", "");
161 INSERT(UISettings, hide_mouse, "Hide mouse on inactivity", ""); 161 INSERT(UISettings, hide_mouse, "Hide mouse on inactivity", "");
162 INSERT(UISettings, controller_applet_disabled, "Disable controller applet", ""); 162 INSERT(UISettings, controller_applet_disabled, "Disable controller applet", "");
163 163
@@ -384,6 +384,13 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
384 translations->insert( 384 translations->insert(
385 {Settings::EnumMetadata<Settings::ConsoleMode>::Index(), 385 {Settings::EnumMetadata<Settings::ConsoleMode>::Index(),
386 {PAIR(ConsoleMode, Docked, "Docked"), PAIR(ConsoleMode, Handheld, "Handheld")}}); 386 {PAIR(ConsoleMode, Docked, "Docked"), PAIR(ConsoleMode, Handheld, "Handheld")}});
387 translations->insert(
388 {Settings::EnumMetadata<Settings::ConfirmStop>::Index(),
389 {
390 PAIR(ConfirmStop, Ask_Always, "Always ask (Default)"),
391 PAIR(ConfirmStop, Ask_Based_On_Game, "Only if game specifies not to stop"),
392 PAIR(ConfirmStop, Ask_Never, "Never ask"),
393 }});
387 394
388#undef PAIR 395#undef PAIR
389#undef CTX_PAIR 396#undef CTX_PAIR
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 26fa3e191..2727f9d06 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3426,7 +3426,7 @@ void GMainWindow::OnPauseContinueGame() {
3426 3426
3427void GMainWindow::OnStopGame() { 3427void GMainWindow::OnStopGame() {
3428 // Open (or not) the right confirm dialog based on current setting and game exit lock 3428 // Open (or not) the right confirm dialog based on current setting and game exit lock
3429 if (UISettings::values.confirm_before_stopping.GetValue() == UISettings::AskStopIndex::Always) { 3429 if (UISettings::values.confirm_before_stopping.GetValue() == ConfirmStop::Ask_Always) {
3430 if (system->GetExitLocked()) { 3430 if (system->GetExitLocked()) {
3431 if (!ConfirmForceLockedExit()) { 3431 if (!ConfirmForceLockedExit()) {
3432 return; 3432 return;
@@ -3438,7 +3438,7 @@ void GMainWindow::OnStopGame() {
3438 } 3438 }
3439 } else { 3439 } else {
3440 if (UISettings::values.confirm_before_stopping.GetValue() == 3440 if (UISettings::values.confirm_before_stopping.GetValue() ==
3441 UISettings::AskStopIndex::Game && 3441 ConfirmStop::Ask_Based_On_Game &&
3442 system->GetExitLocked()) { 3442 system->GetExitLocked()) {
3443 if (!ConfirmForceLockedExit()) { 3443 if (!ConfirmForceLockedExit()) {
3444 return; 3444 return;
@@ -4081,13 +4081,15 @@ void GMainWindow::OnLoadAmiibo() {
4081bool GMainWindow::question(QWidget* parent, const QString& title, const QString& text, 4081bool GMainWindow::question(QWidget* parent, const QString& title, const QString& text,
4082 QMessageBox::StandardButtons buttons, 4082 QMessageBox::StandardButtons buttons,
4083 QMessageBox::StandardButton defaultButton) { 4083 QMessageBox::StandardButton defaultButton) {
4084 ControllerNavigation* controller_navigation = new ControllerNavigation(system->HIDCore(), this);
4085 4084
4086 QMessageBox* box_dialog = new QMessageBox(parent); 4085 QMessageBox* box_dialog = new QMessageBox(parent);
4087 box_dialog->setWindowTitle(title); 4086 box_dialog->setWindowTitle(title);
4088 box_dialog->setText(text); 4087 box_dialog->setText(text);
4089 box_dialog->setStandardButtons(buttons); 4088 box_dialog->setStandardButtons(buttons);
4090 box_dialog->setDefaultButton(defaultButton); 4089 box_dialog->setDefaultButton(defaultButton);
4090
4091 ControllerNavigation* controller_navigation =
4092 new ControllerNavigation(system->HIDCore(), box_dialog);
4091 connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent, 4093 connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
4092 [box_dialog](Qt::Key key) { 4094 [box_dialog](Qt::Key key) {
4093 QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); 4095 QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 1216c4efa..b62ff620c 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -16,7 +16,9 @@
16#include "common/settings_enums.h" 16#include "common/settings_enums.h"
17 17
18using Settings::Category; 18using Settings::Category;
19using Settings::ConfirmStop;
19using Settings::Setting; 20using Settings::Setting;
21using Settings::SwitchableSetting;
20 22
21#ifndef CANNOT_EXPLICITLY_INSTANTIATE 23#ifndef CANNOT_EXPLICITLY_INSTANTIATE
22namespace Settings { 24namespace Settings {
@@ -56,8 +58,6 @@ enum class Theme {
56 MidnightBlueColorful, 58 MidnightBlueColorful,
57}; 59};
58 60
59enum AskStopIndex : int { Always, Game, Never };
60
61using Themes = std::array<std::pair<const char*, const char*>, 6>; 61using Themes = std::array<std::pair<const char*, const char*>, 6>;
62extern const Themes themes; 62extern const Themes themes;
63 63
@@ -96,9 +96,15 @@ struct Values {
96 Setting<bool> confirm_before_closing{ 96 Setting<bool> confirm_before_closing{
97 linkage, true, "confirmClose", Category::UiGeneral, Settings::Specialization::Default, 97 linkage, true, "confirmClose", Category::UiGeneral, Settings::Specialization::Default,
98 true, true}; 98 true, true};
99 Setting<bool> confirm_before_stopping{ 99
100 linkage, true, "confirmStop", Category::UiGeneral, Settings::Specialization::Default, 100 SwitchableSetting<ConfirmStop> confirm_before_stopping{linkage,
101 true, true}; 101 ConfirmStop::Ask_Always,
102 "confirmStop",
103 Category::UiGeneral,
104 Settings::Specialization::Default,
105 true,
106 true};
107
102 Setting<bool> first_start{linkage, true, "firstStart", Category::Ui}; 108 Setting<bool> first_start{linkage, true, "firstStart", Category::Ui};
103 Setting<bool> pause_when_in_background{linkage, 109 Setting<bool> pause_when_in_background{linkage,
104 false, 110 false,