mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-13 18:20:50 +01:00
support for PS2 SNK SVAG
This commit is contained in:
parent
f1b0b0ea82
commit
b5a9db8ae2
@ -302,7 +302,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/g1l.o \
|
||||
meta/mca.o \
|
||||
meta/btsnd.o \
|
||||
meta/hca.o
|
||||
meta/hca.o \
|
||||
meta/ps2_svag_snk.o
|
||||
|
||||
EXT_LIBS = ../ext_libs/clHCA.o
|
||||
|
||||
|
@ -245,5 +245,6 @@ libmeta_la_SOURCES += ps2_vbk.c
|
||||
libmeta_la_SOURCES += mca.c
|
||||
libmeta_la_SOURCES += btsnd.c
|
||||
libmeta_la_SOURCES += hca.c
|
||||
libmeta_la_SOURCES += ps2_svag_snk.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -661,4 +661,6 @@ VGMSTREAM * init_vgmstream_mca(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_btsnd(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
78
src/meta/ps2_svag_snk.c
Normal file
78
src/meta/ps2_svag_snk.c
Normal file
@ -0,0 +1,78 @@
|
||||
#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.
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
/* 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)
|
||||
goto fail;
|
||||
|
||||
|
||||
int sample_rate = read_32bitLE(0x08,streamFile);
|
||||
int channel_count = read_32bitLE(0x0c,streamFile);
|
||||
int blocks = read_32bitLE(0x10,streamFile);
|
||||
/* int unk = read_32bitLE(0x14,streamFile);*/ /* always 0 */
|
||||
int loop_start_block = read_32bitLE(0x18,streamFile);
|
||||
int loop_end_block = read_32bitLE(0x1c,streamFile);
|
||||
|
||||
int loop_flag = loop_end_block > 0; /* loop_start_black can be 0 */
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
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->channels = channel_count;
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
vgmstream->num_samples = blocks * 28;
|
||||
if( vgmstream->loop_flag ) {
|
||||
vgmstream->loop_start_sample = loop_start_block * 28;
|
||||
vgmstream->loop_end_sample = loop_end_block * 28;
|
||||
}
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
|
||||
|
||||
int start_offset = 0x20;
|
||||
/* 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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -339,6 +339,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_3ds_idsp,
|
||||
init_vgmstream_g1l,
|
||||
init_vgmstream_hca,
|
||||
init_vgmstream_ps2_svag_snk,
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
init_vgmstream_ffmpeg,
|
||||
#endif
|
||||
@ -3293,6 +3294,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_HCA:
|
||||
snprintf(temp, TEMPSIZE,"CRI MiddleWare HCA Header");
|
||||
break;
|
||||
case meta_PS2_SVAG_SNK:
|
||||
snprintf(temp,TEMPSIZE,"SNK SVAG header");
|
||||
break;
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
case meta_FFmpeg:
|
||||
snprintf(temp, TEMPSIZE,"FFmpeg supported file format");
|
||||
|
@ -594,7 +594,8 @@ typedef enum {
|
||||
meta_G1L, // Tecmo Koei G1L
|
||||
meta_MCA, // Capcom MCA "MADP"
|
||||
meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX
|
||||
meta_HCA,
|
||||
meta_HCA, /* CRI HCA */
|
||||
meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */
|
||||
#ifdef VGM_USE_FFMPEG
|
||||
meta_FFmpeg,
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user