In mid-December, I discovered a large number of files in the TSOAudio.dat archive that didn’t resemble track data or packing slips or anything tiny like that. These files ranged around 10-50kB, like sound data, but were not the usual WAV, MP3, or XA. This drove my interest in finding out if there were any more codecs of any kind used in the game that we weren’t aware of.
sys/tsoaudio.ini told us the game uses exactly 4 audio codecs: WAV, MP3, XA, and something called UTalk. The header was almost identical to XA, but these files decompressed to noise when using xadecode. By comparing the decompressed size field (from which I can derive sound duration) with the compressed size of the file, I could tell the codec runs at 32kbit/s, while XA runs at 88.2.
I googled and googled Maxis UTalk, UTK (the file extension), and UTM0 (the signature) for 15 minutes but couldn’t find anything. The codec appears to be unique to The Sims Online, so as we had no documentation, my task was to run the game in a disassembler and make sense of what the game does to read these files. Somebody had to do this, and I knew I was the only one in the TSO community with enough experience to do it.
It wasn’t hard to find the file header validation check in the game, since the only instance of “UTM0″ in any of the game binaries appeared in TSOAudioViewD.dll. The game did stop at my breakpoint to load two sounds, but failed both checks. If the game couldn’t load a UTalk sound before the Character Select screen (seeing as we cannot log into the game), it would be impossible to inspect how the game reads these files.
The two sounds it tried to load were the load loop sound and the click sound, both in WAV format. In fact, these were the only sounds used in the log-in screen at all. I hypothesized that the readsound() function in the game’s audio system calls the different readheader functions for these 4 sound formats and decodes it when it finds the right one. And each has a different header (“XA” for XA, “UTM0″ for UTalk, “RIFF” for WAV, and FF FB 90 40 for MP3).
So, in TSOAudio.dat, I replaced the load loop sound (2026960b-29daa4a6-00004f85) with a UTK file that matched the closest to 30 seconds, the duration of the load loop sound. And voila, it worked! The game looped this UTalk sound in place of the old, and (as the name and bitrate imply) it was of course Simlish.
It took about 10 days to gather enough information to find where in memory the UTK file is decompressed into and identify which function does the decompression. At that point, I was able to get the game to decompress any UTK file for us, but we needed more than that: we needed our own code to decompress these files for ourselves. It took about another 2 weeks to fully have all the code interpreted from x86 assembly to C, and another 4 days to analyze exactly how the codec works. The entire process finished on January 18, 2012.
I ran my new utkdecode tool against all 1,200 UTK files in the game, and it decompresses each one of them glitch-free. The code is now being used in Niotso and Afr0’s Project Dollhouse.
I leave you with a sound that I’ve only recalled hearing in The Sims Online. Hope it brings back memories.