fixed broken playback in Dreamcast STR

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@561 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2009-01-12 21:38:23 +00:00
parent cfae8db6d8
commit 2ed34544e0

View File

@ -7,6 +7,7 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
char filename[260];
off_t start_offset;
int loop_flag = 0;
int interleave;
int channel_count;
int samples;
int i;
@ -19,29 +20,21 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
if (read_32bitBE(0xD5,streamFile) != 0x53656761) /* "Sega" */
goto fail;
loop_flag = (read_32bitLE(0x00,streamFile)!=0x00000000);
samples=read_32bitLE(0x08,streamFile);
channel_count = 2;
interleave = read_32bitLE(0xC,streamFile);
if ((get_streamfile_size(streamFile)-0x800) != (read_32bitLE(0x10,streamFile) *
((read_32bitLE(0x0,streamFile)*(read_32bitLE(0x18,streamFile))))*interleave))
goto fail;
loop_flag = 0; /* (read_32bitLE(0x00,streamFile)!=0x00000000); */
samples = read_32bitLE(0x08,streamFile);
channel_count = (read_32bitLE(0x0,streamFile))*(read_32bitLE(0x18,streamFile));
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
switch (read_32bitLE(0x00,streamFile)) {
case 1:
channel_count = 2;
break;
case 2:
channel_count = 2;
break;
case 3:
channel_count = 6;
break;
default:
goto fail;
}
switch (samples) {
case 4:
vgmstream->coding_type = coding_AICA;
@ -62,11 +55,19 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
default:
goto fail;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile);
vgmstream->channels = channel_count;
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
if (vgmstream->channels == 1) {
vgmstream->layout_type = layout_none;
} else if (vgmstream->channels > 1) {
vgmstream->interleave_block_size = interleave;
vgmstream->layout_type = layout_interleave;
}
vgmstream->meta_type = meta_DC_STR;
/* open the file for reading */
@ -78,7 +79,7 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;