mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-31 04:13:47 +01:00
Clean SNK SVAG
This commit is contained in:
parent
a4331eb04e
commit
7f0f1ef9b0
@ -1154,7 +1154,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_MCA, "Capcom MCA header"},
|
||||
{meta_XB3D_ADX, "Xenoblade 3D ADX header"},
|
||||
{meta_HCA, "CRI HCA header"},
|
||||
{meta_PS2_SVAG_SNK, "SNK SVAG header"},
|
||||
{meta_SVAG_SNK, "SNK SVAG header"},
|
||||
{meta_PS2_VDS_VDM, "Procyon Studio VDS/VDM header"},
|
||||
{meta_FFMPEG, "FFmpeg supported file format"},
|
||||
{meta_X360_CXS, "tri-Crescendo CXS header"},
|
||||
|
@ -565,7 +565,7 @@ VGMSTREAM * init_vgmstream_mca(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_btsnd(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile);
|
||||
VGMSTREAM * init_vgmstream_svag_snk(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_xma(STREAMFILE* streamFile);
|
||||
|
||||
|
@ -1,80 +1,46 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* PS2 SVAG (SNK)
|
||||
*
|
||||
* Found in SNK's World Heroes Anthology and Fatal Fury Battle Archives 2, maybe others
|
||||
* No relation with Konami's SVAG.
|
||||
*/
|
||||
/* .SVAG - from SNK games [World Heroes Anthology (PS2), Fatal Fury Battle Archives 2 (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_svag_snk(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
off_t start_offset;
|
||||
int loop_flag, channel_count, loop_start_block, loop_end_block;
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
off_t start_offset = 0x20;
|
||||
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
int loop_start_block;
|
||||
int loop_end_block;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("svag",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check SNK SVAG Header ("VAGm") */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x5641476D)
|
||||
/* checks */
|
||||
if (!check_extensions(sf, "svag"))
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,sf) != 0x5641476D) /* "VAGm" */
|
||||
goto fail;
|
||||
|
||||
|
||||
channel_count = read_32bitLE(0x0c,streamFile);
|
||||
|
||||
loop_start_block = read_32bitLE(0x18,streamFile);
|
||||
loop_end_block = read_32bitLE(0x1c,streamFile);
|
||||
|
||||
channel_count = read_32bitLE(0x0c,sf);
|
||||
loop_start_block = read_32bitLE(0x18,sf);
|
||||
loop_end_block = read_32bitLE(0x1c,sf);
|
||||
loop_flag = loop_end_block > 0; /* loop_start_block can be 0 */
|
||||
start_offset = 0x20;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
vgmstream = allocate_vgmstream(channel_count, loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* header data */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->meta_type = meta_PS2_SVAG_SNK;
|
||||
vgmstream->meta_type = meta_SVAG_SNK;
|
||||
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
|
||||
vgmstream->num_samples = read_32bitLE(0x10,streamFile) * 28; /* size in blocks */
|
||||
if( vgmstream->loop_flag ) {
|
||||
vgmstream->loop_start_sample = loop_start_block * 28;
|
||||
vgmstream->loop_end_sample = loop_end_block * 28;
|
||||
}
|
||||
vgmstream->sample_rate = read_32bitLE(0x08,sf);
|
||||
vgmstream->num_samples = read_32bitLE(0x10,sf) * 28; /* size in blocks */
|
||||
vgmstream->loop_start_sample = loop_start_block * 28;
|
||||
vgmstream->loop_end_sample = loop_end_block * 28;
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset =
|
||||
vgmstream->ch[i].offset =
|
||||
start_offset + vgmstream->interleave_block_size*i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
||||
goto fail;
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_kt_wiibgm,
|
||||
init_vgmstream_ktss,
|
||||
init_vgmstream_hca,
|
||||
init_vgmstream_ps2_svag_snk,
|
||||
init_vgmstream_svag_snk,
|
||||
init_vgmstream_ps2_vds_vdm,
|
||||
init_vgmstream_x360_cxs,
|
||||
init_vgmstream_dsp_adx,
|
||||
|
@ -587,7 +587,7 @@ typedef enum {
|
||||
meta_MCA, /* Capcom MCA "MADP" */
|
||||
meta_XB3D_ADX, /* Xenoblade Chronicles 3D ADX */
|
||||
meta_HCA, /* CRI HCA */
|
||||
meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */
|
||||
meta_SVAG_SNK,
|
||||
meta_PS2_VDS_VDM, /* Graffiti Kingdom */
|
||||
meta_FFMPEG, /* any file supported by FFmpeg */
|
||||
meta_X360_CXS, /* Eternal Sonata (Xbox 360) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user