mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 23:10:10 +01:00
Add DS .wave [Adventure Time: HIKWYSOG (DS)]
This commit is contained in:
parent
7e91b63471
commit
07f26d822a
@ -16,8 +16,9 @@ VGMSTREAM* init_vgmstream_wave(STREAMFILE* sf) {
|
||||
|
||||
/* checks */
|
||||
if (!is_id32be(0x00,sf, "VAW3") && /* Happy Feet Two (3DS) */
|
||||
read_u32le(0x00,sf) != 0xE5B7ECFE && /* common (LE) */
|
||||
read_u32be(0x00,sf) != 0xE5B7ECFE) /* used? */
|
||||
read_u32le(0x00,sf) != 0xE5B7ECFE && /* common LE (hashed something?) */
|
||||
read_u32be(0x00,sf) != 0xE5B7ECFE &&
|
||||
read_u32be(0x00,sf) != 0xC9FB0C03) /* NDS [Lalaloopsy, Adventure Time: HIKWYSOG (DS)] */
|
||||
goto fail;
|
||||
/* 0x04: version? common=0, VAW3=2 */
|
||||
|
||||
@ -51,15 +52,15 @@ VGMSTREAM* init_vgmstream_wave(STREAMFILE* sf) {
|
||||
|
||||
start_offset = read_u32(0x20, sf);
|
||||
interleave = read_u32(0x24, sf); /* typically half data_size */
|
||||
extradata_offset = read_u32(0x28, sf); /* OR: extradata size (always 0x2c) */
|
||||
extradata_offset = read_u32(0x28, sf); /* always 0x2c */
|
||||
|
||||
loop_flag = (loop_start > 0);
|
||||
/* some songs (ex. Adventure Time's m_candykingdom_overworld.wave) do full loops, but there is no way
|
||||
* to tell them apart from sfx/voices, so we try to detect if it's long enough. */
|
||||
if(!loop_flag
|
||||
&& loop_start == 0 && loop_end == num_samples /* full loop */
|
||||
&& channels > 1
|
||||
&& num_samples > 20*sample_rate) { /* in seconds */
|
||||
&& (channels > 1 || (channels == 1 && start_offset <= 0x40))
|
||||
&& num_samples > 30*sample_rate) { /* in seconds */
|
||||
loop_flag = 1;
|
||||
}
|
||||
|
||||
@ -75,9 +76,23 @@ VGMSTREAM* init_vgmstream_wave(STREAMFILE* sf) {
|
||||
|
||||
vgmstream->meta_type = meta_WAVE;
|
||||
|
||||
/* not sure if there are other codecs but anyway */
|
||||
/* not sure if there are other codecs but anyway (based also see wave-segmented) */
|
||||
switch(codec) {
|
||||
case 0x02:
|
||||
/* DS games use IMA, no apparent flag (could also test ID) */
|
||||
if (start_offset <= 0x40) {
|
||||
vgmstream->coding_type = coding_IMA_int;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
|
||||
/* extradata:
|
||||
* 0x00: base hist? (only seen 0)
|
||||
* 0x02: base step? (only seen 0)
|
||||
* 0x04: loop hist?
|
||||
* 0x06: loop step?
|
||||
*/
|
||||
}
|
||||
else {
|
||||
vgmstream->coding_type = coding_NGC_DSP;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
@ -85,12 +100,13 @@ VGMSTREAM* init_vgmstream_wave(STREAMFILE* sf) {
|
||||
/* ADPCM setup: 0x20 coefs + 0x06 initial ps/hist1/hist2 + 0x06 loop ps/hist1/hist2, per channel */
|
||||
dsp_read_coefs(vgmstream, sf, extradata_offset+0x00, 0x2c, big_endian);
|
||||
dsp_read_hist(vgmstream, sf, extradata_offset+0x22, 0x2c, big_endian);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream,sf,start_offset))
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user