creport: Solidify main() logic.

This commit is contained in:
Michael Scire 2018-06-25 01:58:44 -06:00
parent 851d21a276
commit 4e7fcc1a50
3 changed files with 49 additions and 7 deletions

View file

@ -94,12 +94,27 @@ int main(int argc, char **argv) {
/* Try to debug the crashed process. */
g_Creport.BuildReport(crashed_pid, argv[1][0] == '1');
if (R_SUCCEEDED(nsdevInitialize())) {
nsdevTerminateProcess(crashed_pid);
nsdevExit();
if (g_Creport.WasSuccessful()) {
if (R_SUCCEEDED(nsdevInitialize())) {
nsdevTerminateProcess(crashed_pid);
nsdevExit();
}
/* Don't fatal if we have extra info. */
if (kernelAbove500()) {
if (g_Creport.IsApplication()) {
return 0;
}
} else if (argv[1][0] == '1') {
return 0;
}
/* Also don't fatal if we're a user break. */
if (g_Creport.IsUserBreak()) {
return 0;
}
fatalWithType(g_Creport.GetResult(), FatalType_ErrorScreen);
}
/* TODO: fatalWithType(<report error>, FatalType_ErrorScreen); */
fatalWithType(0, FatalType_ErrorScreen);
}