You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Add support for crash screen asserts
This commit is contained in:
@@ -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();
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,12 @@
|
|||||||
#include "n64-stdlib.h"
|
#include "n64-stdlib.h"
|
||||||
#include "n64-stdio.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 ) {
|
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_printf( "%s:%u: %s: Assertion `%s' failed.\n", file, line, fcn, assertion );
|
||||||
n64_abort();
|
n64_abort();
|
||||||
}
|
}
|
||||||
|
|||||||
4
sm64.ld
4
sm64.ld
@@ -9,6 +9,8 @@ OUTPUT_ARCH (mips)
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ld.h"
|
#include "ld.h"
|
||||||
|
|
||||||
|
EXTERN(assertMsg);
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
__romPos = 0;
|
__romPos = 0;
|
||||||
@@ -52,7 +54,7 @@ SECTIONS
|
|||||||
AUDIO_DIR*.o(.text);
|
AUDIO_DIR*.o(.text);
|
||||||
ULTRA_BUILD_DIR/libgultra_rom.a:*.o(.text);
|
ULTRA_BUILD_DIR/libgultra_rom.a:*.o(.text);
|
||||||
BUILD_DIR/src/audio/external.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/libpl2.a:*.o(.text);
|
||||||
BUILD_DIR/lib/rsp.o(.text);
|
BUILD_DIR/lib/rsp.o(.text);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "PR/os_internal.h"
|
#include "PR/os_internal.h"
|
||||||
#include "lib/hackerlibultra/src/libc/xstdio.h"
|
#include "lib/hackerlibultra/src/libc/xstdio.h"
|
||||||
#include "n64-stdio.h"
|
#include "n64-libc.h"
|
||||||
|
|
||||||
#include "audio/external.h"
|
#include "audio/external.h"
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
extern u32 gGlobalTimer;
|
extern u32 gGlobalTimer;
|
||||||
|
|
||||||
|
char *assertMsg = NULL;
|
||||||
|
|
||||||
u8 gCrashScreenCharToGlyph[128] = {
|
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, -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,
|
-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++;
|
ptr++;
|
||||||
x += 6;
|
x += 6;
|
||||||
|
|
||||||
|
if (x >= 285) {
|
||||||
|
x = 30;
|
||||||
|
y += 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,6 +299,10 @@ void draw_crash_screen(OSThread *thread) {
|
|||||||
n64_printf("==============================================\n");
|
n64_printf("==============================================\n");
|
||||||
osViBlack(FALSE);
|
osViBlack(FALSE);
|
||||||
crash_screen_sleep(2500);
|
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);
|
play_music(SEQ_PLAYER_LEVEL, SEQ_LEVEL_BOSS_KOOPA, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user