summaryrefslogtreecommitdiff
path: root/src/core/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/applets/error.cpp34
-rw-r--r--src/core/frontend/applets/error.h37
2 files changed, 71 insertions, 0 deletions
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
7namespace Core::Frontend {
8
9ErrorApplet::~ErrorApplet() = default;
10
11void 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
16void 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
24void 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
12namespace Core::Frontend {
13
14class ErrorApplet {
15public:
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
28class DefaultErrorApplet final : public ErrorApplet {
29public:
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