Apply F-Zero X version of AudioHeap_DiscardSampleCaches bugfix

This commit is contained in:
Sonic Dreamcaster
2026-01-04 07:53:51 -03:00
parent e8391e8e0f
commit 1aa6dff53e
+5 -7
View File
@@ -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++) {