Added PS2 VDS/VDM [Graffiti Kingdom]

This commit is contained in:
bnnm 2017-01-08 12:59:04 +01:00
parent 4e6ce8747d
commit 01981a6686
10 changed files with 66 additions and 1 deletions

View File

@ -307,7 +307,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_svag_snk.o \
meta/ffmpeg.o \
meta/mp4.o \
meta/xma.o
meta/xma.o \
meta/ps2.o
EXT_LIBS = ../ext_libs/clHCA.o

View File

@ -808,6 +808,7 @@ static const meta_info meta_info_list[] = {
{meta_XB3D_ADX, "Xenoblade 3D ADX Header"},
{meta_HCA, "CRI MiddleWare HCA Header"},
{meta_PS2_SVAG_SNK, "SNK SVAG header"},
{meta_PS2_VDS_VDM, "Graffiti Kingdom VDS/VDM Header"},
#ifdef VGM_USE_VORBIS
{meta_OGG_VORBIS, "Ogg Vorbis"},
{meta_OGG_SLI, "Ogg Vorbis with .sli (start,length) for looping"},

View File

@ -646,6 +646,10 @@
RelativePath=".\meta\pos.c"
>
</File>
<File
RelativePath=".\meta\ps2.c"
>
</File>
<File
RelativePath=".\meta\ps2_2pfs.c"
>

View File

@ -240,6 +240,7 @@
<ClCompile Include="meta\pcm.c" />
<ClCompile Include="meta\pona.c" />
<ClCompile Include="meta\pos.c" />
<ClCompile Include="meta\ps2.c" />
<ClCompile Include="meta\ps2_adm.c" />
<ClCompile Include="meta\ps2_ads.c" />
<ClCompile Include="meta\ps2_adsc.c" />

View File

@ -373,6 +373,9 @@
<ClCompile Include="meta\pos.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\ps2_adm.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -248,5 +248,6 @@ libmeta_la_SOURCES += hca.c
libmeta_la_SOURCES += ps2_svag_snk.c
libmeta_la_SOURCES += mp4.c
libmeta_la_SOURCES += xma.c
libmeta_la_SOURCES += ps2.c
EXTRA_DIST = meta.h

View File

@ -663,4 +663,6 @@ VGMSTREAM * init_vgmstream_ps2_svag_snk(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_xma(STREAMFILE* streamFile);
#endif
VGMSTREAM * init_vgmstream_ps2_vds_vdm(STREAMFILE* streamFile);
#endif

50
src/meta/ps2.c Normal file
View File

@ -0,0 +1,50 @@
#include "meta.h"
#include "../util.h"
#include "../header.h"
/* VDS/VDM - from Grafitti Kingdom / Rakugaki Oukoku 2 */
VGMSTREAM * init_vgmstream_ps2_vds_vdm(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* check extension, case insensitive */
if ( !header_check_extensions(streamFile,"vds,vdm"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x56445320 && /* "VDS " (music)*/
read_32bitBE(0x00,streamFile) != 0x56444D20) /* "VDM " (voices) */
goto fail;
loop_flag = read_8bit(0x20,streamFile);
channel_count = read_32bitLE(0x10,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = channel_count > 1 ? layout_interleave : layout_none;
vgmstream->meta_type = meta_PS2_VDS_VDM;
start_offset = 0x800;
vgmstream->num_samples = read_32bitLE(0x04,streamFile) * 28 / 16 / channel_count;
/* 0x08: unknown, always 10 */
vgmstream->sample_rate = read_32bitLE(0x0c,streamFile);
vgmstream->channels = channel_count; /*0x10*/
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile) - start_offset) * 28 / 16 / channel_count;
vgmstream->loop_end_sample = (read_32bitLE(0x1c,streamFile) - start_offset) * 28 / 16 / channel_count;
vgmstream->loop_flag = loop_flag; /*0x20*/
/*0x21: volume? */
/*0x22: pan? */
/*0x23: 02=VDS 04=VDM? */
/* open the file for reading */
if ( !header_open_stream(vgmstream, streamFile, start_offset) )
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -334,6 +334,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_g1l,
init_vgmstream_hca,
init_vgmstream_ps2_svag_snk,
init_vgmstream_ps2_vds_vdm,
#ifdef VGM_USE_FFMPEG
init_vgmstream_xma,
init_vgmstream_mp4_aac_ffmpeg,

View File

@ -587,6 +587,7 @@ typedef enum {
meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX
meta_HCA, /* CRI HCA */
meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */
meta_PS2_VDS_VDM, /* Graffiti Kingdom */
#ifdef VGM_USE_VORBIS
meta_OGG_VORBIS, /* ogg vorbis */