From db637b5a4c02772eb827ed01a6ecb430e4b65daa Mon Sep 17 00:00:00 2001
From: lat9nq <lat9nq@gmail.com>
Date: Thu, 17 Mar 2022 19:20:15 -0400
Subject: yuzu qt: Save disable_web_applet setting

The web applet causes multiple issues with the rest of the application.
Disable it by default and add a debug option to re-enable it until a
proper solution can be found.
---
 src/yuzu/configuration/config.cpp          | 2 ++
 src/yuzu/configuration/configure_debug.cpp | 2 +-
 src/yuzu/main.cpp                          | 3 ++-
 src/yuzu/uisettings.h                      | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 4b943c6baf..d2e735f480 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -775,6 +775,7 @@ void Config::ReadUIValues() {
     ReadBasicSetting(UISettings::values.pause_when_in_background);
     ReadBasicSetting(UISettings::values.mute_when_in_background);
     ReadBasicSetting(UISettings::values.hide_mouse);
+    ReadBasicSetting(UISettings::values.disable_web_applet);
 
     qt_config->endGroup();
 }
@@ -1308,6 +1309,7 @@ void Config::SaveUIValues() {
     WriteBasicSetting(UISettings::values.pause_when_in_background);
     WriteBasicSetting(UISettings::values.mute_when_in_background);
     WriteBasicSetting(UISettings::values.hide_mouse);
+    WriteBasicSetting(UISettings::values.disable_web_applet);
 
     qt_config->endGroup();
 }
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index c2e6bf8d1a..bd50f7a682 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -61,7 +61,7 @@ void ConfigureDebug::SetConfiguration() {
     ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue());
 
 #ifdef YUZU_USE_QT_WEB_ENGINE
-    ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet);
+    ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue());
 #else
     ui->disable_web_applet->setEnabled(false);
     ui->disable_web_applet->setText(QString::fromUtf8("Web applet not compiled"));
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b137d5e38d..617c42734d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -653,7 +653,8 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
         const auto result = QMessageBox::warning(
             this, tr("Disable Web Applet"),
             tr("Disabling the web applet can lead to undefined behavior and should only be used "
-               "with Super Mario 3D All-Stars. Are you sure you want to disable the web applet?"),
+               "with Super Mario 3D All-Stars. Are you sure you want to disable the web "
+               "applet?\n(This can be re-enabled in the Debug settings.)"),
             QMessageBox::Yes | QMessageBox::No);
         if (result == QMessageBox::Yes) {
             UISettings::values.disable_web_applet = true;
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index c952843fe0..cc5aee3823 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -114,7 +114,7 @@ struct Values {
 
     bool configuration_applied;
     bool reset_to_defaults;
-    bool disable_web_applet{};
+    Settings::BasicSetting<bool> disable_web_applet{true, "disable_web_applet"};
 };
 
 extern Values values;
-- 
cgit v1.2.3-70-g09d2