vsf meta from bxaimc

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@576 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2009-02-08 08:36:33 +00:00
parent 019497f829
commit 56b96d1257
10 changed files with 83 additions and 2 deletions

View File

@ -179,7 +179,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_gbts.o \
meta/ngc_ffcc_str.o \
meta/sat_baka.o \
meta/nds_swav.o
meta/nds_swav.o \
meta/vsf.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -694,6 +694,10 @@
RelativePath=".\meta\vs.c"
>
</File>
<File
RelativePath=".\meta\vsf.c"
>
</File>
<File
RelativePath=".\meta\wii_mus.c"
>

View File

@ -140,5 +140,6 @@ libmeta_la_SOURCES += ps2_gbts.c
libmeta_la_SOURCES += ngc_ffcc_str.c
libmeta_la_SOURCES += sat_baka.c
libmeta_la_SOURCES += nds_swav.c
libmeta_la_SOURCES += vsf.c
EXTRA_DIST = meta.h

View File

@ -336,4 +336,6 @@ VGMSTREAM * init_vgmstream_sat_baka(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_nds_swav(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ps2_vsf(STREAMFILE *streamFile);
#endif

View File

@ -86,4 +86,4 @@ VGMSTREAM * init_vgmstream_nds_swav(STREAMFILE *streamFile) {
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
}

66
src/meta/vsf.c Normal file
View File

@ -0,0 +1,66 @@
#include "meta.h"
#include "../util.h"
/* VSF (from Musashi: Samurai Legend) */
VGMSTREAM * init_vgmstream_ps2_vsf(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("vsf",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x56534600) /* "VSF" */
goto fail;
loop_flag = (read_32bitLE(0x1c,streamFile)==0x13);
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x10,streamFile)-0x90)*28;
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)-0x90)*28;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x400;
vgmstream->meta_type = meta_PS2_VSF;
/* 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

@ -188,6 +188,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_ffcc_str,
init_vgmstream_sat_baka,
init_vgmstream_nds_swav,
init_vgmstream_ps2_vsf,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2056,6 +2057,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_NDS_SWAV:
snprintf(temp,TEMPSIZE,"SWAV Header");
break;
case meta_PS2_VSF:
snprintf(temp,TEMPSIZE,"Musashi: Samurai Legend VSF Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -307,6 +307,7 @@ typedef enum {
meta_EMFF_PS2, /* Eidos Music File Format for PS2*/
meta_EMFF_NGC, /* Eidos Music File Format for NGC/WII */
meta_SAT_BAKA, /* Crypt Killer */
meta_PS2_VSF, /* Musashi: Samurai Legend */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -162,6 +162,7 @@ gchar *vgmstream_exts [] = {
"p2bt",
"rwav",
"baka",
"vsf",
/* terminator */
NULL
};

View File

@ -225,6 +225,7 @@ char * extension_list[] = {
"rwav\0RWAV Audio File (*.RWAV)\0",
"baka\0BAKA Audio File (*.BAKA)\0",
"swav\0SWAV Audio File (*.SWAV)\0",
"vsf\0VSF Audio File (*.VSF)\0",
};
void about(HWND hwndParent) {