Vertigo (Wii) .ndp added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@617 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2009-03-30 04:18:46 +00:00
parent 370a1cc565
commit d99bb4c520
7 changed files with 87 additions and 2 deletions

View File

@ -190,7 +190,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_mcg.o \
meta/redspark.o \
meta/ps2_vgs.o \
meta/ivaud.o
meta/ivaud.o \
meta/wii_ndp.0
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

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"
@ -730,6 +730,10 @@
RelativePath=".\meta\wii_mus.c"
>
</File>
<File
RelativePath=".\meta\wii_ndp.c"
>
</File>
<File
RelativePath=".\meta\wii_smp.c"
>

View File

@ -367,4 +367,6 @@ VGMSTREAM * init_vgmstream_ivaud(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_wii_wsd(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_wii_ndp(STREAMFILE *streamFile);
#endif

72
src/meta/wii_ndp.c Normal file
View File

@ -0,0 +1,72 @@
#include "meta.h"
#include "../util.h"
/* NDP (from Vertigo (Wii)) */
VGMSTREAM * init_vgmstream_wii_ndp(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("ndp",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x4E445000) /* NDP */
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x10,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0xd8;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitBE(0x18,streamFile);
vgmstream->layout_type = layout_interleave_byte;
vgmstream->interleave_block_size = 4;
vgmstream->meta_type = meta_WII_NDP;
if (vgmstream->coding_type == coding_NGC_DSP) {
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x34+i*2,streamFile);
}
if (vgmstream->channels) {
for (i=0;i<16;i++) {
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x94+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

@ -203,6 +203,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_RedSpark,
init_vgmstream_ivaud,
init_vgmstream_wii_wsd,
init_vgmstream_wii_ndp,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2127,6 +2128,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_DSP_WII_WSD:
snprintf(temp,TEMPSIZE,"Standard Nintendo DSP headers in .wsd");
break;
case meta_WII_NDP:
snprintf(temp,TEMPSIZE,"Vertigo NDP Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -169,6 +169,7 @@ typedef enum {
meta_DSP_WII_IDSP, /* .gcm with IDSP header */
meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
/* Nintendo */
meta_STRM, /* STRM */

View File

@ -234,6 +234,7 @@ char * extension_list[] = {
"zsd\0ZSD Audio File (*.ZSD)\0",
"ivaud\0IVAUD Audio File (*.IVAUD)\0",
"wsd\0WSD Audio File (*.WSD)\0",
"ndp\0NDP Audio File (*.NDP)\0",
};
void about(HWND hwndParent) {