added .XVAG support for Ratchet & Clank Future: Quest for Booty (PS3)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@827 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-09-04 22:06:39 +00:00
parent d993fbb44b
commit d662a5f323
9 changed files with 86 additions and 2 deletions

View File

@ -479,6 +479,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"xmu")) return 1;
if(!stricmp_utf8(p_extension,"xsf")) return 1;
if(!stricmp_utf8(p_extension,"xss")) return 1;
if(!stricmp_utf8(p_extension,"xvag")) return 1;
if(!stricmp_utf8(p_extension,"xvas")) return 1;
if(!stricmp_utf8(p_extension,"xwav")) return 1;
if(!stricmp_utf8(p_extension,"xwb")) return 1;
@ -758,6 +759,7 @@ DECLARE_MULTIPLE_FILE_TYPE("XAU Audio File (*.XAU)", xau);
DECLARE_MULTIPLE_FILE_TYPE("XMU Audio File (*.XMU)", xmu);
DECLARE_MULTIPLE_FILE_TYPE("XSF Audio File (*.XSF)", xsf);
DECLARE_MULTIPLE_FILE_TYPE("XSS Audio File (*.XSS)", xss);
DECLARE_MULTIPLE_FILE_TYPE("XVAG Audio File (*.XVAG)", xvag);
DECLARE_MULTIPLE_FILE_TYPE("XVAS Audio File (*.XVAS)", xvas);
DECLARE_MULTIPLE_FILE_TYPE("XWAV Audio File (*.XWAV)", xwav);
DECLARE_MULTIPLE_FILE_TYPE("XWB Audio File (*.XWB)", xwb);

View File

@ -250,7 +250,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_xau.o \
meta/gh3_bar.o \
meta/ffw.o \
meta/ps2_jstm.o
meta/ps2_jstm.o \
meta/ps3_xvag.o
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"
@ -806,6 +806,10 @@
RelativePath=".\meta\ps2_xau.c"
>
</File>
<File
RelativePath=".\meta\ps3_xvag.c"
>
</File>
<File
RelativePath=".\meta\psx_cdxa.c"
>

View File

@ -203,5 +203,6 @@ libmeta_la_SOURCES += ps2_xau.c
libmeta_la_SOURCES += gh3_bar.c
libmeta_la_SOURCES += ffw.c
libmeta_la_SOURCES += ps2_jstm.c
libmeta_la_SOURCES += ps3_xvag.c
EXTRA_DIST = meta.h

View File

@ -517,4 +517,6 @@ VGMSTREAM * init_vgmstream_dsp_dspw(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_xvag(STREAMFILE* streamFile);
#endif

68
src/meta/ps3_xvag.c Normal file
View File

@ -0,0 +1,68 @@
#include "meta.h"
#include "../util.h"
/* XVAG (from Ratchet & Clank Future: Quest for Booty) */
VGMSTREAM * init_vgmstream_ps3_xvag(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("xvag",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x58564147) /* "XVAG" */
goto fail;
if (read_32bitBE(0x44,streamFile) !=0x63756573)
loop_flag = 0;
else loop_flag = 1;
channel_count = read_32bitBE(0x28,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitBE(0x4,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x3c,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitBE(0x30,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitBE(0x24,streamFile);;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_PS3_XVAG;
/* 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

@ -281,6 +281,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ffw,
init_vgmstream_dsp_dspw,
init_vgmstream_ps2_jstm,
init_vgmstream_ps3_xvag,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2656,6 +2657,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_PS2_JSTM:
snprintf(temp,TEMPSIZE,"JSTM Header");
break;
case meta_PS3_XVAG:
snprintf(temp,TEMPSIZE,"XVAG Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -482,6 +482,7 @@ typedef enum {
meta_FFW, /* Freedom Fighters [NGC] */
meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */
meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
} meta_t;
typedef struct {

View File

@ -308,6 +308,7 @@ char * extension_list[] = {
"xmu\0XMU Audio File (*.XMU)\0",
"xsf\0XSF Audio File (*.XSF)\0",
"xss\0XSS Audio File (*.XSS)\0",
"xvag\0XVAG Audio File (*.XVAG)\0",
"xvas\0XVAS Audio File (*.XVAS)\0",
"xwav\0XWAV Audio File (*.XWAV)\0",
"xwb\0XWB Audio File (*.XWB)\0",