From 21c386bc5630a1d684da495533f317b64594861f Mon Sep 17 00:00:00 2001 From: halleyscometsw Date: Fri, 7 Nov 2008 01:26:25 +0000 Subject: [PATCH] fix loop detection for bgw git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@464 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/meta/bgw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/meta/bgw.c b/src/meta/bgw.c index 77e1186b..a5da15e9 100644 --- a/src/meta/bgw.c +++ b/src/meta/bgw.c @@ -6,6 +6,7 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; + int32_t loop_start; int loop_flag = 0; int channel_count; @@ -25,7 +26,8 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) { goto fail; channel_count = 2; - loop_flag = read_32bitLE(0x1c,streamFile) != 0; + loop_start = read_32bitLE(0x1c,streamFile); + loop_flag = (loop_start > 0); /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); @@ -38,7 +40,7 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) { vgmstream->coding_type = coding_FFXI; vgmstream->num_samples = read_32bitLE(0x18,streamFile)*16; if (loop_flag) { - vgmstream->loop_start_sample = (read_32bitLE(0x1c,streamFile)-1)*16; + vgmstream->loop_start_sample = (loop_start-1)*16; vgmstream->loop_end_sample = vgmstream->num_samples; }