From daca951818e93969d5455e13197c2281a33270d2 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 11 Jan 2024 05:04:54 +0000 Subject: [PATCH] Temporary fix for fanfares crashing until we get audio working (#21) * Temporary fix for fanfares crashing until we get audio working * Update mm/src/audio/lib/load.c * Update code_8019AF00.c --------- Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com> --- mm/src/audio/code_8019AF00.c | 7 +++++-- mm/src/audio/lib/load.c | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/src/audio/code_8019AF00.c b/mm/src/audio/code_8019AF00.c index 039c8f5c5..379f3038d 100644 --- a/mm/src/audio/code_8019AF00.c +++ b/mm/src/audio/code_8019AF00.c @@ -5651,8 +5651,11 @@ void Audio_PlayFanfare(u16 seqId) { u32 outNumFonts; u8* prevFontId = AudioThread_GetFontsForSequence(prevSeqId & 0xFF, &outNumFonts); u8* fontId = AudioThread_GetFontsForSequence(seqId & 0xFF, &outNumFonts); - - if ((prevSeqId == NA_BGM_DISABLED) || (*prevFontId == *fontId)) { + // BENTODO + // #region 2S2H [Audio] TODO: Fixes fanfare crash, should/can be removed after audio is done + // if ((prevSeqId == NA_BGM_DISABLED) || (*prevFontId == *fontId)) { + if ((prevSeqId == NA_BGM_DISABLED) || (prevFontId != NULL && fontId != NULL && *prevFontId == *fontId)) { + // #endregion sFanfareState = 1; } else { sFanfareState = 5; diff --git a/mm/src/audio/lib/load.c b/mm/src/audio/lib/load.c index 95b0e5698..f19d6335a 100644 --- a/mm/src/audio/lib/load.c +++ b/mm/src/audio/lib/load.c @@ -488,6 +488,9 @@ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* ret } u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) { + // BENTODO + *outNumFonts = 0; + return NULL; s32 index = ((u16*)gAudioCtx.sequenceFontTable)[seqId]; *outNumFonts = gAudioCtx.sequenceFontTable[index++];