add NST DSP (Animaniacs NGC)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@837 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-09-11 17:53:33 +00:00
parent 3d52adfa3a
commit 19fcc3fb49
5 changed files with 112 additions and 12 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream"
@ -490,6 +490,10 @@
RelativePath=".\meta\ngc_lps.c"
>
</File>
<File
RelativePath=".\meta\ngc_nst_dsp.c"
>
</File>
<File
RelativePath=".\meta\ngc_pdt.c"
>

View File

@ -523,4 +523,6 @@ VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_se_scd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngc_nst_dsp(STREAMFILE* streamFile);
#endif

89
src/meta/ngc_nst_dsp.c Normal file
View File

@ -0,0 +1,89 @@
#include "meta.h"
#include "../util.h"
/* DSP (Animaniacs: The Great Edgar Hunt) */
// NOTE: The second dsp header is just a dummy, both channels
// use the same coef table (0x20)
VGMSTREAM * init_vgmstream_ngc_nst_dsp(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(0x0,streamFile) != read_32bitBE(0x54,streamFile))
goto fail;
if (read_32bitBE(0x4,streamFile) != read_32bitBE(0x58,streamFile))
goto fail;
if (read_32bitBE(0x8,streamFile) != read_32bitBE(0x5C,streamFile))
goto fail;
if (read_32bitBE(0xC,streamFile) != read_32bitBE(0x60,streamFile))
goto fail;
loop_flag = 0;
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0xAC;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x14,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x8,streamFile);
#if 0
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = 0;
}
#endif
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_NGC_NST_DSP;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x20+i*2,streamFile);
}
if (vgmstream->channels) {
for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x20+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;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -284,6 +284,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps3_xvag,
init_vgmstream_ps3_cps,
init_vgmstream_se_scd,
init_vgmstream_ngc_nst_dsp,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2668,6 +2669,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_SE_SCD:
snprintf(temp,TEMPSIZE,"Square-Enix SCD");
break;
case meta_NGC_NST_DSP:
snprintf(temp,TEMPSIZE,"Animaniacs NST header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -485,6 +485,7 @@ typedef enum {
meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
meta_PS3_CPS, /* Eternal Sonata (PS3) */
meta_SE_SCD, /* Square-Enix SCD */
meta_NGC_NST_DSP, /* Animaniacs [NGC] */
} meta_t;
typedef struct {