Add support for .WB from Shooting Love. ~TRIZEAL~ (PS2)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@759 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-03-23 03:36:10 +00:00
parent b29738d9df
commit 6475e89d44
9 changed files with 80 additions and 1 deletions

View File

@ -225,7 +225,8 @@ META_OBJS=meta/adx_header.o \
meta/ngc_aaap.o \
meta/ngc_dsp_tmnt2.o \
meta/ps2_ster.o \
meta/bnsf.o
meta/bnsf.o \
meta/ps2_wb.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -714,6 +714,10 @@
RelativePath=".\meta\ps2_vpk.c"
>
</File>
<File
RelativePath=".\meta\ps2_wb.c"
>
</File>
<File
RelativePath=".\meta\ps2_xa2.c"
>

View File

@ -182,5 +182,6 @@ libmeta_la_SOURCES += ngc_aaap.c
libmeta_la_SOURCES += ngc_dsp_tmnt2.c
libmeta_la_SOURCES += ps2_ster.c
libmeta_la_SOURCES += bnsf.c
libmeta_la_SOURCES += ps2_wb.c
EXTRA_DIST = meta.h

View File

@ -449,4 +449,6 @@ VGMSTREAM * init_vgmstream_ps2_ster(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile);
#endif

64
src/meta/ps2_wb.c Normal file
View File

@ -0,0 +1,64 @@
#include "meta.h"
#include "../util.h"
/* WB (from Shooting Love. ~TRIZEAL~) */
VGMSTREAM * init_vgmstream_ps2_wb(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("wb",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0,streamFile) != 0x00000000)
goto fail;
loop_flag = read_32bitLE(0x4,streamFile);
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x10;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 48000;
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0xC,streamFile)/4;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x4,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x8,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 2;
vgmstream->meta_type = meta_PS2_WB;
/* 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

@ -245,6 +245,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_dsp_tmnt2,
init_vgmstream_ps2_ster,
init_vgmstream_bnsf,
init_vgmstream_ps2_wb,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2441,6 +2442,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_BNSF:
snprintf(temp,TEMPSIZE,"Namco Bandai BNSF header");
break;
case meta_PS2_WB:
snprintf(temp,TEMPSIZE,"Shooting Love. ~TRIZEAL~ WB header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -440,6 +440,7 @@ typedef enum {
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
meta_NGC_AAAP, /* Turok: Evolution (NGC) */
meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
} meta_t;
typedef struct {

View File

@ -205,6 +205,7 @@ gchar *vgmstream_exts [] = {
"wad",
"wam",
"wavm",
"wb",
"wii",
"wp2",
"wsd",

View File

@ -274,6 +274,7 @@ char * extension_list[] = {
"wam\0WAM Audio File (*.WAM)\0",
"wavm\0WAVM Audio File (*.WAVM)\0",
"was\0WAS Audio File (*.WAS)\0",
"wb\0WB Audio File (*.WB)\0",
"wii\0WII Audio File (*.WII)\0",
"wp2\0WP2 Audio File (*.WP2)\0",
"wsd\0WSD Audio File (*.WSD)\0",