From 607e7ef78bc946c06bb2f4e3e79fa2cefba2000a Mon Sep 17 00:00:00 2001 From: finict Date: Sat, 25 Jun 2022 13:22:45 +0900 Subject: [PATCH] Fix .2dx9 loop detection --- src/meta/2dx9.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/meta/2dx9.c b/src/meta/2dx9.c index be1ccc3d..8684eb8c 100644 --- a/src/meta/2dx9.c +++ b/src/meta/2dx9.c @@ -24,8 +24,8 @@ VGMSTREAM * init_vgmstream_2dx9(STREAMFILE *streamFile) { if (read_32bitBE(0x6a,streamFile) != 0x64617461) /* data */ goto fail; - /* IIDX 13 has a false flag for looping files. Konami, pls. */ - loop_flag = (read_16bitLE(0x0e,streamFile) > -1); + /* Some data loop from beginning to the end by hardcoded flag so cannot be recognized from sound file */ + loop_flag = (read_32bitLE(0x14,streamFile) > 0); channel_count = read_16bitLE(0x2e,streamFile); start_offset = 0x72; @@ -37,7 +37,7 @@ VGMSTREAM * init_vgmstream_2dx9(STREAMFILE *streamFile) { vgmstream->sample_rate = read_32bitLE(0x30,streamFile); vgmstream->num_samples = read_32bitLE(0x66,streamFile); if (loop_flag) { - vgmstream->loop_start_sample = 0; + vgmstream->loop_start_sample = read_32bitLE(0x14,streamFile) / 2 / channel_count; vgmstream->loop_end_sample = vgmstream->num_samples; }