Added CXS [Eternal Sonata (Xbox 360)]

This commit is contained in:
bnnm 2017-01-08 14:19:32 +01:00
parent 2ac72c1b0e
commit 2467f9afdc
10 changed files with 110 additions and 26 deletions

View File

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

View File

@ -72,6 +72,7 @@ static const char* extension_list[] = {
"ckd",
"cnk",
"cps",
"cxs",
"dcs",
"ddsp",
@ -419,10 +420,10 @@ static const coding_info coding_info_list[] = {
{coding_SASSC, "Activision / EXAKT SASSC 8-bit DPCM"},
{coding_LSF, "lsf 4-bit ADPCM"},
{coding_MTAF, "Konami MTAF 4-bit ADPCM"},
#ifdef VGM_USE_VORBIS
#ifdef VGM_USE_VORBIS
{coding_ogg_vorbis, "Vorbis"},
#endif
#ifdef VGM_USE_MPEG
#endif
#ifdef VGM_USE_MPEG
{coding_fake_MPEG2_L2, "MPEG-2 Layer II Audio"},
{coding_MPEG1_L1, "MPEG-1 Layer I Audio"},
{coding_MPEG1_L2, "MPEG-1 Layer II Audio"},
@ -433,20 +434,20 @@ static const coding_info coding_info_list[] = {
{coding_MPEG25_L1, "MPEG-2.5 Layer I Audio"},
{coding_MPEG25_L2, "MPEG-2.5 Layer II Audio"},
{coding_MPEG25_L3, "MPEG-2.5 Layer III Audio (MP3)"},
#endif
#ifdef VGM_USE_G7221
#endif
#ifdef VGM_USE_G7221
{coding_G7221, "ITU G.722.1 (Polycom Siren 7)"},
{coding_G7221C, "ITU G.722.1 annex C (Polycom Siren 14)"},
#endif
#ifdef VGM_USE_G719
#endif
#ifdef VGM_USE_G719
{coding_G719, "ITU G.719 annex B (Polycom Siren 22)"},
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
{coding_AT3plus "ATRAC3plus"},
#endif
#ifdef VGM_USE_FFMPEG
#endif
#ifdef VGM_USE_FFMPEG
{coding_FFmpeg, "FFmpeg"},
#endif
#endif
};
static const layout_info layout_info_list[] = {
@ -485,13 +486,13 @@ static const layout_info layout_info_list[] = {
{layout_aix, "AIX interleave, internally 18-byte interleaved"},
{layout_aax, "AAX blocked, 18-byte interleaved"},
{layout_scd_int, "SCD multistream interleave"},
#ifdef VGM_USE_VORBIS
#ifdef VGM_USE_VORBIS
{layout_ogg_vorbis, "Ogg"},
#endif
#ifdef VGM_USE_MPEG
#endif
#ifdef VGM_USE_MPEG
{layout_fake_mpeg, "MPEG Audio stream with incorrect frame headers"},
{layout_mpeg, "MPEG Audio stream"},
#endif
#endif
};
static const meta_info meta_info_list[] = {
@ -812,7 +813,8 @@ static const meta_info meta_info_list[] = {
{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_X360_CXS, "CXS Header"},
#ifdef VGM_USE_VORBIS
{meta_OGG_VORBIS, "Ogg Vorbis"},
{meta_OGG_SLI, "Ogg Vorbis with .sli (start,length) for looping"},
{meta_OGG_SLI2, "Ogg Vorbis with .sli (from,to) for looping"},
@ -821,15 +823,15 @@ static const meta_info meta_info_list[] = {
{meta_OGG_KOVS, "Ogg Vorbis, KOVS header"},
{meta_OGG_PSYCH, "Ogg Vorbis, Psychic Software obfuscation"},
#endif
#ifdef VGM_USE_MPEG
#ifdef VGM_USE_MPEG
{meta_AHX, "CRI AHX header"},
#endif
#ifdef VGM_USE_MP4V2
#endif
#ifdef VGM_USE_MP4V2
{meta_MP4, "AAC header"},
#endif
#ifdef VGM_USE_FFMPEG
#endif
#ifdef VGM_USE_FFMPEG
{meta_FFmpeg, "FFmpeg supported file format"},
#endif
#endif
};

View File

@ -1154,6 +1154,10 @@
RelativePath=".\meta\wvs.c"
>
</File>
<File
RelativePath=".\meta\x360.c"
>
</File>
<File
RelativePath=".\meta\x360_tra.c"
>

View File

@ -139,6 +139,7 @@
<ClCompile Include="meta\tun.c" />
<ClCompile Include="meta\wii_ras.c" />
<ClCompile Include="meta\wpd.c" />
<ClCompile Include="meta\x360.c" />
<ClCompile Include="meta\x360_tra.c" />
<ClCompile Include="formats.c" />
<ClCompile Include="header.c" />

View File

@ -1030,5 +1030,8 @@
<ClCompile Include="meta\xma.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\x360.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

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

View File

@ -665,4 +665,6 @@ VGMSTREAM * init_vgmstream_xma(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_vds_vdm(STREAMFILE* streamFile);
#endif
VGMSTREAM * init_vgmstream_x360_cxs(STREAMFILE* streamFile);
#endif /*_META_H*/

68
src/meta/x360.c Normal file
View File

@ -0,0 +1,68 @@
#include "meta.h"
#include "../header.h"
/* CXS - found in Eternal Sonata (Xbox 360) */
VGMSTREAM * init_vgmstream_x360_cxs(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* check extension, case insensitive */
if ( !header_check_extensions(streamFile,"cxs"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x43585320) /* "CXS " */
goto fail;
loop_flag = read_32bitBE(0x18,streamFile) > 0;
channel_count = read_32bitBE(0x0c,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
start_offset = read_32bitBE(0x04,streamFile) + read_32bitBE(0x28,streamFile); /* assumed, seek table always at 0x800 */
/* 0x04: data start? */
vgmstream->sample_rate = read_32bitBE(0x08,streamFile);
vgmstream->channels = channel_count; /*0x0c*/
vgmstream->num_samples = read_32bitBE(0x10,streamFile) + 576; /*todo add proper encoder_delay*/
vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile);
vgmstream->loop_end_sample = read_32bitBE(0x18,streamFile);
/* 0x1c: below */
vgmstream->meta_type = meta_X360_CXS;
vgmstream->layout_type = layout_none;
#ifdef VGM_USE_FFMPEG
{
ffmpeg_codec_data *ffmpeg_data = NULL;
uint8_t buf[100];
size_t bytes, datasize, block_size, block_count;
block_count = read_32bitBE(0x1c,streamFile);
block_size = read_32bitBE(0x20,streamFile);
datasize = read_32bitBE(0x24,streamFile);
/* make a fake riff so FFmpeg can parse the XMA2 */
bytes = header_make_riff_xma2(buf,100, vgmstream->num_samples, datasize, vgmstream->channels, vgmstream->sample_rate, block_count, block_size);
if (bytes <= 0)
goto fail;
ffmpeg_data = init_ffmpeg_header_offset(streamFile, buf,bytes, start_offset,datasize);
if ( !ffmpeg_data ) goto fail;
vgmstream->codec_data = ffmpeg_data;
vgmstream->coding_type = coding_FFmpeg;
}
#else
goto fail;
#endif
/* 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

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

View File

@ -588,9 +588,10 @@ typedef enum {
meta_HCA, /* CRI HCA */
meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */
meta_PS2_VDS_VDM, /* Graffiti Kingdom */
meta_X360_CXS, /* Eternal Sonata (Xbox 360) */
#ifdef VGM_USE_VORBIS
meta_OGG_VORBIS, /* ogg vorbis */
meta_OGG_VORBIS, /* Ogg Vorbis */
meta_OGG_SLI, /* Ogg Vorbis file w/ companion .sli for looping */
meta_OGG_SLI2, /* Ogg Vorbis file w/ different styled .sli for looping */
meta_OGG_SFL, /* Ogg Vorbis file w/ .sfl (RIFF SFPL) for looping */