There were plenty of tools available for PS2 version already, but as far as I was aware, there were none for Dreamcast so I took it upon myself to work that out.
Development was stopped as soon as the tool was good enough for my needs, so some of the features, like command line flags and support for Star Wars Racer specific version of the format were planned but ultimately never implemented.
Most of the hints came from the original Katana SDK as there was actually a tool for creating such banks and showing information on already existing ones. There was none for unpacking those but the rest was fairly straightforward to figure out.
Regular .KAT bank contains at its first 4 bytes the number of files stored within. 18 in this case: Immediately after that there is a series of structures, each describing those files and where to find them:
Code: Select all
/* KAT as per SEGA specs */
typedef struct {
uint32_t m_dataType; // File type
uint32_t m_FileOffset; // Chunk offset from file start
uint32_t m_FileSize; // Data size
uint32_t m_SampleRate;
uint32_t m_Loop; // Looping flag if music
uint32_t m_SampleSize; // 4 - Yamaha ADPCM, 16 - PCM
uint8_t m_unk3[20]; // Unidentified
} kat_t;
It's important to note that data at given offsets is a raw PCM stream with no header data as it's meant to be passed through to the console's sound chip. This means that in order to convert this into a regular .WAV file that would play back in a media player, we also need to construct all the missing chunks that are described in RIFF standards.
Some of the audio used in DoTF is in Dreamcast's native ADPCM which is a lossy 4 bits per sample compressed format, some of the sounds are regular 16-bit PCM that's generally used where higher quality is needed. The tool builds this data automatically based on the header information. Note that some audio players may not have native support for ADPCM and can require additional codecs to be present in the system.
Below is the actual tool one can find useful. Program takes 2 arguments, the first one being the actual .KAT bank and an optional output directory. If the latter does not exist, the program will attempt to create it. If no second argument is supplied, files will be extracted into the same directory containing the original bank.
Code: Select all
> .\exxo.exe .\ATLANTIS.KAT testnewdir
----------- EXXO -----------
Dreamcast .KAT asset extractor program
Copyright (C) 2020 by Moduvator
----------------------------------------
File ./ATLANTIS.KAT contains 18 records
Directory testnewdir doesn't exist, creating it.
Entry 1:
Size: 4936 bytes.
Type: 1 (ADPCM sound file). Sample Rate: 22050 Hz
Written to testnewdir/ATLANTIS_01.wav
----------
Entry 2:
Size: 17084 bytes.
Type: 1 (ADPCM sound file). Sample Rate: 22050 Hz
Written to testnewdir/ATLANTIS_02.wav
----------