2008-07-18 22:20:16 +02:00
|
|
|
#include "meta.h"
|
|
|
|
|
2017-11-15 23:26:38 +01:00
|
|
|
/* DVI - from Konami KCE Yokohama DC games (Pop'n Music series) */
|
|
|
|
VGMSTREAM * init_vgmstream_dc_kcey(STREAMFILE *streamFile) {
|
2008-07-18 22:20:16 +02:00
|
|
|
VGMSTREAM * vgmstream = NULL;
|
|
|
|
off_t start_offset;
|
2017-11-15 23:26:38 +01:00
|
|
|
int loop_flag, channel_count;
|
2008-07-18 22:20:16 +02:00
|
|
|
|
2017-11-15 23:26:38 +01:00
|
|
|
/* check extension (.pcm: original, .kcey: renamed to header id) */
|
|
|
|
if ( !check_extensions(streamFile,"pcm,kcey") )
|
|
|
|
goto fail;
|
2008-07-18 22:20:16 +02:00
|
|
|
|
|
|
|
/* check header */
|
2017-11-15 23:26:38 +01:00
|
|
|
if (read_32bitBE(0x00,streamFile) != 0x4B434559) /* "KCEY" (also "COMP") */
|
2008-07-18 22:20:16 +02:00
|
|
|
goto fail;
|
|
|
|
|
2017-11-15 23:26:38 +01:00
|
|
|
start_offset = read_32bitBE(0x10,streamFile);
|
|
|
|
loop_flag = (read_32bitBE(0x14,streamFile) != 0xFFFFFFFF);
|
2008-07-18 22:20:16 +02:00
|
|
|
channel_count = read_32bitBE(0x08,streamFile);
|
|
|
|
|
2017-11-15 23:26:38 +01:00
|
|
|
/* build the VGMSTREAM */
|
2008-07-18 22:20:16 +02:00
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->sample_rate = 37800;
|
|
|
|
vgmstream->num_samples = read_32bitBE(0x0C,streamFile);
|
2017-11-15 23:26:38 +01:00
|
|
|
vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile);
|
|
|
|
vgmstream->loop_end_sample = read_32bitBE(0x0C,streamFile);
|
2008-07-18 22:20:16 +02:00
|
|
|
|
2017-11-19 03:34:25 +01:00
|
|
|
vgmstream->coding_type = coding_DVI_IMA; /* stereo/mono, high nibble first */
|
2008-07-18 22:20:16 +02:00
|
|
|
vgmstream->layout_type = layout_none;
|
2017-11-15 23:26:38 +01:00
|
|
|
vgmstream->meta_type = meta_DC_KCEY;
|
2008-07-18 22:20:16 +02:00
|
|
|
|
|
|
|
|
2017-11-15 23:26:38 +01:00
|
|
|
/* open the file for reading */
|
|
|
|
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
|
|
|
|
goto fail;
|
2008-07-18 22:20:16 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (vgmstream) close_vgmstream(vgmstream);
|
|
|
|
return NULL;
|
2008-07-18 22:58:48 +02:00
|
|
|
}
|