I finally got around to playing Sniper Elite v2 after buying it a while back and then finding out it required Windows 7. Serpent 4 fixed that, of course. And it’s pretty damn fun. The multiplayer takes me back to the days of Delta Force sniper wars circa 2000.
Sniper Elite v2
The main problem I had with the game was the annoying—perhaps even disturbing—heartbeat sounds that play whenever you’re looking through the scope. It really serves no gameplay purpose considering the sound just plays constantly. And there’s naturally no way to turn the sound off through options or config tweaking. So one must turn to modding, and that’s what I did.
A quick perusal of the installation directory for the game reveals a “Sounds” directory with three files in it, clearly archives given their size. StreamingSounds.asr is probably music and GmSnd.en is probably speech, so that just leaves GmSnd.asr as the likely archive for the heartbeat sounds. Opening the file in a hex editor shows no readable strings whatsoever except for the header of “AsuraZlb”. The “Zlb” part is curious enough and could mean that the file is actually compressed using Zlib. In fact that’s exactly what it means.
In order to do anything with this file, it first needs to be decompressed. Googling around, I quickly found a nifty tool called offzip that can do exactly this. It’s a command-line program, so extracting it into the Sniper Elite “Sounds” directory is the best way to work with it. This tool has several operations but the one we’re interested in uses the -a switch to decompress any found data. To do this, fire up a command prompt or batch file and run the following.
offzip -a GmSnd.asr . 0
This gives us a new file of larger size in the same directory. Taking this new file back into a hex editor shows a lot of readable strings and many matches for “heartbeat”. One match in particular is very interesting. It has the path of a wav file heartbeat01.wav followed by a RIFF header. Somewhere in this vicinity of the file is the start of the heartbeat sound’s waveform data.
If you decode the bytes out as I did in the screenshot below, you eventually get to a string of text that reads simply “data” and is followed by a 4-byte (32-bit) integer that is the size of the waveform data—in this case, 45920. Immediately following that, you just pace out the 45920 bytes of data, which should end just before a “smpl” header, and you have the entirety of the sound data selected.
Modded Heartbeat Sound in GmSnd.asr
The thing about WAV files is that they’re uncompressed (or lightly compressed in the case of ADPCM). So two bytes (16-bits) of zeros in the waveform data means silence for one sample in the 44100 samples per second of audio. Using this knowledge, we can just change all the samples to zero to make the whole sound file only silence. To do this, you’ll need to be using a hex editor that has a fill with zeros feature.
With that part done, we can now save and test our modded archive file. Don’t forget to rename this modded file to the original filename of GmSnd.asr and backup the original file itself. You may also be wondering why we haven’t tried to recompress the modded file with zlib; and this would be an astute observation. Basically we’re hoping the game is smart enough to load both compressed and decompressed data.
Now with Sniper Elite loaded up, we can start a new game and then look through the scope of a rifle to test our mod. You’ll notice that the heartbeat sound still plays but it pauses every four beats. Apparently there is more than one sound file that makes up the heartbeat sound effect, but we’re on the right track since one of them is now silent. We just have to go back into the hex editor and change the four more sounds that follow the one we’ve already done.
And that’s it. No more listening to that droning heartbeat sound while you’re sniping. Luckily, this mod doesn’t lock us out of multiplayer either. Happy sniping!
It’s been said around the webs that merely changing the name of the sound files is enough to disable them. This would make zeroing out the sound data unnecessary. However, I have not tested this method. And one still needs to decompress the archive as detailed above.