diff --git a/fb2k/in_vgmstream.cpp b/fb2k/in_vgmstream.cpp index 1e67b0ca..985922d7 100644 --- a/fb2k/in_vgmstream.cpp +++ b/fb2k/in_vgmstream.cpp @@ -363,6 +363,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension if(!stricmp_utf8(p_extension,"mpdsp")) return 1; if(!stricmp_utf8(p_extension,"mpds")) return 1; if(!stricmp_utf8(p_extension,"msa")) return 1; + if(!stricmp_utf8(p_extension,"msf")) return 1; if(!stricmp_utf8(p_extension,"mss")) return 1; if(!stricmp_utf8(p_extension,"msvp")) return 1; if(!stricmp_utf8(p_extension,"mus")) return 1; @@ -380,6 +381,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension if(!stricmp_utf8(p_extension,"p2bt")) return 1; if(!stricmp_utf8(p_extension,"p3d")) return 1; + if(!stricmp_utf8(p_extension,"past")) return 1; if(!stricmp_utf8(p_extension,"pcm")) return 1; if(!stricmp_utf8(p_extension,"pdt")) return 1; if(!stricmp_utf8(p_extension,"pnb")) return 1; @@ -646,6 +648,7 @@ DECLARE_MULTIPLE_FILE_TYPE("MIHB Audio File (*.MIHB)", mihb); DECLARE_MULTIPLE_FILE_TYPE("MPDSP Audio File (*.MPDSP)", mpdsp); DECLARE_MULTIPLE_FILE_TYPE("MPDS Audio File (*.MPDS)", mpds); DECLARE_MULTIPLE_FILE_TYPE("MSA Audio File (*.MSA)", msa); +DECLARE_MULTIPLE_FILE_TYPE("MSF Audio File (*.MSF)", msf); DECLARE_MULTIPLE_FILE_TYPE("MSS Audio File (*.MSS)", mss); DECLARE_MULTIPLE_FILE_TYPE("MSVP Audio File (*.MSVP)", msvp); DECLARE_MULTIPLE_FILE_TYPE("MUS Playlist File (*.MUS)", mus); @@ -663,6 +666,7 @@ DECLARE_MULTIPLE_FILE_TYPE("OMU Audio File (*.OMU)", omu); DECLARE_MULTIPLE_FILE_TYPE("P2BT Audio File (*.P2BT)", p2bt); DECLARE_MULTIPLE_FILE_TYPE("P3D Audio File (*.P3D)", p3d); +DECLARE_MULTIPLE_FILE_TYPE("PAST Audio File (*.PAST)", past); DECLARE_MULTIPLE_FILE_TYPE("PCM Audio File (*.PCM)", pcm); DECLARE_MULTIPLE_FILE_TYPE("PDT Audio File (*.PDT)", pdt); DECLARE_MULTIPLE_FILE_TYPE("PNB Audio File (*.PNB)", pnb); diff --git a/src/Makefile b/src/Makefile index f6e3a92a..fa7ba68a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -257,7 +257,8 @@ META_OBJS=meta/adx_header.o \ meta/ngc_nst_dsp.o \ meta/baf.o \ meta/ps3_msf.o \ - meta/nub.o + meta/nub.o \ + meta/ps3_past.o OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 80693aa9..759edaf3 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -826,6 +826,10 @@ RelativePath=".\meta\ps3_msf.c" > + + diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index fb63c662..fe9860fc 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -210,5 +210,6 @@ libmeta_la_SOURCES += ngc_nst_dsp.c libmeta_la_SOURCES += baf.c libmeta_la_SOURCES += ps3_msf.c libmeta_la_SOURCES += nub.c +libmeta_la_SOURCES += ps3_past.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index 32cf3e51..ff547c87 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -535,4 +535,7 @@ VGMSTREAM * init_vgmstream_ngc_dsp_iadp(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_nub_vag(STREAMFILE* streamFile); +VGMSTREAM * init_vgmstream_ps3_past(STREAMFILE* streamFile); + + #endif diff --git a/src/meta/ps3_past.c b/src/meta/ps3_past.c new file mode 100644 index 00000000..3f52907c --- /dev/null +++ b/src/meta/ps3_past.c @@ -0,0 +1,66 @@ +#include "meta.h" +#include "../util.h" + +/* .PAST (Bakugan Battle Brawlers */ +VGMSTREAM * init_vgmstream_ps3_past(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("past",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x0,streamFile) != 0x534E4450) /* SNDP */ + goto fail; + + loop_flag = read_32bitLE(0x1C,streamFile); + + channel_count = 2; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x30; + vgmstream->channels = channel_count; + vgmstream->sample_rate = read_32bitBE(0x10,streamFile); + vgmstream->coding_type = coding_PCM16LE; + vgmstream->num_samples = (read_32bitBE(0x14,streamFile))/2/channel_count; + if (loop_flag) { + vgmstream->loop_start_sample = read_32bitBE(0x18,streamFile)/2/channel_count; + vgmstream->loop_end_sample = vgmstream->num_samples; + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x2; + vgmstream->meta_type = meta_PS3_PAST; + + /* 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; + +fail: + /* clean up anything we may have opened */ + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 0860e7e3..b5d08c8b 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -289,6 +289,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ps3_msf, init_vgmstream_fsb_mpeg, init_vgmstream_nub_vag, + init_vgmstream_ps3_past, }; @@ -2703,6 +2704,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { break; case meta_NUB_VAG: snprintf(temp,TEMPSIZE,"VAG (NUB) header"); + break; + case meta_PS3_PAST: + snprintf(temp,TEMPSIZE,"SNDP header"); break; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); diff --git a/src/vgmstream.h b/src/vgmstream.h index 25abf505..d8321b9d 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -492,7 +492,8 @@ typedef enum { meta_PS2_MTAF, /* Metal Gear 3 MTAF */ meta_PS3_CPS, /* Eternal Sonata (PS3) */ meta_PS3_MSF, /* MSF header */ - meta_NUB_VAG /* VAG from Nub archives */ + meta_NUB_VAG, /* VAG from Nub archives */ + meta_PS3_PAST, /* Bakugan Battle Brawlers (PS3) */ } meta_t; typedef struct { diff --git a/unix/data.c b/unix/data.c index e073cb7d..92c51da0 100644 --- a/unix/data.c +++ b/unix/data.c @@ -125,6 +125,7 @@ gchar *vgmstream_exts [] = { "mpdsp", "mpds", "msa", + "msf", "mss", "msvp", "mus", @@ -142,6 +143,7 @@ gchar *vgmstream_exts [] = { "p2bt", "p3d", + "past", "pcm", "pdt", "pnb", diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index b4ed45e5..8418af2a 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -209,6 +209,7 @@ char * extension_list[] = { "p2bt\0P2BT Audio File (*.P2BT)\0", "p3d\0P3D Audio File (*.P3D)\0", + "past\0PAST Audio File (*.PAST)\0", "pcm\0PCM Audio File (*.PCM)\0", "pdt\0PDT Audio File (*.PDT)\0", "pnb\0PNB Audio File (*.PNB)\0",