diff options
Diffstat (limited to '')
-rw-r--r-- | src/yuzu/main.cpp | 24 | ||||
-rw-r--r-- | src/yuzu/main.h | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f696fc494..ccff08074 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -370,6 +370,12 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, std::string_view additional_args) { #ifdef YUZU_USE_QT_WEB_ENGINE + if (disable_web_applet) { + emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, + "http://localhost"); + return; + } + QtNXWebEngineView web_browser_view(this, Core::System::GetInstance()); ui.action_Pause->setEnabled(false); @@ -418,6 +424,22 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, bool exit_check = false; + // TODO (Morph): Remove this + QAction* exit_action = new QAction(tr("Disable Web Applet"), this); + connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] { + const auto result = QMessageBox::warning( + this, tr("Disable Web Applet"), + tr("Disabling the web applet will cause it to not be shown again for the rest of the " + "emulated session. This 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?"), + QMessageBox::Yes | QMessageBox::No); + if (result == QMessageBox::Yes) { + disable_web_applet = true; + web_browser_view.SetFinished(true); + } + }); + ui.menubar->addAction(exit_action); + while (!web_browser_view.IsFinished()) { QCoreApplication::processEvents(); @@ -462,6 +484,8 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, ui.action_Restart->setEnabled(true); ui.action_Stop->setEnabled(true); + ui.menubar->removeAction(exit_action); + QCoreApplication::processEvents(); emit WebBrowserClosed(exit_reason, last_url); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index ed02df3e2..b140995bf 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -325,6 +325,9 @@ private: // Last game booted, used for multi-process apps QString last_filename_booted; + // Disables the web applet for the rest of the emulated session + bool disable_web_applet{}; + protected: void dropEvent(QDropEvent* event) override; void dragEnterEvent(QDragEnterEvent* event) override; |