fix ea psx coding

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@278 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2008-07-03 19:09:53 +00:00
parent fd4f7a9eec
commit 183089bfcb
2 changed files with 10 additions and 6 deletions

View File

@ -27,22 +27,24 @@ void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
vgmstream->ch[i].offset=read_32bitBE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels); vgmstream->ch[i].offset=read_32bitBE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels);
vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C; vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C;
} }
vgmstream->current_block_size /= 28;
} else { } else {
if(vgmstream->coding_type==coding_PSX) { if(vgmstream->coding_type==coding_PSX) {
vgmstream->ch[0].offset=vgmstream->current_block_offset+0x10; vgmstream->ch[0].offset=vgmstream->current_block_offset+0x10;
vgmstream->ch[1].offset=(read_32bitLE(block_offset+0x04,vgmstream->ch[0].streamfile)-0x10)/2; vgmstream->ch[1].offset=(read_32bitLE(block_offset+0x04,vgmstream->ch[0].streamfile)-0x10)/vgmstream->channels;
vgmstream->ch[1].offset+=vgmstream->ch[0].offset; vgmstream->ch[1].offset+=vgmstream->ch[0].offset;
vgmstream->current_block_size=read_32bitLE(block_offset+0x0C,vgmstream->ch[0].streamfile)*0x10; vgmstream->current_block_size=read_32bitLE(block_offset+0x04,vgmstream->ch[0].streamfile)-0x10;
vgmstream->current_block_size/=vgmstream->channels;
} else { } else {
vgmstream->current_block_size = read_32bitLE(block_offset+8,vgmstream->ch[0].streamfile); vgmstream->current_block_size = read_32bitLE(block_offset+8,vgmstream->ch[0].streamfile);
for(i=0;i<vgmstream->channels;i++) { for(i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset=read_32bitLE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels); vgmstream->ch[i].offset=read_32bitLE(block_offset+0x0C+(i*4),vgmstream->ch[0].streamfile)+(4*vgmstream->channels);
vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C; vgmstream->ch[i].offset+=vgmstream->current_block_offset+0x0C;
} }
}
}
vgmstream->current_block_size /= 28; vgmstream->current_block_size /= 28;
}
}
if((vgmstream->ea_compression_version<3) && (vgmstream->coding_type!=coding_PSX)) { if((vgmstream->ea_compression_version<3) && (vgmstream->coding_type!=coding_PSX)) {
for(i=0;i<vgmstream->channels;i++) { for(i=0;i<vgmstream->channels;i++) {
@ -56,5 +58,4 @@ void ea_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
vgmstream->ch[i].offset+=4; vgmstream->ch[i].offset+=4;
} }
} }
} }

View File

@ -225,6 +225,9 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) {
do { do {
ea_block_update(vgmstream->next_block_offset,vgmstream); ea_block_update(vgmstream->next_block_offset,vgmstream);
if(vgmstream->coding_type==coding_PSX)
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size/16*28;
else
vgmstream->num_samples+=(int32_t)vgmstream->current_block_size*28; vgmstream->num_samples+=(int32_t)vgmstream->current_block_size*28;
} while(vgmstream->next_block_offset<(off_t)(file_length-block_length)); } while(vgmstream->next_block_offset<(off_t)(file_length-block_length));
} }