diff --git a/src/formats.c b/src/formats.c index 454842ca..9e8c970a 100644 --- a/src/formats.c +++ b/src/formats.c @@ -259,6 +259,7 @@ static const char* extension_list[] = { "ktsl2asbin", "ktss", //fake extension/header id for .kns "kvs", + "kwa", "l", "l00", //txth/reserved [Disney's Dinosaur (PS2)] @@ -1344,7 +1345,8 @@ static const meta_info meta_info_list[] = { {meta_MJB_MJH, "Sony MultiStream MJH+MJB header"}, {meta_BSNF, "id Software BSNF header"}, {meta_TAC, "tri-Ace Codec header"}, - {meta_IDSP_TOSE, "TOSE .idsp header"}, + {meta_IDSP_TOSE, "TOSE .IDSP header"}, + {meta_DSP_KWA, "Kuju London .KWA header"}, }; void get_vgmstream_coding_description(VGMSTREAM* vgmstream, char* out, size_t out_size) { diff --git a/src/meta/meta.h b/src/meta/meta.h index c41b55f5..049eb55e 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -60,6 +60,7 @@ VGMSTREAM* init_vgmstream_dsp_wiivoice(STREAMFILE* sf); VGMSTREAM* init_vgmstream_dsp_wiiadpcm(STREAMFILE* sf); VGMSTREAM* init_vgmstream_dsp_cwac(STREAMFILE* sf); VGMSTREAM* init_vgmstream_idsp_tose(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_dsp_kwa(STREAMFILE* sf); VGMSTREAM * init_vgmstream_csmp(STREAMFILE *streamFile); diff --git a/src/meta/ngc_dsp_std.c b/src/meta/ngc_dsp_std.c index 098cc180..9e8390f0 100644 --- a/src/meta/ngc_dsp_std.c +++ b/src/meta/ngc_dsp_std.c @@ -149,6 +149,7 @@ static VGMSTREAM* init_vgmstream_dsp_common(STREAMFILE* sf, dsp_meta* dspm) { ch_header[i].loop_flag != ch_header[i+1].loop_flag || ch_header[i].loop_start_offset != ch_header[i+1].loop_start_offset || ch_header[i].loop_end_offset != ch_header[i+1].loop_end_offset) { + //;VGM_LOG("DSP: bad header agreement\n"); goto fail; } } @@ -1380,6 +1381,7 @@ fail: return NULL; } + /* .idsp - interleaved dsp [Harvest Moon: Another Wonderful Life (GC)] */ VGMSTREAM* init_vgmstream_idsp_tose(STREAMFILE* sf) { dsp_meta dspm = {0}; @@ -1410,3 +1412,35 @@ VGMSTREAM* init_vgmstream_idsp_tose(STREAMFILE* sf) { fail: return NULL; } + + +/* .KWA - interleaved dsp [Knight Wars prototype (Wii)] */ +VGMSTREAM* init_vgmstream_dsp_kwa(STREAMFILE* sf) { + dsp_meta dspm = {0}; + + /* checks */ + /* .dsp: assumed */ + if (!check_extensions(sf, "kwa")) + goto fail; + if (read_u32be(0x00,sf) != 3) + goto fail; + + dspm.max_channels = 4; + + dspm.channels = read_u32be(0x04,sf); + dspm.interleave = read_u32be(0x0c,sf); + + dspm.header_offset = 0x20; + dspm.header_spacing = dspm.interleave; + dspm.start_offset = dspm.header_offset + 0x60; + + dspm.interleave_first_skip = 0x60; + dspm.interleave_first = dspm.interleave - dspm.interleave_first_skip; + + dspm.ignore_header_agreement = 1; /* Reus_2.kwa has a few more samples in channels 3+4 */ + + dspm.meta_type = meta_DSP_KWA; + return init_vgmstream_dsp_common(sf, &dspm); +fail: + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 58ca7ded..0942da71 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -524,6 +524,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_bsnf, init_vgmstream_tac, init_vgmstream_idsp_tose, + init_vgmstream_dsp_kwa, /* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */ init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */ diff --git a/src/vgmstream.h b/src/vgmstream.h index 5791a367..799bce3d 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -758,6 +758,7 @@ typedef enum { meta_BSNF, meta_TAC, meta_IDSP_TOSE, + meta_DSP_KWA, } meta_t; /* standard WAVEFORMATEXTENSIBLE speaker positions */