miami: Increase PED_BLOCKSIZE to 105504

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis
2025-03-16 15:49:38 +02:00
parent db677c7000
commit 0102fb2f74
2 changed files with 8 additions and 3 deletions

View File

@@ -115,7 +115,7 @@ enum
#endif #endif
}; };
#define MAX_PEDSFX 7 #define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000 #define PED_BLOCKSIZE 105504
#define PED_BLOCKSIZE_ADPCM (PED_BLOCKSIZE/4) #define PED_BLOCKSIZE_ADPCM (PED_BLOCKSIZE/4)
#define MAXPROVIDERS 64 #define MAXPROVIDERS 64

View File

@@ -772,7 +772,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
} }
} }
assert(m_aSamples[nComment].nByteSize < PED_BLOCKSIZE_ADPCM); assert(m_aSamples[nComment].nByteSize <= PED_BLOCKSIZE_ADPCM);
debugf("Loading ped comment %d, offset: %d, size: %d\n", nComment, m_aSamples[nComment].nFileOffset, m_aSamples[nComment].nByteSize); debugf("Loading ped comment %d, offset: %d, size: %d\n", nComment, m_aSamples[nComment].nFileOffset, m_aSamples[nComment].nByteSize);
CdStreamQueueAudioRead(nComment, (void*)nPedSlotSfxAddr[nCurrentPedSlot], m_aSamples[nComment].nByteSize, m_aSamples[nComment].nFileOffset, [](AudioReadCmd* cmd) { CdStreamQueueAudioRead(nComment, (void*)nPedSlotSfxAddr[nCurrentPedSlot], m_aSamples[nComment].nByteSize, m_aSamples[nComment].nFileOffset, [](AudioReadCmd* cmd) {
@@ -1340,11 +1340,16 @@ cSampleManager::InitialiseSampleBanks(void)
channels[i].nBank = -1; channels[i].nBank = -1;
} }
// validate all ped comments are within bounds
for (uint32 nComment = SAMPLEBANK_PED_START; nComment <= SAMPLEBANK_PED_END; nComment++) {
assert(m_aSamples[nComment].nByteSize <= PED_BLOCKSIZE_ADPCM);
}
#ifdef FIX_BUGS #ifdef FIX_BUGS
// Find biggest player comment // Find biggest player comment
uint32 nMaxPlayerSize = 0; uint32 nMaxPlayerSize = 0;
for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++) for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++)
nMaxPlayerSize = Max(nMaxPlayerSize, m_aSamples[i].nByteSize); nMaxPlayerSize = Max(nMaxPlayerSize, m_aSamples[i].nByteSize);
debugf("Max player comment size: %d\n", nMaxPlayerSize); debugf("Max player comment size: %d\n", nMaxPlayerSize);
gPlayerTalkData = snd_mem_malloc(nMaxPlayerSize); gPlayerTalkData = snd_mem_malloc(nMaxPlayerSize);