From a98780b0ebbd4e277aebbf51243214413ded2258 Mon Sep 17 00:00:00 2001 From: EdnessP <55930127+EdnessP@users.noreply.github.com> Date: Thu, 27 Jul 2023 21:28:30 +0300 Subject: [PATCH] VAG: Increase bigfile padding check to 2MiB --- src/meta/vag.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/meta/vag.c b/src/meta/vag.c index de61c195..791513fa 100644 --- a/src/meta/vag.c +++ b/src/meta/vag.c @@ -287,10 +287,10 @@ VGMSTREAM* init_vgmstream_vag(STREAMFILE* sf) { goto fail; } - /* ignore bad extractions (approximate) */ - /* bigfile ignoring breaks some of Jak series' VAGs (unless increased to roughly 1.4 MiB) */ - //if (channel_size * channels + interleave * channels + start_offset * channels + 0x80000 < get_streamfile_size(sf) || - if (channel_size * channels > get_streamfile_size(sf)) { + /* ignore bigfiles and bad extractions (approximate) */ + /* padding is set to 2 MiB to avoid breaking Jak series' VAGs */ + if (channel_size * channels + interleave * channels + start_offset * channels + 0x200000 < get_streamfile_size(sf) || + channel_size * channels > get_streamfile_size(sf)) { vgm_logi("VAG: wrong expected (incorrect extraction? %x * %i + %x + %x + ~ vs %x)\n", channel_size, channels, interleave * channels, start_offset * channels, (uint32_t)get_streamfile_size(sf)); goto fail;