Update PS2 AST to handle additional variation from Binchou-Tan: Shiawasegoyomi.

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@791 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
snakemeat 2010-05-05 02:39:47 +00:00
parent f3135b8bc7
commit ff39f10738

View File

@ -9,6 +9,7 @@ VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE *streamFile) {
int loop_flag = 0;
int channel_count;
int variant_type;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
@ -18,6 +19,17 @@ VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE *streamFile) {
if (read_32bitBE(0x00,streamFile) != 0x41535400) /* "AST\0" */
goto fail;
/* determine variant */
if (read_32bitBE(0x10,streamFile) == 0)
{
variant_type = 1;
}
else
{
variant_type = 2;
}
loop_flag = 0;
channel_count = 2;
@ -26,19 +38,36 @@ VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE *streamFile) {
if (!vgmstream) goto fail;
/* fill in the vital statistics */
if (variant_type == 1)
{
start_offset = 0x800;
channel_count = 2;
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->sample_rate = read_32bitLE(0x04,streamFile);
vgmstream->num_samples = (read_32bitLE(0x0C,streamFile)-start_offset)*28/16/channel_count;
vgmstream->interleave_block_size = read_32bitLE(0x08,streamFile);
loop_flag = 1;
}
else if (variant_type == 2)
{
start_offset = 0x100;
channel_count = read_32bitLE(0x0C,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->num_samples = (read_32bitLE(0x04,streamFile)-start_offset)*28/16/channel_count;
vgmstream->interleave_block_size = read_32bitLE(0x10,streamFile);
}
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;
vgmstream->coding_type = coding_PSX;
vgmstream->meta_type = meta_PS2_AST;
/* open the file for reading */
{