diff --git a/lib/n64-libc/n64-alloca.c b/lib/n64-libc/n64-alloca.c deleted file mode 100644 index 458afd70..00000000 --- a/lib/n64-libc/n64-alloca.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "n64-assert.h" - -#include "n64-stdlib.h" -#include "n64-stdio.h" - -void __n64_assert_fail( const char *assertion, const char *file, unsigned int line, const char *fcn ) { - n64_printf( "%s:%u: %s: Assertion `%s' failed.\n", file, line, fcn, assertion ); - n64_abort(); -} diff --git a/lib/n64-libc/n64-assert.c b/lib/n64-libc/n64-assert.c index 458afd70..49619405 100644 --- a/lib/n64-libc/n64-assert.c +++ b/lib/n64-libc/n64-assert.c @@ -3,7 +3,12 @@ #include "n64-stdlib.h" #include "n64-stdio.h" +extern char *assertMsg; +char assertBuf[256]; + void __n64_assert_fail( const char *assertion, const char *file, unsigned int line, const char *fcn ) { + n64_snprintf( assertBuf, 256, "%s:%u:%s: Assertion `%s' failed.", file, line, fcn, assertion ); + assertMsg = &assertBuf[0]; n64_printf( "%s:%u: %s: Assertion `%s' failed.\n", file, line, fcn, assertion ); n64_abort(); } diff --git a/sm64.ld b/sm64.ld index 6198c555..f39fbc2d 100755 --- a/sm64.ld +++ b/sm64.ld @@ -9,6 +9,8 @@ OUTPUT_ARCH (mips) #include "config.h" #include "ld.h" +EXTERN(assertMsg); + SECTIONS { __romPos = 0; @@ -52,7 +54,7 @@ SECTIONS AUDIO_DIR*.o(.text); ULTRA_BUILD_DIR/libgultra_rom.a:*.o(.text); BUILD_DIR/src/audio/external.o(.text); - BUILD_DIR/n64-libc.a:*.o(.text); + BUILD_DIR/n64-libc.a:*.o(.text*); BUILD_DIR/libpl2.a:*.o(.text); BUILD_DIR/lib/rsp.o(.text); diff --git a/src/init/crash_screen.c b/src/init/crash_screen.c index bcac814b..971071bb 100644 --- a/src/init/crash_screen.c +++ b/src/init/crash_screen.c @@ -6,7 +6,7 @@ #include "PR/os_internal.h" #include "lib/hackerlibultra/src/libc/xstdio.h" -#include "n64-stdio.h" +#include "n64-libc.h" #include "audio/external.h" #include "sounds.h" @@ -14,6 +14,8 @@ extern u32 gGlobalTimer; +char *assertMsg = NULL; + u8 gCrashScreenCharToGlyph[128] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, 43, -1, -1, 37, 38, -1, 42, @@ -149,6 +151,11 @@ void crash_screen_print(s32 x, s32 y, const char *fmt, ...) { ptr++; x += 6; + + if (x >= 285) { + x = 30; + y += 10; + } } } @@ -292,6 +299,10 @@ void draw_crash_screen(OSThread *thread) { n64_printf("==============================================\n"); osViBlack(FALSE); crash_screen_sleep(2500); + if (assertMsg != NULL) { + crash_screen_draw_rect(25, 45, 270, 185); + crash_screen_print(30, 50, assertMsg); + } play_music(SEQ_PLAYER_LEVEL, SEQ_LEVEL_BOSS_KOOPA, 0); }