diff options
| author | 2019-03-11 19:37:10 -0400 | |
|---|---|---|
| committer | 2019-04-17 11:35:24 -0400 | |
| commit | d9f6715d459630d165537c19e48cc2ddd54b294b (patch) | |
| tree | 87747e2f3558201196c04e0920e8b51fd8101491 /src | |
| parent | applets: Add Error applet (diff) | |
| download | yuzu-d9f6715d459630d165537c19e48cc2ddd54b294b.tar.gz yuzu-d9f6715d459630d165537c19e48cc2ddd54b294b.tar.xz yuzu-d9f6715d459630d165537c19e48cc2ddd54b294b.zip | |
frontend: Add frontend receiver for Error applet
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/core/frontend/applets/error.cpp | 34 | ||||
| -rw-r--r-- | src/core/frontend/applets/error.h | 37 |
3 files changed, 79 insertions, 2 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c59107102..2ace866ee 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -88,6 +88,10 @@ add_library(core STATIC | |||
| 88 | file_sys/vfs_vector.h | 88 | file_sys/vfs_vector.h |
| 89 | file_sys/xts_archive.cpp | 89 | file_sys/xts_archive.cpp |
| 90 | file_sys/xts_archive.h | 90 | file_sys/xts_archive.h |
| 91 | frontend/applets/error.cpp | ||
| 92 | frontend/applets/error.h | ||
| 93 | frontend/applets/general_frontend.cpp | ||
| 94 | frontend/applets/general_frontend.h | ||
| 91 | frontend/applets/profile_select.cpp | 95 | frontend/applets/profile_select.cpp |
| 92 | frontend/applets/profile_select.h | 96 | frontend/applets/profile_select.h |
| 93 | frontend/applets/software_keyboard.cpp | 97 | frontend/applets/software_keyboard.cpp |
| @@ -177,12 +181,14 @@ add_library(core STATIC | |||
| 177 | hle/service/am/applet_oe.h | 181 | hle/service/am/applet_oe.h |
| 178 | hle/service/am/applets/applets.cpp | 182 | hle/service/am/applets/applets.cpp |
| 179 | hle/service/am/applets/applets.h | 183 | hle/service/am/applets/applets.h |
| 184 | hle/service/am/applets/error.cpp | ||
| 185 | hle/service/am/applets/error.h | ||
| 186 | hle/service/am/applets/general_backend.cpp | ||
| 187 | hle/service/am/applets/general_backend.h | ||
| 180 | hle/service/am/applets/profile_select.cpp | 188 | hle/service/am/applets/profile_select.cpp |
| 181 | hle/service/am/applets/profile_select.h | 189 | hle/service/am/applets/profile_select.h |
| 182 | hle/service/am/applets/software_keyboard.cpp | 190 | hle/service/am/applets/software_keyboard.cpp |
| 183 | hle/service/am/applets/software_keyboard.h | 191 | hle/service/am/applets/software_keyboard.h |
| 184 | hle/service/am/applets/stub_applet.cpp | ||
| 185 | hle/service/am/applets/stub_applet.h | ||
| 186 | hle/service/am/applets/web_browser.cpp | 192 | hle/service/am/applets/web_browser.cpp |
| 187 | hle/service/am/applets/web_browser.h | 193 | hle/service/am/applets/web_browser.h |
| 188 | hle/service/am/idle.cpp | 194 | hle/service/am/idle.cpp |
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp new file mode 100644 index 000000000..4002a9211 --- /dev/null +++ b/src/core/frontend/applets/error.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/frontend/applets/error.h" | ||
| 6 | |||
| 7 | namespace Core::Frontend { | ||
| 8 | |||
| 9 | ErrorApplet::~ErrorApplet() = default; | ||
| 10 | |||
| 11 | void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const { | ||
| 12 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", | ||
| 13 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | ||
| 14 | } | ||
| 15 | |||
| 16 | void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 17 | std::function<void()> finished) const { | ||
| 18 | LOG_CRITICAL( | ||
| 19 | Service_Fatal, | ||
| 20 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", | ||
| 21 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw, time.count()); | ||
| 22 | } | ||
| 23 | |||
| 24 | void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text, | ||
| 25 | std::string detail_text, | ||
| 26 | std::function<void()> finished) const { | ||
| 27 | LOG_CRITICAL(Service_Fatal, | ||
| 28 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", | ||
| 29 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | ||
| 30 | LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text); | ||
| 31 | LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text); | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h new file mode 100644 index 000000000..699df940d --- /dev/null +++ b/src/core/frontend/applets/error.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <chrono> | ||
| 8 | #include <functional> | ||
| 9 | |||
| 10 | #include "core/hle/result.h" | ||
| 11 | |||
| 12 | namespace Core::Frontend { | ||
| 13 | |||
| 14 | class ErrorApplet { | ||
| 15 | public: | ||
| 16 | virtual ~ErrorApplet(); | ||
| 17 | |||
| 18 | virtual void ShowError(ResultCode error, std::function<void()> finished) const = 0; | ||
| 19 | |||
| 20 | virtual void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 21 | std::function<void()> finished) const = 0; | ||
| 22 | |||
| 23 | virtual void ShowCustomErrorText(ResultCode error, std::string dialog_text, | ||
| 24 | std::string fullscreen_text, | ||
| 25 | std::function<void()> finished) const = 0; | ||
| 26 | }; | ||
| 27 | |||
| 28 | class DefaultErrorApplet final : public ErrorApplet { | ||
| 29 | public: | ||
| 30 | void ShowError(ResultCode error, std::function<void()> finished) const override; | ||
| 31 | void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 32 | std::function<void()> finished) const override; | ||
| 33 | void ShowCustomErrorText(ResultCode error, std::string main_text, std::string detail_text, | ||
| 34 | std::function<void()> finished) const override; | ||
| 35 | }; | ||
| 36 | |||
| 37 | } // namespace Core::Frontend | ||