Use FatalType_ErrorReportAndErrorScreen instead of FatalType_ErrorScreen, on pre-3.0.0. FatalType_ErrorScreen is only available with 3.0.0+, this fixes a regression where using fatalSimple on pre-3.0.0 caused a system hang.

This commit is contained in:
yellows8 2018-10-11 15:41:05 -04:00
parent 347e3b3156
commit 42d3c32b37
2 changed files with 6 additions and 2 deletions

View File

@ -11,18 +11,19 @@
typedef enum {
FatalType_ErrorReportAndErrorScreen = 0,
FatalType_ErrorReport = 1,
FatalType_ErrorScreen = 2
FatalType_ErrorScreen = 2 ///< Only available with 3.0.0+. If specified, FatalType_ErrorReportAndErrorScreen will be used instead on pre-3.0.0.
} FatalType;
/**
* @brief Triggers a system fatal error.
* @param err[in] Result code to throw.
* @note This function does not return.
* @note This uses \ref fatalWithType with \ref FatalType_ErrorScreen internally.
*/
void NORETURN fatalSimple(Result err);
/**
* @brief Triggers a system fatal error with a custom FatalType.
* @brief Triggers a system fatal error with a custom \ref FatalType.
* @param err[in] Result code to throw.
* @param err[in] Type of fatal error to throw.
* @note This function may not return, depending on \ref FatalType.

View File

@ -17,6 +17,9 @@ void NORETURN fatalSimple(Result err) {
void fatalWithType(Result err, FatalType type) {
Result rc = 0;
//Only 3.0.0+ supports FatalType_ErrorScreen, when specified on pre-3.0.0 use FatalType_ErrorReportAndErrorScreen instead.
if (type == FatalType_ErrorScreen && !kernelAbove300()) type = FatalType_ErrorReportAndErrorScreen;
if (detectDebugger()) {
svcBreak(0x80000000, err, 0);
}