diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-04-05 00:09:42 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-04-17 17:35:24 +0200 |
commit | 2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527 (patch) | |
tree | dab1215651c1855ba471c5c69b7c2c7f9e2e24ba | |
parent | main: Add GMainWindow hooks for Error display (diff) | |
download | yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar.gz yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar.bz2 yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar.lz yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar.xz yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.tar.zst yuzu-2adb226b26f7f4b9a2c5cd4ea056479d7b5c1527.zip |
-rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 2 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.h | 4 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/error.cpp | 7 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/error.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/general_backend.cpp | 1 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/general_backend.h | 6 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/profile_select.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/software_keyboard.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/web_browser.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/web_browser.h | 4 | ||||
-rw-r--r-- | src/yuzu/applets/error.cpp | 6 | ||||
-rw-r--r-- | src/yuzu/applets/web_browser.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/applets/web_browser.h | 6 |
13 files changed, 30 insertions, 25 deletions
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 6a36b4b8f..3a3d3d0bf 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -13,7 +13,7 @@ DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; void DefaultWebBrowserApplet::OpenPage(std::string_view filename, std::function<void()> unpack_romfs_callback, - std::function<void()> finished_callback) const { + std::function<void()> finished_callback) { LOG_INFO(Service_AM, "(STUBBED) called - No suitable web browser implementation found to open website page " "at '{}'!", diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 41d272d26..f952856af 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -14,7 +14,7 @@ public: virtual ~WebBrowserApplet(); virtual void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback, - std::function<void()> finished_callback) const = 0; + std::function<void()> finished_callback) = 0; }; class DefaultWebBrowserApplet final : public WebBrowserApplet { @@ -22,7 +22,7 @@ public: ~DefaultWebBrowserApplet() override; void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback, - std::function<void()> finished_callback) const override; + std::function<void()> finished_callback) override; }; } // namespace Core::Frontend diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index fec014f3b..04774bedc 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp @@ -2,6 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <array> +#include <cstring> +#include "common/assert.h" +#include "common/logging/log.h" #include "common/string_util.h" #include "core/core.h" #include "core/frontend/applets/error.h" @@ -54,7 +58,7 @@ struct ApplicationErrorArg { }; static_assert(sizeof(ApplicationErrorArg) == 0x1014, "ApplicationErrorArg has incorrect size."); -union ErrorArguments { +union Error::ErrorArguments { ShowError error; ShowErrorRecord error_record; SystemErrorArg system_error; @@ -107,6 +111,7 @@ void Error::Initialize() { case ErrorAppletMode::ShowSystemError: CopyArgumentData(data, args->system_error); error_code = ResultCode(Decode64BitError(args->system_error.error_code_64)); + break; case ErrorAppletMode::ShowApplicationError: CopyArgumentData(data, args->application_error); error_code = ResultCode(args->application_error.error_code); diff --git a/src/core/hle/service/am/applets/error.h b/src/core/hle/service/am/applets/error.h index fcf9caef2..a3590d181 100644 --- a/src/core/hle/service/am/applets/error.h +++ b/src/core/hle/service/am/applets/error.h @@ -9,8 +9,6 @@ namespace Service::AM::Applets { -union ErrorArguments; - enum class ErrorAppletMode : u8 { ShowError = 0, ShowSystemError = 1, @@ -23,7 +21,7 @@ enum class ErrorAppletMode : u8 { class Error final : public Applet { public: - Error(const Core::Frontend::ErrorApplet& frontend); + explicit Error(const Core::Frontend::ErrorApplet& frontend); ~Error() override; void Initialize() override; @@ -36,12 +34,14 @@ public: void DisplayCompleted(); private: + union ErrorArguments; + const Core::Frontend::ErrorApplet& frontend; ResultCode error_code = RESULT_SUCCESS; - ErrorAppletMode mode; + ErrorAppletMode mode = ErrorAppletMode::ShowError; std::unique_ptr<ErrorArguments> args; - bool complete; + bool complete = false; }; } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index 18ab0718b..c591b9ac2 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp @@ -4,6 +4,7 @@ #include <string> +#include "common/assert.h" #include "common/hex_util.h" #include "common/logging/log.h" #include "core/core.h" diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/general_backend.h index d7313e74a..2dd255d7c 100644 --- a/src/core/hle/service/am/applets/general_backend.h +++ b/src/core/hle/service/am/applets/general_backend.h @@ -15,7 +15,7 @@ enum class PhotoViewerAppletMode : u8 { class PhotoViewer final : public Applet { public: - PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend); + explicit PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend); ~PhotoViewer() override; void Initialize() override; @@ -28,8 +28,8 @@ public: private: const Core::Frontend::PhotoViewerApplet& frontend; - bool complete; - PhotoViewerAppletMode mode; + bool complete = false; + PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp; }; class StubApplet final : public Applet { diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h index cb281dd52..a2ac6cf50 100644 --- a/src/core/hle/service/am/applets/profile_select.h +++ b/src/core/hle/service/am/applets/profile_select.h @@ -7,7 +7,6 @@ #include <vector> #include "common/common_funcs.h" -#include "core/frontend/applets/software_keyboard.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/applets/applets.h" @@ -29,7 +28,7 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco class ProfileSelect final : public Applet { public: - ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend); + explicit ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend); ~ProfileSelect() override; void Initialize() override; diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h index e97e1cd5b..0fbc43e51 100644 --- a/src/core/hle/service/am/applets/software_keyboard.h +++ b/src/core/hle/service/am/applets/software_keyboard.h @@ -55,7 +55,7 @@ static_assert(sizeof(KeyboardConfig) == 0x3E0, "KeyboardConfig has incorrect siz class SoftwareKeyboard final : public Applet { public: - SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend); + explicit SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend); ~SoftwareKeyboard() override; void Initialize() override; diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index a66e23fce..7878f5136 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp @@ -95,7 +95,7 @@ static FileSys::VirtualFile GetManualRomFS() { return nullptr; } -WebBrowser::WebBrowser(const Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {} +WebBrowser::WebBrowser(Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {} WebBrowser::~WebBrowser() = default; diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h index 894bdb35a..7e0f34c7d 100644 --- a/src/core/hle/service/am/applets/web_browser.h +++ b/src/core/hle/service/am/applets/web_browser.h @@ -12,7 +12,7 @@ namespace Service::AM::Applets { class WebBrowser final : public Applet { public: - WebBrowser(const Core::Frontend::WebBrowserApplet& frontend); + WebBrowser(Core::Frontend::WebBrowserApplet& frontend); ~WebBrowser() override; void Initialize() override; @@ -32,7 +32,7 @@ public: void Finalize(); private: - const Core::Frontend::WebBrowserApplet& frontend; + Core::Frontend::WebBrowserApplet& frontend; bool complete = false; bool unpacked = false; diff --git a/src/yuzu/applets/error.cpp b/src/yuzu/applets/error.cpp index f7535e768..1fb2fe277 100644 --- a/src/yuzu/applets/error.cpp +++ b/src/yuzu/applets/error.cpp @@ -17,7 +17,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) { QtErrorDisplay::~QtErrorDisplay() = default; void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) const { - this->callback = finished; + this->callback = std::move(finished); emit MainWindowDisplayError( tr("An error has occured.\nPlease try again or contact the developer of the " "software.\n\nError Code: %1-%2 (0x%3)") @@ -28,7 +28,7 @@ void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, std::function<void()> finished) const { - this->callback = finished; + this->callback = std::move(finished); emit MainWindowDisplayError( tr("An error occured on %1 at %2.\nPlease try again or contact the " "developer of the software.\n\nError Code: %3-%4 (0x%5)") @@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text, std::string fullscreen_text, std::function<void()> finished) const { - this->callback = finished; + this->callback = std::move(finished); emit MainWindowDisplayError( tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5") .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/web_browser.cpp index 5b7b73518..ac80b2fa2 100644 --- a/src/yuzu/applets/web_browser.cpp +++ b/src/yuzu/applets/web_browser.cpp @@ -88,7 +88,7 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { QtWebBrowser::~QtWebBrowser() = default; void QtWebBrowser::OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback, - std::function<void()> finished_callback) const { + std::function<void()> finished_callback) { this->unpack_romfs_callback = std::move(unpack_romfs_callback); this->finished_callback = std::move(finished_callback); diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h index 983886586..1a3d67353 100644 --- a/src/yuzu/applets/web_browser.h +++ b/src/yuzu/applets/web_browser.h @@ -38,7 +38,7 @@ public: ~QtWebBrowser() override; void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback, - std::function<void()> finished_callback) const override; + std::function<void()> finished_callback) override; signals: void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const; @@ -47,6 +47,6 @@ private: void MainWindowUnpackRomFS(); void MainWindowFinishedBrowsing(); - mutable std::function<void()> unpack_romfs_callback; - mutable std::function<void()> finished_callback; + std::function<void()> unpack_romfs_callback; + std::function<void()> finished_callback; }; |