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, | |||
| 370 | std::string_view additional_args) { | 370 | std::string_view additional_args) { |
| 371 | #ifdef YUZU_USE_QT_WEB_ENGINE | 371 | #ifdef YUZU_USE_QT_WEB_ENGINE |
| 372 | 372 | ||
| 373 | if (disable_web_applet) { | ||
| 374 | emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, | ||
| 375 | "http://localhost"); | ||
| 376 | return; | ||
| 377 | } | ||
| 378 | |||
| 373 | QtNXWebEngineView web_browser_view(this, Core::System::GetInstance()); | 379 | QtNXWebEngineView web_browser_view(this, Core::System::GetInstance()); |
| 374 | 380 | ||
| 375 | ui.action_Pause->setEnabled(false); | 381 | ui.action_Pause->setEnabled(false); |
| @@ -418,6 +424,22 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, | |||
| 418 | 424 | ||
| 419 | bool exit_check = false; | 425 | bool exit_check = false; |
| 420 | 426 | ||
| 427 | // TODO (Morph): Remove this | ||
| 428 | QAction* exit_action = new QAction(tr("Disable Web Applet"), this); | ||
| 429 | connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] { | ||
| 430 | const auto result = QMessageBox::warning( | ||
| 431 | this, tr("Disable Web Applet"), | ||
| 432 | tr("Disabling the web applet will cause it to not be shown again for the rest of the " | ||
| 433 | "emulated session. This can lead to undefined behavior and should only be used with " | ||
| 434 | "Super Mario 3D All-Stars. Are you sure you want to disable the web applet?"), | ||
| 435 | QMessageBox::Yes | QMessageBox::No); | ||
| 436 | if (result == QMessageBox::Yes) { | ||
| 437 | disable_web_applet = true; | ||
| 438 | web_browser_view.SetFinished(true); | ||
| 439 | } | ||
| 440 | }); | ||
| 441 | ui.menubar->addAction(exit_action); | ||
| 442 | |||
| 421 | while (!web_browser_view.IsFinished()) { | 443 | while (!web_browser_view.IsFinished()) { |
| 422 | QCoreApplication::processEvents(); | 444 | QCoreApplication::processEvents(); |
| 423 | 445 | ||
| @@ -462,6 +484,8 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, | |||
| 462 | ui.action_Restart->setEnabled(true); | 484 | ui.action_Restart->setEnabled(true); |
| 463 | ui.action_Stop->setEnabled(true); | 485 | ui.action_Stop->setEnabled(true); |
| 464 | 486 | ||
| 487 | ui.menubar->removeAction(exit_action); | ||
| 488 | |||
| 465 | QCoreApplication::processEvents(); | 489 | QCoreApplication::processEvents(); |
| 466 | 490 | ||
| 467 | emit WebBrowserClosed(exit_reason, last_url); | 491 | 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: | |||
| 325 | // Last game booted, used for multi-process apps | 325 | // Last game booted, used for multi-process apps |
| 326 | QString last_filename_booted; | 326 | QString last_filename_booted; |
| 327 | 327 | ||
| 328 | // Disables the web applet for the rest of the emulated session | ||
| 329 | bool disable_web_applet{}; | ||
| 330 | |||
| 328 | protected: | 331 | protected: |
| 329 | void dropEvent(QDropEvent* event) override; | 332 | void dropEvent(QDropEvent* event) override; |
| 330 | void dragEnterEvent(QDragEnterEvent* event) override; | 333 | void dragEnterEvent(QDragEnterEvent* event) override; |