Understanding Mega Man X4's Sound Archive Format
Mega Man X4 was released by Capcom in 1997 for the Playstation 1 and Sega Saturn. Shortly after, it was ported over to the PC. There are several different files and folders which make up the game. An executable which makes up the game code, a main folder for storing graphics and levels, and several other folders for storing full motion video, sound effects, and background music. With the exception of the background music and full motion video, most assets are stored in archives. These archives pack all relevant assets in a single file, allowing for files to be quickly loaded into memory while reducing the time it would normally take to seek to each file.
The format used for sound effects consists of two components: a header and a body.
The header begins with four bytes which define how many sound effects are in the archive. For each sound effect, there is a 17 byte entry in the header. The first four bytes of this entry tell where the sound file is located in the file. The next 13 bytes give the filename of the sound, with 8 bytes for the name, 4 bytes for the extension, and a single byte for the string terminator. To calculate the size of the sound file, you get the location of the next sound file and subtract it with the location of the current one. If you are decoding the last sound file, then you just read from the sound's location to the end of the archive.
The body of the archive consists of the sound data of each sound effect packed together side by side. Each sound is a regular wave file. No proprietary sound format was used for the PC version of the game. To grab a sound, you obtain it's address and size from the header, then read its contents.