summaryrefslogtreecommitdiff
path: root/src/audio/audio_heap.c
diff options
context:
space:
mode:
authorSonic Dreamcaster <alejandro.asenjo88@gmail.com>2026-01-04 07:53:51 -0300
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2026-01-04 07:53:51 -0300
commit1aa6dff53ee6e068ec8eb3b313bb0ff7980482b3 (patch)
treeb430295ccafd4cd4b962db89742d66c5f60237d5 /src/audio/audio_heap.c
parente8391e8e0fec3b665e6f17c8809d0c899cef24ab (diff)
Apply F-Zero X version of AudioHeap_DiscardSampleCaches bugfix
Diffstat (limited to 'src/audio/audio_heap.c')
-rw-r--r--src/audio/audio_heap.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/audio/audio_heap.c b/src/audio/audio_heap.c
index dbc37c57..b1e0cb49 100644
--- a/src/audio/audio_heap.c
+++ b/src/audio/audio_heap.c
@@ -991,16 +991,14 @@ void AudioHeap_DiscardSampleCaches(void) {
Instrument* instrument;
SampleCacheEntry* entry;
-#ifdef AVOID_UB
- entry = gPersistentSampleCache.entries;
-#endif
-
for (fontId = 0; fontId < numFonts; fontId++) {
sampleBankId1 = gSoundFontList[fontId].sampleBankId1;
sampleBankId2 = gSoundFontList[fontId].sampleBankId2;
- if (((sampleBankId1 != SAMPLES_NONE_U) && (entry->sampleBankId == sampleBankId1)) ||
- ((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) ||
- (entry->sampleBankId == SAMPLES_SFX)) {
+ // @port: avoid reading from garbage memory,
+ // F-Zero X newer version of this audio driver has this fix:
+ if (((sampleBankId1 != SAMPLES_NONE_U) /* && (entry->sampleBankId == sampleBankId1) */) ||
+ ((sampleBankId2 != SAMPLES_NONE) /* && (entry->sampleBankId == sampleBankId2)*/ ) /* ||
+ (entry->sampleBankId == SAMPLES_SFX) */) {
if (((void*) AudioHeap_SearchCaches(FONT_TABLE, CACHE_PERMANENT, fontId) != NULL) &&
((gFontLoadStatus[fontId] > 1) != 0)) {
for (i = 0; i < gPersistentSampleCache.numEntries; i++) {