From b9c43bb721b32588b2144299bd4f9e8c585ad48d Mon Sep 17 00:00:00 2001 From: Fazana <52551480+FazanaJ@users.noreply.github.com> Date: Fri, 10 Sep 2021 21:37:35 +0100 Subject: [PATCH] Mario Gaming branded crash screen --- src/audio/external.c | 5 ----- src/audio/external.h | 5 +++++ src/audio/heap.c | 3 --- src/audio/synthesis.c | 2 -- src/game/crash_screen.c | 16 ++++++++++++++-- src/game/game_init.c | 3 ++- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/audio/external.c b/src/audio/external.c index fc97681f..08f000f8 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -57,11 +57,6 @@ struct SoundCharacteristics { // Also the number of frames a discrete sound can be in the WAITING state before being deleted #define SOUND_MAX_FRESHNESS 10 -struct SequenceQueueItem { - u8 seqId; - u8 priority; -}; // size = 0x2 - // data #if defined(VERSION_EU) || defined(VERSION_SH) // moved to bss in data.c diff --git a/src/audio/external.h b/src/audio/external.h index 96dbc104..0a802a0e 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -18,6 +18,11 @@ #define SEQ_PLAYER_ENV 1 // Misc music like the puzzle jingle #define SEQ_PLAYER_SFX 2 // Sound effects +struct SequenceQueueItem { + u8 seqId; + u8 priority; +}; // size = 0x2 + extern s32 gAudioErrorFlags; extern f32 gGlobalSoundSource[3]; diff --git a/src/audio/heap.c b/src/audio/heap.c index 4f5e6e31..a5bee754 100644 --- a/src/audio/heap.c +++ b/src/audio/heap.c @@ -1073,9 +1073,6 @@ void wait_for_audio_frames(s32 frames) { } #endif - -#define VERSION_EU - u8 sAudioFirstBoot = 0; //Separate the reverb settings into their own func. Bit unstable currently, so still only runs at boot. #if defined(VERSION_EU) || defined(VERSION_SH) diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c index 5e6f4bf3..7c341491 100644 --- a/src/audio/synthesis.c +++ b/src/audio/synthesis.c @@ -299,8 +299,6 @@ u8 audioString1[] = "pitch %x: delaybytes %d : olddelay %d\n"; u8 audioString2[] = "cont %x: delaybytes %d : olddelay %d\n"; #endif -#define VERSION_EU - #ifdef VERSION_EU // Equivalent functionality as the US/JP version, // just that the reverb structure is chosen from an array with index diff --git a/src/game/crash_screen.c b/src/game/crash_screen.c index ae672038..8b516d4f 100644 --- a/src/game/crash_screen.c +++ b/src/game/crash_screen.c @@ -5,6 +5,7 @@ #include "buffers/framebuffers.h" #include "types.h" #include "puppyprint.h" +#include "audio/external.h" #include "sm64.h" @@ -188,7 +189,7 @@ void draw_crash_screen(OSThread *thread) { } osWritebackDCacheAll(); - crash_screen_sleep(2000); + crash_screen_sleep(500); crash_screen_draw_rect(25, 20, 270, 25); crash_screen_print(30, 25, "THREAD:%d (%s)", thread->id, gCauseDesc[cause]); #if !PUPPYPRINT_DEBUG @@ -238,10 +239,12 @@ void draw_crash_screen(OSThread *thread) { crash_screen_print_float_reg(30, 220, 30, &tc->fp30.f.f_even); #else s32 i; +#define LINE_HEIGHT 60 + ((LOG_BUFFER_SIZE-1)*10) for (i = 0; i < LOG_BUFFER_SIZE; i++) { - crash_screen_print(30, 50+(10*i), consoleLogTable[i]); + crash_screen_print(30, (LINE_HEIGHT)-(i*10), consoleLogTable[i]); } +#undef LINE_HEIGHT #endif osWritebackDCacheAll(); osViBlack(FALSE); @@ -263,6 +266,9 @@ OSThread *get_crashed_thread(void) { } extern u16 sRenderedFramebuffer; +extern void audio_signal_game_loop_tick(void); +extern void stop_sounds_in_continuous_banks(void); +extern struct SequenceQueueItem sBackgroundMusicQueue[6]; void thread2_crash_screen(UNUSED void *arg) { OSMesg mesg; @@ -275,7 +281,13 @@ void thread2_crash_screen(UNUSED void *arg) { thread = get_crashed_thread(); gCrashScreen.framebuffer = (u16 *) gFrameBuffers[sRenderedFramebuffer]; } while (thread == NULL); + gCrashScreen.thread.priority = 15; + stop_sounds_in_continuous_banks(); + stop_background_music(sBackgroundMusicQueue[0].seqId); + audio_signal_game_loop_tick(); draw_crash_screen(thread); + play_sound(SOUND_MARIO_WAAAOOOW, gGlobalSoundSource); + audio_signal_game_loop_tick(); for (;;) { } } diff --git a/src/game/game_init.c b/src/game/game_init.c index f7aeda7b..6d80cc18 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -795,7 +795,8 @@ void thread5_game_loop(UNUSED void *arg) { if (gPlayer1Controller->buttonPressed & L_TRIG) { - set_background_music(SEQ_LEVEL_SLIDE, SEQUENCE_ARGS(0xFF, SEQ_LEVEL_SLIDE), 30); + *(volatile int*) 0 = 0; + //set_background_music(SEQ_LEVEL_SLIDE, SEQUENCE_ARGS(0xFF, SEQ_LEVEL_SLIDE), 30); } if (gPlayer1Controller->buttonPressed & R_TRIG) {