From 68fabb248a5e43e801edb156cc03fb25b0523c49 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 24 Feb 2026 23:00:23 +0100 Subject: [PATCH 1/2] Make OSPanic abort properly, don't unwind stack Existing abort code is a bad idea on a modern compiler. Just call abort() --- src/m_Do/m_Do_printf.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/m_Do/m_Do_printf.cpp b/src/m_Do/m_Do_printf.cpp index 0350811da9..05f9afcc0b 100644 --- a/src/m_Do/m_Do_printf.cpp +++ b/src/m_Do/m_Do_printf.cpp @@ -293,7 +293,9 @@ void OSPanic(const char* file, int line, const char* fmt, ...) { mDoPrintf_vprintf(fmt, args); va_end(args); OSAttention(" in \"%s\" on line %d.\n", file, line); - +#if TARGET_PC + abort(); +#else OSAttention("\nAddress: Back Chain LR Save\n"); for (i = 0, p = (u32*)OSGetStackPointer(); p && (uintptr_t)p != 0xFFFFFFFF && i++ < 16; p = (u32*)*p) { OSAttention("0x%08x: 0x%08x 0x%08x\n", p, p[0], p[1]); @@ -303,4 +305,5 @@ void OSPanic(const char* file, int line, const char* fmt, ...) { tmp = (u32*)0x1234567; *tmp = (uintptr_t)tmp; PPCHalt(); +#endif } From 5d496baee4e70a705bad3685bb7a67c73a75f785 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 24 Feb 2026 23:01:29 +0100 Subject: [PATCH 2/2] Make JUT showAssert_f_va just log and exit Normally it tries to draw the error on screen, but the wait on vblank just infinite loops for us. --- src/JSystem/JUtility/JUTAssert.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/JSystem/JUtility/JUTAssert.cpp b/src/JSystem/JUtility/JUTAssert.cpp index bf26d0ae99..7d230b942f 100644 --- a/src/JSystem/JUtility/JUTAssert.cpp +++ b/src/JSystem/JUtility/JUTAssert.cpp @@ -90,6 +90,10 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va sMessageLife = -1; vsnprintf(sMessageString, 255, msg, args); +#if TARGET_PC + OSReport_Error("Failed assertion: %s:%d\n", file, line); + OSReport_Error("%s\n", sMessageString); +#else if (device & 2) { OSReport("Failed assertion: %s:%d\n", file, line); OSReport("%s\n", sMessageString); @@ -121,6 +125,7 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va } } } +#endif } void showAssert_f(u32 device, const char* file, int line, const char* msg, ...) {