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 crash screen to all versions -- always enabled
This commit is contained in:
7
sm64.ld
7
sm64.ld
@@ -209,11 +209,6 @@ SECTIONS
|
||||
AUDIO_DIR/playback.o(.text);
|
||||
AUDIO_DIR/effects.o(.text);
|
||||
AUDIO_DIR/seqplayer.o(.text);
|
||||
#ifndef LIBULTRA_EXCLUSIVE
|
||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
||||
BUILD_DIR/libultra.a:driverominit.o(.text);
|
||||
#endif
|
||||
#endif
|
||||
BUILD_DIR/src/audio/external.o(.text);
|
||||
#ifdef VERSION_EU
|
||||
AUDIO_DIR/port.o(.text);
|
||||
@@ -323,6 +318,7 @@ SECTIONS
|
||||
#define SECTION data*
|
||||
// #include "lib/ultra/ld.inc"
|
||||
ULTRA_BUILD_DIR/libgultra_rom.a:*.o(.data*);
|
||||
BUILD_DIR/src/game/libgcc.o(.data*);
|
||||
#undef SECTION
|
||||
|
||||
/* rodata */
|
||||
@@ -394,6 +390,7 @@ SECTIONS
|
||||
#define SECTION rodata*
|
||||
// #include "lib/ultra/ld.inc"
|
||||
ULTRA_BUILD_DIR/libgultra_rom.a:*.o(.rodata*);
|
||||
BUILD_DIR/src/game/libgcc.o(.rodata*);
|
||||
#undef SECTION
|
||||
|
||||
#ifndef __sgi
|
||||
|
||||
@@ -392,9 +392,6 @@ s32 D_SH_80343CF0;
|
||||
s8 D_SH_80343CF8_pad[0x8];
|
||||
struct UnkStruct80343D00 D_SH_80343D00;
|
||||
s8 D_SH_8034DC8_pad[0x8];
|
||||
#ifndef LIBULTRA_EXCLUSIVE
|
||||
ALIGNED8 OSPiHandle DriveRomHandle; // used in osDriveRomInit.c. Why here?
|
||||
#endif
|
||||
s8 D_SH_80343E48_pad[0x8];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
#include "sm64.h"
|
||||
|
||||
#if defined(TARGET_N64) && (defined(VERSION_EU) || defined(VERSION_SH) || defined(VERSION_CN))
|
||||
#include "PR/os_internal.h"
|
||||
#include "lib/ultra/libc/xstdio.h"
|
||||
#include "lib/hackerlibultra/src/libc/xstdio.h"
|
||||
|
||||
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,
|
||||
@@ -113,16 +112,12 @@ void crash_screen_print(s32 x, s32 y, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
size = _Printf(write_to_buf, buf, fmt, args);
|
||||
size = _Printf((void*)write_to_buf, buf, fmt, args);
|
||||
|
||||
if (size > 0) {
|
||||
ptr = buf;
|
||||
|
||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
||||
while (size > 0) {
|
||||
#else
|
||||
while (*ptr) {
|
||||
#endif
|
||||
|
||||
glyph = gCrashScreenCharToGlyph[*ptr & 0x7f];
|
||||
|
||||
@@ -130,9 +125,7 @@ void crash_screen_print(s32 x, s32 y, const char *fmt, ...) {
|
||||
crash_screen_draw_glyph(x, y, glyph);
|
||||
}
|
||||
|
||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
||||
size--;
|
||||
#endif
|
||||
|
||||
ptr++;
|
||||
x += 6;
|
||||
@@ -189,16 +182,11 @@ void draw_crash_screen(OSThread *thread) {
|
||||
cause = 17;
|
||||
}
|
||||
|
||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
||||
osWritebackDCacheAll();
|
||||
#endif
|
||||
|
||||
crash_screen_draw_rect(25, 20, 270, 25);
|
||||
crash_screen_print(30, 25, "THREAD:%d (%s)", thread->id, gCauseDesc[cause]);
|
||||
crash_screen_print(30, 35, "PC:%08XH SR:%08XH VA:%08XH", tc->pc, tc->sr, tc->badvaddr);
|
||||
#ifdef VERSION_EU
|
||||
osWritebackDCacheAll();
|
||||
#endif
|
||||
crash_screen_sleep(2000);
|
||||
crash_screen_draw_rect(25, 45, 270, 185);
|
||||
crash_screen_print(30, 50, "AT:%08XH V0:%08XH V1:%08XH", (u32) tc->at, (u32) tc->v0,
|
||||
@@ -221,9 +209,6 @@ void draw_crash_screen(OSThread *thread) {
|
||||
(u32) tc->sp);
|
||||
crash_screen_print(30, 140, "S8:%08XH RA:%08XH", (u32) tc->s8, (u32) tc->ra);
|
||||
crash_screen_print_fpcsr(tc->fpcsr);
|
||||
#ifdef VERSION_EU
|
||||
osWritebackDCacheAll();
|
||||
#endif
|
||||
crash_screen_print_float_reg(30, 170, 0, &tc->fp0.f.f_even);
|
||||
crash_screen_print_float_reg(120, 170, 2, &tc->fp2.f.f_even);
|
||||
crash_screen_print_float_reg(210, 170, 4, &tc->fp4.f.f_even);
|
||||
@@ -240,9 +225,6 @@ void draw_crash_screen(OSThread *thread) {
|
||||
crash_screen_print_float_reg(120, 210, 26, &tc->fp26.f.f_even);
|
||||
crash_screen_print_float_reg(210, 210, 28, &tc->fp28.f.f_even);
|
||||
crash_screen_print_float_reg(30, 220, 30, &tc->fp30.f.f_even);
|
||||
#ifdef VERSION_EU
|
||||
osWritebackDCacheAll();
|
||||
#endif
|
||||
osViBlack(FALSE);
|
||||
osViSwapBuffer(gCrashScreen.framebuffer);
|
||||
}
|
||||
@@ -277,38 +259,20 @@ void thread2_crash_screen(UNUSED void *arg) {
|
||||
}
|
||||
|
||||
void crash_screen_set_framebuffer(u16 *framebuffer, u16 width, u16 height) {
|
||||
#ifdef VERSION_EU
|
||||
gCrashScreen.framebuffer = framebuffer;
|
||||
#else
|
||||
gCrashScreen.framebuffer = (u16 *)((uintptr_t)framebuffer | 0xa0000000);
|
||||
#endif
|
||||
gCrashScreen.width = width;
|
||||
gCrashScreen.height = height;
|
||||
}
|
||||
|
||||
void crash_screen_init(void) {
|
||||
#ifdef VERSION_EU
|
||||
gCrashScreen.framebuffer = (u16 *) (osMemSize | 0x80000000) - SCREEN_WIDTH * SCREEN_HEIGHT;
|
||||
#else
|
||||
gCrashScreen.framebuffer = (u16 *) (osMemSize | 0xA0000000) - SCREEN_WIDTH * SCREEN_HEIGHT;
|
||||
#endif
|
||||
gCrashScreen.width = SCREEN_WIDTH;
|
||||
#ifdef VERSION_EU
|
||||
gCrashScreen.height = SCREEN_HEIGHT;
|
||||
#else
|
||||
gCrashScreen.height = 0x10;
|
||||
#endif
|
||||
osCreateMesgQueue(&gCrashScreen.mesgQueue, &gCrashScreen.mesg, 1);
|
||||
osCreateThread(
|
||||
&gCrashScreen.thread, 2, thread2_crash_screen, NULL,
|
||||
(u8 *) gCrashScreen.stack + sizeof(gCrashScreen.stack),
|
||||
#ifdef VERSION_EU
|
||||
OS_PRIORITY_APPMAX
|
||||
#else
|
||||
OS_PRIORITY_RMON
|
||||
#endif
|
||||
);
|
||||
osStartThread(&gCrashScreen.thread);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -329,11 +329,15 @@ void handle_dp_complete(void) {
|
||||
sCurrentDisplaySPTask = NULL;
|
||||
}
|
||||
|
||||
extern void crash_screen_init(void);
|
||||
|
||||
void thread3_main(UNUSED void *arg) {
|
||||
setup_mesg_queues();
|
||||
alloc_pool();
|
||||
load_engine_code_segment();
|
||||
|
||||
crash_screen_init();
|
||||
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
|
||||
osStartThread(&gSoundThread);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user