Fix truncated .wem with PTADPCM

This commit is contained in:
bnnm 2020-08-15 20:04:59 +02:00
parent f5a9e5d06a
commit a33c63d8a0

View File

@ -225,8 +225,9 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE* sf) {
goto fail;
}
if (ww.codec == PCM || ww.codec == IMA || ww.codec == DSP || ww.codec == VORBIS || ww.codec == XMA2 || ww.codec == OPUSNX || ww.codec == OPUS) {
ww.truncated = 1; /* only seen those, probably all exist */
if (ww.codec == PCM || ww.codec == IMA || ww.codec == VORBIS || ww.codec == DSP || ww.codec == XMA2 ||
ww.codec == OPUSNX || ww.codec == OPUS || ww.codec == PTADPCM) {
ww.truncated = 1; /* only seen those, probably all exist (XWMA, AAC, HEVAG, ATRAC9?) */
} else {
VGM_LOG("WWISE: wrong size, maybe truncated\n");
goto fail;
@ -679,6 +680,10 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE* sf) {
vgmstream->interleave_block_size = ww.block_align / ww.channels;
//vgmstream->codec_endian = ww.big_endian; //?
if (ww.truncated) {
ww.data_size = ww.file_size - ww.data_offset;
}
vgmstream->num_samples = ptadpcm_bytes_to_samples(ww.data_size, ww.channels, vgmstream->interleave_block_size);
break;