.ast (PS2) added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@729 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-01-26 17:57:49 +00:00
parent 8ddf6990c9
commit c9e9319cc1
8 changed files with 81 additions and 4 deletions

View File

@ -219,7 +219,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_stm.o \
meta/myspd.o \
meta/his.o \
meta/isws.o
meta/isws.o \
meta/ps2_ast.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -518,6 +518,10 @@
RelativePath=".\meta\ps2_ass.c"
>
</File>
<File
RelativePath=".\meta\ps2_ast.c"
>
</File>
<File
RelativePath=".\meta\ps2_aus.c"
>

View File

@ -177,5 +177,6 @@ libmeta_la_SOURCES += ps2_stm.c
libmeta_la_SOURCES += myspd.c
libmeta_la_SOURCES += his.c
libmeta_la_SOURCES += isws.c
libmeta_la_SOURCES += ps2_ast.c
EXTRA_DIST = meta.h

View File

@ -39,9 +39,8 @@ VGMSTREAM * init_vgmstream_isws(STREAMFILE *streamFile) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
// vgmstream->layout_type = layout_interleave;
vgmstream->layout_type = layout_interleave_shortblock;
vgmstream->interleave_block_size = read_32bitBE(0x10,streamFile);
vgmstream->interleave_smallblock_size = (((read_32bitBE(0x24,streamFile))-start_offset)%(vgmstream->channels*vgmstream->interleave_block_size))/vgmstream->channels;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0x10,streamFile);
}
vgmstream->meta_type = meta_ISWS;

View File

@ -435,4 +435,6 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_isws(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE* streamFile);
#endif

65
src/meta/ps2_ast.c Normal file
View File

@ -0,0 +1,65 @@
#include "meta.h"
#include "../util.h"
/* AST */
VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("ast",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x41535400) /* "AST\0" */
goto fail;
loop_flag = 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 = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (read_32bitLE(0x0C,streamFile)-start_offset)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (read_32bitLE(0x0C,streamFile)-start_offset)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x08,streamFile);
vgmstream->meta_type = meta_PS2_AST;
/* 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

@ -238,6 +238,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_myspd,
init_vgmstream_his,
init_vgmstream_isws,
init_vgmstream_ps2_ast,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2376,6 +2377,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_ISWS:
snprintf(temp,TEMPSIZE,"SEGA Superstars Tennis iSWS header");
break;
case meta_PS2_AST:
snprintf(temp,TEMPSIZE,"KOEI AST header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -426,6 +426,7 @@ typedef enum {
meta_PONA, /* Policenauts (3DO + PSX) */
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
meta_ISWS, /* SEGA Superstars Tennis (Wii) */
meta_PS2_AST, /* Some KOEI game (PS2) */
} meta_t;
typedef struct {