fatal: Implement configuration based on settings

This commit is contained in:
Michael Scire 2018-11-10 12:38:24 -08:00
parent 5f3187300d
commit f914edeebd
6 changed files with 128 additions and 5 deletions

View file

@ -18,6 +18,7 @@
#include "fatal_user.hpp"
#include "fatal_event_manager.hpp"
#include "fatal_task.hpp"
#include "fatal_config.hpp"
static bool g_thrown = false;
@ -37,6 +38,9 @@ Result UserService::ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCp
ctx.error_code = error;
ctx.cpu_ctx = *cpu_ctx;
/* Get config. */
const FatalConfig *config = GetFatalConfig();
/* Get title id. On failure, it'll be zero. */
u64 title_id = 0;
pminfoGetTitleId(&title_id, pid);
@ -63,7 +67,13 @@ Result UserService::ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCp
}
/* Run tasks. */
RunFatalTasks(&ctx, title_id, policy == FatalType_ErrorReportAndErrorScreen, &erpt_event, &battery_event);
if (config->transition_to_fatal) {
RunFatalTasks(&ctx, title_id, policy == FatalType_ErrorReportAndErrorScreen, &erpt_event, &battery_event);
} else {
/* If flag is not set, don't show the fatal screen. */
return 0;
}
}
break;
default: