From 33b3cdb0f53ad1faafd2d3a0e6b4cb3d594e8cfb Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 10 May 2026 03:02:24 +0500 Subject: [PATCH] engine: client: soundlib: catch broken null.wav and replace it with silence --- engine/client/soundlib/snd_wav.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engine/client/soundlib/snd_wav.c b/engine/client/soundlib/snd_wav.c index 676a0d43..fc3f6d59 100644 --- a/engine/client/soundlib/snd_wav.c +++ b/engine/client/soundlib/snd_wav.c @@ -344,6 +344,18 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi } } + // silence known-broken WAVs that contain stray non-zero samples masquerading as silence + if( Q_stristr( name, "null.wav" )) + { + uint32_t crc; + CRC32_Init( &crc ); + CRC32_ProcessBuffer( &crc, buffer, filesize ); + crc = CRC32_Final( crc ); + + if( crc == 0x14a36f29 ) // common/null.wav (Half-Life) + memset( sound.wav, 0, sound.size ); + } + return true; }