@@ -601,9 +601,9 @@ std::unique_ptr<XSound> GameModernWarfare5::ReadXSound(const CoDSound_t* Sound)
601601 {
602602 // Buffer
603603 std::unique_ptr<uint8_t []> SoundBuffer = nullptr ;
604- // Extract buffer, these are compressed
604+ // Extract buffer, these are compressed, pad the audio size since the size in sound asset is literal, but XPAK data is padded.
605605 uint32_t SoundMemoryResult = 0 ;
606- SoundBuffer = CoDAssets::GamePackageCache->ExtractPackageObject (SoundData.StreamKey , (int32_t )(((uint64_t )SoundData.Size + 4095 ) & 0xFFFFFFFFFFFFF000 ), SoundMemoryResult);
606+ SoundBuffer = CoDAssets::GamePackageCache->ExtractPackageObject (SoundData.StreamKey , (int32_t )(((uint64_t )SoundData.Size + ( size_t )SoundData. SeekTableSize + 4095 ) & 0xFFFFFFFFFFFFFFF0 ), SoundMemoryResult);
607607
608608 if (SoundMemoryResult == 0 )
609609 return nullptr ;
@@ -617,9 +617,9 @@ std::unique_ptr<XSound> GameModernWarfare5::ReadXSound(const CoDSound_t* Sound)
617617 {
618618 // Buffer
619619 std::unique_ptr<uint8_t []> SoundBuffer = nullptr ;
620- // Extract buffer, these are compressed
620+ // Extract buffer, these are compressed, pad the audio size since the size in sound asset is literal, but XPAK data is padded.
621621 uint32_t SoundMemoryResult = 0 ;
622- SoundBuffer = CoDAssets::GamePackageCache->ExtractPackageObject (SoundData.StreamKeyEx , (int32_t )(((uint64_t )SoundData.LoadedSize + 4095 ) & 0xFFFFFFFFFFFFF000 ), SoundMemoryResult);
622+ SoundBuffer = CoDAssets::GamePackageCache->ExtractPackageObject (SoundData.StreamKeyEx , (int32_t )(((uint64_t )SoundData.LoadedSize + ( size_t )SoundData. SeekTableSize + 4095 ) & 0xFFFFFFFFFFFFFFF0 ), SoundMemoryResult);
623623
624624 if (SoundMemoryResult == 0 )
625625 return nullptr ;
0 commit comments