diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 07a2ca22..4925710b 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1,7 +1,7 @@  + + + + @@ -234,6 +242,10 @@ RelativePath=".\meta\halpst.c" > + + @@ -250,18 +262,42 @@ RelativePath=".\meta\ngc_dsp_std.c" > + + + + + + + + + + + + @@ -286,10 +322,22 @@ RelativePath=".\meta\ps2_pnb.c" > + + + + + + @@ -318,6 +366,10 @@ RelativePath=".\meta\raw.c" > + + @@ -331,7 +383,15 @@ > + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -458,10 +470,6 @@ RelativePath=".\coding\psx_decoder.c" > - - @@ -471,7 +479,7 @@ > @@ -519,7 +527,11 @@ > + + - - diff --git a/src/meta/meta.h b/src/meta/meta.h index aeb5fb8c..7bd4a53c 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -123,4 +123,8 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rws(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_rsd(STREAMFILE * streamFile); + +VGMSTREAM * init_vgmstream_fsb(STREAMFILE * streamFile); + #endif diff --git a/src/meta/ps2_fsb.c b/src/meta/ps2_fsb.c new file mode 100644 index 00000000..6f0804f9 --- /dev/null +++ b/src/meta/ps2_fsb.c @@ -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;ich[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; +} diff --git a/src/meta/ps2_rsd.c b/src/meta/ps2_rsd.c new file mode 100644 index 00000000..78d6fbca --- /dev/null +++ b/src/meta/ps2_rsd.c @@ -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;ich[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; +} + diff --git a/src/vgmstream.c b/src/vgmstream.c index 670d87b8..28f21724 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -77,6 +77,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_hgc1, init_vgmstream_aus, init_vgmstream_rws, + init_vgmstream_rsd, + init_vgmstream_fsb, }; #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; case meta_RWS: 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; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); diff --git a/src/vgmstream.h b/src/vgmstream.h index 10e9f572..810ea2df 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -161,6 +161,8 @@ typedef enum { meta_HGC1, /* Knights of the Temple 2 */ meta_AUS, /* Variuos Capcom 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_RIFF, /* XBOX RIFF/WAVE File */ diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 2c416fee..8cb8cf29 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -132,6 +132,8 @@ char * extension_list[] = { "hgc1\0HGC1 Audio File (*.HGC1)\0", "aus\0AUS Audio File (*.AUS)\0", "rws\0RWS Audio File (*.RWS)\0", + "rsd\0RSD Audio File (*.RSD)\0", + "fsb\0FSB Audio File (*.FSB)\0", }; void about(HWND hwndParent) {