.smp (Wii) added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@501 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-12-08 17:36:44 +00:00
parent c57d6dd3e4
commit 48d1092d51
9 changed files with 91 additions and 3 deletions

View File

@ -159,7 +159,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_joe.o \
meta/vgs.o \
meta/vs.o \
meta/dc_wav_dcs.o
meta/dc_wav_dcs.o \
meta/wii_smp.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -661,6 +661,10 @@
RelativePath=".\meta\wii_mus.c"
>
</File>
<File
RelativePath=".\meta\wii_smp.c"
>
</File>
<File
RelativePath=".\meta\ws_aud.c"
>

View File

@ -128,5 +128,6 @@ libmeta_la_SOURCES += ps2_joe.c
libmeta_la_SOURCES += vs.c
libmeta_la_SOURCES += vgs.c
libmeta_la_SOURCES += dc_wav_dcs.c
libmeta_la_SOURCES += wii_smp.c
EXTRA_DIST = meta.h

View File

@ -267,7 +267,6 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
for (j=0;j<16;j++)
vgmstream->ch[i].adpcm_coef[j] = read_16bitBE(coef[i]+j*2,streamFile);
chstart_offset =start_offset+vgmstream->interleave_block_size*i;
break;

View File

@ -311,4 +311,6 @@ VGMSTREAM * init_vgmstream_vgs(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_wii_smp(STREAMFILE * streamFile);
#endif

75
src/meta/wii_smp.c Normal file
View File

@ -0,0 +1,75 @@
#include "meta.h"
#include "../util.h"
/* SMP (Mushroom Men: The Spore Wars ) */
VGMSTREAM * init_vgmstream_wii_smp(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("smp",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x05000000) /* 0x05000000 */
goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x28,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x1C,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x30,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = read_32bitLE(0x34,streamFile)/2;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x34,streamFile)/2;
}
/* We have no interleave, so we have no layout */
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_WII_SMP;
/* 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;
}
}
/*Retrieving the coef table...
This game has an exception, the coefs are stored in Little Endian... */
{
int i;
for (i=0;i<16;i++) {
vgmstream->ch[0].adpcm_coef[i] = read_16bitLE(0x50+i*2,streamFile);
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -172,6 +172,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_joe,
init_vgmstream_vgs,
init_vgmstream_dc_wav_dcs,
init_vgmstream_wii_smp,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -1888,6 +1889,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_DC_WAV_DCS:
snprintf(temp,TEMPSIZE,"Evil Twin WAV+DCS Header");
break;
case meta_WII_SMP:
snprintf(temp,TEMPSIZE,"SMP DSP Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -284,6 +284,7 @@ typedef enum {
meta_ZWDSP, /* Zack and Wiki */
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
meta_DC_WAV_DCS, /* Evil Twin - Cypriens Chronicles (DC) */
meta_WII_SMP, /* Mushroom Men - The Spore Wars */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -213,6 +213,7 @@ char * extension_list[] = {
"vgs\0VGS Audio File (*.VGS)\0",
"vs\0VS Audio File (*.VS)\0",
"dcs\0DCS Audio File (*.DCS)\0",
"smp\0SMP Audio File (*.SMP)\0",
};
void about(HWND hwndParent) {