From fc41c6a6a72e24c15175e23e663a45e0137aefe5 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 1 Mar 2024 09:58:19 +0100 Subject: [PATCH] Add missing OSFatals and make existing OSFatals more verbose --- src/function_patches.cpp | 12 ++++++++---- src/main.cpp | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/function_patches.cpp b/src/function_patches.cpp index 53c39b7..6d302d5 100644 --- a/src/function_patches.cpp +++ b/src/function_patches.cpp @@ -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! diff --git a/src/main.cpp b/src/main.cpp index 2d5b032..965652f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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)); }