diff --git a/src/Makefile b/src/Makefile index c55d751d..19ef78eb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -222,7 +222,8 @@ META_OBJS=meta/adx_header.o \ meta/ps2_ast.o \ meta/dmsg_segh.o \ meta/ngc_aaap.o \ - meta/ngc_dsp_tmnt2.o + meta/ngc_dsp_tmnt2.o \ + meta/ps2_ster.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 68fd3e0b..5ef7f695 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1,7 +1,7 @@  + + diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index 9da0bd99..aeb39395 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -180,5 +180,6 @@ libmeta_la_SOURCES += ps2_ast.c libmeta_la_SOURCES += dmsg_segh.c libmeta_la_SOURCES += ngc_aaap.c libmeta_la_SOURCES += ngc_dsp_tmnt2.c +libmeta_la_SOURCES += ps2_ster.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index 978f7619..0a91ae9e 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -445,4 +445,6 @@ VGMSTREAM * init_vgmstream_ngc_aaap(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_ngc_dsp_tmnt2(STREAMFILE* streamFile); +VGMSTREAM * init_vgmstream_ps2_ster(STREAMFILE* streamFile); + #endif diff --git a/src/meta/ps2_ster.c b/src/meta/ps2_ster.c new file mode 100644 index 00000000..0e6a39ba --- /dev/null +++ b/src/meta/ps2_ster.c @@ -0,0 +1,66 @@ +#include "meta.h" +#include "../util.h" + +/* STER (from Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka) */ +VGMSTREAM * init_vgmstream_ps2_ster(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("ster",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x53544552) /* "STER" */ + goto fail; + + + loop_flag = (read_16bitLE(0xB,streamFile)==0); + 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_PSX; + vgmstream->num_samples = read_32bitLE(0x4,streamFile)*56/32; + if (loop_flag) { + vgmstream->loop_start_sample = read_32bitLE(0x8,streamFile)*28/32; + vgmstream->loop_end_sample = vgmstream->num_samples; + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x10; + vgmstream->meta_type = meta_PS2_STER; + + /* 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 b812486b..a5a07e13 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -243,6 +243,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_dmsg, init_vgmstream_ngc_aaap, init_vgmstream_ngc_dsp_tmnt2, + init_vgmstream_ps2_ster, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) @@ -2403,6 +2404,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_NGC_DSP_TMNT2: snprintf(temp,TEMPSIZE,"TMNT2 dsp header"); break; + case meta_PS2_STER: + snprintf(temp,TEMPSIZE,"STER Header"); + break; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); } diff --git a/src/vgmstream.h b/src/vgmstream.h index bd2dba97..fa10220d 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -432,6 +432,7 @@ typedef enum { meta_PS2_AST, /* Some KOEI game (PS2) */ meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ meta_NGC_AAAP, /* Turok: Evolution (NGC) */ + meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */ } meta_t; typedef struct { diff --git a/unix/data.c b/unix/data.c index d17f6573..646de1e1 100644 --- a/unix/data.c +++ b/unix/data.c @@ -172,6 +172,7 @@ gchar *vgmstream_exts [] = { "ss3", "ss7" "ssm", + "ster", "stma", "str", "strm", diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 4d03b4c1..57c858d9 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -240,6 +240,7 @@ char * extension_list[] = { "ss3\0SS3 Audio File (*.SS3)\0", "ss7\0SS7 Audio File (*.SS7)\0", "ssm\0SSM Audio File (*.SSM)\0", + "ster\0STER Audio File (*.STER)\0", "stma\0STMA Audio File (*.STMA)\0", "str\0STR Audio File (*.STR)\0", "strm\0STRM Audio File (*.STRM)\0",