Add .kwa [Knight Wars (Wii)]

This commit is contained in:
bnnm 2021-04-03 17:43:37 +02:00
parent 39bfac5dc0
commit 9acd4bc55a
5 changed files with 40 additions and 1 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}

View File

@ -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 */

View File

@ -758,6 +758,7 @@ typedef enum {
meta_BSNF,
meta_TAC,
meta_IDSP_TOSE,
meta_DSP_KWA,
} meta_t;
/* standard WAVEFORMATEXTENSIBLE speaker positions */