From 6de04c14bd2c3fb5138d000ba1644c38d26182b7 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 18 Jul 2021 23:07:03 +0200 Subject: [PATCH] Fix some ATRAC9 .wem [DmC: Definitive Edition (PS4)] --- src/meta/wwise.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/meta/wwise.c b/src/meta/wwise.c index 77df05f3..88b69899 100644 --- a/src/meta/wwise.c +++ b/src/meta/wwise.c @@ -603,9 +603,9 @@ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) { if (ww.fmt_size != 0x18) goto fail; if (ww.big_endian) goto fail; - /* extra_data (size 0x06) + /* extra data (size 0x06) * 0x00: samples per block (0x1c) - * 0x04: channel config (again?) */ + * 0x02: channel config (again?) */ vgmstream->coding_type = coding_HEVAG; vgmstream->layout_type = layout_interleave; @@ -621,9 +621,19 @@ VGMSTREAM* init_vgmstream_wwise(STREAMFILE* sf) { if (ww.fmt_size != 0x24) goto fail; if (ww.extra_size != 0x12) goto fail; + /* extra data + * 0x00: samples per subframe? + * 0x02: channel config (again?) + * 0x06: config + * 0x0a: samples + * 0x0e: encoder delay? (same as samples per subframe?) + * 0x10: decoder delay? (PS4 only, 0 on Vita?) */ + cfg.channels = ww.channels; cfg.config_data = read_u32be(ww.fmt_offset + 0x18,sf); - cfg.encoder_delay = read_u32(ww.fmt_offset + 0x20,sf); + cfg.encoder_delay = read_u16(ww.fmt_offset + 0x20,sf); + /* PS4 value at 0x22 looks like encoder delay, but using it removes too many + * samples [DmC: Definitive Edition (PS4)] */ vgmstream->codec_data = init_atrac9(&cfg); if (!vgmstream->codec_data) goto fail;