Validate Konami Svag vs bad rips

This commit is contained in:
bnnm 2020-02-22 10:17:01 +01:00
parent bc46f0a13b
commit c914608c5d

View File

@ -1,7 +1,7 @@
#include "meta.h"
#include "../coding/coding.h"
/* SVAG - from Konami Tokyo games [OZ (PS2), Neo Contra (PS2)]] */
/* SVAG - from Konami Tokyo games [OZ (PS2), Neo Contra (PS2), Silent Hill 2 (PS2)] */
VGMSTREAM * init_vgmstream_ps2_svag(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
@ -12,14 +12,17 @@ VGMSTREAM * init_vgmstream_ps2_svag(STREAMFILE *streamFile) {
/* checks */
if (!check_extensions(streamFile, "svag"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x53766167) /* "Svag" */
goto fail;
channel_count = read_16bitLE(0x0C,streamFile); /* always 2? ("S"tereo vag?) */
loop_flag = (read_32bitLE(0x14,streamFile)==1);
start_offset = 0x800; /* header repeated at 0x400 too */
/* header repeated at 0x400 presumably for stereo */
if (channel_count > 1 && read_32bitBE(0x400,streamFile) != 0x53766167) /* "Svag" */
goto fail;
start_offset = 0x800;
data_size = read_32bitLE(0x04,streamFile);