added .dsp support for Yu-Gi-Oh! The Falsebound Kingdom (GC)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@660 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2009-06-20 21:26:36 +00:00
parent 2d097f4bde
commit f65adfd696
4 changed files with 1443 additions and 1365 deletions

View File

@ -393,4 +393,6 @@ VGMSTREAM * init_vgmstream_sd9(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_2dx(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE * streamFile);
#endif

View File

@ -1362,3 +1362,73 @@ fail:
return NULL;
}
/* .dsp found in Yu-Gi-Oh! The Falsebound Kingdom (GC) */
VGMSTREAM * init_vgmstream_dsp_ygo(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("dsp",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x10,streamFile) != 0x0000)
goto fail;
loop_flag = read_16bitBE(0x2C,streamFile);
channel_count = 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0xE0;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x28,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x20,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitBE(0x30,streamFile))/2;
vgmstream->loop_end_sample = (read_32bitBE(0x34,streamFile))/2;
}
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_DSP_YGO;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x3c+i*2,streamFile);
}
}
/* open the file for reading */
{
int i;
STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
return vgmstream;
fail:
/* clean up anything we may have opened */
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -216,6 +216,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_naomi_adpcm,
init_vgmstream_sd9,
init_vgmstream_2dx,
init_vgmstream_dsp_ygo,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -247,7 +248,8 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
(vgmstream->meta_type == meta_GENH) ||
(vgmstream->meta_type == meta_KRAW) ||
(vgmstream->meta_type == meta_PS2_MIB) ||
(vgmstream->meta_type == meta_NGC_LPS)
(vgmstream->meta_type == meta_NGC_LPS) ||
(vgmstream->meta_type == meta_DSP_YGO)
) && vgmstream->channels == 1) {
try_dual_file_stereo(vgmstream, streamFile);
}
@ -2196,6 +2198,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_2DX:
snprintf(temp,TEMPSIZE,"beatmaniaIIDX 2DX9 header");
break;
case meta_DSP_YGO:
snprintf(temp,TEMPSIZE," Yu-Gi-Oh! The Falsebound Kingdom DSP Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -171,6 +171,7 @@ typedef enum {
meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Yu-Gi-Oh! The Falsebound Kingdom (GC) */
/* Nintendo */
meta_STRM, /* STRM */