From a33c63d8a0a10e9291aae2c12b4cc7131866def6 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 15 Aug 2020 20:04:59 +0200 Subject: [PATCH] Fix truncated .wem with PTADPCM --- src/meta/wwise.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/meta/wwise.c b/src/meta/wwise.c index 0a8a99ff..c545054a 100644 --- a/src/meta/wwise.c +++ b/src/meta/wwise.c @@ -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;