From 28f48968186756dddcae54055b4ee76336e0f694 Mon Sep 17 00:00:00 2001 From: bnnm Date: Fri, 21 Dec 2018 22:38:48 +0100 Subject: [PATCH] Fix stereo .vs [All Star Pro-Wrestling 2/3 (PS2)] --- src/layout/blocked_vs_ffx.c | 2 +- src/meta/vs_ffx.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/layout/blocked_vs_ffx.c b/src/layout/blocked_vs_ffx.c index d7a924a1..42885b4b 100644 --- a/src/layout/blocked_vs_ffx.c +++ b/src/layout/blocked_vs_ffx.c @@ -8,7 +8,7 @@ void block_update_vs_ffx(off_t block_offset, VGMSTREAM * vgmstream) { vgmstream->current_block_offset = block_offset; vgmstream->current_block_size = block_size - 0x20; - vgmstream->next_block_offset = block_offset + block_size; + vgmstream->next_block_offset = block_offset + block_size*vgmstream->channels; /* 0x08: number of remaning blocks, 0x0c: blocks left */ for (i = 0; i < vgmstream->channels; i++) { diff --git a/src/meta/vs_ffx.c b/src/meta/vs_ffx.c index b06548ef..fbac7218 100644 --- a/src/meta/vs_ffx.c +++ b/src/meta/vs_ffx.c @@ -3,10 +3,10 @@ #include "../coding/coding.h" -/* VS - VagStream from Square games [Final Fantasy X (PS2) voices, Unlimited Saga (PS2) voices] */ +/* VS - VagStream from Square games [Final Fantasy X (PS2) voices, Unlimited Saga (PS2) voices, All Star Pro-Wrestling 2/3 (PS2) music] */ VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; - int channel_count, loop_flag, pitch; + int channel_count, loop_flag, pitch, flags; off_t start_offset; @@ -17,7 +17,7 @@ VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE *streamFile) { if (read_32bitBE(0x00,streamFile) != 0x56530000) /* "VS\0\0" */ goto fail; - /* 0x04: null (flags? used in SVS) */ + flags = read_32bitLE(0x04,streamFile); /* 0x08: block number */ /* 0x0c: blocks left in the subfile */ pitch = read_32bitLE(0x10,streamFile); /* usually 0x1000 = 48000 */ @@ -25,8 +25,13 @@ VGMSTREAM * init_vgmstream_vs_ffx(STREAMFILE *streamFile) { /* 0x18: null */ /* 0x1c: null */ + if (flags != 0x00 && flags != 0x01) { + VGM_LOG("VS: unknown flags\n"); + goto fail; + } + loop_flag = 0; - channel_count = 1; + channel_count = (flags & 1) ? 2 : 1; start_offset = 0x00;