diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2022-07-13 21:26:44 -0400 |
|---|---|---|
| committer | louist103 <35883445+louist103@users.noreply.github.com> | 2022-07-13 21:36:19 -0400 |
| commit | 379649beadeeec32f73e4e203887e57d66977658 (patch) | |
| tree | 185c655c94ee53eaa7a74bc6ff7b42ba751f0c91 /soh/src/code | |
| parent | 248f49b3bfa39c80f157fdc2c15500f3e5384007 (diff) | |
Fixed soundfont issues
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/audio_seqplayer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/soh/src/code/audio_seqplayer.c b/soh/src/code/audio_seqplayer.c index 3ae70719c..b8fbd9e1f 100644 --- a/soh/src/code/audio_seqplayer.c +++ b/soh/src/code/audio_seqplayer.c @@ -1176,9 +1176,13 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { if (seqPlayer->defaultFont != 0xFF) { SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqPlayer->seqId]); - int8_t idx = (sDat.numFonts - result - 1); - command = sDat.fonts[abs(idx)]; + // The game apparantely would sometimes do negative array lookups, the result of which would get rejected by AudioHeap_SearchCaches, never + // changing the actual fontid. + if (result > sDat.numFonts) + break; + + command = sDat.fonts[(sDat.numFonts - result - 1)]; } if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, command)) |
