Add missing OSFatals and make existing OSFatals more verbose

This commit is contained in:
Maschell 2024-03-01 09:58:19 +01:00
parent 6816efc263
commit 105014220d
2 changed files with 10 additions and 6 deletions

View File

@ -114,7 +114,7 @@ DECL_FUNCTION(void, GX2Init, uint32_t attributes) {
DEBUG_FUNCTION_LINE_VERBOSE("Init Overlay");
gOverlayFrame = new (std::nothrow) OverlayFrame(1280.0f, 720.0f);
if (!gOverlayFrame) {
OSFatal("Failed to alloc gOverlayFrame");
OSFatal("NotificationModule: Failed to alloc gOverlayFrame");
}
// Add notification that had been called before the overlay was ready
@ -124,12 +124,16 @@ DECL_FUNCTION(void, GX2Init, uint32_t attributes) {
gOverlayQueueDuringStartup.clear();
// Allocate shader.
ColorShader::instance();
Texture2DShader::instance();
if (ColorShader::instance() == nullptr) {
OSFatal("NotificationModule: Failed to alloc ColorShader");
}
if (Texture2DShader::instance() == nullptr) {
OSFatal("NotificationModule: Failed to alloc Texture2DShader");
}
// has been allocated in WUMS INIT
if (!gContextState) {
OSFatal("Failed to alloc gContextState");
OSFatal("NotificationModule: Failed to alloc gContextState");
}
real_GX2SetupContextStateEx(gContextState, GX2_TRUE);
DCInvalidateRange(gContextState, sizeof(GX2ContextState)); // Important!

View File

@ -20,7 +20,7 @@ WUMS_INITIALIZE() {
initLogging();
if (FunctionPatcher_InitLibrary() != FUNCTION_PATCHER_RESULT_SUCCESS) {
OSFatal("homebrew_notifications: FunctionPatcher_InitLibrary failed");
OSFatal("NotificationModule: FunctionPatcher_InitLibrary failed");
}
DEBUG_FUNCTION_LINE("Patch NotificationModule functions");
for (uint32_t i = 0; i < function_replacements_size; i++) {
@ -38,7 +38,7 @@ WUMS_INITIALIZE() {
sizeof(GX2ContextState),
GX2_CONTEXT_STATE_ALIGNMENT);
if (gContextState == nullptr) {
OSFatal("Failed to allocate gContextState");
OSFatal("NotificationModule: Failed to allocate gContextState");
} else {
DEBUG_FUNCTION_LINE("Allocated %d bytes for gCont extState", sizeof(GX2ContextState));
}