Fix inconsistent PSX channel padding [Gitaroo Man (PS2)]

This commit is contained in:
bnnm 2019-03-24 03:21:05 +01:00
parent 9ac36892f6
commit 9e9417b916
2 changed files with 8 additions and 13 deletions

View File

@ -282,7 +282,12 @@ size_t ps_find_padding(STREAMFILE *streamFile, off_t start_offset, size_t data_s
return 0;
offset = start_offset + data_size;
min_offset = 0; //offset - interleave; /* some files have padding spanning multiple interleave blocks */
/* in rare cases (ex. Gitaroo Man) channels have inconsistent empty padding, use first as guide */
offset = offset - interleave * (channels - 1);
/* some files have padding spanning multiple interleave blocks */
min_offset = start_offset; //offset - interleave;
while (offset > min_offset) {
uint32_t f1,f2,f3,f4;

View File

@ -29,19 +29,9 @@ VGMSTREAM * init_vgmstream_imc(STREAMFILE *streamFile) {
if (interleave*blocks + start_offset != file_size)
goto fail;
/* remove padding (important to play gapless subsongs, happens even for mono) */
{
off_t min_offset = file_size - interleave;
off_t offset = file_size - 0x10;
data_size = file_size - start_offset;
data_size -= ps_find_padding(streamFile, start_offset, data_size, channel_count, interleave, 0);
data_size = file_size - start_offset;
while (offset > min_offset) {
if (read_32bitLE(offset, streamFile) != 0)
break;
data_size -= 0x10*channel_count;
offset -= 0x10;
}
}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);