applets/error: Save report on error applet

This matches official behavior with the erpt/eclct/eupld service chain.
This commit is contained in:
Zach Hilman 2019-05-17 21:47:47 -04:00
parent bdc47693f1
commit 24392c8ec8

View file

@ -9,8 +9,10 @@
#include "common/string_util.h" #include "common/string_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/frontend/applets/error.h" #include "core/frontend/applets/error.h"
#include "core/hle/kernel/process.h"
#include "core/hle/service/am/am.h" #include "core/hle/service/am/am.h"
#include "core/hle/service/am/applets/error.h" #include "core/hle/service/am/applets/error.h"
#include "core/reporter.h"
namespace Service::AM::Applets { namespace Service::AM::Applets {
@ -143,9 +145,12 @@ void Error::Execute() {
} }
const auto callback = [this] { DisplayCompleted(); }; const auto callback = [this] { DisplayCompleted(); };
const auto title_id = Core::CurrentProcess()->GetTitleID();
const auto& reporter{Core::System::GetInstance().GetReporter()};
switch (mode) { switch (mode) {
case ErrorAppletMode::ShowError: case ErrorAppletMode::ShowError:
reporter.SaveErrorReport(title_id, error_code);
frontend.ShowError(error_code, callback); frontend.ShowError(error_code, callback);
break; break;
case ErrorAppletMode::ShowSystemError: case ErrorAppletMode::ShowSystemError:
@ -156,14 +161,18 @@ void Error::Execute() {
const auto& detail_text = const auto& detail_text =
system ? args->system_error.detail_text : args->application_error.detail_text; system ? args->system_error.detail_text : args->application_error.detail_text;
frontend.ShowCustomErrorText( const auto main_text_string =
error_code, Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size());
Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size()), const auto detail_text_string =
Common::StringFromFixedZeroTerminatedBuffer(detail_text.data(), detail_text.size()), Common::StringFromFixedZeroTerminatedBuffer(detail_text.data(), detail_text.size());
callback);
reporter.SaveErrorReport(title_id, error_code, main_text_string, detail_text_string);
frontend.ShowCustomErrorText(error_code, main_text_string, detail_text_string, callback);
break; break;
} }
case ErrorAppletMode::ShowErrorRecord: case ErrorAppletMode::ShowErrorRecord:
reporter.SaveErrorReport(title_id, error_code,
fmt::format("{:016X}", args->error_record.posix_time));
frontend.ShowErrorWithTimestamp( frontend.ShowErrorWithTimestamp(
error_code, std::chrono::seconds{args->error_record.posix_time}, callback); error_code, std::chrono::seconds{args->error_record.posix_time}, callback);
break; break;