Added support for .VAG from NUB archives found in Ridge Racer 7 (PS3) and others.

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@859 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-09-30 00:04:17 +00:00
parent 029e19ac5c
commit f2cbf2116d
7 changed files with 88 additions and 4 deletions

View File

@ -256,7 +256,8 @@ META_OBJS=meta/adx_header.o \
meta/se_scd.o \
meta/ngc_nst_dsp.o \
meta/baf.o \
meta/ps3_msf.o
meta/ps3_msf.o \
meta/nub.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"
@ -522,6 +522,10 @@
RelativePath=".\meta\ngc_ymf.c"
>
</File>
<File
RelativePath=".\meta\nub.c"
>
</File>
<File
RelativePath=".\meta\nwa.c"
>

View File

@ -209,5 +209,6 @@ libmeta_la_SOURCES += se_scd.c
libmeta_la_SOURCES += ngc_nst_dsp.c
libmeta_la_SOURCES += baf.c
libmeta_la_SOURCES += ps3_msf.c
libmeta_la_SOURCES += nub.c
EXTRA_DIST = meta.h

View File

@ -533,4 +533,6 @@ VGMSTREAM * init_vgmstream_ps3_msf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ngc_dsp_iadp(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile);
#endif

70
src/meta/nub.c Normal file
View File

@ -0,0 +1,70 @@
#include "meta.h"
#include "../util.h"
/* Stuff from NUB archives */
/* VAG (from Ridge Racer 7) */
VGMSTREAM * init_vgmstream_nub_vag(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("vag",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x76616700) /* "vag" */
goto fail;
if (read_32bitBE(0x30,streamFile)==0x3F800000)
loop_flag = 1;
else
loop_flag = 0;
channel_count = 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0xC0;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0xBC,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitBE(0x14,streamFile)*28/32*2;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitBE(0x20,streamFile)*28/32*2;
vgmstream->loop_end_sample = read_32bitBE(0x24,streamFile)*28/32*2;
}
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_NUB_VAG;
/* 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

@ -288,6 +288,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_baf,
init_vgmstream_ps3_msf,
init_vgmstream_fsb_mpeg,
init_vgmstream_nub_vag,
};
@ -321,9 +322,10 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
(vgmstream->meta_type == meta_KRAW) ||
(vgmstream->meta_type == meta_PS2_MIB) ||
(vgmstream->meta_type == meta_NGC_LPS) ||
(vgmstream->meta_type == meta_DSP_YGO) ||
(vgmstream->meta_type == meta_DSP_YGO) ||
(vgmstream->meta_type == meta_DSP_AGSC) ||
(vgmstream->meta_type == meta_PS2_SMPL) ||
(vgmstream->meta_type == meta_PS2_SMPL) ||
(vgmstream->meta_type == meta_NUB_VAG) ||
(vgmstream->meta_type == meta_SPT_SPD)
) && vgmstream->channels == 1) {
try_dual_file_stereo(vgmstream, streamFile);
@ -2698,6 +2700,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_FSB_MPEG:
snprintf(temp,TEMPSIZE,"FSB MPEG header");
break;
case meta_NUB_VAG:
snprintf(temp,TEMPSIZE,"VAG (NUB) header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -490,6 +490,7 @@ typedef enum {
meta_NGC_NST_DSP, /* Animaniacs [NGC] */
meta_BAF, /* .baf (Blur) */
meta_PS3_MSF, /* MSF header */
meta_NUB_VAG /* VAG from Nub archives */
} meta_t;
typedef struct {