SABS & SABL Files: Difference between revisions
Red-EyeX32 (talk | contribs) |
Red-EyeX32 (talk | contribs) |
||
| Line 12: | Line 12: | ||
u8 md5[0x10]; // md5 of the audio file | u8 md5[0x10]; // md5 of the audio file | ||
}; // 0x10 | }; // 0x10 | ||
enum snd_asset_mode | |||
{ | |||
SND_ASSET_MODE_MONO = 0x1, | |||
SND_ASSET_MODE_DUAL = 0x2, | |||
// Could be more modes ex: ("Joint Stereo" and "Stereo") | |||
}; | |||
enum snd_asset_format | enum snd_asset_format | ||
| Line 29: | Line 36: | ||
}; | }; | ||
static const int frame_rate_table[] = { | |||
8000, | |||
12000, | |||
16000, | |||
24000, | |||
32000, | |||
44100, | |||
48000, | |||
96000, | |||
192000 | |||
}; | |||
struct SndAssetBankEntry | struct SndAssetBankEntry | ||
{ | { | ||
unsigned int id; | unsigned int id; // this is a hash of the name. Name Found in SndBank asset in ff | ||
unsigned int size; | unsigned int size; | ||
unsigned int offset; | unsigned int offset; | ||
unsigned int frameCount; | unsigned int frameCount; | ||
char frameRateIndex; | char frameRateIndex; // see frame_rate_table | ||
snd_asset_mode channelCount; // enum 0x1 = mono 0x2 = dual | |||
char looping; | char looping; | ||
snd_asset_format format; | snd_asset_format format; | ||
| Line 45: | Line 62: | ||
struct SndAssetBankHeader | struct SndAssetBankHeader | ||
{ | { | ||
unsigned int magic; | unsigned int magic; // "2UX#" | ||
unsigned int version; | unsigned int version; // 0x0E | ||
unsigned int entrySize; | unsigned int entrySize; // 0x14 | ||
unsigned int checksumSize; | unsigned int checksumSize; // 0x10 | ||
unsigned int dependencySize; | unsigned int dependencySize; // 0x40 | ||
unsigned int entryCount; | unsigned int entryCount; // Amount of sound entries NOT NAME ENTRIES | ||
unsigned int dependencyCount; | unsigned int dependencyCount; // Always 0x8 for some reason, might be the size of the next 3 fields | ||
unsigned int pad32; | unsigned int pad32; | ||
__int64 fileSize; | __int64 fileSize; // Size of the whole file | ||
__int64 entryOffset; | __int64 entryOffset; // &SndAssetBankEntry[0] | ||
__int64 checksumOffset; | __int64 checksumOffset; // &hash_entry_t[0] | ||
char checksumChecksum[16]; | char checksumChecksum[16]; // 16 bytes which are associated between sabs + 0x38 and soundasset + 0x830 (can be > 0x830) | ||
char dependencies[512]; | char dependencies[512]; | ||
char padding[1464]; | char padding[1464]; | ||
Revision as of 04:18, 25 June 2015
SAB(Stream) and SAB(Load). The B is most likely "bank" as the game code refers to a "sound bank" when loading SABL/SABS files.
- SABS = Snd Asset Bank Stream
- SABL = Snd Asset Bank Load
Structure
Thanks to Jakes625, Red-EyeX32, master131, and kokole.
struct hash_entry_t
{
u8 md5[0x10]; // md5 of the audio file
}; // 0x10
enum snd_asset_mode
{
SND_ASSET_MODE_MONO = 0x1,
SND_ASSET_MODE_DUAL = 0x2,
// Could be more modes ex: ("Joint Stereo" and "Stereo")
};
enum snd_asset_format
{
SND_ASSET_FORMAT_PCMS16 = 0x0,
SND_ASSET_FORMAT_PCMS24 = 0x1,
SND_ASSET_FORMAT_PCMS32 = 0x2,
SND_ASSET_FORMAT_IEEE = 0x3,
SND_ASSET_FORMAT_XMA4 = 0x4,
SND_ASSET_FORMAT_MP3 = 0x5,
SND_ASSET_FORMAT_MSADPCM = 0x6,
SND_ASSET_FORMAT_WMA = 0x7,
SND_ASSET_FORMAT_FLAC = 0x8,
SND_ASSET_FORMAT_WIIUADPCM = 0x9,
SND_ASSET_FORMAT_MPC = 0xA,
SND_ASSET_FORMAT_COUNT = 0xB,
};
static const int frame_rate_table[] = {
8000,
12000,
16000,
24000,
32000,
44100,
48000,
96000,
192000
};
struct SndAssetBankEntry
{
unsigned int id; // this is a hash of the name. Name Found in SndBank asset in ff
unsigned int size;
unsigned int offset;
unsigned int frameCount;
char frameRateIndex; // see frame_rate_table
snd_asset_mode channelCount; // enum 0x1 = mono 0x2 = dual
char looping;
snd_asset_format format;
}; // 0x14
struct SndAssetBankHeader
{
unsigned int magic; // "2UX#"
unsigned int version; // 0x0E
unsigned int entrySize; // 0x14
unsigned int checksumSize; // 0x10
unsigned int dependencySize; // 0x40
unsigned int entryCount; // Amount of sound entries NOT NAME ENTRIES
unsigned int dependencyCount; // Always 0x8 for some reason, might be the size of the next 3 fields
unsigned int pad32;
__int64 fileSize; // Size of the whole file
__int64 entryOffset; // &SndAssetBankEntry[0]
__int64 checksumOffset; // &hash_entry_t[0]
char checksumChecksum[16]; // 16 bytes which are associated between sabs + 0x38 and soundasset + 0x830 (can be > 0x830)
char dependencies[512];
char padding[1464];
}; // 0x800To calculate the duration of an audio entry:
durationInMilliseconds = 1000 * frameCount / frameRate;
Note that "frameRate" is the actual frame rate value from the table and not the index/flag value from the structure.