Add .STER support for Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka (PS2)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@756 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-03-16 02:34:18 +00:00
parent 1eb20e259f
commit c387c06dc3
9 changed files with 83 additions and 2 deletions

View File

@ -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)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream"
@ -666,6 +666,10 @@
RelativePath=".\meta\ps2_sps.c"
>
</File>
<File
RelativePath=".\meta\ps2_ster.c"
>
</File>
<File
RelativePath=".\meta\ps2_stm.c"
>

View File

@ -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

View File

@ -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

66
src/meta/ps2_ster.c Normal file
View File

@ -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;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

@ -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");
}

View File

@ -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 {

View File

@ -172,6 +172,7 @@ gchar *vgmstream_exts [] = {
"ss3",
"ss7"
"ssm",
"ster",
"stma",
"str",
"strm",

View File

@ -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",