git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@311 51a99a44-fe44-0410-b1ba-c3e57ba2b86b

This commit is contained in:
manakoAT 2008-07-14 11:02:39 +00:00
parent f4971c8233
commit 7a9a6c4c17
7 changed files with 259 additions and 65 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8,00"
Name="libvgmstream" Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}" ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream" RootNamespace="libvgmstream"
@ -206,6 +206,14 @@
RelativePath=".\meta\agsc.c" RelativePath=".\meta\agsc.c"
> >
</File> </File>
<File
RelativePath=".\meta\ahx.c"
>
</File>
<File
RelativePath=".\meta\aifc.c"
>
</File>
<File <File
RelativePath=".\meta\ast.c" RelativePath=".\meta\ast.c"
> >
@ -234,6 +242,10 @@
RelativePath=".\meta\halpst.c" RelativePath=".\meta\halpst.c"
> >
</File> </File>
<File
RelativePath=".\meta\ivb.c"
>
</File>
<File <File
RelativePath=".\meta\nds_strm.c" RelativePath=".\meta\nds_strm.c"
> >
@ -250,18 +262,42 @@
RelativePath=".\meta\ngc_dsp_std.c" RelativePath=".\meta\ngc_dsp_std.c"
> >
</File> </File>
<File
RelativePath=".\meta\nwa.c"
>
</File>
<File <File
RelativePath=".\meta\ogg_vorbis_file.c" RelativePath=".\meta\ogg_vorbis_file.c"
> >
</File> </File>
<File
RelativePath=".\meta\pos.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_ads.c" RelativePath=".\meta\ps2_ads.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_aus.c"
>
</File>
<File
RelativePath=".\meta\ps2_bmdx.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_exst.c" RelativePath=".\meta\ps2_exst.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_fsb.c"
>
</File>
<File
RelativePath=".\meta\ps2_hgc1.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_ild.c" RelativePath=".\meta\ps2_ild.c"
> >
@ -286,10 +322,22 @@
RelativePath=".\meta\ps2_pnb.c" RelativePath=".\meta\ps2_pnb.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_rsd.c"
>
</File>
<File
RelativePath=".\meta\ps2_rws.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_rxw.c" RelativePath=".\meta\ps2_rxw.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_sl3.c"
>
</File>
<File <File
RelativePath=".\meta\ps2_str.c" RelativePath=".\meta\ps2_str.c"
> >
@ -318,6 +366,10 @@
RelativePath=".\meta\raw.c" RelativePath=".\meta\raw.c"
> >
</File> </File>
<File
RelativePath=".\meta\riff.c"
>
</File>
<File <File
RelativePath=".\meta\rs03.c" RelativePath=".\meta\rs03.c"
> >
@ -331,7 +383,15 @@
> >
</File> </File>
<File <File
RelativePath=".\meta\ps2_bmdx.c" RelativePath=".\meta\str_snds.c"
>
</File>
<File
RelativePath=".\meta\svs.c"
>
</File>
<File
RelativePath=".\meta\ws_aud.c"
> >
</File> </File>
<File <File
@ -342,62 +402,10 @@
RelativePath=".\meta\xbox_xwav.c" RelativePath=".\meta\xbox_xwav.c"
> >
</File> </File>
<File
RelativePath=".\meta\aifc.c"
>
</File>
<File
RelativePath=".\meta\str_snds.c"
>
</File>
<File
RelativePath=".\meta\ws_aud.c"
>
</File>
<File
RelativePath=".\meta\ahx.c"
>
</File>
<File
RelativePath=".\meta\ivb.c"
>
</File>
<File
RelativePath=".\meta\svs.c"
>
</File>
<File
RelativePath=".\meta\riff.c"
>
</File>
<File
RelativePath=".\meta\pos.c"
>
</File>
<File
RelativePath=".\meta\nwa.c"
>
</File>
<File
RelativePath=".\meta\ps2_rws.c"
>
</File>
<File
RelativePath=".\meta\ps2_hgc1.c"
>
</File>
<File <File
RelativePath=".\meta\xss.c" RelativePath=".\meta\xss.c"
> >
</File> </File>
<File
RelativePath=".\meta\ps2_sl3.c"
>
</File>
<File
RelativePath=".\meta\ps2_aus.c"
>
</File>
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter
@ -434,6 +442,10 @@
RelativePath=".\coding\ima_decoder.c" RelativePath=".\coding\ima_decoder.c"
> >
</File> </File>
<File
RelativePath=".\coding\mpeg_decoder.c"
>
</File>
<File <File
RelativePath=".\coding\ngc_afc_decoder.c" RelativePath=".\coding\ngc_afc_decoder.c"
> >
@ -458,10 +470,6 @@
RelativePath=".\coding\psx_decoder.c" RelativePath=".\coding\psx_decoder.c"
> >
</File> </File>
<File
RelativePath=".\coding\xa_decoder.c"
>
</File>
<File <File
RelativePath=".\coding\sdx2_decoder.c" RelativePath=".\coding\sdx2_decoder.c"
> >
@ -471,7 +479,7 @@
> >
</File> </File>
<File <File
RelativePath=".\coding\mpeg_decoder.c" RelativePath=".\coding\xa_decoder.c"
> >
</File> </File>
</Filter> </Filter>
@ -519,7 +527,11 @@
> >
</File> </File>
<File <File
RelativePath=".\layout\xa_blocked.c" RelativePath=".\layout\str_snds_blocked.c"
>
</File>
<File
RelativePath=".\layout\ws_aud_blocked.c"
> >
</File> </File>
<File <File
@ -527,11 +539,7 @@
> >
</File> </File>
<File <File
RelativePath=".\layout\str_snds_blocked.c" RelativePath=".\layout\xa_blocked.c"
>
</File>
<File
RelativePath=".\layout\ws_aud_blocked.c"
> >
</File> </File>
</Filter> </Filter>

View File

@ -123,4 +123,8 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rws(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rws(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rsd(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb(STREAMFILE * streamFile);
#endif #endif

73
src/meta/ps2_fsb.c Normal file
View File

@ -0,0 +1,73 @@
#include "meta.h"
#include "../util.h"
/* FSB - FlatOut (XBOX), Guitar Hero III (WII), FlatOut 1 & 2 (PS2) */
VGMSTREAM * init_vgmstream_fsb(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int fsb3_headerlen = 0x18;
int fsb3_format;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("fsb",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x46534233) /* "FSB3\0" */
goto fail;
loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
switch (fsb3_format) (
case 0:
break;
/* fill in the vital statistics */
start_offset = (read_32bitLE(0x08,streamFile))+fsb3_headerlen;
vgmstream->channels = read_16bitLE(0x56,streamFile);
vgmstream->sample_rate = read_32bitLE(0x4C,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x0C,streamFile))*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0; /* (read_32bitLE(0x08,streamFile)-1)*28; */
vgmstream->loop_end_sample = (read_32bitLE(0x0C,streamFile))*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_FSB;
/* 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;
}

97
src/meta/ps2_rsd.c Normal file
View File

@ -0,0 +1,97 @@
#include "meta.h"
#include "../util.h"
/* RSD (Crash Bandicot games, possibly more) */
VGMSTREAM * init_vgmstream_rsd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
coding_t coding_type;
int loop_flag = 0;
int channel_count;
int rsd_ident;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("rsd",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x52534436 && /* RSD6 */
read_32bitBE(0x0,streamFile) != 0x52534434) /* RSD4 */
goto fail;
loop_flag = (read_16bitLE(0x12,streamFile));
channel_count = (read_16bitLE(0x8,streamFile));
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
rsd_ident = read_32bitBE(0x4,streamFile);
/* fill in the vital statistics */
switch (rsd_ident) {
case 0x56414720: /* RSD4VAG & RSD6VAG */
coding_type = coding_PSX;
vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile);
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = (loop_flag)*28/2;
vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
}
break;
case 0x50434D20: /* RSD4PCM */
coding_type = coding_PCM16LE;
vgmstream->interleave_block_size = 0x2;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)/2/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = loop_flag;
vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-0x800)/2/channel_count;
}
break;
default:
goto fail;
}
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_RSD;
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_16bitLE(0x10,streamFile);
vgmstream->coding_type = coding_type;
/* 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

@ -77,6 +77,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_hgc1, init_vgmstream_hgc1,
init_vgmstream_aus, init_vgmstream_aus,
init_vgmstream_rws, init_vgmstream_rws,
init_vgmstream_rsd,
init_vgmstream_fsb,
}; };
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -1140,6 +1142,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case meta_RWS: case meta_RWS:
snprintf(temp,TEMPSIZE,"RWS Header"); snprintf(temp,TEMPSIZE,"RWS Header");
break;
case meta_RSD:
snprintf(temp,TEMPSIZE,"RSD4 or RSD6 Header");
break;
case meta_FSB:
snprintf(temp,TEMPSIZE,"FSB Header");
break; break;
default: default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -161,6 +161,8 @@ typedef enum {
meta_HGC1, /* Knights of the Temple 2 */ meta_HGC1, /* Knights of the Temple 2 */
meta_AUS, /* Variuos Capcom Games */ meta_AUS, /* Variuos Capcom Games */
meta_RWS, /* Variuos Konami Games */ meta_RWS, /* Variuos Konami Games */
meta_RSD, /* Crash Bandicoot Games */
meta_FSB, /* FSB File (Various Games) */
meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -132,6 +132,8 @@ char * extension_list[] = {
"hgc1\0HGC1 Audio File (*.HGC1)\0", "hgc1\0HGC1 Audio File (*.HGC1)\0",
"aus\0AUS Audio File (*.AUS)\0", "aus\0AUS Audio File (*.AUS)\0",
"rws\0RWS Audio File (*.RWS)\0", "rws\0RWS Audio File (*.RWS)\0",
"rsd\0RSD Audio File (*.RSD)\0",
"fsb\0FSB Audio File (*.FSB)\0",
}; };
void about(HWND hwndParent) { void about(HWND hwndParent) {