Updated VGMStream to r1776-46-gc0c2c3c7

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-09-06 21:56:51 -07:00
parent 9a7ecd98ea
commit 7ad895b95c
9 changed files with 384 additions and 341 deletions

View File

@ -133,6 +133,7 @@ static const char* extension_list[] = {
"ccc",
"cd",
"cfn", //fake extension for CAF (renamed, to be removed?)
"chd", //txth/reserved [Donkey Konga (GC), Star Fox Assault (GC)]
"chk",
"ckb",
"ckd",

View File

@ -95,7 +95,7 @@ VGMSTREAM* init_vgmstream_awb_memory(STREAMFILE* sf, STREAMFILE* sf_acb) {
init_vgmstream_subkey = init_vgmstream_hca_subkey; /* most common */
extension = "hca";
}
else if (is_id32be(subfile_offset,sf, "VAGp") == 0x56414770) { /* (type 7=VAG, 10=HEVAG) */
else if (is_id32be(subfile_offset,sf, "VAGp")) { /* (type 7=VAG, 10=HEVAG) */
init_vgmstream = init_vgmstream_vag; /* Ukiyo no Roushi (Vita) */
extension = "vag";
}

View File

@ -379,17 +379,17 @@ VGMSTREAM* init_vgmstream_ea_hdr_sth_dat(STREAMFILE* sf) {
int target_stream = sf->stream_index;
uint32_t snr_offset, sns_offset, block_size;
uint16_t sth_offset, sth_offset2;
uint8_t userdata_size, total_sounds, block_id;
uint8_t num_params, num_sounds, block_id;
size_t dat_size;
STREAMFILE *sf_dat = NULL, *sf_sth = NULL;
VGMSTREAM* vgmstream;
uint32_t(*read_u32)(off_t, STREAMFILE*);
/* 0x00: ID */
/* 0x02: parameters (userdata size, ...) */
/* 0x03: number of files */
/* 0x04: sub-ID (used for different police voices in NFS games) */
/* 0x08: sample repeat (alt number of files?) */
/* 0x02: number of parameters */
/* 0x03: number of samples */
/* 0x04: speaker ID (used for different police voices in NFS games) */
/* 0x08: sample repeat (alt number of samples?) */
/* 0x09: block size (always zero?) */
/* 0x0a: number of blocks (related to size?) */
/* 0x0c: number of sub-banks (always zero?) */
@ -427,18 +427,18 @@ VGMSTREAM* init_vgmstream_ea_hdr_sth_dat(STREAMFILE* sf) {
if (block_id != EAAC_BLOCKID0_DATA && block_id != EAAC_BLOCKID0_END)
goto fail;
userdata_size = read_u8(0x02, sf) & 0x0F;
total_sounds = read_u8(0x03, sf);
num_params = read_u8(0x02, sf) & 0x7F;
num_sounds = read_u8(0x03, sf);
if (read_u8(0x08, sf) > total_sounds)
if (read_u8(0x08, sf) > num_sounds)
goto fail;
if (target_stream == 0) target_stream = 1;
if (target_stream < 0 || total_sounds == 0 || target_stream > total_sounds)
if (target_stream < 0 || num_sounds == 0 || target_stream > num_sounds)
goto fail;
/* offsets in HDR are always big endian */
sth_offset = read_u16be(0x10 + (0x02 + userdata_size) * (target_stream - 1), sf);
sth_offset = read_u16be(0x10 + (0x02 + num_params) * (target_stream - 1), sf);
#if 0
snr_offset = sth_offset + 0x04;
@ -449,7 +449,7 @@ VGMSTREAM* init_vgmstream_ea_hdr_sth_dat(STREAMFILE* sf) {
snr_offset = 0;
sns_offset = 0;
if (total_sounds == 1) {
if (num_sounds == 1) {
/* always 0 */
snr_offset = sth_offset + 0x04;
sns_offset = 0x00;
@ -474,7 +474,7 @@ VGMSTREAM* init_vgmstream_ea_hdr_sth_dat(STREAMFILE* sf) {
}
sns_offset = align_size_to_block(sns_offset, 0x40);
sth_offset2 = read_u16be(0x10 + (0x02 + userdata_size) * 1, sf);
sth_offset2 = read_u16be(0x10 + (0x02 + num_params) * 1, sf);
if (sns_offset == read_u32be(sth_offset2, sf_sth)) {
read_u32 = read_u32be;
} else if (sns_offset == read_u32le(sth_offset2, sf_sth)) {
@ -496,7 +496,20 @@ VGMSTREAM* init_vgmstream_ea_hdr_sth_dat(STREAMFILE* sf) {
if (!vgmstream)
goto fail;
vgmstream->num_streams = total_sounds;
if (num_params != 0) {
uint8_t val;
char buf[8];
int i;
for (i = 0; i < num_params; i++) {
val = read_u8(0x10 + (0x02 + num_params) * (target_stream - 1) + 0x02 + i, sf);
snprintf(buf, sizeof(buf), "%u", val);
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, buf);
if (i != num_params - 1)
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, ", ");
}
}
vgmstream->num_streams = num_sounds;
close_streamfile(sf_sth);
close_streamfile(sf_dat);
return vgmstream;
@ -610,8 +623,8 @@ static STREAMFILE *open_mapfile_pair(STREAMFILE* sf, int track /*, int num_track
/* EA MPF/MUS combo - used in older 7th gen games for storing interactive music */
VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
uint32_t num_tracks, track_start, track_checksum = 0, mus_sounds, mus_stream = 0, bnk_index = 0, bnk_sound_index = 0;
uint32_t tracks_table, samples_table, eof_offset, table_offset, entry_offset, snr_offset, sns_offset;
uint32_t num_tracks, track_start, track_checksum = 0, mus_sounds, mus_stream = 0, bnk_index = 0, bnk_sound_index = 0,
tracks_table, samples_table, eof_offset, table_offset, entry_offset = 0, snr_offset, sns_offset;
uint16_t num_subbanks, index, sub_index;
uint8_t version, sub_version;
STREAMFILE *sf_mus = NULL;
@ -627,10 +640,10 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
goto fail;
/* detect endianness */
if (read_u32be(0x00, sf) == 0x50464478) { /* "PFDx" */
if (is_id32be(0x00, sf, "PFDx")) {
read_u32 = read_u32be;
read_u16 = read_u16be;
} else if (read_u32le(0x00, sf) == 0x50464478) { /* "xDFP" */
} else if (is_id32le(0x00, sf, "PFDx")) {
read_u32 = read_u32le;
read_u16 = read_u16le;
} else {
@ -663,11 +676,6 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
num_subbanks = read_u16(entry_offset + 0x04, sf);
track_checksum = read_u32be(entry_offset + 0x08, sf);
is_ram = (num_subbanks != 0);
if (is_ram) {
track_checksum = read_u32be(entry_offset + 0x14, sf);
}
mus_stream = target_stream - 1 - track_start;
break;
}
@ -756,7 +764,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
for (i = 0; i < ram_segments; i++) {
entry_offset = table_offset + (bnk_sound_index + i) * 0x0c;
snr_offset = read_u32(entry_offset + 0x04, sf_mus);
data_s->segments[i] = init_vgmstream_eaaudiocore_header(sf_mus, sf_mus,
data_s->segments[i] = init_vgmstream_eaaudiocore_header(sf_mus, NULL,
snr_offset, 0,
meta_EA_SNR_SNS, 0);
if (!data_s->segments[i]) goto fail;

View File

@ -132,7 +132,7 @@ typedef struct {
size_t stream_size;
} ea_header;
static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset, int standalone);
static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset);
static VGMSTREAM* parse_bnk_header(STREAMFILE* sf, off_t offset, int target_stream, int is_embedded);
static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offset, int max_length, int bnk_version);
static uint32_t read_patch(STREAMFILE* sf, off_t* offset);
@ -184,7 +184,7 @@ VGMSTREAM* init_vgmstream_ea_schl(STREAMFILE* sf) {
/* Stream is divided into blocks/chunks: SCHl=audio header, SCCl=count of SCDl, SCDl=data xN, SCLl=loop end, SCEl=end.
* Video uses picture blocks (MVhd/MV0K/etc) and sometimes multiaudio blocks (SHxx/SCxx/SDxx/SExx where xx=language).
* The number/size is affected by: block rate setting, sample rate, channels, CPU location (SPU/main/DSP/others), etc */
return parse_schl_block(sf, 0x00, 1);
return parse_schl_block(sf, 0x00);
fail:
return NULL;
@ -275,7 +275,7 @@ VGMSTREAM* init_vgmstream_ea_schl_video(STREAMFILE* sf) {
if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail;
vgmstream = parse_schl_block(sf, start_offset, 1);
vgmstream = parse_schl_block(sf, start_offset);
if (!vgmstream) goto fail;
vgmstream->num_streams = total_subsongs;
@ -428,7 +428,7 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) {
if (read_32bitBE(schl_offset, astData) != EA_BLOCKID_HEADER)
goto fail;
vgmstream = parse_schl_block(astData, schl_offset, 0);
vgmstream = parse_schl_block(astData, schl_offset);
if (!vgmstream)
goto fail;
@ -455,9 +455,9 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) {
if (!data_s) goto fail;
/* load intro and loop segments */
data_s->segments[0] = parse_schl_block(astData, schl_offset, 0);
data_s->segments[0] = parse_schl_block(astData, schl_offset);
if (!data_s->segments[0]) goto fail;
data_s->segments[1] = parse_schl_block(astData, schl_loop_offset, 0);
data_s->segments[1] = parse_schl_block(astData, schl_loop_offset);
if (!data_s->segments[1]) goto fail;
/* setup segmented VGMSTREAMs */
@ -491,7 +491,7 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
STREAMFILE *sf_dat = NULL, *temp_sf = NULL;
int target_stream = sf->stream_index;
uint32_t offset_mult, sound_offset, sound_size;
uint8_t userdata_size, total_sounds;
uint8_t num_params, num_sounds;
size_t dat_size;
/* checks */
@ -500,10 +500,10 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
/* main header is machine endian but it's not important here */
/* 0x00: ID */
/* 0x02: sub-ID (used for different police voices in NFS games) */
/* 0x04: parameters (userdata size, ...) */
/* 0x05: number of files */
/* 0x06: sample repeat (alt number of files?) */
/* 0x02: speaker ID (used for different police voices in NFS games) */
/* 0x04: number of parameters */
/* 0x05: number of samples */
/* 0x06: sample repeat (alt number of samples?) */
/* 0x07: block size (offset multiplier) */
/* 0x08: number of blocks (DAT size divided by block size) */
/* 0x0a: number of sub-banks */
@ -526,11 +526,11 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
read_u32be(0x00, sf_dat) != 0x56414770)
goto fail;
userdata_size = read_u8(0x04, sf) & 0x0F;
total_sounds = read_u8(0x05, sf);
num_params = read_u8(0x04, sf) & 0x7F;
num_sounds = read_u8(0x05, sf);
offset_mult = read_u8(0x07, sf) * 0x0100 + 0x0100;
if (read_u8(0x06, sf) > total_sounds)
if (read_u8(0x06, sf) > num_sounds)
goto fail;
dat_size = get_streamfile_size(sf_dat);
@ -539,13 +539,13 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
goto fail;
if (target_stream == 0) target_stream = 1;
if (target_stream < 0 || total_sounds == 0 || target_stream > total_sounds)
if (target_stream < 0 || num_sounds == 0 || target_stream > num_sounds)
goto fail;
/* offsets are always big endian */
sound_offset = read_u16be(0x0C + (0x02 + userdata_size) * (target_stream - 1), sf) * offset_mult;
sound_offset = read_u16be(0x0C + (0x02 + num_params) * (target_stream - 1), sf) * offset_mult;
if (read_u32be(sound_offset, sf_dat) == EA_BLOCKID_HEADER) { /* "SCHl" */
vgmstream = parse_schl_block(sf_dat, sound_offset, 0);
vgmstream = parse_schl_block(sf_dat, sound_offset);
if (!vgmstream)
goto fail;
} else if (read_u32be(sound_offset, sf_dat) == 0x56414770) { /* "VAGp" */
@ -561,7 +561,20 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
goto fail;
}
vgmstream->num_streams = total_sounds;
if (num_params != 0) {
uint8_t val;
char buf[8];
int i;
for (i = 0; i < num_params; i++) {
val = read_u8(0x0C + (0x02 + num_params) * (target_stream - 1) + 0x02 + i, sf);
snprintf(buf, sizeof(buf), "%u", val);
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, buf);
if (i != num_params - 1)
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, ", ");
}
}
vgmstream->num_streams = num_sounds;
close_streamfile(sf_dat);
return vgmstream;
@ -577,7 +590,7 @@ VGMSTREAM* init_vgmstream_ea_hdr_dat_v2(STREAMFILE* sf) {
STREAMFILE *sf_dat = NULL;
int target_stream = sf->stream_index;
uint32_t offset_mult, sound_offset;
uint8_t userdata_size, total_sounds;
uint8_t num_params, num_sounds;
size_t dat_size;
/* checks */
@ -586,10 +599,10 @@ VGMSTREAM* init_vgmstream_ea_hdr_dat_v2(STREAMFILE* sf) {
/* main header is machine endian but it's not important here */
/* 0x00: ID */
/* 0x02: parameters (userdata size, ...) */
/* 0x03: number of files */
/* 0x04: sub-ID (used for different police voices in NFS games) */
/* 0x08: sample repeat (alt number of files?) */
/* 0x02: number of parameters */
/* 0x03: number of samples */
/* 0x04: speaker ID (used for different police voices in NFS games) */
/* 0x08: sample repeat (alt number of samples?) */
/* 0x09: block size (offset multiplier) */
/* 0x0a: number of blocks (DAT size divided by block size) */
/* 0x0c: number of sub-banks (always zero?) */
@ -612,11 +625,11 @@ VGMSTREAM* init_vgmstream_ea_hdr_dat_v2(STREAMFILE* sf) {
if (read_u32be(0x00, sf_dat) != EA_BLOCKID_HEADER)
goto fail;
userdata_size = read_u8(0x02, sf) & 0x0F;
total_sounds = read_u8(0x03, sf);
num_params = read_u8(0x02, sf) & 0x7F;
num_sounds = read_u8(0x03, sf);
offset_mult = read_u8(0x09, sf) * 0x0100 + 0x0100;
if (read_u8(0x08, sf) > total_sounds)
if (read_u8(0x08, sf) > num_sounds)
goto fail;
dat_size = get_streamfile_size(sf_dat);
@ -625,19 +638,32 @@ VGMSTREAM* init_vgmstream_ea_hdr_dat_v2(STREAMFILE* sf) {
goto fail;
if (target_stream == 0) target_stream = 1;
if (target_stream < 0 || total_sounds == 0 || target_stream > total_sounds)
if (target_stream < 0 || num_sounds == 0 || target_stream > num_sounds)
goto fail;
/* offsets are always big endian */
sound_offset = read_u16be(0x10 + (0x02 + userdata_size) * (target_stream - 1), sf) * offset_mult;
sound_offset = read_u16be(0x10 + (0x02 + num_params) * (target_stream - 1), sf) * offset_mult;
if (read_u32be(sound_offset, sf_dat) != EA_BLOCKID_HEADER)
goto fail;
vgmstream = parse_schl_block(sf_dat, sound_offset, 0);
vgmstream = parse_schl_block(sf_dat, sound_offset);
if (!vgmstream)
goto fail;
vgmstream->num_streams = total_sounds;
if (num_params != 0) {
uint8_t val;
char buf[8];
int i;
for (i = 0; i < num_params; i++) {
val = read_u8(0x10 + (0x02 + num_params) * (target_stream - 1) + 0x02 + i, sf);
snprintf(buf, sizeof(buf), "%u", val);
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, buf);
if (i != num_params - 1)
concatn(STREAM_NAME_SIZE, vgmstream->stream_name, ", ");
}
}
vgmstream->num_streams = num_sounds;
close_streamfile(sf_dat);
return vgmstream;
@ -756,8 +782,9 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE* sf, int track /*, int num_track
VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
STREAMFILE* sf_mus = NULL;
uint32_t schl_offset;
uint8_t version, num_sounds, num_events, num_sections;
off_t section_offset, schl_offset;
off_t section_offset;
int target_stream = sf->stream_index;
/* check extension */
@ -765,10 +792,10 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) {
goto fail;
/* always big endian */
if (read_32bitBE(0x00, sf) != 0x50464478) /* "PFDx" */
if (!is_id32be(0x00, sf, "PFDx"))
goto fail;
version = read_8bit(0x04, sf);
version = read_u8(0x04, sf);
if (version > 1) goto fail;
sf_mus = open_mapfile_pair(sf, 0); //, 1
@ -783,9 +810,9 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) {
* 0x0b: number of sections
* 0x0c: data start
*/
num_sounds = read_8bit(0x06, sf);
num_events = read_8bit(0x07, sf);
num_sections = read_8bit(0x0b, sf);
num_sounds = read_u8(0x06, sf);
num_events = read_u8(0x07, sf);
num_sections = read_u8(0x0b, sf);
section_offset = 0x0c;
/* section 1: nodes, contains information about segment playback order */
@ -799,11 +826,11 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) {
goto fail;
/* section 3: samples */
schl_offset = read_32bitBE(section_offset + (target_stream - 1) * 0x04, sf);
if (read_32bitBE(schl_offset, sf_mus) != EA_BLOCKID_HEADER)
schl_offset = read_u32be(section_offset + (target_stream - 1) * 0x04, sf);
if (read_u32be(schl_offset, sf_mus) != EA_BLOCKID_HEADER)
goto fail;
vgmstream = parse_schl_block(sf_mus, schl_offset, 0);
vgmstream = parse_schl_block(sf_mus, schl_offset);
if (!vgmstream)
goto fail;
@ -822,8 +849,8 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
STREAMFILE* sf_mus = NULL;
segmented_layout_data *data_s = NULL;
uint32_t track_start, track_end = 0, track_checksum = 0;
uint32_t tracks_table, samples_table = 0, section_offset, entry_offset = 0, eof_offset = 0, off_mult, sound_offset;
uint32_t tracks_table, tracks_data, samples_table = 0, section_offset, entry_offset = 0, eof_offset = 0, sound_offset,
off_mult = 0, track_start, track_end = 0, track_checksum = 0;
uint16_t num_nodes, num_subbanks = 0;
uint8_t version, sub_version, num_tracks, num_sections, num_events, num_routers, num_vars, subentry_num = 0;
int i;
@ -836,11 +863,11 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
goto fail;
/* detect endianness */
if (read_u32be(0x00, sf) == 0x50464478) { /* "PFDx" */
if (is_id32be(0x00, sf, "PFDx")) {
read_u32 = read_u32be;
read_u16 = read_u16be;
big_endian = 1;
} else if (read_u32le(0x00, sf) == 0x50464478) { /* "xDFP" */
} else if (is_id32le(0x00, sf, "PFDx")) {
read_u32 = read_u32le;
read_u16 = read_u16le;
big_endian = 0;
@ -943,10 +970,8 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
}
section_offset = entry_offset + 0x10 + subentry_num * 0x10;
/* TODO: verify this */
section_offset = read_u32(section_offset, sf) * 0x04;
section_offset += num_routers * 0x04;
section_offset += num_vars * 0x04;
section_offset = read_u32(section_offset, sf) * 0x04;
tracks_table = section_offset;
samples_table = tracks_table + (num_tracks + 1) * 0x04;
@ -966,11 +991,16 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
} else if (version == 5) {
/* Need for Speed: Most Wanted, Need for Speed: Carbon, SSX on Tour */
tracks_table = read_u32(0x2c, sf);
tracks_data = read_u32(0x30, sf);
samples_table = read_u32(0x34, sf);
eof_offset = read_u32(0x38, sf);
total_streams = (eof_offset - samples_table) / 0x08;
off_mult = 0x80;
/* check to distinguish it from SNR/SNS version (first streamed sample is always at 0x100) */
if (read_u16(tracks_data + 0x04, sf) == 0 && read_u32(samples_table + 0x00, sf) != 0x02)
goto fail;
track_start = total_streams;
for (i = num_tracks - 1; i >= 0; i--) {
@ -985,15 +1015,6 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
num_subbanks = read_u16(entry_offset + 0x04, sf);
track_checksum = read_u32be(entry_offset + 0x08, sf);
is_ram = (num_subbanks != 0);
/* checks to distinguish it from SNR/SNS version */
if (is_ram) {
if (read_u32(entry_offset + 0x0c, sf) == 0x00)
goto fail;
} else {
if (read_u32(entry_offset + 0x0c, sf) != 0x00)
goto fail;
}
break;
}
}
@ -1050,12 +1071,11 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
if (version == 5) {
track_checksum = read_u32be(entry_offset + 0x14 + 0x10 * bnk_index, sf);
if (read_u32be(0x00, sf_mus) != track_checksum)
if (track_checksum && read_u32be(0x00, sf_mus) != track_checksum)
goto fail;
}
if (read_u32be(bnk_offset, sf_mus) != EA_BNK_HEADER_LE &&
read_u32be(bnk_offset, sf_mus) != EA_BNK_HEADER_BE)
if (read_u32be(bnk_offset, sf_mus) != (big_endian ? EA_BNK_HEADER_BE : EA_BNK_HEADER_LE))
goto fail;
/* play until the next entry in MPF track or the end of BNK */
@ -1086,11 +1106,11 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
if (version == 5 && track_checksum && read_u32be(0x00, sf_mus) != track_checksum)
goto fail;
sound_offset *= off_mult;;
sound_offset *= off_mult;
if (read_u32be(sound_offset, sf_mus) != EA_BLOCKID_HEADER)
goto fail;
vgmstream = parse_schl_block(sf_mus, sound_offset, 0);
vgmstream = parse_schl_block(sf_mus, sound_offset);
}
if (!vgmstream)
@ -1109,7 +1129,7 @@ fail:
}
/* EA SCHl with variable header - from EA games (roughly 1997~2010); generated by EA Canada's sx.exe/Sound eXchange */
static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset, int standalone) {
static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset) {
off_t start_offset, header_offset;
size_t header_size;
uint32_t header_id;

View File

@ -85,6 +85,7 @@ VGMSTREAM* init_vgmstream_sgxd(STREAMFILE* sf) {
* - 0x18: min note range
* - 0x19: max note range
* - 0x1C: root note
* - 0x1d: fine tuning
* - 0x34: WAVE id
* > sample_rate = wave_sample_rate * (2 ^ (1/12)) ^ (target_note - root_note)
* - NAME: strings for other chunks
@ -93,7 +94,8 @@ VGMSTREAM* init_vgmstream_sgxd(STREAMFILE* sf) {
* - 0x04: absolute offset
* - SEQD: related to SFX (sequences?), entries seem to be offsets to name offset + sequence offset
* > sequence format seems to be 1 byte type (0=sfx, 1=music) + midi without header
* (default tick resolution of 960 pulses per quarter note)
* (default tick resolution of 960 pulses per quarter note). They use Midi Time Code
* (like 30fps with around 196 ticks per frame), and same controller event for looping as old SEQs (CC 99).
* - WSUR: ?
* - WMKR: ?
* - CONF: ? (name offset + config offset)

View File

@ -80,7 +80,7 @@ VGMSTREAM* init_vgmstream_vab(STREAMFILE* sf) {
uint8_t center, shift, min_note, max_note;
off_t programs_off, tones_off, waves_off, entry_off, data_offset;
size_t data_size;
int target_subsong = sf->stream_index, is_vh = 0, program_num, tone_num = 0, total_subsongs,
int target_subsong = sf->stream_index, is_vh = 0, program_num, tone_num, total_subsongs,
note, fine, uselimits,
channels, loop_flag, loop_start = 0, loop_end = 0;
int i;
@ -119,6 +119,7 @@ VGMSTREAM* init_vgmstream_vab(STREAMFILE* sf) {
total_subsongs = 0;
program_num = -1;
tone_num = -1;
for (i = 0; i < programs; i++) {
uint8_t program_tones;
int local_target;
@ -145,6 +146,10 @@ VGMSTREAM* init_vgmstream_vab(STREAMFILE* sf) {
wave_num = read_u16le(entry_off + 0x16, sf);
if (read_vabcfg_file(sf, program_num, tone_num, &note, &fine, &uselimits)) {
if (note == -1)
note = center;
if (shift == -1)
fine = shift;
if (uselimits)
note = VAB_CLAMP(note, min_note, max_note);
} else {

View File

@ -24,8 +24,10 @@ VGMSTREAM* init_vgmstream_vag(STREAMFILE* sf) {
* .str: Ben10 Galactic Racing
* .vig: MX vs. ATV Untamed (PS2)
* .l/r: Crash Nitro Kart (PS2), Gradius V (PS2)
* .vas: Kingdom Hearts II (PS2) */
if (!check_extensions(sf,"vag,swag,str,vig,l,r,vas"))
* .vas: Kingdom Hearts II (PS2)
* .xa2: Shikigami no Shiro (PS2)
* .snd: Alien Breed (Vita) */
if (!check_extensions(sf,"vag,swag,str,vig,l,r,vas,xa2,snd"))
goto fail;
file_size = get_streamfile_size(sf);

View File

@ -251,7 +251,7 @@ VGMSTREAM* init_vgmstream_wbk_nslb(STREAMFILE* sf) {
case 0x22: { /* DSP */
int i, j;
off_t table_offset;
off_t coef_table_offset;
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_interleave;
@ -259,14 +259,14 @@ VGMSTREAM* init_vgmstream_wbk_nslb(STREAMFILE* sf) {
/* check info entry variation */
if (read_u32le(info_entry_offset + 0x44 + 0x30*channels, sf) != 0x00)
table_offset = 0x4c; /* Call of Duty 3 */
coef_table_offset = 0x4c; /* Call of Duty 3 */
else
table_offset = 0x44; /* Kung Fu Panda */
coef_table_offset = 0x44; /* Kung Fu Panda */
/* It looks like the table is re-interpreted as 8 32-bit integers and stored with little endian byte order
* like the rest of the data. Fun times. */
for (i = 0; i < vgmstream->channels; i++) {
off_t coef_offset = info_entry_offset + table_offset + 0x30*i;
off_t coef_offset = info_entry_offset + coef_table_offset + 0x30*i;
for (j = 0; j < 8; j++) {
vgmstream->ch[i].adpcm_coef[j*2] = read_s16le(coef_offset + j*0x04 + 0x02, sf);
vgmstream->ch[i].adpcm_coef[j*2+1] = read_s16le(coef_offset + j*0x04 + 0x00, sf);

View File

@ -105,6 +105,251 @@
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wav</string>
<string>w64</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>wav.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>WAVE File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aif</string>
<string>aiff</string>
<string>aifc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>aiff.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AIFF File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>caf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>CAF File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>au</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AU File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp3</string>
<string>mp2</string>
<string>mp1</string>
<string>m2a</string>
<string>mpa</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mp3.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mpeg</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG Stream File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m4a</string>
<string>mp4</string>
<string>m4b</string>
<string>m4r</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>m4a.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG-4 Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aac</string>
<string>adts</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG-4 AAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>amr</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AMR Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>xhe</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>USAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ac3</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AC-3 Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>flac.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>FLAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>snd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>SND Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
@ -190,6 +435,7 @@
<string>bika</string>
<string>bik2</string>
<string>bk2</string>
<string>bkr</string>
<string>blk</string>
<string>bmdx</string>
<string>bms</string>
@ -207,11 +453,11 @@
<string>bvg</string>
<string>bwav</string>
<string>caf</string>
<string>capdsp</string>
<string>cbd2</string>
<string>ccc</string>
<string>cd</string>
<string>cfn</string>
<string>chd</string>
<string>chk</string>
<string>ckb</string>
<string>ckd</string>
@ -243,7 +489,6 @@
<string>dspw</string>
<string>dtk</string>
<string>dvi</string>
<string>dxh</string>
<string>dyx</string>
<string>e4x</string>
<string>eam</string>
@ -327,6 +572,7 @@
<string>kces</string>
<string>kcey</string>
<string>km9</string>
<string>kmx</string>
<string>kovs</string>
<string>kno</string>
<string>kns</string>
@ -495,6 +741,7 @@
<string>sab</string>
<string>sad</string>
<string>saf</string>
<string>sag</string>
<string>sam</string>
<string>sap</string>
<string>sb0</string>
@ -509,6 +756,7 @@
<string>sbin</string>
<string>sbr</string>
<string>sbv</string>
<string>sig</string>
<string>sm0</string>
<string>sm1</string>
<string>sm2</string>
@ -521,6 +769,7 @@
<string>scd</string>
<string>sch</string>
<string>sd9</string>
<string>sdp</string>
<string>sdf</string>
<string>sdt</string>
<string>seb</string>
@ -590,7 +839,6 @@
<string>szd1</string>
<string>szd3</string>
<string>tad</string>
<string>tec</string>
<string>tgq</string>
<string>tgv</string>
<string>thp</string>
@ -609,6 +857,7 @@
<string>uv</string>
<string>v0</string>
<string>va3</string>
<string>vab</string>
<string>vag</string>
<string>vai</string>
<string>vam</string>
@ -623,6 +872,7 @@
<string>vgm</string>
<string>vgs</string>
<string>vgv</string>
<string>vh</string>
<string>vid</string>
<string>vig</string>
<string>vis</string>
@ -1342,251 +1592,6 @@
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wav</string>
<string>w64</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>wav.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>WAVE File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aif</string>
<string>aiff</string>
<string>aifc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>aiff.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AIFF File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>caf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>CAF File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>au</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AU File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp3</string>
<string>mp2</string>
<string>mp1</string>
<string>m2a</string>
<string>mpa</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mp3.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mpeg</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG Stream File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m4a</string>
<string>mp4</string>
<string>m4b</string>
<string>m4r</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>m4a.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG-4 Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aac</string>
<string>adts</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>MPEG-4 AAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>amr</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AMR Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>xhe</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>USAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ac3</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>AC-3 Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>flac.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>FLAC Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>snd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>song.icns</string>
<key>CFBundleTypeIconSystemGenerated</key>
<integer>1</integer>
<key>CFBundleTypeName</key>
<string>SND Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>