From 317600fb3aa1bfd69d88c0940e4fea4a1cc69197 Mon Sep 17 00:00:00 2001 From: manakoAT Date: Tue, 11 Nov 2008 10:02:52 +0000 Subject: [PATCH] .ass added - Dai Senryaku VII - Exceed (PS2) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@468 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/Makefile | 3 +- src/libvgmstream.vcproj | 4 +++ src/meta/Makefile.unix.am | 1 + src/meta/meta.h | 2 ++ src/meta/ps2_ass.c | 67 +++++++++++++++++++++++++++++++++++++++ src/vgmstream.c | 4 +++ src/vgmstream.h | 2 ++ winamp/in_vgmstream.c | 1 + 8 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 src/meta/ps2_ass.c diff --git a/src/Makefile b/src/Makefile index a27cad25..d96ac56d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -143,7 +143,8 @@ META_OBJS=meta/adx_header.o \ meta/wii_mus.o \ meta/dc_asd.o \ meta/naomi_spsd.o \ - meta/bgw.o + meta/bgw.o \ + meta/ps2_ass.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 cbcb6d53..caf9ffb6 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -389,6 +389,10 @@ RelativePath=".\meta\ps2_ads.c" > + + diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index ffa09451..36af376c 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -112,4 +112,5 @@ libmeta_la_SOURCES += wii_mus.c libmeta_la_SOURCES += dc_asd.c libmeta_la_SOURCES += naomi_spsd.c libmeta_la_SOURCES += bgw.c +libmeta_la_SOURCES += ps2_ass.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index 3dc95a3a..d88e5a5a 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -267,4 +267,6 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_spw(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_ps2_ass(STREAMFILE * streamFile); + #endif diff --git a/src/meta/ps2_ass.c b/src/meta/ps2_ass.c new file mode 100644 index 00000000..242a27c4 --- /dev/null +++ b/src/meta/ps2_ass.c @@ -0,0 +1,67 @@ +#include "meta.h" +#include "../util.h" + +/* SVS (from Dai Senryaku VII - Exceed) */ + +VGMSTREAM * init_vgmstream_ps2_ass(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("ass",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x02000000) /* "00000000" */ + goto fail; + + loop_flag = 1; + channel_count = 2; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x800; + vgmstream->channels = channel_count; + vgmstream->sample_rate = read_32bitLE(0x04,streamFile); + vgmstream->coding_type = coding_PSX; + vgmstream->num_samples = (read_32bitLE(0x08,streamFile)*2)*28/16/channel_count; + + if(loop_flag) { + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample=(read_32bitLE(0x08,streamFile)*2)*28/16/channel_count; + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile); + vgmstream->meta_type = meta_PS2_ASS; + + /* 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 499cf645..f09e9458 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -150,6 +150,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_rsd6xadp, init_vgmstream_bgw, init_vgmstream_spw, + init_vgmstream_ps2_ass, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) @@ -1785,6 +1786,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_FFXI_SPW: snprintf(temp,TEMPSIZE,"SPW SeWave header"); break; + case meta_PS2_ASS: + snprintf(temp,TEMPSIZE,"ASS header"); + break; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); } diff --git a/src/vgmstream.h b/src/vgmstream.h index 871c980c..315e98f1 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -257,6 +257,8 @@ typedef enum { meta_RSD6WADP, /* RSD6WADP */ meta_RSD6XADP, /* RSD6XADP */ + meta_PS2_ASS, /* RSD6XADP */ + meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_WVS, /* XBOX WVS */ diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 2dc6b92e..6eaf56a9 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -194,6 +194,7 @@ char * extension_list[] = { "spsd\0SPSD Audio File (*.SPSD)\0", "bgw\0BGW Audio File (*.BGW)\0", "spw\0SPW Audio File (*.SPW)\0", + "ass\0ASS Audio File (*.ASS)\0", }; void about(HWND hwndParent) {