From 2557074cebdf68d2de2eadaffc67df6048101840 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 7 Jan 2017 14:33:10 +0100 Subject: [PATCH 01/12] Added .nps extension [Venus & Braves PS2] --- src/formats.c | 1 + src/meta/ps2_npsf.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/formats.c b/src/formats.c index a3780936..a140ea17 100644 --- a/src/formats.c +++ b/src/formats.c @@ -164,6 +164,7 @@ static const char* extension_list[] = { "ndp", "ngca", + "nps", "npsf", "nus3bank", //todo not existing? "nwa", diff --git a/src/meta/ps2_npsf.c b/src/meta/ps2_npsf.c index 9bad95ca..d37ee6c1 100644 --- a/src/meta/ps2_npsf.c +++ b/src/meta/ps2_npsf.c @@ -1,8 +1,9 @@ #include "meta.h" #include "../util.h" -/* Sony .ADS with SShd & SSbd Headers */ - +/* NPFS - found in Namco PS2/PSP games: + * Tekken 5, Ace Combat 5, Yumeria, Venus & Braves (.nps), Ridge Racer PSP, etc + */ VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[PATH_LIMIT]; @@ -14,7 +15,9 @@ VGMSTREAM * init_vgmstream_ps2_npsf(STREAMFILE *streamFile) { /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("npsf",filename_extension(filename))) goto fail; + if (strcasecmp("npsf",filename_extension(filename)) && + strcasecmp("nps",filename_extension(filename))) + goto fail; /* check NPSF Header */ if (read_32bitBE(0x00,streamFile) != 0x4E505346) From 03d744da53c5812f991269d1972a34948920d13d Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 7 Jan 2017 16:51:23 +0100 Subject: [PATCH 02/12] Add make_riff_atrac3 (for FFmpeg) --- src/header.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++--- src/header.h | 2 ++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/header.c b/src/header.c index e51c27db..7e8cc573 100644 --- a/src/header.c +++ b/src/header.c @@ -43,6 +43,11 @@ int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t star char filename[PATH_LIMIT]; int ch; +#ifdef VGM_USE_FFMPEG + if (vgmstream->coding_type == coding_FFmpeg) /* not needed */ + return 1; +#endif + streamFile->get_name(streamFile,filename,sizeof(filename)); { @@ -53,7 +58,10 @@ int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t star vgmstream->ch[ch].streamfile = file; if (vgmstream->layout_type == layout_none - || vgmstream->layout_type == layout_mpeg) { /* no appreciable difference for mpeg */ +#ifdef VGM_USE_MPEG + || vgmstream->layout_type == layout_mpeg +#endif + ) { /* no appreciable difference for mpeg */ /* for some codecs like IMA where channels work with the same bytes */ vgmstream->ch[ch].channel_start_offset = vgmstream->ch[ch].offset = start_offset; @@ -127,11 +135,11 @@ int header_make_riff_xma2(uint8_t * buf, size_t buf_size, size_t sample_count, s memcpy(buf+0x08, "WAVE", 4); memcpy(buf+0x0c, "fmt ", 4); - put_32bitLE(buf+0x10, 0x34);/*size*/ + put_32bitLE(buf+0x10, 0x34);/*fmt size*/ put_16bitLE(buf+0x14, codec_XMA2); put_16bitLE(buf+0x16, channels); put_32bitLE(buf+0x18, sample_rate); - put_32bitLE(buf+0x1c, sample_rate*channels*sizeof(sample)); /* average bytes per second (wrong) */ + put_32bitLE(buf+0x1c, sample_rate*channels / sizeof(sample)); /* average bytes per second (wrong) */ put_16bitLE(buf+0x20, (int16_t)(channels*sizeof(sample))); /* block align */ put_16bitLE(buf+0x22, sizeof(sample)*8); /* bits per sample */ @@ -155,6 +163,50 @@ int header_make_riff_xma2(uint8_t * buf, size_t buf_size, size_t sample_count, s return riff_size; } +/** + * Copies a ATRAC3 riff to buf + * + * returns number of bytes in buf or -1 when buf is not big enough + */ +int header_make_riff_atrac3(uint8_t * buf, size_t buf_size, size_t sample_count, size_t data_size, int channels, int sample_rate, int block_align, int joint_stereo, int encoder_delay) { + uint16_t codec_ATRAC3 = 0x0270; + size_t riff_size = 4+4+ 4 + 0x28 + 0x10 + 4+4; + + if (buf_size < riff_size) + return -1; + + memcpy(buf+0x00, "RIFF", 4); + put_32bitLE(buf+0x04, (int32_t)(riff_size-4-4 + data_size)); /* riff size */ + memcpy(buf+0x08, "WAVE", 4); + + memcpy(buf+0x0c, "fmt ", 4); + put_32bitLE(buf+0x10, 0x20);/*fmt size*/ + put_16bitLE(buf+0x14, codec_ATRAC3); + put_16bitLE(buf+0x16, channels); + put_32bitLE(buf+0x18, sample_rate); + put_32bitLE(buf+0x1c, sample_rate*channels / sizeof(sample)); /* average bytes per second (wrong) */ + put_32bitLE(buf+0x20, (int16_t)(block_align)); /* block align */ + + put_16bitLE(buf+0x24, 0x0e); /* extra data size */ + put_16bitLE(buf+0x26, 1); /* unknown, always 1 */ + put_16bitLE(buf+0x28, channels==1 ? 0x0800 : 0x1000); /* unknown (some size? 0x1000=2ch, 0x0800=1ch) */ + put_16bitLE(buf+0x2a, 0); /* unknown, always 0 */ + put_16bitLE(buf+0x2c, joint_stereo ? 0x0001 : 0x0000); + put_16bitLE(buf+0x2e, joint_stereo ? 0x0001 : 0x0000); /* repeated? */ + put_16bitLE(buf+0x30, 1); /* unknown, always 1 (frame_factor?) */ + put_16bitLE(buf+0x32, 0); /* unknown, always 0 */ + + memcpy(buf+0x34, "fact", 4); + put_32bitLE(buf+0x38, 0x8); /* fact size */ + put_32bitLE(buf+0x3c, sample_count); + put_32bitLE(buf+0x40, encoder_delay); + + memcpy(buf+0x44, "data", 4); + put_32bitLE(buf+0x48, data_size); /* data size */ + + return riff_size; +} + /** * reads DSP coefs built in the streamfile diff --git a/src/header.h b/src/header.h index 8c94dd93..d6e14424 100644 --- a/src/header.h +++ b/src/header.h @@ -16,6 +16,8 @@ int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t star int header_make_riff_xma2(uint8_t * buf, size_t buf_size, size_t sample_count, size_t data_size, int channels, int sample_rate, int block_count, int block_size);; +int header_make_riff_atrac3(uint8_t * buf, size_t buf_size, size_t sample_count, size_t data_size, int channels, int sample_rate, int block_align, int joint_stereo, int encoder_delay); + void header_dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing); From 3e4299b37320a7767a8dec8348d488578ae7e8b2 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 7 Jan 2017 17:04:21 +0100 Subject: [PATCH 03/12] Added ATRAC3/XMA in VAWX (.xwv) [Moon Diver, No More Heroes X360] --- src/formats.c | 1 + src/meta/meta.h | 2 +- src/meta/ps3_vawx.c | 158 +++++++++++++++++++++++++++++--------------- src/vgmstream.c | 6 +- src/vgmstream.h | 4 +- 5 files changed, 112 insertions(+), 59 deletions(-) diff --git a/src/formats.c b/src/formats.c index a140ea17..7043ae3b 100644 --- a/src/formats.c +++ b/src/formats.c @@ -307,6 +307,7 @@ static const char* extension_list[] = { "xwb", "xwm", //FFmpeg, not parsed (XWMA) "xwma", //FFmpeg, not parsed (XWMA) + "xwv", "ydsp", "ymf", diff --git a/src/meta/meta.h b/src/meta/meta.h index f51326de..b3267dfc 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -603,7 +603,7 @@ VGMSTREAM * init_vgmstream_ps2_strlr(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_lsf_n1nj4n(STREAMFILE* streamFile); -VGMSTREAM * init_vgmstream_ps3_vawx(STREAMFILE* streamFile); +VGMSTREAM * init_vgmstream_vawx(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_pc_snds(STREAMFILE* streamFile); diff --git a/src/meta/ps3_vawx.c b/src/meta/ps3_vawx.c index b9195e82..4916d22e 100644 --- a/src/meta/ps3_vawx.c +++ b/src/meta/ps3_vawx.c @@ -1,77 +1,129 @@ #include "meta.h" #include "../util.h" +#include "../header.h" -/* VAWX - - No More Heroes: Heroes Paradise (PS3) -*/ -VGMSTREAM * init_vgmstream_ps3_vawx(STREAMFILE *streamFile) -{ +#define FAKE_RIFF_BUFFER_SIZE 100 + +/** + * VAWX - found in feelplus games: No More Heroes Heroes Paradise, Moon Diver + */ +VGMSTREAM * init_vgmstream_vawx(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; - char filename[PATH_LIMIT]; - - off_t start_offset; + off_t start_offset, datasize; - int loop_flag = 0; - int channel_count; + int loop_flag = 0, channel_count, type; - /* check extension, case insensitive */ - streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("vawx",filename_extension(filename))) goto fail; - - /* check header */ - if (read_32bitBE(0x00,streamFile) != 0x56415758) // "VAWX" + /* check extensions */ + if ( !header_check_extensions(streamFile, "vawx,xwv") ) goto fail; - if (read_8bit(0xF,streamFile) == 2) - { - loop_flag = 1; - } + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x56415758) /* "VAWX" */ + goto fail; + loop_flag = read_8bit(0x37,streamFile); channel_count = read_8bit(0x39,streamFile);; - /* build the VGMSTREAM */ + /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; - /* fill in the vital statistics */ - start_offset = 0x800; - vgmstream->channels = channel_count; + /* 0x04: filesize */ + start_offset = 0x800; /* ? read_32bitLE(0x0c,streamFile); */ + vgmstream->channels = channel_count; + /* 0x16: file id */ + type = read_8bit(0x36,streamFile); /* could be at 0x38 too */ + vgmstream->num_samples = read_32bitBE(0x3c,streamFile); vgmstream->sample_rate = read_32bitBE(0x40,streamFile); - vgmstream->coding_type = coding_PSX; - vgmstream->num_samples = ((get_streamfile_size(streamFile)-start_offset)/16/channel_count*28); - - if (loop_flag) - { - vgmstream->loop_start_sample = read_32bitBE(0x44,streamFile); - vgmstream->loop_end_sample = read_32bitBE(0x48,streamFile);; - } - vgmstream->layout_type = layout_interleave; - vgmstream->interleave_block_size = 0x10; - vgmstream->meta_type = meta_PS3_VAWX; + vgmstream->meta_type = meta_VAWX; + + switch(type) { + case 2: /* VAG */ + vgmstream->coding_type = coding_PSX; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x10; + + vgmstream->loop_start_sample = read_32bitBE(0x44,streamFile); + vgmstream->loop_end_sample = read_32bitBE(0x48,streamFile); + /* todo 6ch has 0x8000 blocks and must skip last 0x20 each block (or, skip 0x20 every 0x1550*6 */ + + break; + +#ifdef VGM_USE_FFMPEG + case 1: { /* XMA */ + ffmpeg_codec_data *ffmpeg_data = NULL; + uint8_t buf[FAKE_RIFF_BUFFER_SIZE]; + size_t bytes, block_size, block_count; + /* not accurate but not needed by FFmpeg */ + datasize = get_streamfile_size(streamFile)-start_offset; + block_size = 2048; + block_count = datasize / block_size; /* read_32bitLE(custom_data_offset +0x14) -1? */ + + /* make a fake riff so FFmpeg can parse the XMA2 */ + bytes = header_make_riff_xma2(buf, FAKE_RIFF_BUFFER_SIZE, 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; + vgmstream->layout_type = layout_none; + + vgmstream->loop_start_sample = read_32bitBE(0x44,streamFile); + vgmstream->loop_end_sample = read_32bitBE(0x48,streamFile); + + break; + } + + case 7: { /* ATRAC3 */ + ffmpeg_codec_data *ffmpeg_data = NULL; + uint8_t buf[FAKE_RIFF_BUFFER_SIZE]; + size_t bytes, block_size, encoder_delay; + int joint_stereo; + int32_t max_samples; + + datasize = read_32bitBE(0x54,streamFile); + block_size = 0x98 * 2; + joint_stereo = 0; + max_samples = (datasize / block_size) * 1024; + encoder_delay = 0x0; /* not used by FFmpeg */ + if (vgmstream->num_samples > max_samples) { + vgmstream->num_samples = max_samples; + /*encoder_delay = ?; */ /* todo some tracks need it to skip garbage but not sure how to calculate it */ + } + + /* make a fake riff so FFmpeg can parse the ATRAC3 */ + bytes = header_make_riff_atrac3(buf, FAKE_RIFF_BUFFER_SIZE, vgmstream->num_samples, datasize, vgmstream->channels, vgmstream->sample_rate, block_size, joint_stereo, encoder_delay); + 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; + vgmstream->layout_type = layout_none; + + vgmstream->loop_start_sample = (read_32bitBE(0x44,streamFile) / ffmpeg_data->blockAlign) * ffmpeg_data->frameSize; + vgmstream->loop_end_sample = (read_32bitBE(0x48,streamFile) / ffmpeg_data->blockAlign) * ffmpeg_data->frameSize; + + break; + } +#endif + default: + goto fail; + + } + /* 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;ich[i].streamfile = file; - - vgmstream->ch[i].channel_start_offset= - vgmstream->ch[i].offset=start_offset + (vgmstream->interleave_block_size * i); - - } - - } + if ( !header_open_stream(vgmstream, streamFile, start_offset) ) + goto fail; return vgmstream; - /* clean up anything we may have opened */ fail: - if (vgmstream) close_vgmstream(vgmstream); + close_vgmstream(vgmstream); return NULL; } diff --git a/src/vgmstream.c b/src/vgmstream.c index dba4476d..790736cf 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -307,7 +307,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ps2_iab, init_vgmstream_ps2_strlr, init_vgmstream_lsf_n1nj4n, - init_vgmstream_ps3_vawx, + init_vgmstream_vawx, init_vgmstream_pc_snds, init_vgmstream_ps2_wmus, init_vgmstream_hyperscan_kvag, @@ -3169,8 +3169,8 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_LSF_N1NJ4N: snprintf(temp,TEMPSIZE,".lsf !n1nj4n header"); break; - case meta_PS3_VAWX: - snprintf(temp,TEMPSIZE,"VAWX header"); + case meta_VAWX: + snprintf(temp,TEMPSIZE,"feelplus VAWX header"); break; case meta_PC_SNDS: snprintf(temp,TEMPSIZE,"assumed Heavy Iron IMA by .snds extension"); diff --git a/src/vgmstream.h b/src/vgmstream.h index 745c19d3..1ca78318 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -569,7 +569,7 @@ typedef enum { meta_PS2_IAB, // Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) meta_PS2_STRLR, meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */ - meta_PS3_VAWX, // No More Heroes: Heroes Paradise (PS3) + meta_VAWX, /* No More Heroes: Heroes Paradise, Moon Diver */ meta_PC_SNDS, // Incredibles PC .snds meta_PS2_WMUS, // The Warriors (PS2) meta_HYPERSCAN_KVAG, // Hyperscan KVAG/BVG @@ -722,7 +722,7 @@ typedef struct { int32_t thpNextFrameSize; - int skip_last_channel; + int skip_last_channel; /* todo not used anymore */ /* Data the codec needs for the whole stream. This is for codecs too * different from vgmstream's structure to be reasonably shoehorned into From c7c1564d9f774149ddb614ae8068fc7d3cd02d9a Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 01:09:20 +0100 Subject: [PATCH 04/12] Minor cleanups (no functionality changes) - added comments, code alignment for clarity - renamed some decoders for consistency (ex. eaxa > ea_xa, invert_psx > psx_bmdx, vgm_adpcm_cfg > psx_cfg) - removed layout_dkt_interleave (same as nolayout) - removed skip_last_channel (not used anymore) - removed meta_DSP_HALP (not used anymore) --- src/coding/coding.h | 136 +++++----- src/coding/eaxa_decoder.c | 2 +- src/coding/g72x_state.h | 2 +- src/coding/psx_decoder.c | 6 +- src/layout/layout.h | 26 +- src/meta/baf.c | 2 +- src/meta/bgw.c | 4 +- src/meta/ea_header.c | 2 +- src/meta/genh.c | 2 +- src/meta/ngc_adpdtk.c | 2 +- src/meta/ogg_vorbis_file.c | 8 +- src/meta/ps2_bmdx.c | 4 +- src/meta/ps2_vag.c | 2 +- src/meta/ps3_sgh_sgb.c | 2 +- src/meta/riff.c | 2 +- src/vgmstream.c | 184 +++++++------ src/vgmstream.h | 522 +++++++++++++++++++------------------ 17 files changed, 463 insertions(+), 445 deletions(-) diff --git a/src/coding/coding.h b/src/coding/coding.h index 4ae8420c..69587b3e 100644 --- a/src/coding/coding.h +++ b/src/coding/coding.h @@ -3,43 +3,41 @@ #include "../vgmstream.h" +/* adx_decoder */ void decode_adx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_adx_enc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - void adx_next_key(VGMSTREAMCHANNEL * stream); +/* g721_decoder */ void decode_g721(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void g72x_init_state(struct g72x_state *state_ptr); +/* ima_decoder */ void decode_nds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_dat4_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_int_xbox_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_dvi_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_eacs_ima(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); - void decode_snds_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); - void decode_ima(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); - void decode_rad_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); - void decode_rad_ima_mono(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - void decode_apple_ima4(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); -void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +/* ngc_dsp_decoder */ void decode_ngc_dsp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_ngc_dsp_mem(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, uint8_t * mem); - int32_t dsp_nibbles_to_samples(int32_t nibbles); +/* ngc_dtk_decoder */ void decode_ngc_dtk(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); +/* ngc_afc_decoder */ +void decode_ngc_afc(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* pcm_decoder */ void decode_pcm16LE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm16LE_XOR_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); @@ -50,38 +48,70 @@ void decode_pcm8_sb_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels void decode_pcm8_unsigned_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); void decode_pcm8_unsigned(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +/* psx_decoder */ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +void decode_psx_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size); +void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); -void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size); - +/* xa_decoder */ void decode_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void init_get_high_nibble(VGMSTREAM * vgmstream); -void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); +/*eaxa_decoder */ +void decode_ea_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel); void decode_ea_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); void decode_maxis_adpcm(VGMSTREAM * vgmstream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); +/* sdx2_decoder */ +void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +void decode_sdx2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +/* sdx2_decoder */ +void decode_cbd2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); +void decode_cbd2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* ws_decoder */ +void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* acm_decoder */ +void decode_acm(ACMStream * acm, sample * outbuf, int32_t samples_to_do, int channelspacing); + +/* nwa_decoder */ +void decode_nwa(NWAData *nwa, sample *outbuf, int32_t samples_to_do); + +/* msadpcm_decoder */ +long msadpcm_bytes_to_samples(long bytes, int block_size, int channels); +void decode_msadpcm_stereo(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do); +void decode_msadpcm_mono(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do); + +/* aica_decoder */ +void decode_aica(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* nds_procyon_decoder */ +void decode_nds_procyon(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* l5_555_decoder */ +void decode_l5_555(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* SASSC_decoder */ +void decode_SASSC(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* lsf_decode */ +void decode_lsf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); + +/* mtaf_decoder */ +void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels); + +/* hca_decoder */ +void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); + +/* ogg_vorbis_decoder */ #ifdef VGM_USE_VORBIS void decode_ogg_vorbis(ogg_vorbis_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); #endif -#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) -void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); -#endif - -void decode_sdx2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); -void decode_sdx2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); -void decode_cbd2(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); -void decode_cbd2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_ws(VGMSTREAM * vgmstream, int channel, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - +/* mpeg_decoder */ #ifdef VGM_USE_MPEG mpeg_codec_data *init_mpeg_codec_data(STREAMFILE *streamfile, off_t start_offset, long given_sample_rate, int given_channels, coding_t *coding_type, int * actual_sample_rate, int * actual_channels); void decode_fake_mpeg2_l2(VGMSTREAMCHANNEL * stream, mpeg_codec_data * data, sample * outbuf, int32_t samples_to_do); @@ -90,51 +120,31 @@ long mpeg_bytes_to_samples(long bytes, const struct mpg123_frameinfo *mi); void mpeg_set_error_logging(mpeg_codec_data * data, int enable); #endif +/* g7221_decoder */ #ifdef VGM_USE_G7221 -void decode_g7221(VGMSTREAM *vgmstream, - sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); +void decode_g7221(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); #endif +/* g719_decoder */ #ifdef VGM_USE_G719 -void decode_g719(VGMSTREAM *vgmstream, - sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); +void decode_g719(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); #endif +/* mp4_aac_decoder */ +#if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) +void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); +#endif + +/* at3_decoder */ #ifdef VGM_USE_MAIATRAC3PLUS -void decode_at3plus(VGMSTREAM *vgmstream, - sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); +void decode_at3plus(VGMSTREAM *vgmstream, sample * outbuf, int channelspacing, int32_t samples_to_do, int channel); #endif +/* ffmpeg_decoder */ #ifdef VGM_USE_FFMPEG void decode_ffmpeg(VGMSTREAM *stream, sample * outbuf, int32_t samples_to_do, int channels); - void reset_ffmpeg(VGMSTREAM *vgmstream); - void seek_ffmpeg(VGMSTREAM *vgmstream, int32_t num_sample); #endif -void decode_acm(ACMStream * acm, sample * outbuf, - int32_t samples_to_do, int channelspacing); - -void decode_nwa(NWAData *nwa, sample *outbuf, int32_t samples_to_do); - -long msadpcm_bytes_to_samples(long bytes, int block_size, int channels); -void decode_msadpcm_stereo(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do); - -void decode_msadpcm_mono(VGMSTREAM * vgmstream, sample * outbuf, int32_t first_sample, int32_t samples_to_do); - -void decode_aica(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_nds_procyon(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_l5_555(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_SASSC(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_lsf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do); - -void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels); - -void decode_hca(hca_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels); - -#endif +#endif /*_CODING_H*/ diff --git a/src/coding/eaxa_decoder.c b/src/coding/eaxa_decoder.c index 63dce241..9d748a94 100644 --- a/src/coding/eaxa_decoder.c +++ b/src/coding/eaxa_decoder.c @@ -14,7 +14,7 @@ int32_t EA_TABLE[20]= { 0x00000000, 0x000000F0, 0x000001CC, 0x00000188, 0x00000007, 0x00000008, 0x0000000A, 0x0000000B, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFD, 0xFFFFFFFC}; -void decode_eaxa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { +void decode_ea_xa(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel) { uint8_t frame_info; int32_t sample_count; int32_t coef1,coef2; diff --git a/src/coding/g72x_state.h b/src/coding/g72x_state.h index bf1a6ade..9eec93bb 100644 --- a/src/coding/g72x_state.h +++ b/src/coding/g72x_state.h @@ -1,5 +1,5 @@ /* - * streamtypes.h - widely used type definitions + * g72x_state.h - internal state used by g721 decoder */ diff --git a/src/coding/psx_decoder.c b/src/coding/psx_decoder.c index 23dc710b..85265b85 100644 --- a/src/coding/psx_decoder.c +++ b/src/coding/psx_decoder.c @@ -214,7 +214,7 @@ void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, stream->adpcm_history2_32=hist2; } -void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { +void decode_psx_bmdx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { int predict_nr, shift_factor, sample; int32_t hist1=stream->adpcm_history1_32; @@ -301,7 +301,7 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel * * Original research and algorithm by id-daemon / daemon1. */ -void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { +void decode_hevag(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) { uint8_t predict_nr, shift, flag, byte; int32_t scale = 0; @@ -367,7 +367,7 @@ void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels * PS ADPCM of configurable size, with no flag. * Found in PS3 Afrika (SGDX type 5) in size 4, FF XI in sizes 3/5/9/41, Blur and James Bond in size 33. */ -void decode_vag_adpcm_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) { +void decode_psx_configurable(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int frame_size) { uint8_t predict_nr, shift, byte; int16_t scale = 0; diff --git a/src/layout/layout.h b/src/layout/layout.h index f5a8efde..4cb1df78 100644 --- a/src/layout/layout.h +++ b/src/layout/layout.h @@ -4,6 +4,7 @@ #include "../streamtypes.h" #include "../vgmstream.h" +/* blocked layouts */ void ast_block_update(off_t block_ofset, VGMSTREAM * vgmstream); void mxch_block_update(off_t block_ofset, VGMSTREAM * vgmstream); @@ -46,6 +47,19 @@ void filp_block_update(off_t block_offset, VGMSTREAM * vgmstream); void ivaud_block_update(off_t block_offset, VGMSTREAM * vgmstream); +void psx_mgav_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +void ps2_adm_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream); + +/* other layouts */ void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); void render_vgmstream_nolayout(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); @@ -60,16 +74,4 @@ void render_vgmstream_aax(sample * buffer, int32_t sample_count, VGMSTREAM * vgm void render_vgmstream_scd_int(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); -void psx_mgav_block_update(off_t block_offset, VGMSTREAM * vgmstream); - -void ps2_adm_block_update(off_t block_offset, VGMSTREAM * vgmstream); - -void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream); - -void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream); - -void ps2_iab_block_update(off_t block_offset, VGMSTREAM * vgmstream); - -void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream); - #endif diff --git a/src/meta/baf.c b/src/meta/baf.c index 2eb7bfd3..8ef6f822 100644 --- a/src/meta/baf.c +++ b/src/meta/baf.c @@ -51,7 +51,7 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) { vgmstream->sample_rate = sample_rate; vgmstream->num_samples = sample_count; - vgmstream->coding_type = coding_VAG_ADPCM_cfg; + vgmstream->coding_type = coding_PSX_cfg; vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = frame_size; vgmstream->meta_type = meta_BAF; diff --git a/src/meta/bgw.c b/src/meta/bgw.c index 5eb0489e..4656fbe5 100644 --- a/src/meta/bgw.c +++ b/src/meta/bgw.c @@ -55,7 +55,7 @@ VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) { switch (codec) { case 0: /* PS ADPCM */ - vgmstream->coding_type = coding_VAG_ADPCM_cfg; + vgmstream->coding_type = coding_PSX_cfg; vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */ @@ -138,7 +138,7 @@ VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) { switch (codec) { case 0: /* PS ADPCM */ - vgmstream->coding_type = coding_VAG_ADPCM_cfg; + vgmstream->coding_type = coding_PSX_cfg; vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */ diff --git a/src/meta/ea_header.c b/src/meta/ea_header.c index 0da2d047..293f4c3e 100644 --- a/src/meta/ea_header.c +++ b/src/meta/ea_header.c @@ -225,7 +225,7 @@ VGMSTREAM * init_vgmstream_ea(STREAMFILE *streamFile) { vgmstream->meta_type=meta_EAXA_R2; } - vgmstream->coding_type=coding_EAXA; + vgmstream->coding_type=coding_EA_XA; vgmstream->layout_type=layout_ea_blocked; if((vgmstream->ea_platform==EA_GC) || (vgmstream->ea_platform==EA_X360)) vgmstream->ea_big_endian=1; diff --git a/src/meta/genh.c b/src/meta/genh.c index 2c9933a3..3682dbad 100644 --- a/src/meta/genh.c +++ b/src/meta/genh.c @@ -215,7 +215,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) { vgmstream->layout_type = layout_none; break; case coding_NGC_DTK: - vgmstream->layout_type = layout_dtk_interleave; + vgmstream->layout_type = layout_none; break; case coding_NGC_DSP: if (dsp_interleave_type == 0) { diff --git a/src/meta/ngc_adpdtk.c b/src/meta/ngc_adpdtk.c index 613ffcfe..214ac2ac 100644 --- a/src/meta/ngc_adpdtk.c +++ b/src/meta/ngc_adpdtk.c @@ -29,7 +29,7 @@ VGMSTREAM * init_vgmstream_ngc_adpdtk(STREAMFILE *streamFile) { vgmstream->num_samples = file_size/32*28; vgmstream->sample_rate = 48000; vgmstream->coding_type = coding_NGC_DTK; - vgmstream->layout_type = layout_dtk_interleave; + vgmstream->layout_type = layout_none; vgmstream->meta_type = meta_NGC_ADPDTK; /* locality is such that two streamfiles is silly */ diff --git a/src/meta/ogg_vorbis_file.c b/src/meta/ogg_vorbis_file.c index cadec2b3..43648559 100644 --- a/src/meta/ogg_vorbis_file.c +++ b/src/meta/ogg_vorbis_file.c @@ -233,13 +233,13 @@ VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile) { callbacks.tell_func = tell_func; if (um3_ogg) { - inf.meta_type = meta_um3_ogg; + inf.meta_type = meta_OGG_UM3; } else if (kovs_ogg) { - inf.meta_type = meta_KOVS_ogg; + inf.meta_type = meta_OGG_KOVS; } else if (psych_ogg) { - inf.meta_type = meta_psych_ogg; + inf.meta_type = meta_OGG_PSYCH; } else { - inf.meta_type = meta_ogg_vorbis; + inf.meta_type = meta_OGG_VORBIS; } inf.layout_type = layout_ogg_vorbis; diff --git a/src/meta/ps2_bmdx.c b/src/meta/ps2_bmdx.c index dc0e9309..a1e735af 100644 --- a/src/meta/ps2_bmdx.c +++ b/src/meta/ps2_bmdx.c @@ -33,7 +33,7 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) { /* Check for Compression Scheme */ if (read_32bitLE(0x20,streamFile) == 1) - vgmstream->coding_type = coding_invert_PSX; + vgmstream->coding_type = coding_PSX_bmdx; else vgmstream->coding_type = coding_PSX; vgmstream->num_samples = read_32bitLE(0x0c,streamFile)*28/16/channel_count; @@ -55,7 +55,7 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) { start_offset = read_32bitLE(0x08,streamFile); - if (vgmstream->coding_type == coding_invert_PSX) + if (vgmstream->coding_type == coding_PSX_bmdx) { uint8_t xor = read_8bit(start_offset,streamFile); uint8_t add = (~(uint8_t)read_8bit(start_offset+2,streamFile))+1; diff --git a/src/meta/ps2_vag.c b/src/meta/ps2_vag.c index 7ca91519..02024dad 100644 --- a/src/meta/ps2_vag.c +++ b/src/meta/ps2_vag.c @@ -150,7 +150,7 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { start_offset = 0x30; } else if (version == 0x00020001) { /* HEVAG */ - vgmstream->coding_type = coding_HEVAG_ADPCM; + vgmstream->coding_type = coding_HEVAG; vgmstream->layout_type = layout_interleave; vgmstream->meta_type = meta_PS2_VAGs; diff --git a/src/meta/ps3_sgh_sgb.c b/src/meta/ps3_sgh_sgb.c index e0a4cf29..164a77cb 100644 --- a/src/meta/ps3_sgh_sgb.c +++ b/src/meta/ps3_sgh_sgb.c @@ -195,7 +195,7 @@ VGMSTREAM * init_vgmstream_ps3_sgdx(STREAMFILE *streamFile) { } #endif case 0x05: /* Short VAG ADPCM */ - vgmstream->coding_type = coding_VAG_ADPCM_cfg; + vgmstream->coding_type = coding_PSX_cfg; vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = 0x4; diff --git a/src/meta/riff.c b/src/meta/riff.c index e6c68a2c..6a41732a 100644 --- a/src/meta/riff.c +++ b/src/meta/riff.c @@ -503,7 +503,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) { (long long)loop_start_ms*fmt.sample_rate/1000; vgmstream->loop_end_sample = (long long)loop_end_ms*fmt.sample_rate/1000; - vgmstream->meta_type = meta_RIFF_WAVE_labl_Marker; + vgmstream->meta_type = meta_RIFF_WAVE_labl; } else if (loop_start_offset >= 0) { diff --git a/src/vgmstream.c b/src/vgmstream.c index 790736cf..fe2d1880 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -30,7 +30,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_halpst, init_vgmstream_rs03, init_vgmstream_ngc_dsp_std, - init_vgmstream_ngc_dsp_csmp, + init_vgmstream_ngc_dsp_csmp, init_vgmstream_Cstr, init_vgmstream_gcsw, init_vgmstream_ps2_ads, @@ -119,7 +119,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ps2_dxh, init_vgmstream_ps2_psh, init_vgmstream_pcm_scd, - init_vgmstream_pcm_ps2, + init_vgmstream_pcm_ps2, init_vgmstream_ps2_rkv, init_vgmstream_ps2_psw, init_vgmstream_ps2_vas, @@ -163,7 +163,6 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_wii_mus, init_vgmstream_dc_asd, init_vgmstream_naomi_spsd, - init_vgmstream_rsd2vag, init_vgmstream_rsd2pcmb, init_vgmstream_rsd2xadp, @@ -228,19 +227,19 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ps2_sps, init_vgmstream_ps2_xa2_rrp, init_vgmstream_nds_hwas, - init_vgmstream_ngc_lps, + init_vgmstream_ngc_lps, init_vgmstream_ps2_snd, init_vgmstream_naomi_adpcm, - init_vgmstream_sd9, - init_vgmstream_2dx9, - init_vgmstream_dsp_ygo, + init_vgmstream_sd9, + init_vgmstream_2dx9, + init_vgmstream_dsp_ygo, init_vgmstream_ps2_vgv, init_vgmstream_ngc_gcub, init_vgmstream_maxis_xa, init_vgmstream_ngc_sck_dsp, init_vgmstream_apple_caff, - init_vgmstream_pc_mxst, - init_vgmstream_sab, + init_vgmstream_pc_mxst, + init_vgmstream_sab, init_vgmstream_exakt_sc, init_vgmstream_wii_bns, init_vgmstream_wii_was, @@ -251,8 +250,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_ps2_stm, init_vgmstream_myspd, init_vgmstream_his, - init_vgmstream_ps2_ast, - init_vgmstream_dmsg, + init_vgmstream_ps2_ast, + init_vgmstream_dmsg, init_vgmstream_ngc_dsp_aaap, init_vgmstream_ngc_dsp_konami, init_vgmstream_ps2_ster, @@ -283,16 +282,16 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_dsp_xiii, init_vgmstream_dsp_cabelas, init_vgmstream_ps2_adm, - init_vgmstream_ps2_lpcm, + init_vgmstream_ps2_lpcm, init_vgmstream_dsp_bdsp, - init_vgmstream_ps2_vms, - init_vgmstream_ps2_xau, + init_vgmstream_ps2_vms, + init_vgmstream_ps2_xau, init_vgmstream_gh3_bar, init_vgmstream_ffw, init_vgmstream_dsp_dspw, init_vgmstream_ps2_jstm, init_vgmstream_ps3_xvag, - init_vgmstream_ps3_cps, + init_vgmstream_ps3_cps, init_vgmstream_sqex_scd, init_vgmstream_ngc_nst_dsp, init_vgmstream_baf, @@ -337,21 +336,23 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { #ifdef VGM_USE_FFMPEG init_vgmstream_xma, init_vgmstream_mp4_aac_ffmpeg, - init_vgmstream_ffmpeg, + + init_vgmstream_ffmpeg, /* should go at the end */ #endif }; -#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) /* internal version with all parameters */ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) { - int i; + int i, fcns_size; if (!streamFile) return NULL; + fcns_size = (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])); /* try a series of formats, see which works */ - for (i=0;imeta_type == meta_KRAW) || (vgmstream->meta_type == meta_PS2_MIB) || (vgmstream->meta_type == meta_NGC_LPS) || - (vgmstream->meta_type == meta_DSP_YGO) || + (vgmstream->meta_type == meta_DSP_YGO) || (vgmstream->meta_type == meta_DSP_AGSC) || - (vgmstream->meta_type == meta_PS2_SMPL) || - (vgmstream->meta_type == meta_NGCA) || + (vgmstream->meta_type == meta_PS2_SMPL) || + (vgmstream->meta_type == meta_NGCA) || (vgmstream->meta_type == meta_NUB_VAG) || (vgmstream->meta_type == meta_SPT_SPD) || (vgmstream->meta_type == meta_EB_SFX) || @@ -912,7 +913,6 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre case layout_fake_mpeg: case layout_mpeg: #endif - case layout_dtk_interleave: case layout_none: render_vgmstream_nolayout(buffer,sample_count,vgmstream); break; @@ -1026,15 +1026,15 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) { case coding_NGC_AFC: case coding_PSX: case coding_PSX_badflags: - case coding_invert_PSX: - case coding_HEVAG_ADPCM: + case coding_PSX_bmdx: + case coding_HEVAG: case coding_XA: return 28; - case coding_VAG_ADPCM_cfg: + case coding_PSX_cfg: return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */ case coding_XBOX: case coding_INT_XBOX: - case coding_EAXA: + case coding_EA_XA: return 28; case coding_MAXIS_ADPCM: case coding_EA_ADPCM: @@ -1153,11 +1153,11 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) { case coding_NGC_AFC: case coding_PSX: case coding_PSX_badflags: - case coding_HEVAG_ADPCM: - case coding_invert_PSX: + case coding_PSX_bmdx: + case coding_HEVAG: case coding_NDS_PROCYON: return 16; - case coding_VAG_ADPCM_cfg: + case coding_PSX_cfg: return vgmstream->interleave_block_size; case coding_XA: return 14*vgmstream->channels; @@ -1168,7 +1168,7 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) { return 15*vgmstream->channels; case coding_EA_ADPCM: return 30; - case coding_EAXA: + case coding_EA_XA: return 1; // the frame is variant in size case coding_WS: return vgmstream->current_block_size; @@ -1387,19 +1387,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to break; case coding_PSX: for (chan=0;chanchannels;chan++) { - if(vgmstream->skip_last_channel) - { - if(chan!=vgmstream->channels-1) { - decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, - vgmstream->channels,vgmstream->samples_into_block, - samples_to_do); - } - - } else { - decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, + decode_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, vgmstream->channels,vgmstream->samples_into_block, samples_to_do); - } } break; case coding_PSX_badflags: @@ -1409,23 +1399,23 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to samples_to_do); } break; - case coding_invert_PSX: + case coding_PSX_bmdx: for (chan=0;chanchannels;chan++) { - decode_invert_psx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, + decode_psx_bmdx(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, vgmstream->channels,vgmstream->samples_into_block, samples_to_do); } break; - case coding_HEVAG_ADPCM: + case coding_HEVAG: for (chan=0;chanchannels;chan++) { - decode_hevag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, + decode_hevag(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, vgmstream->channels,vgmstream->samples_into_block, samples_to_do); } break; - case coding_VAG_ADPCM_cfg: + case coding_PSX_cfg: for (chan=0;chanchannels;chan++) { - decode_vag_adpcm_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, + decode_psx_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, vgmstream->channels,vgmstream->samples_into_block, samples_to_do, vgmstream->interleave_block_size); } @@ -1437,9 +1427,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to samples_to_do,chan); } break; - case coding_EAXA: + case coding_EA_XA: for (chan=0;chanchannels;chan++) { - decode_eaxa(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, + decode_ea_xa(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, vgmstream->channels,vgmstream->samples_into_block, samples_to_do,chan); } @@ -1557,6 +1547,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to samples_to_do); } break; + #ifdef VGM_USE_MPEG case coding_fake_MPEG2_L2: decode_fake_mpeg2_l2( @@ -1731,7 +1722,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { vgmstream->meta_type == meta_DSP_RS03 || vgmstream->meta_type == meta_DSP_CSTR || vgmstream->coding_type == coding_PSX || - vgmstream->coding_type == coding_invert_PSX || + vgmstream->coding_type == coding_PSX_bmdx || vgmstream->coding_type == coding_PSX_badflags) { int i; for (i=0;ichannels;i++) { @@ -1741,7 +1732,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32; } } - /* todo preserve hevag/adjustable_vag_adpcm/others history? */ + /* todo preserve ADPCM (ex hevag) history? */ #ifdef DEBUG { @@ -1757,6 +1748,13 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { } #endif + if (vgmstream->coding_type==coding_CRI_HCA) { + hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data); + data->curblock = data->info.loopStart; + data->sample_ptr = clHCA_samplesPerBlock; + data->samples_discard = 0; + } + #ifdef VGM_USE_VORBIS if (vgmstream->coding_type==coding_ogg_vorbis) { ogg_vorbis_codec_data *data = @@ -1766,17 +1764,13 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { ov_pcm_seek_lap(ogg_vorbis_file, vgmstream->loop_sample); } #endif - if (vgmstream->coding_type==coding_CRI_HCA) { - hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data); - data->curblock = data->info.loopStart; - data->sample_ptr = clHCA_samplesPerBlock; - data->samples_discard = 0; - } + #ifdef VGM_USE_FFMPEG if (vgmstream->coding_type==coding_FFmpeg) { seek_ffmpeg(vgmstream, vgmstream->loop_start_sample); } -#endif /* VGM_USE_FFMPEG */ +#endif + #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) if (vgmstream->coding_type==coding_MP4_AAC) { mp4_aac_codec_data *data = (mp4_aac_codec_data *)(vgmstream->codec_data); @@ -1785,6 +1779,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { data->samples_discard = vgmstream->loop_sample; } #endif + #ifdef VGM_USE_MAIATRAC3PLUS if (vgmstream->coding_type==coding_AT3plus) { int blocks_to_skip = vgmstream->loop_sample / 2048; @@ -1796,6 +1791,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { data->samples_discard = samples_to_discard; } #endif + #ifdef VGM_USE_MPEG /* won't work for fake MPEG */ if (vgmstream->layout_type==layout_mpeg) { @@ -1912,18 +1908,25 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case coding_PCM8_SB_int: snprintf(temp,TEMPSIZE,"8-bit PCM with sign bit, 1 byte interleave"); break; - case coding_NGC_DSP: - snprintf(temp,TEMPSIZE,"Gamecube \"DSP\" 4-bit ADPCM"); - break; case coding_CRI_ADX: snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM"); break; case coding_CRI_ADX_enc_8: - snprintf(temp,TEMPSIZE,"encrypted (type 8) CRI ADX 4-bit ADPCM"); + snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)"); break; case coding_CRI_ADX_enc_9: - snprintf(temp,TEMPSIZE,"encrypted (type 9) CRI ADX 4-bit ADPCM"); + snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)"); break; + case coding_NGC_DSP: + snprintf(temp,TEMPSIZE,"Nintendo DSP 4-bit ADPCM"); + break; + case coding_NGC_DTK: + snprintf(temp,TEMPSIZE,"Nintendo DTK 4-bit ADPCM"); + break; + case coding_NGC_AFC: + snprintf(temp,TEMPSIZE,"Nintendo AFC 4-bit ADPCM"); + break; + case coding_CRI_HCA: snprintf(temp,TEMPSIZE,"CRI HCA"); break; @@ -1933,30 +1936,24 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case coding_DAT4_IMA: snprintf(temp,TEMPSIZE,"Eurocom DAT4 4-bit IMA ADPCM"); break; - case coding_NGC_DTK: - snprintf(temp,TEMPSIZE,"Gamecube \"ADP\"/\"DTK\" 4-bit ADPCM"); - break; case coding_G721: snprintf(temp,TEMPSIZE,"CCITT G.721 4-bit ADPCM"); break; - case coding_NGC_AFC: - snprintf(temp,TEMPSIZE,"Gamecube \"AFC\" 4-bit ADPCM"); - break; case coding_PSX: snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM"); break; case coding_PSX_badflags: - snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM with bad flags"); + snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (bad flags)"); break; - case coding_invert_PSX: - snprintf(temp,TEMPSIZE,"BMDX \"encrypted\" Playstation 4-bit ADPCM"); + case coding_PSX_bmdx: + snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (BMDX encryption)"); break; - case coding_HEVAG_ADPCM: - snprintf(temp,TEMPSIZE,"PSVita HEVAG ADPCM"); - break; - case coding_VAG_ADPCM_cfg: + case coding_PSX_cfg: snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)"); break; + case coding_HEVAG: + snprintf(temp,TEMPSIZE,"Playstation Vita HEVAG 4-bit ADPCM"); + break; case coding_XA: snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM"); break; @@ -1964,19 +1961,14 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM"); break; case coding_INT_XBOX: - snprintf(temp,TEMPSIZE,"XBOX Interleaved 4-bit IMA ADPCM"); + snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM (interleaved)"); break; - case coding_EAXA: - snprintf(temp,TEMPSIZE,"Electronic Arts XA Based 4-bit ADPCM"); + case coding_EA_XA: + snprintf(temp,TEMPSIZE,"Electronic Arts 4-bit ADPCM (XA based)"); break; case coding_EA_ADPCM: - snprintf(temp,TEMPSIZE,"Electronic Arts XA Based (R1) 4-bit ADPCM"); + snprintf(temp,TEMPSIZE,"Electronic Arts R1 4-bit ADPCM (XA based)"); break; -#ifdef VGM_USE_VORBIS - case coding_ogg_vorbis: - snprintf(temp,TEMPSIZE,"Vorbis"); - break; -#endif case coding_SDX2: snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM"); break; @@ -2023,8 +2015,13 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { snprintf(temp,TEMPSIZE,"Heavy Iron .snds 4-bit IMA ADPCM"); break; case coding_WS: - snprintf(temp,TEMPSIZE,"Westwood Studios DPCM"); + snprintf(temp,TEMPSIZE,"Westwood Studios ADPCM"); break; +#ifdef VGM_USE_VORBIS + case coding_ogg_vorbis: + snprintf(temp,TEMPSIZE,"Vorbis"); + break; +#endif #ifdef VGM_USE_MPEG case coding_fake_MPEG2_L2: snprintf(temp,TEMPSIZE,"MPEG-2 Layer II Audio"); @@ -2159,9 +2156,6 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { break; case layout_interleave_byte: snprintf(temp,TEMPSIZE,"sub-frame interleave"); - break; - case layout_dtk_interleave: - snprintf(temp,TEMPSIZE,"ADP/DTK nibble interleave"); break; case layout_mxch_blocked: snprintf(temp,TEMPSIZE,"MxCh blocked"); @@ -2486,7 +2480,7 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { snprintf(temp,TEMPSIZE,"GENH Generic Header"); break; #ifdef VGM_USE_VORBIS - case meta_ogg_vorbis: + case meta_OGG_VORBIS: snprintf(temp,TEMPSIZE,"Ogg Vorbis"); break; case meta_OGG_SLI: @@ -2498,13 +2492,13 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_OGG_SFL: snprintf(temp,TEMPSIZE,"Ogg Vorbis with SFPL for looping"); break; - case meta_um3_ogg: + case meta_OGG_UM3: snprintf(temp,TEMPSIZE,"Ogg Vorbis, Ultramarine3 \"encryption\""); break; - case meta_KOVS_ogg: + case meta_OGG_KOVS: snprintf(temp,TEMPSIZE,"Ogg Vorbis, KOVS header"); break; - case meta_psych_ogg: + case meta_OGG_PSYCH: snprintf(temp,TEMPSIZE,"Ogg Vorbis, Psychic Software obfuscation"); break; #endif @@ -2666,7 +2660,7 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { case meta_PS2_PSH: snprintf(temp,TEMPSIZE,"Dawn of Mana - Seiken Densetsu 4 PSH Header"); break; - case meta_RIFF_WAVE_labl_Marker: + case meta_RIFF_WAVE_labl: snprintf(temp,TEMPSIZE,"RIFF WAVE header with loop markers"); break; case meta_RIFF_WAVE_smpl: diff --git a/src/vgmstream.h b/src/vgmstream.h index 1ca78318..026d0619 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -7,11 +7,12 @@ enum { PATH_LIMIT = 32768 }; -/* Due mostly to licensing issues, Vorbis, MPEG, and G.722.1 decoding are +#include "streamfile.h" + +/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1, etc decoding is * done by external libraries. * If someone wants to do a standalone build, they can do it by simply - * removing these defines (and the references to the libraries in the - * Makefile) */ + * removing these defines (and the references to the libraries in the Makefile) */ #define VGM_USE_VORBIS /* can be disabled to decode with FFmpeg instead */ @@ -19,18 +20,22 @@ enum { PATH_LIMIT = 32768 }; #define VGM_USE_MPEG #endif -/* disabled by default, defined for builds that support it */ +/* disabled by default, defined on compile-time for builds that support it*/ //#define VGM_USE_G7221 //#define VGM_USE_G719 +//#define VGM_USE_MP4V2 +//#define VGM_USE_FDKAAC +//#define VGM_USE_MAIATRAC3PLUS +//#define VGM_USE_FFMPEG -#include "streamfile.h" -#include "coding/g72x_state.h" #ifdef VGM_USE_VORBIS #include #endif + #ifdef VGM_USE_MPEG #include #endif + #ifdef VGM_USE_G7221 #include "g7221.h" #endif @@ -51,79 +56,99 @@ enum { PATH_LIMIT = 32768 }; #include "maiatrac3plus.h" #endif -#include "clHCA.h" - #ifdef VGM_USE_FFMPEG #include #include #endif +#include "coding/g72x_state.h" #include "coding/acm_decoder.h" #include "coding/nwa_decoder.h" +#include "clHCA.h" + /* The encoding type specifies the format the sound data itself takes */ typedef enum { /* 16-bit PCM */ - coding_PCM16BE, /* big endian 16-bit PCM */ coding_PCM16LE, /* little endian 16-bit PCM */ - coding_PCM16LE_int, /* little endian 16-bit PCM with sample-level - interleave handled by the decoder */ + coding_PCM16LE_int, /* little endian 16-bit PCM with sample-level interleave */ + coding_PCM16LE_XOR_int, /* little endian 16-bit PCM with sample-level xor */ + coding_PCM16BE, /* big endian 16-bit PCM */ /* 8-bit PCM */ coding_PCM8, /* 8-bit PCM */ + coding_PCM8_int, /* 8-Bit PCM with sample-level interleave */ coding_PCM8_U, /* 8-bit PCM, unsigned (0x80 = 0) */ - coding_PCM8_int, /* 8-Bit PCM with sample-level interleave handled - by the decoder */ - coding_PCM8_SB_int, /* 8-bit PCM, sign bit (others are 2's complement), - sample-level interleave */ - coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0), sample-level - interleave */ + coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0) with sample-level interleave */ + coding_PCM8_SB_int, /* 8-bit PCM, sign bit (others are 2's complement) with sample-level interleave */ /* 4-bit ADPCM */ - coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */ coding_CRI_ADX, /* CRI ADX */ - coding_CRI_ADX_enc_8, /* encrypted CRI ADX, type 8 (God Hand) */ - coding_CRI_ADX_enc_9, /* encrypted CRI ADX, type 9 (PSO2) */ - coding_NGC_DSP, /* NGC ADPCM, called DSP */ - coding_NGC_DTK, /* NGC hardware disc ADPCM, called DTK, TRK or ADP */ - coding_G721, /* CCITT G.721 ADPCM */ - coding_NGC_AFC, /* NGC ADPCM, called AFC */ - coding_PSX, /* PSX & PS2 ADPCM */ - coding_invert_PSX, /* PSX ADPCM with some weirdness */ - coding_PSX_badflags, /* with garbage in the flags byte */ - coding_HEVAG_ADPCM, /* PSVita games */ - coding_VAG_ADPCM_cfg, /* VAG with configurable frame size: FF XI, SGXD type 5, Bizarre Creations */ - coding_XA, /* PSX CD-XA */ - coding_XBOX, /* XBOX IMA */ - coding_INT_XBOX, /* XBOX 'real interleaved' IMA */ - coding_EAXA, /* EA/XA ADPCM */ - coding_EA_ADPCM, /* EA ADPCM */ - coding_MAXIS_ADPCM, /* MAXIS ADPCM */ - coding_NDS_PROCYON, /* NDS Procyon Studio ADPCM */ + coding_CRI_ADX_enc_8, /* CRI ADX, type 8 encryption (God Hand) */ + coding_CRI_ADX_enc_9, /* CRI ADX, type 9 encryption (PSO2) */ -#ifdef VGM_USE_VORBIS - coding_ogg_vorbis, /* vorbis */ -#endif - coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression */ - coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression, - with smaple-level interleave handled by the - decoder */ - coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression */ - coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, - with sample-level interleave handled by the - decoder */ - coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */ - coding_INT_DVI_IMA, /* Interleaved DVI */ + coding_NGC_DSP, /* Nintendo DSP ADPCM */ + coding_NGC_DTK, /* Nintendo DTK ADPCM (hardware disc), also called TRK or ADP */ + coding_NGC_AFC, /* Nintendo AFC ADPCM */ + + coding_G721, /* CCITT G.721 */ + + coding_XA, /* CD-ROM XA */ + coding_PSX, /* Sony PS ADPCM (VAG) */ + coding_PSX_badflags, /* Sony PS ADPCM with garbage in the flag byte */ + coding_PSX_bmdx, /* Sony PS ADPCM with BMDX encryption */ + coding_PSX_cfg, /* Sony PS ADPCM with configurable frame size (FF XI, SGXD type 5, Bizarre Creations) */ + coding_HEVAG, /* Sony PSVita ADPCM */ + + coding_EA_XA, /* Electronic Arts XA ADPCM */ + coding_EA_ADPCM, /* Electronic Arts R1 ADPCM */ + coding_MAXIS_ADPCM, /* Maxis ADPCM */ + coding_NDS_PROCYON, /* Procyon Studio ADPCM */ + + coding_XBOX, /* XBOX IMA ADPCM */ + coding_INT_XBOX, /* XBOX IMA ADPCM (interleaved) */ + coding_IMA, /* IMA ADPCM (low nibble first) */ + coding_INT_IMA, /* IMA ADPCM (interleaved) */ + coding_DVI_IMA, /* DVI IMA ADPCM (high nibble first), aka ADP4 */ + coding_INT_DVI_IMA, /* DVI IMA ADPCM (Interleaved) */ + coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */ coding_EACS_IMA, - coding_IMA, /* bare IMA, low nibble first */ - coding_INT_IMA, /* */ coding_MS_IMA, /* Microsoft IMA */ coding_RAD_IMA, /* "Radical ADPCM" IMA */ coding_RAD_IMA_mono, /* "Radical ADPCM" IMA, mono (for interleave) */ coding_APPLE_IMA4, /* Apple Quicktime IMA4 */ coding_DAT4_IMA, /* Eurocom 'DAT4' IMA ADPCM */ coding_SNDS_IMA, /* Heavy Iron Studios .snds IMA ADPCM */ - coding_WS, /* Westwood Studios' custom VBR ADPCM */ + coding_WS, /* Westwood Studios VBR ADPCM */ + + coding_MSADPCM, /* Microsoft ADPCM */ + coding_AICA, /* Yamaha AICA ADPCM */ + coding_L5_555, /* Level-5 0x555 ADPCM */ + coding_SASSC, /* Activision EXAKT SASSC DPCM */ + coding_LSF, /* lsf ADPCM (Fastlane Street Racing iPhone)*/ + coding_MTAF, /* Konami MTAF ADPCM (IMA-derived) */ + + /* others */ + coding_SDX2, /* SDX2 2:1 Squareroot-Delta-Exact compression DPCM */ + coding_SDX2_int, /* SDX2 2:1 Squareroot-Delta-Exact compression with sample-level interleave */ + coding_CBD2, /* CBD2 2:1 Cuberoot-Delta-Exact compression DPCM */ + coding_CBD2_int, /* CBD2 2:1 Cuberoot-Delta-Exact compression, with sample-level interleave */ + + coding_ACM, /* InterPlay ACM */ + + coding_NWA0, /* Visual Art's NWA (compressed at various levels) */ + coding_NWA1, + coding_NWA2, + coding_NWA3, + coding_NWA4, + coding_NWA5, + + coding_CRI_HCA, /* CRI High Compression Audio (MDCT-based) */ + +#ifdef VGM_USE_VORBIS + coding_ogg_vorbis, /* Xiph Vorbis (MDCT-based) */ +#endif + #ifdef VGM_USE_MPEG coding_fake_MPEG2_L2, /* MPEG-2 Layer 2 (AHX), with lying headers */ /* I don't even know offhand if all these combinations exist... */ @@ -137,43 +162,26 @@ typedef enum { coding_MPEG25_L2, coding_MPEG25_L3, #endif + #ifdef VGM_USE_G7221 - coding_G7221, /* G.722.1 (Polycom Siren 7) */ - coding_G7221C, /* G.722.1 with Annex C extension (Polycom Siren 14) */ + 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 - coding_G719, -#endif - - coding_ACM, /* InterPlay ACM */ - /* compressed NWA at various levels */ - coding_NWA0, - coding_NWA1, - coding_NWA2, - coding_NWA3, - coding_NWA4, - coding_NWA5, - - coding_MSADPCM, /* Microsoft ADPCM */ - coding_AICA, /* Yamaha AICA ADPCM */ - coding_L5_555, /* Level-5 0x555 */ - coding_SASSC, /* Activision EXAKT SASSC DPCM */ - coding_PCM16LE_XOR_int, /* sample-level xor */ - coding_LSF, /* lsf ADPCM */ - coding_MTAF, /* Konami IMA-derived MTAF ADPCM */ - - coding_CRI_HCA, /* CRI High Compression Audio */ - -#ifdef VGM_USE_FFMPEG - coding_FFmpeg, + coding_G719, /* ITU G.719 annex B (Polycom Siren 22) */ #endif #if defined(VGM_USE_MP4V2) && defined(VGM_USE_FDKAAC) - coding_MP4_AAC, + coding_MP4_AAC, /* AAC (MDCT-based) */ #endif #ifdef VGM_USE_MAIATRAC3PLUS - coding_AT3plus, + coding_AT3plus, /* Sony ATRAC3plus (MDCT-based) */ +#endif + +#ifdef VGM_USE_FFMPEG + coding_FFmpeg, /* Formats handled by FFmpeg (ATRAC3, XMA, AC3, etc) */ #endif } coding_t; @@ -181,15 +189,15 @@ typedef enum { typedef enum { /* generic */ layout_none, /* straight data */ + /* interleave */ layout_interleave, /* equal interleave throughout the stream */ layout_interleave_shortblock, /* interleave with a short last block */ - layout_interleave_byte, /* full byte interleave */ /* headered blocks */ - layout_ast_blocked, /* .ast STRM with BLCK blocks*/ - layout_halpst_blocked, /* blocks with HALPST-format header */ + layout_ast_blocked, + layout_halpst_blocked, layout_xa_blocked, layout_ea_blocked, layout_eacs_blocked, @@ -210,12 +218,18 @@ typedef enum { layout_ps2_adm_blocked, layout_dsp_bdsp_blocked, layout_mxch_blocked, + layout_ivaud_blocked, /* GTA IV .ivaud blocks */ + layout_tra_blocked, /* DefJam Rapstar .tra blocks */ + layout_ps2_iab_blocked, + layout_ps2_strlr_blocked, -#if 0 - layout_strm_blocked, /* */ -#endif /* otherwise odd */ - layout_dtk_interleave, /* dtk interleaves channels by nibble */ + layout_acm, /* libacm layout */ + layout_mus_acm, /* mus has multi-files to deal with */ + layout_aix, /* CRI AIX's wheels within wheels */ + layout_aax, /* CRI AAX's wheels within databases */ + layout_scd_int, /* deinterleave done by the SCDINTSTREAMFILE */ + #ifdef VGM_USE_VORBIS layout_ogg_vorbis, /* ogg vorbis file */ #endif @@ -223,31 +237,22 @@ typedef enum { layout_fake_mpeg, /* MPEG audio stream with bad frame headers (AHX) */ layout_mpeg, /* proper MPEG audio stream */ #endif - layout_acm, /* dummy, let libacm handle layout */ - layout_mus_acm, /* mus has multi-files to deal with */ - layout_aix, /* CRI AIX's wheels within wheels */ - layout_aax, /* CRI AAX's wheels within databases */ - layout_ivaud_blocked, /* GTA IV .ivaud blocks */ - layout_tra_blocked, /* DefJam Rapstar .tra blocks */ - layout_ps2_iab_blocked, - layout_ps2_strlr_blocked, - layout_scd_int, /* deinterleave done by the SCDINTSTREAMFILE */ } layout_t; -/* The meta type specifies how we know what we know about the file. We may know because of a header we read, some of it may have been guessed from filenames, etc. */ +/* The meta type specifies how we know what we know about the file. + * We may know because of a header we read, some of it may have been guessed from filenames, etc. */ typedef enum { /* DSP-specific */ - meta_DSP_STD, /* standard GC ADPCM (DSP) header */ - meta_DSP_CSMP, /* Metroid Prime 3, Donkey Kong Country Returns */ + meta_DSP_STD, /* Nintendo standard GC ADPCM (DSP) header */ + meta_DSP_CSMP, /* Retro: Metroid Prime 3, Donkey Kong Country Returns */ meta_DSP_CSTR, /* Star Fox Assault "Cstr" */ - meta_DSP_RS03, /* Metroid Prime 2 "RS03" */ + meta_DSP_RS03, /* Retro: Metroid Prime 2 "RS03" */ meta_DSP_STM, /* Paper Mario 2 STM */ - meta_DSP_HALP, /* SSB:M "HALPST" */ - meta_DSP_AGSC, /* Metroid Prime 2 title */ + meta_DSP_AGSC, /* Retro: Metroid Prime 2 title */ meta_DSP_MPDSP, /* Monopoly Party single header stereo */ meta_DSP_JETTERS, /* Bomberman Jetters .dsp */ - meta_DSP_MSS, - meta_DSP_GCM, + meta_DSP_MSS, /* ? */ + meta_DSP_GCM, /* ? */ meta_DSP_STR, /* Conan .str files */ meta_DSP_SADB, /* .sad */ meta_DSP_WSI, /* .wsi */ @@ -255,12 +260,12 @@ typedef enum { meta_DSP_WII_IDSP, /* .gcm with IDSP header */ meta_DSP_WII_MUS, /* .mus */ meta_DSP_WII_WSD, /* Phantom Brave (WII) */ - meta_WII_NDP, /* Vertigo (Wii) */ - meta_DSP_YGO, /* Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ + meta_WII_NDP, /* Vertigo (Wii) */ + meta_DSP_YGO, /* Konami: Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */ /* Nintendo */ - meta_STRM, /* STRM */ - meta_RSTM, /* RSTM (similar to STRM) */ + meta_STRM, /* Nintendo STRM */ + meta_RSTM, /* Nintendo RSTM (similar to STRM) */ meta_AFC, /* AFC */ meta_AST, /* AST */ meta_RWSD, /* single-stream RWSD */ @@ -269,7 +274,7 @@ typedef enum { meta_CWAV, /* contents of CWAR */ meta_FWAV, /* contents of FWAR */ meta_RSTM_SPM, /* RSTM with 44->22khz hack */ - meta_THP, + meta_THP, /* THP movie files */ meta_RSTM_shrunken, /* Atlus' mutant shortened RSTM */ meta_NDS_SWAV, /* Asphalt Urban GT 1 & 2 */ meta_NDS_RRDS, /* Ridge Racer DS */ @@ -277,18 +282,16 @@ typedef enum { meta_STX, /* Pikmin .stx */ meta_WIIU_BTSND, /* Wii U Boot Sound */ - /* CRI ADX */ - meta_ADX_03, /* ADX "type 03" */ - meta_ADX_04, /* ADX "type 04" */ - meta_ADX_05, /* ADX "type 05" */ + meta_ADX_03, /* CRI ADX "type 03" */ + meta_ADX_04, /* CRI ADX "type 04" */ + meta_ADX_05, /* CRI ADX "type 05" */ meta_AIX, /* CRI AIX */ meta_AAX, /* CRI AAX */ meta_UTF_DSP, /* CRI ADPCM_WII, like AAX with DSP */ - /* etc */ - meta_NGC_ADPDTK, /* NGC DTK/ADP, no header (.adp) */ + meta_NGC_ADPDTK, /* NGC DTK/ADP (.adp/dkt DTK) [no header_id] */ meta_kRAW, /* almost headerless PCM */ - meta_RSF, /* Retro Studios RSF, no header (.rsf) */ + meta_RSF, /* Retro Studios RSF (Metroid Prime .rsf) [no header_id] */ meta_HALPST, /* HAL Labs HALPST */ meta_GCSW, /* GCSW (PCM) */ meta_CFN, /* Namco CAF Audio File */ @@ -296,6 +299,7 @@ typedef enum { meta_HIS, /* Her Ineractive .his */ meta_BNSF, /* Bandai Namco Sound Format */ + meta_PSX_XA, /* CD-ROM XA with RIFF header */ meta_PS2_SShd, /* .ADS with SShd header */ meta_PS2_NPSF, /* Namco Production Sound File */ meta_PS2_RXW, /* Sony Arc The Lad Sound File */ @@ -309,11 +313,10 @@ typedef enum { meta_PS2_VAGp, /* VAGp Mono File */ meta_PS2_VAGm, /* VAGp Mono File */ meta_PS2_pGAV, /* VAGp with Little Endian Header */ - meta_PSX_GMS, /* GMS File (used in PS1 & PS2) */ + meta_PSX_GMS, /* GMS File (used in PS1 & PS2) [no header_id] */ meta_PS2_STR, /* Pacman STR+STH files */ meta_PS2_ILD, /* ILD File */ meta_PS2_PNB, /* PsychoNauts Bgm File */ - meta_PSX_XA, /* CD-XA with RIFF header */ meta_PS2_VAGs, /* VAG Stereo from Kingdom Hearts */ meta_PS2_VPK, /* VPK Audio File */ meta_PS2_BMDX, /* Beatmania thing */ @@ -323,8 +326,8 @@ typedef enum { meta_XSS, /* Dino Crisis 3 */ meta_SL3, /* Test Drive Unlimited */ meta_HGC1, /* Knights of the Temple 2 */ - meta_AUS, /* Variuos Capcom Games */ - meta_RWS, /* Variuos Konami Games */ + meta_AUS, /* Various Capcom games */ + meta_RWS, /* Various Konami games */ meta_FSB1, /* FMOD Sample Bank, version 1 */ meta_FSB2, /* FMOD Sample Bank, version 2 */ meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */ @@ -339,7 +342,7 @@ typedef enum { meta_MUSX_V006, /* Spyro Games, possibly more */ meta_MUSX_V010, /* Spyro Games, possibly more */ meta_MUSX_V201, /* Sphinx and the cursed Mummy */ - meta_LEG, /* Legaia 2 */ + meta_LEG, /* Legaia 2 [no header_id] */ meta_FILP, /* Resident Evil - Dead Aim */ meta_IKM, /* Zwei! */ meta_SFS, /* Baroque */ @@ -348,8 +351,8 @@ typedef enum { meta_PS2_KCES, /* Dance Dance Revolution */ meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */ meta_PS2_PSH, /* Dawn of Mana - Seiken Densetsu 4 */ - meta_PCM_SCD, /* Ephemeral Fantasia */ - meta_PCM_PS2, /* Lunar - Eternal Blue */ + meta_PCM_SCD, /* Lunar - Eternal Blue */ + meta_PCM_PS2, /* Konami: Ephemeral Fantasia, Yu-Gi-Oh! The Duelists of the Roses */ meta_PS2_RKV, /* Legacy of Kain - Blood Omen 2 */ meta_PS2_PSW, /* Rayman Raving Rabbids */ meta_PS2_VAS, /* Pro Baseball Spirits 5 */ @@ -358,7 +361,7 @@ typedef enum { meta_SDT, /* Baldur's Gate - Dark Alliance */ meta_NGC_TYDSP, /* Ty - The Tasmanian Tiger */ meta_NGC_SWD, /* Conflict - Desert Storm 1 & 2 */ - meta_CAPDSP, /* Capcom DSP Header */ + meta_CAPDSP, /* Capcom DSP Header [no header_id] */ meta_DC_STR, /* SEGA Stream Asset Builder */ meta_DC_STR_V2, /* variant of SEGA Stream Asset Builder */ meta_NGC_BH2PCM, /* Bio Hazard 2 */ @@ -368,40 +371,39 @@ typedef enum { meta_PS2_OMU, /* PS2 Int file with Header */ meta_PS2_XA2, /* XG3 Extreme-G Racing */ meta_IDSP, /* Chronicles of Narnia, Soul Calibur Legends, Mario Strikers Charged */ - meta_SPT_SPD, /* Variouis */ - meta_ISH_ISD, /* Various */ - meta_GSP_GSB, /* Various */ + meta_SPT_SPD, /* Various (SPT+SPT DSP) */ + meta_ISH_ISD, /* Various (ISH+ISD DSP) */ + meta_GSP_GSB, /* Various (GSP+GSB DSP), Super Swing Golf 1 & 2 */ meta_YDSP, /* WWE Day of Reckoning */ - meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */ - + meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */ meta_WAA_WAC_WAD_WAM, /* Beyond Good & Evil */ - meta_GCA, /* Metal Slug Anthology */ - meta_MSVP, /* Popcap Hits */ - meta_NGC_SSM, /* Golden Gashbell Full Power */ - meta_PS2_JOE, /* Wall-E / Pixar games */ + meta_GCA, /* Metal Slug Anthology */ + meta_MSVP, /* Popcap Hits */ + meta_NGC_SSM, /* Golden Gashbell Full Power */ + meta_PS2_JOE, /* Wall-E / Pixar games */ - meta_NGC_YMF, /* WWE WrestleMania X8 */ - meta_SADL, /* .sad */ - meta_PS2_CCC, /* Tokyo Xtreme Racer DRIFT 2 */ - meta_PSX_FAG, /* Jackie Chan - Stuntmaster */ - meta_PS2_MIHB, /* Merged MIH+MIB */ - meta_NGC_PDT, /* Mario Party 6 */ - meta_DC_ASD, /* Miss Moonligh */ - meta_NAOMI_SPSD, /* Guilty Gear X */ + meta_NGC_YMF, /* WWE WrestleMania X8 */ + meta_SADL, /* .sad */ + meta_PS2_CCC, /* Tokyo Xtreme Racer DRIFT 2 */ + meta_PSX_FAG, /* Jackie Chan - Stuntmaster */ + meta_PS2_MIHB, /* Merged MIH+MIB */ + meta_NGC_PDT, /* Mario Party 6 */ + meta_DC_ASD, /* Miss Moonligh */ + meta_NAOMI_SPSD, /* Guilty Gear X */ - meta_RSD2VAG, /* RSD2VAG */ + meta_RSD2VAG, /* RSD2VAG */ meta_RSD2PCMB, /* RSD2PCMB */ meta_RSD2XADP, /* RSD2XADP */ - meta_RSD3VAG, /* RSD3VAG */ - meta_RSD3GADP, /* RSD3GADP */ + meta_RSD3VAG, /* RSD3VAG */ + meta_RSD3GADP, /* RSD3GADP */ meta_RSD3PCM, /* RSD3PCM */ meta_RSD3PCMB, /* RSD3PCMB */ meta_RSD4PCMB, /* RSD4PCMB */ - meta_RSD4PCM, /* RSD4PCM */ + meta_RSD4PCM, /* RSD4PCM */ meta_RSD4RADP, /* RSD4RADP */ - meta_RSD4VAG, /* RSD4VAG */ - meta_RSD6VAG, /* RSD6VAG */ + meta_RSD4VAG, /* RSD4VAG */ + meta_RSD6VAG, /* RSD6VAG */ meta_RSD6WADP, /* RSD6WADP */ meta_RSD6XADP, /* RSD6XADP */ meta_RSD6RADP, /* RSD6RADP */ @@ -409,7 +411,7 @@ typedef enum { meta_PS2_ASS, /* ASS */ meta_PS2_SEG, /* Eragon */ - meta_XBOX_SEG, + meta_XBOX_SEG, /* Eragon */ meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */ meta_STR_ASR, /* Donkey Kong Jet Race */ meta_ZWDSP, /* Zack and Wiki */ @@ -420,19 +422,19 @@ typedef enum { meta_EMFF_PS2, /* Eidos Music File Format for PS2*/ meta_EMFF_NGC, /* Eidos Music File Format for NGC/WII */ meta_SAT_BAKA, /* Crypt Killer */ - meta_PS2_VSF, /* Musashi: Samurai Legend */ - meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */ - meta_ADS, /* Gauntlet Dark Legends (GC) */ - meta_PS2_SPS, /* Ape Escape 2 */ - meta_PS2_XA2_RRP, /* RC Revenge Pro */ - meta_PS2_STM, /* Red Dead Revolver .stm, renamed .ps2stm */ - meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */ - meta_UBI_CKD, /* Ubisoft CKD RIFF header from Rayman Origins */ + meta_PS2_VSF, /* Musashi: Samurai Legend */ + meta_PS2_VSF_TTA, /* Tiny Toon Adventures: Defenders of the Universe */ + meta_ADS, /* Gauntlet Dark Legends (GC) */ + meta_PS2_SPS, /* Ape Escape 2 */ + meta_PS2_XA2_RRP, /* RC Revenge Pro */ + meta_PS2_STM, /* Red Dead Revolver .stm, renamed .ps2stm */ + meta_NGC_DSP_KONAMI, /* Konami DSP header, found in various games */ + meta_UBI_CKD, /* Ubisoft CKD RIFF header from Rayman Origins */ meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ meta_XBOX_WVS, /* XBOX WVS */ - meta_NGC_WVS, /* NGC WVS */ + meta_NGC_WVS, /* Metal Arms - Glitch in the System */ meta_XBOX_STMA, /* XBOX STMA */ meta_XBOX_MATX, /* XBOX MATX */ meta_XBOX_XMU, /* XBOX XMU */ @@ -444,69 +446,56 @@ typedef enum { meta_EACS_PC, /* EACS PC */ meta_EACS_PSX, /* EACS PSX */ meta_EACS_SAT, /* EACS SATURN */ - meta_EA_ADPCM, /* EA XA ADPCM */ - meta_EA_IMA, /* EA IMA */ - meta_EA_PCM, /* EA PCM */ + meta_EA_ADPCM, /* EA header using XA ADPCM */ + meta_EA_IMA, /* EA header using IMA */ + meta_EA_PCM, /* EA header using PCM */ meta_RAW, /* RAW PCM file */ meta_GENH, /* generic header */ -#ifdef VGM_USE_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 */ - meta_um3_ogg, /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */ - meta_KOVS_ogg, /* Ogg Vorbis with exta header and 0x100 bytes XOR */ - meta_psych_ogg, /* Ogg Vorbis with all bytes -0x23*/ -#endif - meta_AIFC, /* Audio Interchange File Format AIFF-C */ meta_AIFF, /* Audio Interchange File Format */ meta_STR_SNDS, /* .str with SNDS blocks and SHDR header */ meta_WS_AUD, /* Westwood Studios .aud */ meta_WS_AUD_old, /* Westwood Studios .aud, old style */ -#ifdef VGM_USE_MPEG - meta_AHX, /* CRI AHX header (same structure as ADX) */ -#endif meta_RIFF_WAVE, /* RIFF, for WAVs */ meta_RIFF_WAVE_POS, /* .wav + .pos for looping */ - meta_RIFF_WAVE_labl_Marker, /* RIFF w/ loop Markers in LIST-adtl-labl */ + meta_RIFF_WAVE_labl, /* RIFF w/ loop Markers in LIST-adtl-labl */ meta_RIFF_WAVE_smpl, /* RIFF w/ loop data in smpl chunk */ meta_RIFF_WAVE_MWV, /* .mwv RIFF w/ loop data in ctrl chunk pflt */ meta_RIFF_WAVE_SNS, /* .sns RIFF */ meta_RIFX_WAVE, /* RIFX, for big-endian WAVs */ meta_RIFX_WAVE_smpl, /* RIFX w/ loop data in smpl chunk */ meta_XNBm, /* XNBm, which has a RIFF fmt chunk */ - meta_PC_MXST, /* Lego Island MxSt */ - meta_PC_SOB_SAB, /* Worms 4 Mayhem SOB+SAB file */ + meta_PC_MXST, /* Lego Island MxSt */ + meta_PC_SOB_SAB, /* Worms 4 Mayhem SOB+SAB file */ meta_NWA, /* Visual Art's NWA */ - meta_NWA_NWAINFOINI, /* NWA w/ NWAINFO.INI for looping */ - meta_NWA_GAMEEXEINI, /* NWA w/ Gameexe.ini for looping */ - meta_DVI, /* DVI Interleaved */ - meta_KCEY, /* KCEYCOMP */ + meta_NWA_NWAINFOINI, /* Visual Art's NWA w/ NWAINFO.INI for looping */ + meta_NWA_GAMEEXEINI, /* Visual Art's NWA w/ Gameexe.ini for looping */ + meta_DVI, /* DVI Interleaved */ + meta_KCEY, /* KCEYCOMP */ meta_ACM, /* InterPlay ACM header */ meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */ meta_DE2, /* Falcom (Gurumin) .de2 */ - meta_VS, /* Men in Black .vs */ + meta_VS, /* Men in Black .vs */ meta_FFXI_BGW, /* FFXI BGW */ meta_FFXI_SPW, /* FFXI SPW */ - meta_STS_WII, /* Shikigami No Shiro 3 STS Audio File */ - meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */ - meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */ + meta_STS_WII, /* Shikigami No Shiro 3 STS Audio File */ + meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */ + meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */ meta_NGC_DSP_IADP, /* Gamecube Interleave DSP */ - meta_PS2_TK5, /* Tekken 5 Stream Files */ - meta_WII_STR, /* House of The Dead Overkill STR+STH */ - meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */ + meta_PS2_TK5, /* Tekken 5 Stream Files */ + meta_WII_STR, /* House of The Dead Overkill STR+STH */ + meta_PS2_MCG, /* Gunvari MCG Files (was name .GCM on disk) */ meta_ZSD, /* Dragon Booster ZSD */ meta_RedSpark, /* "RedSpark" RSD (MadWorld) */ - meta_PC_IVAUD, /* .ivaud GTA IV */ - meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */ - meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */ - meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */ - meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ - meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ + meta_PC_IVAUD, /* .ivaud GTA IV */ + meta_NDS_HWAS, /* Spider-Man 3, Tony Hawk's Downhill Jam, possibly more... */ + meta_NGC_LPS, /* Rave Master (Groove Adventure Rave)(GC) */ + meta_NAOMI_ADPCM, /* NAOMI/NAOMI2 ARcade games */ + meta_SD9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ + meta_2DX9, /* beatmaniaIIDX16 - EMPRESS (Arcade) */ meta_PS2_VGV, /* Rune: Viking Warlord */ meta_NGC_GCUB, /* Sega Soccer Slam */ meta_MAXIS_XA, /* Sim City 3000 (PC) */ @@ -517,9 +506,9 @@ typedef enum { meta_PONA_3DO, /* Policenauts (3DO) */ meta_PONA_PSX, /* Policenauts (PSX) */ meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */ - meta_PS2_AST, /* Some KOEI game (PS2) */ - meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ - meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */ + meta_PS2_AST, /* Some KOEI game (PS2) */ + meta_DMSG, /* Nightcaster II - Equinox (XBOX) */ + meta_NGC_DSP_AAAP, /* Turok: Evolution (NGC), Vexx (NGC) */ meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */ meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */ meta_S14, /* raw Siren 14, 24kbit mono */ @@ -531,7 +520,7 @@ typedef enum { meta_PS2_KHV, /* Kingdom Hearts 2 VAG streams */ meta_PC_SMP, /* Ghostbusters PC .smp */ meta_P3D, /* Prototype P3D */ - meta_PS2_TK1, /* Tekken (NamCollection) */ + meta_PS2_TK1, /* Tekken (NamCollection) */ meta_PS2_ADSC, /* Kenka Bancho 2: Full Throttle */ meta_NGC_BO2, /* Blood Omen 2 (NGC) */ meta_DSP_DDSP, /* Various (2 dsp files stuck together */ @@ -544,17 +533,17 @@ typedef enum { meta_DSP_XIII, /* XIII, possibly more (Ubisoft header???) */ meta_DSP_CABELAS, /* Cabelas games */ meta_PS2_ADM, /* Dragon Quest 5 */ - meta_PS2_LPCM, /* Ah! My Goddess */ + meta_PS2_LPCM, /* Ah! My Goddess */ meta_DSP_BDSP, /* Ah! My Goddess */ - meta_PS2_VMS, /* Autobahn Raser - Police Madness */ - meta_PS2_XAU, // Spectral Force Chronicle + meta_PS2_VMS, /* Autobahn Raser - Police Madness */ + meta_PS2_XAU, /* Spectral Force Chronicle */ meta_GH3_BAR, /* Guitar Hero III Mobile .bar */ meta_FFW, /* Freedom Fighters [NGC] */ meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */ meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */ - meta_SQEX_SCD, /* Square-Enix SCD */ + meta_SQEX_SCD, /* Square-Enix SCD */ meta_NGC_NST_DSP, /* Animaniacs [NGC] */ - meta_BAF, /* .baf (Blur) */ + meta_BAF, /* Bizarre Creations (Blur, James Bond) */ meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */ meta_PS3_CPS, /* Eternal Sonata (PS3) */ meta_PS3_MSF, /* MSF header */ @@ -563,13 +552,13 @@ typedef enum { meta_PS3_SGDX, /* Folklore, Genji, Tokyo Jungle (PS3), Brave Story, Kurohyo (PSP) */ meta_NGCA, /* GoldenEye 007 (Wii) */ meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */ - meta_PS2_SPM, /* Lethal Skies Elite Pilot: Team SW */ + meta_PS2_SPM, /* Lethal Skies Elite Pilot: Team SW */ meta_X360_TRA, /* Def Jam Rapstar */ - meta_PS2_VGS, // Princess Soft PS2 games - meta_PS2_IAB, // Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) - meta_PS2_STRLR, + meta_PS2_VGS, /* Princess Soft PS2 games */ + meta_PS2_IAB, /* Ueki no Housoku - Taosu ze Robert Juudan!! (PS2) */ + meta_PS2_STRLR, /* The Bouncer */ meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */ - meta_VAWX, /* No More Heroes: Heroes Paradise, Moon Diver */ + meta_VAWX, /* feelplus: No More Heroes Heroes Paradise, Moon Diver */ meta_PC_SNDS, // Incredibles PC .snds meta_PS2_WMUS, // The Warriors (PS2) meta_HYPERSCAN_KVAG, // Hyperscan KVAG/BVG @@ -584,28 +573,43 @@ typedef enum { meta_TUN, // LEGO Racers (PC) meta_WPD, // Shuffle! (PC) meta_MN_STR, // Mini Ninjas (PC/PS3/WII) - meta_PS2_MSS, // ShellShock Nam '67 (PS2) + meta_PS2_MSS, // Guerilla: ShellShock Nam '67, Killzone (PS2) meta_PS2_HSF, // Lowrider (PS2) meta_PS3_IVAG, // Interleaved VAG files (PS3) - meta_PS2_2PFS, // Mahoromatic: Moetto - KiraKira Maid-San (PS2) - meta_PS2_VBK, - meta_OTM, // Otomedius (Arcade) - meta_CSTM, // Nintendo 3DS CSTM - meta_FSTM, // Nintendo Wii U FSTM - meta_3DS_IDSP, // Nintendo 3DS IDSP - meta_G1L, // Tecmo Koei G1L - meta_MCA, // Capcom MCA "MADP" - meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX - meta_HCA, /* CRI HCA */ - meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */ -#ifdef VGM_USE_FFMPEG - meta_FFmpeg, + meta_PS2_2PFS, // Konami: Mahoromatic: Moetto - KiraKira Maid-San, GANTZ (PS2) + meta_PS2_VBK, // Disney's Stitch - Experiment 626 + meta_OTM, // Otomedius (Arcade) + meta_CSTM, // Nintendo 3DS CSTM + meta_FSTM, // Nintendo Wii U FSTM + meta_3DS_IDSP, // Nintendo 3DS IDSP + meta_G1L, // Tecmo Koei G1L + meta_MCA, // Capcom MCA "MADP" + meta_XB3D_ADX, // Xenoblade Chronicles 3D ADX + meta_HCA, /* CRI HCA */ + meta_PS2_SVAG_SNK, /* SNK PS2 SVAG */ + +#ifdef VGM_USE_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 */ + meta_OGG_UM3, /* Ogg Vorbis with first 0x800 bytes XOR 0xFF */ + meta_OGG_KOVS, /* Ogg Vorbis with exta header and 0x100 bytes XOR */ + meta_OGG_PSYCH, /* Ogg Vorbis with all bytes -0x23*/ +#endif +#ifdef VGM_USE_MPEG + meta_AHX, /* CRI AHX header (same structure as ADX) */ #endif #ifdef VGM_USE_MP4V2 - meta_MP4, + meta_MP4, /* AAC (iOS) */ +#endif +#ifdef VGM_USE_FFMPEG + meta_FFmpeg, #endif } meta_t; + +/* info for a single vgmstream channel */ typedef struct { STREAMFILE * streamfile; /* file used by this channel */ off_t channel_start_offset; /* where data for this channel begins */ @@ -642,8 +646,8 @@ typedef struct { int adpcm_step_index; /* for IMA */ int adpcm_scale; /* for MS ADPCM */ - struct g72x_state g72x_state; /* state for G.721 decoder, sort of big but we - might as well keep it around */ + /* state for G.721 decoder, sort of big but we might as well keep it around */ + struct g72x_state g72x_state; #ifdef DEBUG int samples_done; @@ -664,6 +668,7 @@ typedef struct { uint16_t key_xor; } VGMSTREAMCHANNEL; +/* main vgmstream info */ typedef struct { /* basics */ int32_t num_samples; /* the actual number of samples in this stream */ @@ -701,28 +706,28 @@ typedef struct { /* loop layout (saved values) */ int32_t loop_sample; /* saved from current_sample, should be loop_start_sample... */ - int32_t loop_samples_into_block; /* saved from samples_into_block */ + int32_t loop_samples_into_block;/* saved from samples_into_block */ off_t loop_block_offset; /* saved from current_block_offset */ size_t loop_block_size; /* saved from current_block_size */ off_t loop_next_block_offset; /* saved from next_block_offset */ - uint8_t xa_channel; /* Selected XA Channel */ - int32_t xa_sector_length; /* XA block */ - uint8_t xa_headerless; /* headerless XA block */ - int8_t get_high_nibble; + /* decoder specific */ + uint8_t xa_channel; /* XA ADPCM: selected channel */ + int32_t xa_sector_length; /* XA ADPCM: XA block */ + uint8_t xa_headerless; /* XA ADPCM: headerless XA block */ - uint8_t ea_big_endian; /* Big Endian ? */ - uint8_t ea_compression_type; - uint8_t ea_compression_version; + int8_t get_high_nibble; /* ADPCM: which nibble (XA, IMA, EA) */ + + uint8_t ea_big_endian; /* EA ADPCM stuff */ + uint8_t ea_compression_type; + uint8_t ea_compression_version; uint8_t ea_platform; - int32_t ws_output_size; /* output bytes for this block */ + int32_t ws_output_size; /* WS ADPCM: output bytes for this block */ - void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream */ + int32_t thpNextFrameSize; /* THP */ - int32_t thpNextFrameSize; - - int skip_last_channel; /* todo not used anymore */ + void * start_vgmstream; /* a copy of the VGMSTREAM as it was at the beginning of the stream (for AAX/AIX/SCD) */ /* Data the codec needs for the whole stream. This is for codecs too * different from vgmstream's structure to be reasonably shoehorned into @@ -744,7 +749,6 @@ typedef struct { void (*decryption_callback)(void *ptr, size_t size, size_t nmemb, void *datasource, int bytes_read); uint8_t scd_xor; off_t scd_xor_length; - } ogg_vorbis_streamfile; typedef struct { @@ -759,6 +763,7 @@ typedef struct { #define AHX_EXPECTED_FRAME_SIZE 0x414 /* MPEG_BUFFER_SIZE should be >= AHX_EXPECTED_FRAME_SIZE */ #define MPEG_BUFFER_SIZE 0x1000 + typedef struct { uint8_t buffer[MPEG_BUFFER_SIZE]; int buffer_used; @@ -791,8 +796,7 @@ typedef struct { } maiatrac3plus_codec_data; #endif -/* with one file this is also used for just - ACM */ +/* with one file this is also used for just ACM */ typedef struct { int file_count; int current_file; @@ -835,6 +839,7 @@ typedef struct { NWAData *nwa; } nwa_codec_data; +/* SQEX SCD interleaved */ typedef struct { int substream_count; VGMSTREAM **substreams; @@ -927,6 +932,11 @@ typedef struct { #endif #endif + +/* -------------------------------------------------------------------------*/ +/* vgmstream "public" API */ +/* -------------------------------------------------------------------------*/ + /* do format detection, return pointer to a usable VGMSTREAM, or NULL on failure */ VGMSTREAM * init_vgmstream(const char * const filename); @@ -935,10 +945,7 @@ VGMSTREAM * init_vgmstream_from_STREAMFILE(STREAMFILE *streamFile); /* reset a VGMSTREAM to start of stream */ void reset_vgmstream(VGMSTREAM * vgmstream); -/* allocate a VGMSTREAM and channel stuff */ -VGMSTREAM * allocate_vgmstream(int channel_count, int looped); - -/* deallocate, close, etc. */ +/* close an open vgmstream */ void close_vgmstream(VGMSTREAM * vgmstream); /* calculate the number of samples to be played based on looping parameters */ @@ -947,6 +954,21 @@ int32_t get_vgmstream_play_samples(double looptimes, double fadeseconds, double /* render! */ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream); +/* Write a description of the stream into array pointed by desc, + * which must be length bytes long. Will always be null-terminated if length > 0 */ +void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length); + +/* Return the average bitrate in bps of all unique files contained within this + * stream. Compares files by absolute paths. */ +int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream); + +/* -------------------------------------------------------------------------*/ +/* vgmstream "private" API */ +/* -------------------------------------------------------------------------*/ + +/* allocate a VGMSTREAM and channel stuff */ +VGMSTREAM * allocate_vgmstream(int channel_count, int looped); + /* smallest self-contained group of samples is a frame */ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream); /* number of bytes per frame */ @@ -970,19 +992,9 @@ int vgmstream_samples_to_do(int samples_this_block, int samples_per_frame, VGMST * Returns 1 if loop was done. */ int vgmstream_do_loop(VGMSTREAM * vgmstream); -/* Write a description of the stream into array pointed by desc, - * which must be length bytes long. Will always be null-terminated if length > 0 - */ -void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length); - /* See if there is a second file which may be the second channel, given * already opened mono opened_stream which was opened from filename. - * If a suitable file is found, open it and change opened_stream to a - * stereo stream. */ + * If a suitable file is found, open it and change opened_stream to a stereo stream. */ void try_dual_file_stereo(VGMSTREAM * opened_stream, STREAMFILE *streamFile); -/* Return the average bitrate in bps of all unique files contained within this - * stream. Compares files by absolute paths. */ -int get_vgmstream_average_bitrate(VGMSTREAM * vgmstream); - #endif From ad74cced1f9d709d5dccebf4a97848d4851c7fb2 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 02:27:35 +0100 Subject: [PATCH 05/12] Moved coding/layout/meta switch-case descriptions to list in formats.c --- src/formats.c | 526 ++++++++++++++++++ src/formats.h | 4 + src/vgmstream.c | 1385 ++--------------------------------------------- 3 files changed, 563 insertions(+), 1352 deletions(-) diff --git a/src/formats.c b/src/formats.c index 7043ae3b..f93376a4 100644 --- a/src/formats.c +++ b/src/formats.c @@ -335,3 +335,529 @@ const char ** vgmstream_get_formats() { int vgmstream_get_formats_length() { return sizeof(extension_list) / sizeof(char*); } + + +/* internal description info */ + +typedef struct { + coding_t type; + const char *description; +} coding_info; + +typedef struct { + layout_t type; + const char *description; +} layout_info; + +typedef struct { + meta_t type; + const char *description; +} meta_info; + + +static const coding_info coding_info_list[] = { + {coding_PCM16BE, "Big Endian 16-bit PCM"}, + {coding_PCM16LE, "Little Endian 16-bit PCM"}, + {coding_PCM16LE_int, "Little Endian 16-bit PCM with 2 byte interleave"}, + {coding_PCM16LE_XOR_int, "Little Endian 16-bit PCM with 2 byte interleave and XOR obfuscation"}, + {coding_PCM8, "8-bit PCM"}, + {coding_PCM8_U, "8-bit unsigned PCM"}, + {coding_PCM8_U_int, "8-bit unsigned PCM with 1 byte interleave"}, + {coding_PCM8_int, "8-bit PCM with 1 byte interleave"}, + {coding_PCM8_SB_int, "8-bit PCM with sign bit, 1 byte interleave"}, + {coding_CRI_ADX, "CRI ADX 4-bit ADPCM"}, + {coding_CRI_ADX_enc_8, "CRI ADX 4-bit ADPCM (type 8 encryption)"}, + {coding_CRI_ADX_enc_9, "CRI ADX 4-bit ADPCM (type 8 encryption)"}, + {coding_NGC_DSP, "Nintendo DSP 4-bit ADPCM"}, + {coding_NGC_DTK, "Nintendo DTK 4-bit ADPCM"}, + {coding_NGC_AFC, "Nintendo AFC 4-bit ADPCM"}, + {coding_CRI_HCA, "CRI HCA"}, + {coding_NDS_IMA, "NDS-style 4-bit IMA ADPCM"}, + {coding_DAT4_IMA, "Eurocom DAT4 4-bit IMA ADPCM"}, + {coding_G721, "CCITT G.721 4-bit ADPCM"}, + {coding_PSX, "Playstation 4-bit ADPCM"}, + {coding_PSX_badflags, "Playstation 4-bit ADPCM (bad flags)"}, + {coding_PSX_bmdx, "Playstation 4-bit ADPCM (BMDX encryption)"}, + {coding_PSX_cfg, "Playstation 4-bit ADPCM (configurable)"}, + {coding_HEVAG, "Playstation Vita HEVAG 4-bit ADPCM"}, + {coding_XA, "CD-ROM XA 4-bit ADPCM"}, + {coding_XBOX, "XBOX 4-bit IMA ADPCM"}, + {coding_INT_XBOX, "XBOX 4-bit IMA ADPCM (interleaved)"}, + {coding_EA_XA, "Electronic Arts 4-bit ADPCM (XA based)"}, + {coding_EA_ADPCM, "Electronic Arts R1 4-bit ADPCM (XA based)"}, + {coding_SDX2, "Squareroot-delta-exact (SDX2) 8-bit DPCM"}, + {coding_SDX2_int, "Squareroot-delta-exact (SDX2) 8-bit DPCM with 1 byte interleave"}, + {coding_CBD2, "Cuberoot-delta-exact (CBD2) 8-bit DPCM"}, + {coding_CBD2_int, "Cuberoot-delta-exact (CBD2) 8-bit DPCM with 1 byte interleave"}, + {coding_DVI_IMA, "Intel DVI 4-bit IMA ADPCM"}, + {coding_INT_DVI_IMA, "Interleaved Intel DVI 4-bit IMA ADPCM"}, + {coding_EACS_IMA, "EACS 4-bit IMA ADPCM"}, + {coding_MAXIS_ADPCM, "Maxis XA (EA ADPCM Variant)"}, + {coding_INT_IMA, "Interleaved 4-bit IMA ADPCM"}, + {coding_IMA, "4-bit IMA ADPCM"}, + {coding_MS_IMA, "Microsoft 4-bit IMA ADPCM"}, + {coding_RAD_IMA, "'Radical' 4-bit IMA ADPCM"}, + {coding_RAD_IMA_mono, "'Radical' 4-bit IMA ADPCM (mono)"}, + {coding_APPLE_IMA4, "Apple Quicktime 4-bit IMA ADPCM"}, + {coding_SNDS_IMA, "Heavy Iron .snds 4-bit IMA ADPCM"}, + {coding_WS, "Westwood Studios ADPCM"}, + {coding_ACM, "InterPlay ACM"}, + {coding_NWA0, "NWA DPCM Level 0"}, + {coding_NWA1, "NWA DPCM Level 1"}, + {coding_NWA2, "NWA DPCM Level 2"}, + {coding_NWA3, "NWA DPCM Level 3"}, + {coding_NWA4, "NWA DPCM Level 4"}, + {coding_NWA5, "NWA DPCM Level 5"}, + {coding_MSADPCM, "Microsoft 4-bit ADPCM"}, + {coding_AICA, "Yamaha AICA 4-bit ADPCM"}, + {coding_NDS_PROCYON, "Procyon Studio Digital Sound Elements NDS 4-bit APDCM"}, + {coding_L5_555, "Level-5 0x555 4-bit ADPCM"}, + {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 + {coding_ogg_vorbis, "Vorbis"}, + #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"}, + {coding_MPEG1_L3, "MPEG-1 Layer III Audio (MP3)"}, + {coding_MPEG2_L1, "MPEG-2 Layer I Audio"}, + {coding_MPEG2_L2, "MPEG-2 Layer II Audio"}, + {coding_MPEG2_L3, "MPEG-2 Layer III Audio (MP3)"}, + {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 + {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 + {coding_G719, "ITU G.719 annex B (Polycom Siren 22)"}, + #endif + #ifdef VGM_USE_MAIATRAC3PLUS + {coding_AT3plus "ATRAC3plus"}, + #endif + #ifdef VGM_USE_FFMPEG + {coding_FFmpeg, "FFmpeg"}, + #endif +}; + +static const layout_info layout_info_list[] = { + {layout_none, "flat (no layout)"}, + {layout_interleave, "interleave"}, + {layout_interleave_shortblock, "interleave with short last block"}, + {layout_interleave_byte, "sub-frame interleave"}, + {layout_mxch_blocked, "MxCh blocked"}, + {layout_ast_blocked, "AST blocked"}, + {layout_halpst_blocked, "HALPST blocked"}, + {layout_xa_blocked, "CD-ROM XA"}, + {layout_ea_blocked, "Electronic Arts Audio Blocks"}, + {layout_eacs_blocked, "Electronic Arts (Old Version) Audio Blocks"}, + {layout_caf_blocked, "CAF blocked"}, + {layout_wsi_blocked, ".wsi blocked"}, + {layout_xvas_blocked, ".xvas blocked"}, + {layout_str_snds_blocked, ".str SNDS blocked"}, + {layout_ws_aud_blocked, "Westwood Studios .aud blocked"}, + {layout_matx_blocked, "Matrix .matx blocked"}, + {layout_de2_blocked, "de2 blocked"}, + {layout_vs_blocked, "vs blocked"}, + {layout_emff_ps2_blocked, "EMFF (PS2) blocked"}, + {layout_emff_ngc_blocked, "EMFF (NGC/WII) blocked"}, + {layout_gsb_blocked, "GSB blocked"}, + {layout_thp_blocked, "THP Movie Audio blocked"}, + {layout_filp_blocked, "FILp blocked"}, + {layout_psx_mgav_blocked, "MGAV blocked"}, + {layout_ps2_adm_blocked, "ADM blocked"}, + {layout_dsp_bdsp_blocked, "DSP blocked"}, + {layout_ivaud_blocked, "GTA IV blocked"}, + {layout_ps2_iab_blocked, "IAB blocked"}, + {layout_ps2_strlr_blocked, "The Bouncer STR blocked"}, + {layout_tra_blocked, "TRA blocked"}, + {layout_acm, "ACM blocked"}, + {layout_mus_acm, "multiple ACM files, ACM blocked"}, + {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 + {layout_ogg_vorbis, "Ogg"}, + #endif + #ifdef VGM_USE_MPEG + {layout_fake_mpeg, "MPEG Audio stream with incorrect frame headers"}, + {layout_mpeg, "MPEG Audio stream"}, + #endif +}; + +static const meta_info meta_info_list[] = { + {meta_RSTM, "Nintendo RSTM header"}, + {meta_STRM, "Nintendo STRM header"}, + {meta_ADX_03, "CRI ADX header type 03"}, + {meta_ADX_04, "CRI ADX header type 04"}, + {meta_ADX_05, "CRI ADX header type 05"}, + {meta_AIX, "CRI AIX header"}, + {meta_AAX, "CRI AAX header"}, + {meta_UTF_DSP, "CRI ADPCM_WII header"}, + {meta_DSP_AGSC, "Retro Studios AGSC header"}, + {meta_DSP_CSMP, "Retro Studios CSMP header"}, + {meta_NGC_ADPDTK, "assumed Nintendo ADP by .adp extension and valid first frame"}, + {meta_RSF, "assumed Retro Studios RSF by .rsf extension and valid first bytes"}, + {meta_AFC, "Nintendo AFC header"}, + {meta_AST, "Nintendo AST header"}, + {meta_HALPST, "HAL Laboratory HALPST header"}, + {meta_DSP_RS03, "Retro Studios RS03 header"}, + {meta_DSP_STD, "Standard Nintendo DSP header"}, + {meta_DSP_CSTR, "Namco Cstr header"}, + {meta_GCSW, "GCSW header"}, + {meta_PS2_SShd, "SShd header"}, + {meta_PS2_NPSF, "Namco Production Sound File (NPSF) header"}, + {meta_RWSD, "Nintendo RWSD header (single stream)"}, + {meta_RWAR, "Nintendo RWAR header (single RWAV stream)"}, + {meta_RWAV, "Nintendo RWAV header"}, + {meta_CWAV, "Nintendo CWAV header"}, + {meta_FWAV, "Nintendo FWAV header"}, + {meta_PSX_XA, "RIFF/CDXA header"}, + {meta_PS2_RXW, "RXWS header)"}, + {meta_PS2_RAW, "assumed RAW Interleaved PCM by .int extension"}, + {meta_PS2_OMU, "Alter Echo OMU Header"}, + {meta_DSP_STM, "Nintendo STM header"}, + {meta_PS2_EXST, "EXST header"}, + {meta_PS2_SVAG, "Konami SVAG header"}, + {meta_PS2_MIB, "assumed MIB Interleaved file by .mib extension"}, + {meta_PS2_MIB_MIH, "assumed MIB with MIH Info Header file by .mib+.mih extension"}, + {meta_DSP_MPDSP, "Single DSP header stereo by .mpdsp extension"}, + {meta_PS2_MIC, "assume KOEI MIC file by .mic extension"}, + {meta_DSP_JETTERS, "Double DSP header stereo by _lr.dsp extension"}, + {meta_DSP_MSS, "Double DSP header stereo by .mss extension"}, + {meta_DSP_GCM, "Double DSP header stereo by .gcm extension"}, + {meta_DSP_WII_IDSP, "Wii IDSP Double DSP header"}, + {meta_RSTM_SPM, "Nintendo RSTM header and .brstmspm extension"}, + {meta_RAW, "assumed RAW PCM file by .raw extension"}, + {meta_PS2_VAGi, "Sony VAG Interleaved header (VAGi)"}, + {meta_PS2_VAGp, "Sony VAG Mono header (VAGp)"}, + {meta_PS2_VAGs, "Sony VAG Stereo header (VAGp)"}, + {meta_PS2_VAGm, "Sony VAG Mono header (VAGm)"}, + {meta_PS2_pGAV, "Sony VAG Stereo Little Endian header (pGAV)"}, + {meta_PSX_GMS, "assumed Grandia GMS file by .gms extension"}, + {meta_PS2_STR, "assumed STR + STH File by .str & .sth extension"}, + {meta_PS2_ILD, "ILD header"}, + {meta_PS2_PNB, "assumed PNB (PsychoNauts Bgm File) by .pnb extension"}, + {meta_XBOX_WAVM, "assumed Xbox WAVM file by .wavm extension"}, + {meta_XBOX_RIFF, "Xbox RIFF/WAVE file with 0x0069 Codec ID"}, + {meta_DSP_STR, "assumed Conan Gamecube STR File by .str extension"}, + {meta_EAXA_R2, "Electronic Arts XA R2"}, + {meta_EAXA_R3, "Electronic Arts XA R3"}, + {meta_EA_ADPCM, "Electronic Arts XA R1"}, + {meta_EA_IMA, "Electronic Arts container with IMA blocks"}, + {meta_EAXA_PSX, "Electronic Arts With PSX ADPCM"}, + {meta_EA_PCM, "Electronic Arts With PCM"}, + {meta_CFN, "Namco CAF Header"}, + {meta_PS2_VPK, "VPK Header"}, + {meta_GENH, "GENH Generic Header"}, + {meta_DSP_SADB, "sadb header"}, + {meta_SADL, "sadl header"}, + {meta_PS2_BMDX, "Beatmania .bmdx header"}, + {meta_DSP_WSI, ".wsi header"}, + {meta_AIFC, "Audio Interchange File Format AIFF-C"}, + {meta_AIFF, "Audio Interchange File Format"}, + {meta_STR_SNDS, ".str SNDS SHDR chunk"}, + {meta_WS_AUD, "Westwood Studios .aud header"}, + {meta_WS_AUD_old, "Westwood Studios .aud (old) header"}, + {meta_PS2_IVB, "IVB/BVII header"}, + {meta_PS2_SVS, "Square SVS header"}, + {meta_RIFF_WAVE, "RIFF WAVE header"}, + {meta_RIFF_WAVE_POS, "RIFF WAVE header and .pos for looping"}, + {meta_NWA, "Visual Art's NWA header"}, + {meta_NWA_NWAINFOINI, "Visual Art's NWA header and NWAINFO.INI for looping"}, + {meta_NWA_GAMEEXEINI, "Visual Art's NWA header and Gameexe.ini for looping"}, + {meta_XSS, "Dino Crisis 3 XSS File"}, + {meta_HGC1, "Knights of the Temple 2 hgC1 Header"}, + {meta_AUS, "Capcom AUS Header"}, + {meta_RWS, "RWS Header"}, + {meta_EACS_PC, "EACS Header (PC)"}, + {meta_EACS_PSX, "EACS Header (PSX)"}, + {meta_EACS_SAT, "EACS Header (SATURN)"}, + {meta_SL3, "SL3 Header"}, + {meta_FSB1, "FMOD Sample Bank (FSB1) Header"}, + {meta_FSB2, "FMOD Sample Bank (FSB2) Header"}, + {meta_FSB3, "FMOD Sample Bank (FSB3) Header"}, + {meta_FSB4, "FMOD Sample Bank (FSB4) Header"}, + {meta_FSB5, "FMOD Sample Bank (FSB5) Header"}, + {meta_RWX, "RWX Header"}, + {meta_XWB, "XWB WBND Header"}, + {meta_XA30, "XA30 Header"}, + {meta_MUSC, "MUSC Header"}, + {meta_MUSX_V004, "MUSX / Version 004 Header"}, + {meta_MUSX_V005, "MUSX / Version 005 Header"}, + {meta_MUSX_V006, "MUSX / Version 006 Header"}, + {meta_MUSX_V010, "MUSX / Version 010 Header"}, + {meta_MUSX_V201, "MUSX / Version 201 Header"}, + {meta_LEG, "Legaia 2 - Duel Saga LEG Header"}, + {meta_FILP, "Bio Hazard - Gun Survivor FILp Header"}, + {meta_IKM, "Zwei!! IKM Header"}, + {meta_SFS, "Baroque SFS Header"}, + {meta_DVI, "DVI Header"}, + {meta_KCEY, "KCEYCOMP Header"}, + {meta_BG00, "Falcom BG00 Header"}, + {meta_PS2_RSTM, "Rockstar Games RSTM Header"}, + {meta_ACM, "InterPlay ACM Header"}, + {meta_MUS_ACM, "MUS playlist and multiple InterPlay ACM Headered files"}, + {meta_PS2_KCES, "Konami KCES Header"}, + {meta_PS2_DXH, "Tokobot Plus DXH Header"}, + {meta_PS2_PSH, "Dawn of Mana - Seiken Densetsu 4 PSH Header"}, + {meta_RIFF_WAVE_labl, "RIFF WAVE header with loop markers"}, + {meta_RIFF_WAVE_smpl, "RIFF WAVE header with sample looping info"}, + {meta_RIFX_WAVE, "RIFX WAVE header"}, + {meta_RIFX_WAVE_smpl, "RIFX WAVE header with sample looping info"}, + {meta_XNBm, "XNBm header"}, + {meta_PCM_SCD, "PCM file with custom header (SCD)"}, + {meta_PCM_PS2, "PCM file with custom header (PS2)"}, + {meta_PS2_RKV, "Legacy of Kain - Blood Omen 2 RKV Header"}, + {meta_PS2_PSW, "Rayman Raving Rabbids Riff Container File"}, + {meta_PS2_VAS, "Pro Baseball Spirits 5 VAS Header"}, + {meta_PS2_TEC, "assumed TECMO badflagged stream by .tec extension"}, + {meta_XBOX_WVS, "Metal Arms WVS Header (XBOX)"}, + {meta_NGC_WVS, "Metal Arms WVS Header (GameCube)"}, + {meta_XBOX_STMA, "Midnight Club 2 STMA Header"}, + {meta_XBOX_MATX, "assumed Matrix file by .matx extension"}, + {meta_DE2, "gurumin .de2 with embedded funky RIFF"}, + {meta_VS, "Men in Black VS Header"}, + {meta_DC_STR, "Sega Stream Asset Builder header"}, + {meta_DC_STR_V2, "variant of Sega Stream Asset Builder header"}, + {meta_XBOX_XMU, "XMU header"}, + {meta_XBOX_XVAS, "assumed TMNT file by .xvas extension"}, + {meta_PS2_XA2, "Acclaim XA2 Header"}, + {meta_DC_IDVI, "IDVI Header"}, + {meta_NGC_YMF, "YMF DSP Header"}, + {meta_PS2_CCC, "CCC Header"}, + {meta_PSX_FAG, "FAG Header"}, + {meta_PS2_MIHB, "Merged MIH+MIB"}, + {meta_DSP_WII_MUS, "mus header"}, + {meta_WII_SNG, "SNG DSP Header"}, + {meta_RSD2VAG, "RSD2/VAG Header"}, + {meta_RSD2PCMB, "RSD2/PCMB Header"}, + {meta_RSD2XADP, "RSD2/XADP Header"}, + {meta_RSD3VAG, "RSD3/VAG Header"}, + {meta_RSD3GADP, "RSD3/GADP Header"}, + {meta_RSD3PCM, "RSD3/PCM Header"}, + {meta_RSD3PCMB, "RSD3/PCMB Header"}, + {meta_RSD4PCMB, "RSD4/PCMB Header"}, + {meta_RSD4PCM, "RSD4/PCM Header"}, + {meta_RSD4RADP, "RSD4/RADP Header"}, + {meta_RSD4VAG, "RSD4/VAG Header"}, + {meta_RSD6XADP, "RSD6/XADP Header"}, + {meta_RSD6VAG, "RSD6/VAG Header"}, + {meta_RSD6WADP, "RSD6/WADP Header"}, + {meta_RSD6RADP, "RSD6/RADP Header"}, + {meta_DC_ASD, "ASD Header"}, + {meta_NAOMI_SPSD, "SPSD Header"}, + {meta_FFXI_BGW, "BGW BGMStream header"}, + {meta_FFXI_SPW, "SPW SeWave header"}, + {meta_PS2_ASS, "ASS Header"}, + {meta_IDSP, "IDSP Header"}, + {meta_WAA_WAC_WAD_WAM, "WAA/WAC/WAD/WAM RIFF Header"}, + {meta_PS2_SEG, "SEG (PS2) Header"}, + {meta_XBOX_SEG, "SEG (XBOX) Header"}, + {meta_NDS_STRM_FFTA2, "Final Fantasy Tactics A2 RIFF Header"}, + {meta_STR_ASR, "Donkey Kong Jet Race KNON/WII Header"}, + {meta_ZWDSP, "Zack and Wiki custom DSP Header"}, + {meta_GCA, "GCA DSP Header"}, + {meta_SPT_SPD, "SPT+SPD DSP Header"}, + {meta_ISH_ISD, "ISH+ISD DSP Header"}, + {meta_YDSP, "Yuke's DSP (YDSP) Header"}, + {meta_MSVP, "MSVP Header"}, + {meta_NGC_SSM, "SSM DSP Header"}, + {meta_PS2_JOE, "Disney/Pixar JOE Header"}, + {meta_VGS, "Guitar Hero Encore Rocks the 80's Header"}, + {meta_DC_DCSW_DCS, "Evil Twin DCS file with helper"}, + {meta_WII_SMP, "SMP DSP Header"}, + {meta_EMFF_PS2, "Eidos Music File Format Header"}, + {meta_EMFF_NGC, "Eidos Music File Format Header"}, + {meta_THP, "THP Movie File Format Header"}, + {meta_STS_WII, "Shikigami no Shiro (WII) Header"}, + {meta_PS2_P2BT, "Pop'n'Music 7 Header"}, + {meta_PS2_GBTS, "Pop'n'Music 9 Header"}, + {meta_NGC_DSP_IADP, "IADP Header"}, + {meta_RSTM_shrunken, "Nintendo RSTM header, corrupted by Atlus"}, + {meta_RIFF_WAVE_MWV, "RIFF WAVE header with .mwv flavoring"}, + {meta_RIFF_WAVE_SNS, "RIFF WAVE header with .sns flavoring"}, + {meta_FFCC_STR, "Final Fantasy: Crystal Chronicles STR header"}, + {meta_SAT_BAKA, "BAKA header from Crypt Killer"}, + {meta_NDS_SWAV, "SWAV Header"}, + {meta_PS2_VSF, "Musashi: Samurai Legend VSF Header"}, + {meta_NDS_RRDS, "Ridger Racer DS Header"}, + {meta_PS2_TK5, "Tekken 5 Stream Header"}, + {meta_PS2_SND, "Might and Magic SSND Header"}, + {meta_PS2_VSF_TTA, "VSF with SMSS Header"}, + {meta_ADS, "dhSS Header"}, + {meta_WII_STR, "HOTD Overkill - STR+STH WII Header"}, + {meta_PS2_MCG, "Gunvari MCG Header"}, + {meta_ZSD, "ZSD Header"}, + {meta_RedSpark, "RedSpark Header"}, + {meta_PC_IVAUD, "assumed GTA IV Audio file by .ivaud extension"}, + {meta_DSP_WII_WSD, "Standard Nintendo DSP headers in .wsd"}, + {meta_WII_NDP, "Vertigo NDP Header"}, + {meta_PS2_SPS, "Ape Escape 2 SPS Header"}, + {meta_PS2_XA2_RRP, "Acclaim XA2 Header"}, + {meta_NDS_HWAS, "NDS 'HWAS' Header"}, + {meta_NGC_LPS, "Rave Master LPS Header"}, + {meta_NAOMI_ADPCM, "NAOMI/NAOMI2 Arcade games ADPCM header"}, + {meta_SD9, "beatmania IIDX SD9 header"}, + {meta_2DX9, "beatmania IIDX 2DX9 header"}, + {meta_DSP_YGO, "Konami custom DSP Header"}, + {meta_PS2_VGV, "Rune: Viking Warlord VGV Header"}, + {meta_NGC_GCUB, "GCub Header"}, + {meta_NGC_SCK_DSP, "The Scorpion King SCK Header"}, + {meta_NGC_SWD, "PSF + Standard DSP Headers"}, + {meta_CAFF, "Apple Core Audio Format Header"}, + {meta_PC_MXST, "Lego Island MxSt Header"}, + {meta_PC_SOB_SAB, "Worms 4: Mayhem SOB/SAB Header"}, + {meta_MAXIS_XA, "Maxis XAI/XAJ Header"}, + {meta_EXAKT_SC, "assumed Activision / EXAKT SC by extension"}, + {meta_WII_BNS, "Nintendo BNS header"}, + {meta_WII_WAS, "WAS (iSWS) DSP header"}, + {meta_XBOX_HLWAV, "Half Life 2 bgm header"}, + {meta_STX, "Nintendo .stx header"}, + {meta_PS2_STM, "Red Dead Revolver .stm (.ps2stm)"}, + {meta_MYSPD, "U-Sing .myspd header"}, + {meta_HIS, "Her Interactive Sound header"}, + {meta_PS2_AST, "KOEI AST header"}, + {meta_CAPDSP, "Capcom custom DSP header"}, + {meta_DMSG, "RIFF/DMSGsegh header"}, + {meta_PONA_3DO, "Policenauts BGM header"}, + {meta_PONA_PSX, "Policenauts BGM header"}, + {meta_NGC_DSP_AAAP, "Double standard dsp header in 'AAAp'"}, + {meta_NGC_DSP_KONAMI, "Konami dsp header"}, + {meta_PS2_STER, "STER Header"}, + {meta_BNSF, "Namco Bandai BNSF header"}, + {meta_PS2_WB, "Shooting Love. ~TRIZEAL~ WB header"}, + {meta_S14, "assumed Polycom Siren 14 by .s14 extension"}, + {meta_SSS, "assumed Polycom Siren 14 by .sss extension"}, + {meta_PS2_GCM, "GCM 'MCG' Header"}, + {meta_PS2_SMPL, "Homura 'SMPL' Header"}, + {meta_PS2_MSA, "Psyvariar -Complete Edition- MSA header"}, + {meta_PC_SMP, "Ghostbusters .smp Header"}, + {meta_NGC_PDT, "PDT DSP header"}, + {meta_NGC_BO2, "Blood Omen 2 DSP header"}, + {meta_P3D, "Prototype P3D Header"}, + {meta_PS2_TK1, "Tekken TK5STRM1 Header"}, + {meta_PS2_ADSC, "ADSC Header"}, + {meta_NGC_DSP_MPDS, "MPDS DSP header"}, + {meta_DSP_STR_IG, "Infogrames dual dsp header"}, + {meta_PSX_MGAV, "Electronic Arts RVWS header"}, + {meta_PS2_B1S, "B1S header"}, + {meta_PS2_WAD, "WAD header"}, + {meta_DSP_XIII, "XIII dsp header"}, + {meta_NGC_DSP_STH_STR, "STH dsp header"}, + {meta_DSP_CABELAS, "Cabelas games dsp header"}, + {meta_PS2_LPCM, "LPCM header"}, + {meta_PS2_VMS, "VMS Header"}, + {meta_PS2_XAU, "XAU Header"}, + {meta_GH3_BAR, "Guitar Hero III Mobile .bar"}, + {meta_FFW, "Freedom Fighters BGM header"}, + {meta_DSP_DSPW, "DSPW dsp header"}, + {meta_PS2_JSTM, "JSTM Header"}, + {meta_PS3_XVAG, "XVAG Header"}, + {meta_PS3_CPS, "CPS Header"}, + {meta_SQEX_SCD, "Square-Enix SCD"}, + {meta_NGC_NST_DSP, "Animaniacs NST header"}, + {meta_BAF, ".baf WAVE header"}, + {meta_PS3_MSF, "PS3 MSF header"}, + {meta_NUB_VAG, "VAG (NUB) header"}, + {meta_PS3_PAST, "SNDP header"}, + {meta_PS3_SGDX, "SGXD header"}, + {meta_NGCA, "NGCA header"}, + {meta_WII_RAS, "RAS header"}, + {meta_PS2_SPM, "SPM header"}, + {meta_X360_TRA, "assumed DefJam Rapstar Audio File by .tra extension"}, + {meta_PS2_VGS, "Princess Soft VGS header"}, + {meta_PS2_IAB, "IAB header"}, + {meta_PS2_STRLR, "STR L/R header"}, + {meta_LSF_N1NJ4N, ".lsf !n1nj4n header"}, + {meta_VAWX, "feelplus VAWX header"}, + {meta_PC_SNDS, "assumed Heavy Iron IMA by .snds extension"}, + {meta_PS2_WMUS, "assumed The Warriors Sony ADPCM by .wmus extension"}, + {meta_HYPERSCAN_KVAG, "Mattel Hyperscan KVAG"}, + {meta_IOS_PSND, "PSND Header"}, + {meta_BOS_ADP, "ADP! header"}, + {meta_EB_SFX, "Excitebots .sfx header"}, + {meta_EB_SF0, "assumed Excitebots .sf0 by extension"}, + {meta_PS3_KLBS, "klBS Header"}, + {meta_PS2_MTAF, "Konami MTAF header"}, + {meta_PS2_VAG1, "Konami VAG Mono header (VAG1)"}, + {meta_PS2_VAG2, "Konami VAG Stereo header (VAG2)"}, + {meta_TUN, "TUN 'ALP' header"}, + {meta_WPD, "WPD 'DPW' header"}, + {meta_MN_STR, "Mini Ninjas 'STR' header"}, + {meta_PS2_MSS, "Guerilla MSCC header"}, + {meta_PS2_HSF, "Lowrider 'HSF' header"}, + {meta_PS3_IVAG, "PS3 'IVAG' Header"}, + {meta_PS2_2PFS, "PS2 '2PFS' Header"}, + {meta_RSD6OOGV, "RSD6/OOGV Header"}, + {meta_UBI_CKD, "CKD 'RIFF' Header"}, + {meta_PS2_VBK, "PS2 VBK Header"}, + {meta_OTM, "Otomedius OTM Header"}, + {meta_CSTM, "Nintendo 3DS CSTM Header"}, + {meta_FSTM, "Nintendo Wii U FSTM Header"}, + {meta_G1L, "Tecmo Koei G1L Header"}, + {meta_3DS_IDSP, "Nintendo 3DS IDSP Header"}, + {meta_WIIU_BTSND, "Wii U Menu Boot Sound"}, + {meta_MCA, "Capcom MCA Header"}, + {meta_XB3D_ADX, "Xenoblade 3D ADX Header"}, + {meta_HCA, "CRI MiddleWare HCA Header"}, + {meta_PS2_SVAG_SNK, "SNK SVAG 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"}, + {meta_OGG_SFL, "Ogg Vorbis with SFPL for looping"}, + {meta_OGG_UM3, "Ogg Vorbis, Ultramarine3 'encryption'"}, + {meta_OGG_KOVS, "Ogg Vorbis, KOVS header"}, + {meta_OGG_PSYCH, "Ogg Vorbis, Psychic Software obfuscation"}, + #endif + #ifdef VGM_USE_MPEG + {meta_AHX, "CRI AHX header"}, + #endif + #ifdef VGM_USE_MP4V2 + {meta_MP4, "AAC header"}, + #endif + #ifdef VGM_USE_FFMPEG + {meta_FFmpeg, "FFmpeg supported file format"}, + #endif +}; + + +const char * get_vgmstream_coding_description(coding_t coding_type) { + int i, list_length; + + list_length = sizeof(coding_info_list) / sizeof(coding_info); + for (i=0; i < list_length; i++) { + if (coding_info_list[i].type == coding_type) + return coding_info_list[i].description; + } + + return NULL; +} +const char * get_vgmstream_layout_description(layout_t layout_type) { + int i, list_length; + + list_length = sizeof(layout_info_list) / sizeof(layout_info); + for (i=0; i < list_length; i++) { + if (layout_info_list[i].type == layout_type) + return layout_info_list[i].description; + } + + return NULL; +} +const char * get_vgmstream_meta_description(meta_t meta_type) { + int i, list_length; + + list_length = sizeof(meta_info_list) / sizeof(meta_info); + for (i=0; i < list_length; i++) { + if (meta_info_list[i].type == meta_type) + return meta_info_list[i].description; + } + + return NULL; +} diff --git a/src/formats.h b/src/formats.h index 447cfca8..2fe6d910 100644 --- a/src/formats.h +++ b/src/formats.h @@ -4,6 +4,7 @@ #ifndef _FORMATS_H_ #define _FORMATS_H_ +#include "vgmstream.h" /* rough number of chars counting all extensions (actually <1500 and extra space) */ #define VGM_EXTENSION_LIST_CHAR_SIZE 2000 @@ -11,5 +12,8 @@ const char ** vgmstream_get_formats(); int vgmstream_get_formats_length(); +const char * get_vgmstream_coding_description(coding_t coding_type); +const char * get_vgmstream_layout_description(layout_t layout_type); +const char * get_vgmstream_meta_description(meta_t meta_type); #endif /* _FORMATS_H_ */ diff --git a/src/vgmstream.c b/src/vgmstream.c index fe2d1880..216501cd 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -5,6 +5,7 @@ #include #include #include +#include "formats.h" #include "vgmstream.h" #include "meta/meta.h" #include "layout/layout.h" @@ -1850,6 +1851,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { #define TEMPSIZE 256 char temp[TEMPSIZE]; + const char* description; if (!vgmstream) { snprintf(temp,TEMPSIZE,"NULL VGMSTREAM"); @@ -1879,399 +1881,51 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { snprintf(temp,TEMPSIZE,"encoding: "); concatn(length,desc,temp); - switch (vgmstream->coding_type) { - case coding_PCM16BE: - snprintf(temp,TEMPSIZE,"Big Endian 16-bit PCM"); - break; - case coding_PCM16LE: - snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM"); - break; - case coding_PCM16LE_int: - snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM with 2 byte interleave"); - break; - case coding_PCM16LE_XOR_int: - snprintf(temp,TEMPSIZE,"Little Endian 16-bit PCM with 2 byte interleave and XOR obfuscation"); - break; - case coding_PCM8: - snprintf(temp,TEMPSIZE,"8-bit PCM"); - break; - case coding_PCM8_U: - snprintf(temp,TEMPSIZE,"8-bit unsigned PCM"); - break; - case coding_PCM8_U_int: - snprintf(temp,TEMPSIZE,"8-bit unsigned PCM with 1 byte interleave"); - break; - case coding_PCM8_int: - snprintf(temp,TEMPSIZE,"8-bit PCM with 1 byte interleave"); - break; - case coding_PCM8_SB_int: - snprintf(temp,TEMPSIZE,"8-bit PCM with sign bit, 1 byte interleave"); - break; - case coding_CRI_ADX: - snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM"); - break; - case coding_CRI_ADX_enc_8: - snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)"); - break; - case coding_CRI_ADX_enc_9: - snprintf(temp,TEMPSIZE,"CRI ADX 4-bit ADPCM (type 8 encryption)"); - break; - case coding_NGC_DSP: - snprintf(temp,TEMPSIZE,"Nintendo DSP 4-bit ADPCM"); - break; - case coding_NGC_DTK: - snprintf(temp,TEMPSIZE,"Nintendo DTK 4-bit ADPCM"); - break; - case coding_NGC_AFC: - snprintf(temp,TEMPSIZE,"Nintendo AFC 4-bit ADPCM"); - break; - - case coding_CRI_HCA: - snprintf(temp,TEMPSIZE,"CRI HCA"); - break; - case coding_NDS_IMA: - snprintf(temp,TEMPSIZE,"NDS-style 4-bit IMA ADPCM"); - break; - case coding_DAT4_IMA: - snprintf(temp,TEMPSIZE,"Eurocom DAT4 4-bit IMA ADPCM"); - break; - case coding_G721: - snprintf(temp,TEMPSIZE,"CCITT G.721 4-bit ADPCM"); - break; - case coding_PSX: - snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM"); - break; - case coding_PSX_badflags: - snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (bad flags)"); - break; - case coding_PSX_bmdx: - snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (BMDX encryption)"); - break; - case coding_PSX_cfg: - snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)"); - break; - case coding_HEVAG: - snprintf(temp,TEMPSIZE,"Playstation Vita HEVAG 4-bit ADPCM"); - break; - case coding_XA: - snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM"); - break; - case coding_XBOX: - snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM"); - break; - case coding_INT_XBOX: - snprintf(temp,TEMPSIZE,"XBOX 4-bit IMA ADPCM (interleaved)"); - break; - case coding_EA_XA: - snprintf(temp,TEMPSIZE,"Electronic Arts 4-bit ADPCM (XA based)"); - break; - case coding_EA_ADPCM: - snprintf(temp,TEMPSIZE,"Electronic Arts R1 4-bit ADPCM (XA based)"); - break; - case coding_SDX2: - snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM"); - break; - case coding_SDX2_int: - snprintf(temp,TEMPSIZE,"Squareroot-delta-exact (SDX2) 8-bit DPCM with 1 byte interleave"); - break; - case coding_CBD2: - snprintf(temp,TEMPSIZE,"Cuberoot-delta-exact (CBD2) 8-bit DPCM"); - break; - case coding_CBD2_int: - snprintf(temp,TEMPSIZE,"Cuberoot-delta-exact (CBD2) 8-bit DPCM with 1 byte interleave"); - break; - case coding_DVI_IMA: - snprintf(temp,TEMPSIZE,"Intel DVI 4-bit IMA ADPCM"); - break; - case coding_INT_DVI_IMA: - snprintf(temp,TEMPSIZE,"Interleaved Intel DVI 4-bit IMA ADPCM"); - break; - case coding_EACS_IMA: - snprintf(temp,TEMPSIZE,"EACS 4-bit IMA ADPCM"); - break; - case coding_MAXIS_ADPCM: - snprintf(temp,TEMPSIZE,"Maxis XA (EA ADPCM Variant)"); - break; - case coding_INT_IMA: - snprintf(temp,TEMPSIZE,"Interleaved 4-bit IMA ADPCM"); - break; - case coding_IMA: - snprintf(temp,TEMPSIZE,"4-bit IMA ADPCM"); - break; - case coding_MS_IMA: - snprintf(temp,TEMPSIZE,"Microsoft 4-bit IMA ADPCM"); - break; - case coding_RAD_IMA: - snprintf(temp,TEMPSIZE,"\"Radical\" 4-bit IMA ADPCM"); - break; - case coding_RAD_IMA_mono: - snprintf(temp,TEMPSIZE,"\"Radical\" 4-bit IMA ADPCM (mono)"); - break; - case coding_APPLE_IMA4: - snprintf(temp,TEMPSIZE,"Apple Quicktime 4-bit IMA ADPCM"); - break; - case coding_SNDS_IMA: - snprintf(temp,TEMPSIZE,"Heavy Iron .snds 4-bit IMA ADPCM"); - break; - case coding_WS: - snprintf(temp,TEMPSIZE,"Westwood Studios ADPCM"); - break; -#ifdef VGM_USE_VORBIS - case coding_ogg_vorbis: - snprintf(temp,TEMPSIZE,"Vorbis"); - break; -#endif -#ifdef VGM_USE_MPEG - case coding_fake_MPEG2_L2: - snprintf(temp,TEMPSIZE,"MPEG-2 Layer II Audio"); - break; - case coding_MPEG1_L1: - snprintf(temp,TEMPSIZE,"MPEG-1 Layer I Audio"); - break; - case coding_MPEG1_L2: - snprintf(temp,TEMPSIZE,"MPEG-1 Layer II Audio"); - break; - case coding_MPEG1_L3: - snprintf(temp,TEMPSIZE,"MPEG-1 Layer III Audio (MP3)"); - break; - case coding_MPEG2_L1: - snprintf(temp,TEMPSIZE,"MPEG-2 Layer I Audio"); - break; - case coding_MPEG2_L2: - snprintf(temp,TEMPSIZE,"MPEG-2 Layer II Audio"); - break; - case coding_MPEG2_L3: - snprintf(temp,TEMPSIZE,"MPEG-2 Layer III Audio (MP3)"); - break; - case coding_MPEG25_L1: - snprintf(temp,TEMPSIZE,"MPEG-2.5 Layer I Audio"); - break; - case coding_MPEG25_L2: - snprintf(temp,TEMPSIZE,"MPEG-2.5 Layer II Audio"); - break; - case coding_MPEG25_L3: - snprintf(temp,TEMPSIZE,"MPEG-2.5 Layer III Audio (MP3)"); - break; -#endif -#ifdef VGM_USE_G7221 - case coding_G7221: - snprintf(temp,TEMPSIZE,"ITU G.722.1 (Polycom Siren 7)"); - break; - case coding_G7221C: - snprintf(temp,TEMPSIZE,"ITU G.722.1 annex C (Polycom Siren 14)"); - break; -#endif -#ifdef VGM_USE_G719 - case coding_G719: - snprintf(temp,TEMPSIZE,"ITU G.719 annex B (Polycom Siren 22)"); - break; -#endif -#ifdef VGM_USE_MAIATRAC3PLUS - case coding_AT3plus: - snprintf(temp,TEMPSIZE,"ATRAC3plus"); - break; -#endif #ifdef VGM_USE_FFMPEG - case coding_FFmpeg: - { - ffmpeg_codec_data *data = (ffmpeg_codec_data *) vgmstream->codec_data; - if (vgmstream->codec_data) { - if (data->codec && data->codec->long_name) { - snprintf(temp,TEMPSIZE,data->codec->long_name); - } - else if (data->codec && data->codec->name) { - snprintf(temp,TEMPSIZE,data->codec->name); - } - else { - snprintf(temp,TEMPSIZE,"FFmpeg (unknown codec)"); - } - } - else { - snprintf(temp,TEMPSIZE,"FFmpeg"); + case coding_FFmpeg: { + ffmpeg_codec_data *data = (ffmpeg_codec_data *) vgmstream->codec_data; + if (vgmstream->codec_data) { + if (data->codec && data->codec->long_name) { + snprintf(temp,TEMPSIZE,data->codec->long_name); + } else if (data->codec && data->codec->name) { + snprintf(temp,TEMPSIZE,data->codec->name); + } else { + snprintf(temp,TEMPSIZE,"FFmpeg (unknown codec)"); } + } else { + snprintf(temp,TEMPSIZE,"FFmpeg"); } break; + } #endif - - case coding_ACM: - snprintf(temp,TEMPSIZE,"InterPlay ACM"); - break; - case coding_NWA0: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 0"); - break; - case coding_NWA1: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 1"); - break; - case coding_NWA2: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 2"); - break; - case coding_NWA3: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 3"); - break; - case coding_NWA4: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 4"); - break; - case coding_NWA5: - snprintf(temp,TEMPSIZE,"NWA DPCM Level 5"); - break; - case coding_MSADPCM: - snprintf(temp,TEMPSIZE,"Microsoft 4-bit ADPCM"); - break; - case coding_AICA: - snprintf(temp,TEMPSIZE,"Yamaha AICA 4-bit ADPCM"); - break; - case coding_NDS_PROCYON: - snprintf(temp,TEMPSIZE,"Procyon Studio Digital Sound Elements NDS 4-bit APDCM"); - break; - case coding_L5_555: - snprintf(temp,TEMPSIZE,"Level-5 0x555 4-bit ADPCM"); - break; - case coding_SASSC: - snprintf(temp,TEMPSIZE,"Activision / EXAKT SASSC 8-bit DPCM"); - break; - case coding_LSF: - snprintf(temp,TEMPSIZE,"lsf 4-bit ADPCM"); - break; - case coding_MTAF: - snprintf(temp,TEMPSIZE,"Konami MTAF 4-bit ADPCM"); - break; default: - snprintf(temp,TEMPSIZE,"CANNOT DECODE"); + description = get_vgmstream_coding_description(vgmstream->coding_type); + if (!description) + description = "CANNOT DECODE"; + snprintf(temp,TEMPSIZE,description); + break; } concatn(length,desc,temp); snprintf(temp,TEMPSIZE,"\nlayout: "); concatn(length,desc,temp); - switch (vgmstream->layout_type) { - case layout_none: - snprintf(temp,TEMPSIZE,"flat (no layout)"); - break; - case layout_interleave: - snprintf(temp,TEMPSIZE,"interleave"); - break; - case layout_interleave_shortblock: - snprintf(temp,TEMPSIZE,"interleave with short last block"); - break; - case layout_interleave_byte: - snprintf(temp,TEMPSIZE,"sub-frame interleave"); - break; - case layout_mxch_blocked: - snprintf(temp,TEMPSIZE,"MxCh blocked"); - break; - case layout_ast_blocked: - snprintf(temp,TEMPSIZE,"AST blocked"); - break; - case layout_halpst_blocked: - snprintf(temp,TEMPSIZE,"HALPST blocked"); - break; - case layout_xa_blocked: - snprintf(temp,TEMPSIZE,"CD-ROM XA"); - break; - case layout_ea_blocked: - snprintf(temp,TEMPSIZE,"Electronic Arts Audio Blocks"); - break; - case layout_eacs_blocked: - snprintf(temp,TEMPSIZE,"Electronic Arts (Old Version) Audio Blocks"); - break; - case layout_caf_blocked: - snprintf(temp,TEMPSIZE,"CAF blocked"); - break; - case layout_wsi_blocked: - snprintf(temp,TEMPSIZE,".wsi blocked"); - break; - case layout_xvas_blocked: - snprintf(temp,TEMPSIZE,".xvas blocked"); - break; -#ifdef VGM_USE_VORBIS - case layout_ogg_vorbis: - snprintf(temp,TEMPSIZE,"Ogg"); - break; -#endif - case layout_str_snds_blocked: - snprintf(temp,TEMPSIZE,".str SNDS blocked"); - break; - case layout_ws_aud_blocked: - snprintf(temp,TEMPSIZE,"Westwood Studios .aud blocked"); - break; - case layout_matx_blocked: - snprintf(temp,TEMPSIZE,"Matrix .matx blocked"); - break; - case layout_de2_blocked: - snprintf(temp,TEMPSIZE,"de2 blocked"); - break; - case layout_vs_blocked: - snprintf(temp,TEMPSIZE,"vs blocked"); - break; - case layout_emff_ps2_blocked: - snprintf(temp,TEMPSIZE,"EMFF (PS2) blocked"); - break; - case layout_emff_ngc_blocked: - snprintf(temp,TEMPSIZE,"EMFF (NGC/WII) blocked"); - break; - case layout_gsb_blocked: - snprintf(temp,TEMPSIZE,"GSB blocked"); - break; - case layout_thp_blocked: - snprintf(temp,TEMPSIZE,"THP Movie Audio blocked"); - break; - case layout_filp_blocked: - snprintf(temp,TEMPSIZE,"FILp blocked"); - break; - case layout_psx_mgav_blocked: - snprintf(temp,TEMPSIZE,"MGAV blocked"); - break; - case layout_ps2_adm_blocked: - snprintf(temp,TEMPSIZE,"ADM blocked"); - break; - case layout_dsp_bdsp_blocked: - snprintf(temp,TEMPSIZE,"DSP blocked"); - break; -#ifdef VGM_USE_MPEG - case layout_fake_mpeg: - snprintf(temp,TEMPSIZE,"MPEG Audio stream with incorrect frame headers"); - break; - case layout_mpeg: - snprintf(temp,TEMPSIZE,"MPEG Audio stream"); - break; -#endif - case layout_acm: - snprintf(temp,TEMPSIZE,"ACM blocked"); - break; - case layout_mus_acm: - snprintf(temp,TEMPSIZE,"multiple ACM files, ACM blocked"); - break; - case layout_aix: - snprintf(temp,TEMPSIZE,"AIX interleave, internally 18-byte interleaved"); - break; - case layout_aax: - snprintf(temp,TEMPSIZE,"AAX blocked, 18-byte interleaved"); - break; - case layout_ivaud_blocked: - snprintf(temp,TEMPSIZE,"GTA IV blocked"); - break; - case layout_ps2_iab_blocked: - snprintf(temp,TEMPSIZE,"IAB blocked"); - break; - case layout_ps2_strlr_blocked: - snprintf(temp,TEMPSIZE,"The Bouncer STR blocked"); - break; - case layout_tra_blocked: - snprintf(temp,TEMPSIZE,"TRA blocked"); - break; - case layout_scd_int: - snprintf(temp,TEMPSIZE,"SCD multistream interleave"); - break; default: - snprintf(temp,TEMPSIZE,"INCONCEIVABLE"); + description = get_vgmstream_layout_description(vgmstream->layout_type); + if (!description) + description = "INCONCEIVABLE"; + snprintf(temp,TEMPSIZE,description); + break; } concatn(length,desc,temp); snprintf(temp,TEMPSIZE,"\n"); concatn(length,desc,temp); - if (vgmstream->layout_type == layout_interleave || vgmstream->layout_type == layout_interleave_shortblock || vgmstream->layout_type == layout_interleave_byte) { + if (vgmstream->layout_type == layout_interleave + || vgmstream->layout_type == layout_interleave_shortblock + || vgmstream->layout_type == layout_interleave_byte) { snprintf(temp,TEMPSIZE,"interleave: %#x bytes\n", (int32_t)vgmstream->interleave_block_size); concatn(length,desc,temp); @@ -2287,990 +1941,17 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { concatn(length,desc,temp); switch (vgmstream->meta_type) { - case meta_RSTM: - snprintf(temp,TEMPSIZE,"Nintendo RSTM header"); + default: + description = get_vgmstream_meta_description(vgmstream->meta_type); + if (!description) + description = "THEY SHOULD HAVE SENT A POET"; + snprintf(temp,TEMPSIZE,description); break; - case meta_STRM: - snprintf(temp,TEMPSIZE,"Nintendo STRM header"); - break; - case meta_ADX_03: - snprintf(temp,TEMPSIZE,"CRI ADX header type 03"); - break; - case meta_ADX_04: - snprintf(temp,TEMPSIZE,"CRI ADX header type 04"); - break; - case meta_ADX_05: - snprintf(temp,TEMPSIZE,"CRI ADX header type 05"); - break; - case meta_AIX: - snprintf(temp,TEMPSIZE,"CRI AIX header"); - break; - case meta_AAX: - snprintf(temp,TEMPSIZE,"CRI AAX header"); - break; - case meta_UTF_DSP: - snprintf(temp,TEMPSIZE,"CRI ADPCM_WII header"); - break; - case meta_DSP_AGSC: - snprintf(temp,TEMPSIZE,"Retro Studios AGSC header"); - break; - case meta_DSP_CSMP: - snprintf(temp,TEMPSIZE,"Retro Studios CSMP header"); - break; - case meta_NGC_ADPDTK: - snprintf(temp,TEMPSIZE,"assumed Nintendo ADP by .adp extension and valid first frame"); - break; - case meta_RSF: - snprintf(temp,TEMPSIZE,"assumed Retro Studios RSF by .rsf extension and valid first bytes"); - break; - case meta_AFC: - snprintf(temp,TEMPSIZE,"Nintendo AFC header"); - break; - case meta_AST: - snprintf(temp,TEMPSIZE,"Nintendo AST header"); - break; - case meta_HALPST: - snprintf(temp,TEMPSIZE,"HAL Laboratory HALPST header"); - break; - case meta_DSP_RS03: - snprintf(temp,TEMPSIZE,"Retro Studios RS03 header"); - break; - case meta_DSP_STD: - snprintf(temp,TEMPSIZE,"Standard Nintendo DSP header"); - break; - case meta_DSP_CSTR: - snprintf(temp,TEMPSIZE,"Namco Cstr header"); - break; - case meta_GCSW: - snprintf(temp,TEMPSIZE,"GCSW header"); - break; - case meta_PS2_SShd: - snprintf(temp,TEMPSIZE,"SShd header"); - break; - case meta_PS2_NPSF: - snprintf(temp,TEMPSIZE,"Namco Production Sound File (NPSF) header"); - break; - case meta_RWSD: - snprintf(temp,TEMPSIZE,"Nintendo RWSD header (single stream)"); - break; - case meta_RWAR: - snprintf(temp,TEMPSIZE,"Nintendo RWAR header (single RWAV stream)"); - break; - case meta_RWAV: - snprintf(temp,TEMPSIZE,"Nintendo RWAV header"); - break; - case meta_CWAV: - snprintf(temp,TEMPSIZE,"Nintendo CWAV header"); - break; - case meta_FWAV: - snprintf(temp,TEMPSIZE,"Nintendo FWAV header"); - break; - case meta_PSX_XA: - snprintf(temp,TEMPSIZE,"RIFF/CDXA header"); - break; - case meta_PS2_RXW: - snprintf(temp,TEMPSIZE,"RXWS header)"); - break; - case meta_PS2_RAW: - snprintf(temp,TEMPSIZE,"assumed RAW Interleaved PCM by .int extension"); - break; - case meta_PS2_OMU: - snprintf(temp,TEMPSIZE,"Alter Echo OMU Header"); - break; - case meta_DSP_STM: - snprintf(temp,TEMPSIZE,"Nintendo STM header"); - break; - case meta_PS2_EXST: - snprintf(temp,TEMPSIZE,"EXST header"); - break; - case meta_PS2_SVAG: - snprintf(temp,TEMPSIZE,"Konami SVAG header"); - break; - case meta_PS2_MIB: - snprintf(temp,TEMPSIZE,"assumed MIB Interleaved file by .mib extension"); - break; - case meta_PS2_MIB_MIH: - snprintf(temp,TEMPSIZE,"assumed MIB with MIH Info Header file by .mib+.mih extension"); - break; - case meta_DSP_MPDSP: - snprintf(temp,TEMPSIZE,"Single DSP header stereo by .mpdsp extension"); - break; - case meta_PS2_MIC: - snprintf(temp,TEMPSIZE,"assume KOEI MIC file by .mic extension"); - break; - case meta_DSP_JETTERS: - snprintf(temp,TEMPSIZE,"Double DSP header stereo by _lr.dsp extension"); - break; - case meta_DSP_MSS: - snprintf(temp,TEMPSIZE,"Double DSP header stereo by .mss extension"); - break; - case meta_DSP_GCM: - snprintf(temp,TEMPSIZE,"Double DSP header stereo by .gcm extension"); - break; - case meta_DSP_WII_IDSP: - snprintf(temp,TEMPSIZE,"Wii IDSP Double DSP header"); - break; - case meta_RSTM_SPM: - snprintf(temp,TEMPSIZE,"Nintendo RSTM header and .brstmspm extension"); - break; - case meta_RAW: - snprintf(temp,TEMPSIZE,"assumed RAW PCM file by .raw extension"); - break; - case meta_PS2_VAGi: - snprintf(temp,TEMPSIZE,"Sony VAG Interleaved header (VAGi)"); - break; - case meta_PS2_VAGp: - snprintf(temp,TEMPSIZE,"Sony VAG Mono header (VAGp)"); - break; - case meta_PS2_VAGs: - snprintf(temp,TEMPSIZE,"Sony VAG Stereo header (VAGp)"); - break; - case meta_PS2_VAGm: - snprintf(temp,TEMPSIZE,"Sony VAG Mono header (VAGm)"); - break; - case meta_PS2_pGAV: - snprintf(temp,TEMPSIZE,"Sony VAG Stereo Little Endian header (pGAV)"); - break; - case meta_PSX_GMS: - snprintf(temp,TEMPSIZE,"assumed Grandia GMS file by .gms extension"); - break; - case meta_PS2_STR: - snprintf(temp,TEMPSIZE,"assumed STR + STH File by .str & .sth extension"); - break; - case meta_PS2_ILD: - snprintf(temp,TEMPSIZE,"ILD header"); - break; - case meta_PS2_PNB: - snprintf(temp,TEMPSIZE,"assumed PNB (PsychoNauts Bgm File) by .pnb extension"); - break; - case meta_XBOX_WAVM: - snprintf(temp,TEMPSIZE,"assumed Xbox WAVM file by .wavm extension"); - break; - case meta_XBOX_RIFF: - snprintf(temp,TEMPSIZE,"Xbox RIFF/WAVE file with 0x0069 Codec ID"); - break; - case meta_DSP_STR: - snprintf(temp,TEMPSIZE,"assumed Conan Gamecube STR File by .str extension"); - break; - case meta_EAXA_R2: - snprintf(temp,TEMPSIZE,"Electronic Arts XA R2"); - break; - case meta_EAXA_R3: - snprintf(temp,TEMPSIZE,"Electronic Arts XA R3"); - break; - case meta_EA_ADPCM: - snprintf(temp,TEMPSIZE,"Electronic Arts XA R1"); - break; - case meta_EA_IMA: - snprintf(temp,TEMPSIZE,"Electronic Arts container with IMA blocks"); - break; - case meta_EAXA_PSX: - snprintf(temp,TEMPSIZE,"Electronic Arts With PSX ADPCM"); - break; - case meta_EA_PCM: - snprintf(temp,TEMPSIZE,"Electronic Arts With PCM"); - break; - case meta_CFN: - snprintf(temp,TEMPSIZE,"Namco CAF Header"); - break; - case meta_PS2_VPK: - snprintf(temp,TEMPSIZE,"VPK Header"); - break; - case meta_GENH: - snprintf(temp,TEMPSIZE,"GENH Generic Header"); - break; -#ifdef VGM_USE_VORBIS - case meta_OGG_VORBIS: - snprintf(temp,TEMPSIZE,"Ogg Vorbis"); - break; - case meta_OGG_SLI: - snprintf(temp,TEMPSIZE,"Ogg Vorbis with .sli (start,length) for looping"); - break; - case meta_OGG_SLI2: - snprintf(temp,TEMPSIZE,"Ogg Vorbis with .sli (from,to) for looping"); - break; - case meta_OGG_SFL: - snprintf(temp,TEMPSIZE,"Ogg Vorbis with SFPL for looping"); - break; - case meta_OGG_UM3: - snprintf(temp,TEMPSIZE,"Ogg Vorbis, Ultramarine3 \"encryption\""); - break; - case meta_OGG_KOVS: - snprintf(temp,TEMPSIZE,"Ogg Vorbis, KOVS header"); - break; - case meta_OGG_PSYCH: - snprintf(temp,TEMPSIZE,"Ogg Vorbis, Psychic Software obfuscation"); - break; -#endif - case meta_DSP_SADB: - snprintf(temp,TEMPSIZE,"sadb header"); - break; - case meta_SADL: - snprintf(temp,TEMPSIZE,"sadl header"); - break; - case meta_PS2_BMDX: - snprintf(temp,TEMPSIZE,"Beatmania .bmdx header"); - break; - case meta_DSP_WSI: - snprintf(temp,TEMPSIZE,".wsi header"); - break; - case meta_AIFC: - snprintf(temp,TEMPSIZE,"Audio Interchange File Format AIFF-C"); - break; - case meta_AIFF: - snprintf(temp,TEMPSIZE,"Audio Interchange File Format"); - break; - case meta_STR_SNDS: - snprintf(temp,TEMPSIZE,".str SNDS SHDR chunk"); - break; - case meta_WS_AUD: - snprintf(temp,TEMPSIZE,"Westwood Studios .aud header"); - break; - case meta_WS_AUD_old: - snprintf(temp,TEMPSIZE,"Westwood Studios .aud (old) header"); - break; -#ifdef VGM_USE_MPEG - case meta_AHX: - snprintf(temp,TEMPSIZE,"CRI AHX header"); - break; -#endif - case meta_PS2_IVB: - snprintf(temp,TEMPSIZE,"IVB/BVII header"); - break; - case meta_PS2_SVS: - snprintf(temp,TEMPSIZE,"Square SVS header"); - break; - case meta_RIFF_WAVE: - snprintf(temp,TEMPSIZE,"RIFF WAVE header"); - break; - case meta_RIFF_WAVE_POS: - snprintf(temp,TEMPSIZE,"RIFF WAVE header and .pos for looping"); - break; - case meta_NWA: - snprintf(temp,TEMPSIZE,"Visual Art's NWA header"); - break; - case meta_NWA_NWAINFOINI: - snprintf(temp,TEMPSIZE,"Visual Art's NWA header and NWAINFO.INI for looping"); - break; - case meta_NWA_GAMEEXEINI: - snprintf(temp,TEMPSIZE,"Visual Art's NWA header and Gameexe.ini for looping"); - break; - case meta_XSS: - snprintf(temp,TEMPSIZE,"Dino Crisis 3 XSS File"); - break; - case meta_HGC1: - snprintf(temp,TEMPSIZE,"Knights of the Temple 2 hgC1 Header"); - break; - case meta_AUS: - snprintf(temp,TEMPSIZE,"Capcom AUS Header"); - break; - case meta_RWS: - snprintf(temp,TEMPSIZE,"RWS Header"); - break; - case meta_EACS_PC: - snprintf(temp,TEMPSIZE,"EACS Header (PC)"); - break; - case meta_EACS_PSX: - snprintf(temp,TEMPSIZE,"EACS Header (PSX)"); - break; - case meta_EACS_SAT: - snprintf(temp,TEMPSIZE,"EACS Header (SATURN)"); - break; - case meta_SL3: - snprintf(temp,TEMPSIZE,"SL3 Header"); - break; - case meta_FSB1: - snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB1) Header"); - break; - case meta_FSB2: - snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB2) Header"); - break; - case meta_FSB3: - snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB3) Header"); - break; - case meta_FSB4: - snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB4) Header"); - break; - case meta_FSB5: - snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB5) Header"); - break; - case meta_RWX: - snprintf(temp,TEMPSIZE,"RWX Header"); - break; - case meta_XWB: - snprintf(temp,TEMPSIZE,"XWB WBND Header"); - break; - case meta_XA30: - snprintf(temp,TEMPSIZE,"XA30 Header"); - break; - case meta_MUSC: - snprintf(temp,TEMPSIZE,"MUSC Header"); - break; - case meta_MUSX_V004: - snprintf(temp,TEMPSIZE,"MUSX / Version 004 Header"); - break; - case meta_MUSX_V005: - snprintf(temp,TEMPSIZE,"MUSX / Version 005 Header"); - break; - case meta_MUSX_V006: - snprintf(temp,TEMPSIZE,"MUSX / Version 006 Header"); - break; - case meta_MUSX_V010: - snprintf(temp,TEMPSIZE,"MUSX / Version 010 Header"); - break; - case meta_MUSX_V201: - snprintf(temp,TEMPSIZE,"MUSX / Version 201 Header"); - break; - case meta_LEG: - snprintf(temp,TEMPSIZE,"Legaia 2 - Duel Saga LEG Header"); - break; - case meta_FILP: - snprintf(temp,TEMPSIZE,"Bio Hazard - Gun Survivor FILp Header"); - break; - case meta_IKM: - snprintf(temp,TEMPSIZE,"Zwei!! IKM Header"); - break; - case meta_SFS: - snprintf(temp,TEMPSIZE,"Baroque SFS Header"); - break; - case meta_DVI: - snprintf(temp,TEMPSIZE,"DVI Header"); - break; - case meta_KCEY: - snprintf(temp,TEMPSIZE,"KCEYCOMP Header"); - break; - case meta_BG00: - snprintf(temp,TEMPSIZE,"Falcom BG00 Header"); - break; - case meta_PS2_RSTM: - snprintf(temp,TEMPSIZE,"Rockstar Games RSTM Header"); - break; - case meta_ACM: - snprintf(temp,TEMPSIZE,"InterPlay ACM Header"); - break; - case meta_MUS_ACM: - snprintf(temp,TEMPSIZE,"MUS playlist and multiple InterPlay ACM Headered files"); - break; - case meta_PS2_KCES: - snprintf(temp,TEMPSIZE,"Konami KCES Header"); - break; - case meta_PS2_DXH: - snprintf(temp,TEMPSIZE,"Tokobot Plus DXH Header"); - break; - case meta_PS2_PSH: - snprintf(temp,TEMPSIZE,"Dawn of Mana - Seiken Densetsu 4 PSH Header"); - break; - case meta_RIFF_WAVE_labl: - snprintf(temp,TEMPSIZE,"RIFF WAVE header with loop markers"); - break; - case meta_RIFF_WAVE_smpl: - snprintf(temp,TEMPSIZE,"RIFF WAVE header with sample looping info"); - break; - case meta_RIFX_WAVE: - snprintf(temp,TEMPSIZE,"RIFX WAVE header"); - break; - case meta_RIFX_WAVE_smpl: - snprintf(temp,TEMPSIZE,"RIFX WAVE header with sample looping info"); - break; - case meta_XNBm: - snprintf(temp,TEMPSIZE,"XNBm header"); - break; - case meta_PCM_SCD: - snprintf(temp,TEMPSIZE,"PCM file with custom header (SCD)"); - break; - case meta_PCM_PS2: - snprintf(temp,TEMPSIZE,"PCM file with custom header (PS2)"); - break; - case meta_PS2_RKV: - snprintf(temp,TEMPSIZE,"Legacy of Kain - Blood Omen 2 RKV Header"); - break; - case meta_PS2_PSW: - snprintf(temp,TEMPSIZE,"Rayman Raving Rabbids Riff Container File"); - break; - case meta_PS2_VAS: - snprintf(temp,TEMPSIZE,"Pro Baseball Spirits 5 VAS Header"); - break; - case meta_PS2_TEC: - snprintf(temp,TEMPSIZE,"assumed TECMO badflagged stream by .tec extension"); - break; - case meta_XBOX_WVS: - snprintf(temp,TEMPSIZE,"Metal Arms WVS Header (XBOX)"); - break; - case meta_NGC_WVS: - snprintf(temp,TEMPSIZE,"Metal Arms WVS Header (GameCube)"); - break; - case meta_XBOX_STMA: - snprintf(temp,TEMPSIZE,"Midnight Club 2 STMA Header"); - break; - case meta_XBOX_MATX: - snprintf(temp,TEMPSIZE,"assumed Matrix file by .matx extension"); - break; - case meta_DE2: - snprintf(temp,TEMPSIZE,"gurumin .de2 with embedded funky RIFF"); - break; - case meta_VS: - snprintf(temp,TEMPSIZE,"Men in Black VS Header"); - break; - case meta_DC_STR: - snprintf(temp,TEMPSIZE,"Sega Stream Asset Builder header"); - break; - case meta_DC_STR_V2: - snprintf(temp,TEMPSIZE,"variant of Sega Stream Asset Builder header"); - break; - case meta_XBOX_XMU: - snprintf(temp,TEMPSIZE,"XMU header"); - break; - case meta_XBOX_XVAS: - snprintf(temp,TEMPSIZE,"assumed TMNT file by .xvas extension"); - break; - case meta_PS2_XA2: - snprintf(temp,TEMPSIZE,"Acclaim XA2 Header"); - break; - case meta_DC_IDVI: - snprintf(temp,TEMPSIZE,"IDVI Header"); - break; - case meta_NGC_YMF: - snprintf(temp,TEMPSIZE,"YMF DSP Header"); - break; - case meta_PS2_CCC: - snprintf(temp,TEMPSIZE,"CCC Header"); - break; - case meta_PSX_FAG: - snprintf(temp,TEMPSIZE,"FAG Header"); - break; - case meta_PS2_MIHB: - snprintf(temp,TEMPSIZE,"Merged MIH+MIB"); - break; - case meta_DSP_WII_MUS: - snprintf(temp,TEMPSIZE,"mus header"); - break; - case meta_WII_SNG: - snprintf(temp,TEMPSIZE,"SNG DSP Header"); - break; - case meta_RSD2VAG: - snprintf(temp,TEMPSIZE,"RSD2/VAG Header"); - break; - case meta_RSD2PCMB: - snprintf(temp,TEMPSIZE,"RSD2/PCMB Header"); - break; - case meta_RSD2XADP: - snprintf(temp,TEMPSIZE,"RSD2/XADP Header"); - break; - case meta_RSD3VAG: - snprintf(temp,TEMPSIZE,"RSD3/VAG Header"); - break; - case meta_RSD3GADP: - snprintf(temp,TEMPSIZE,"RSD3/GADP Header"); - break; - case meta_RSD3PCM: - snprintf(temp,TEMPSIZE,"RSD3/PCM Header"); - break; - case meta_RSD3PCMB: - snprintf(temp,TEMPSIZE,"RSD3/PCMB Header"); - break; - case meta_RSD4PCMB: - snprintf(temp,TEMPSIZE,"RSD4/PCMB Header"); - break; - case meta_RSD4PCM: - snprintf(temp,TEMPSIZE,"RSD4/PCM Header"); - break; - case meta_RSD4RADP: - snprintf(temp,TEMPSIZE,"RSD4/RADP Header"); - break; - case meta_RSD4VAG: - snprintf(temp,TEMPSIZE,"RSD4/VAG Header"); - break; - case meta_RSD6XADP: - snprintf(temp,TEMPSIZE,"RSD6/XADP Header"); - break; - case meta_RSD6VAG: - snprintf(temp,TEMPSIZE,"RSD6/VAG Header"); - break; - case meta_RSD6WADP: - snprintf(temp,TEMPSIZE,"RSD6/WADP Header"); - break; - case meta_RSD6RADP: - snprintf(temp,TEMPSIZE,"RSD6/RADP Header"); - break; - case meta_DC_ASD: - snprintf(temp,TEMPSIZE,"ASD Header"); - break; - case meta_NAOMI_SPSD: - snprintf(temp,TEMPSIZE,"SPSD Header"); - break; - case meta_FFXI_BGW: - snprintf(temp,TEMPSIZE,"BGW BGMStream header"); - break; - case meta_FFXI_SPW: - snprintf(temp,TEMPSIZE,"SPW SeWave header"); - break; - case meta_PS2_ASS: - snprintf(temp,TEMPSIZE,"ASS Header"); - break; - case meta_IDSP: - snprintf(temp,TEMPSIZE,"IDSP Header"); - break; - case meta_WAA_WAC_WAD_WAM: - snprintf(temp,TEMPSIZE,"WAA/WAC/WAD/WAM RIFF Header"); - break; - case meta_PS2_SEG: - snprintf(temp,TEMPSIZE,"SEG (PS2) Header"); - break; - case meta_XBOX_SEG: - snprintf(temp,TEMPSIZE,"SEG (XBOX) Header"); - break; - case meta_NDS_STRM_FFTA2: - snprintf(temp,TEMPSIZE,"Final Fantasy Tactics A2 RIFF Header"); - break; - case meta_STR_ASR: - snprintf(temp,TEMPSIZE,"Donkey Kong Jet Race KNON/WII Header"); - break; - case meta_ZWDSP: - snprintf(temp,TEMPSIZE,"Zack and Wiki custom DSP Header"); - break; - case meta_GCA: - snprintf(temp,TEMPSIZE,"GCA DSP Header"); - break; - case meta_SPT_SPD: - snprintf(temp,TEMPSIZE,"SPT+SPD DSP Header"); - break; - case meta_ISH_ISD: - snprintf(temp,TEMPSIZE,"ISH+ISD DSP Header"); - break; - case meta_YDSP: - snprintf(temp,TEMPSIZE,"Yuke's DSP (YDSP) Header"); - break; - case meta_MSVP: - snprintf(temp,TEMPSIZE,"MSVP Header"); - break; - case meta_NGC_SSM: - snprintf(temp,TEMPSIZE,"SSM DSP Header"); - break; - case meta_PS2_JOE: - snprintf(temp,TEMPSIZE,"Disney/Pixar JOE Header"); - break; - case meta_VGS: - snprintf(temp,TEMPSIZE,"Guitar Hero Encore Rocks the 80's Header"); - break; - case meta_DC_DCSW_DCS: - snprintf(temp,TEMPSIZE,"Evil Twin DCS file with helper"); - break; - case meta_WII_SMP: - snprintf(temp,TEMPSIZE,"SMP DSP Header"); - break; - case meta_EMFF_PS2: - case meta_EMFF_NGC: - snprintf(temp,TEMPSIZE,"Eidos Music File Format Header"); - break; - case meta_THP: - snprintf(temp,TEMPSIZE,"THP Movie File Format Header"); - break; - case meta_STS_WII: - snprintf(temp,TEMPSIZE,"Shikigami no Shiro (WII) Header"); - break; - case meta_PS2_P2BT: - snprintf(temp,TEMPSIZE,"Pop'n'Music 7 Header"); - break; - case meta_PS2_GBTS: - snprintf(temp,TEMPSIZE,"Pop'n'Music 9 Header"); - break; - case meta_NGC_DSP_IADP: - snprintf(temp,TEMPSIZE,"IADP Header"); - break; - case meta_RSTM_shrunken: - snprintf(temp,TEMPSIZE,"Nintendo RSTM header, corrupted by Atlus"); - break; - case meta_RIFF_WAVE_MWV: - snprintf(temp,TEMPSIZE,"RIFF WAVE header with .mwv flavoring"); - break; - case meta_RIFF_WAVE_SNS: - snprintf(temp,TEMPSIZE,"RIFF WAVE header with .sns flavoring"); - break; - case meta_FFCC_STR: - snprintf(temp,TEMPSIZE,"Final Fantasy: Crystal Chronicles STR header"); - break; - case meta_SAT_BAKA: - snprintf(temp,TEMPSIZE,"BAKA header from Crypt Killer"); - break; - case meta_NDS_SWAV: - snprintf(temp,TEMPSIZE,"SWAV Header"); - break; - case meta_PS2_VSF: - snprintf(temp,TEMPSIZE,"Musashi: Samurai Legend VSF Header"); - break; - case meta_NDS_RRDS: - snprintf(temp,TEMPSIZE,"Ridger Racer DS Header"); - break; - case meta_PS2_TK5: - snprintf(temp,TEMPSIZE,"Tekken 5 Stream Header"); - break; - case meta_PS2_SND: - snprintf(temp,TEMPSIZE,"Might and Magic SSND Header"); - break; - case meta_PS2_VSF_TTA: - snprintf(temp,TEMPSIZE,"VSF with SMSS Header"); - break; - case meta_ADS: - snprintf(temp,TEMPSIZE,"dhSS Header"); - break; - case meta_WII_STR: - snprintf(temp,TEMPSIZE,"HOTD Overkill - STR+STH WII Header"); - break; - case meta_PS2_MCG: - snprintf(temp,TEMPSIZE,"Gunvari MCG Header"); - break; - case meta_ZSD: - snprintf(temp,TEMPSIZE,"ZSD Header"); - break; - case meta_RedSpark: - snprintf(temp,TEMPSIZE,"RedSpark Header"); - break; - case meta_PC_IVAUD: - snprintf(temp,TEMPSIZE,"assumed GTA IV Audio file by .ivaud extension"); - break; - case meta_DSP_WII_WSD: - snprintf(temp,TEMPSIZE,"Standard Nintendo DSP headers in .wsd"); - break; - case meta_WII_NDP: - snprintf(temp,TEMPSIZE,"Vertigo NDP Header"); - break; - case meta_PS2_SPS: - snprintf(temp,TEMPSIZE,"Ape Escape 2 SPS Header"); - break; - case meta_PS2_XA2_RRP: - snprintf(temp,TEMPSIZE,"Acclaim XA2 Header"); - break; - case meta_NDS_HWAS: - snprintf(temp,TEMPSIZE,"NDS 'HWAS' Header"); - break; - case meta_NGC_LPS: - snprintf(temp,TEMPSIZE,"Rave Master LPS Header"); - break; - case meta_NAOMI_ADPCM: - snprintf(temp,TEMPSIZE,"NAOMI/NAOMI2 Arcade games ADPCM header"); - break; - case meta_SD9: - snprintf(temp,TEMPSIZE,"beatmania IIDX SD9 header"); - break; - case meta_2DX9: - snprintf(temp,TEMPSIZE,"beatmania IIDX 2DX9 header"); - break; - case meta_DSP_YGO: - snprintf(temp,TEMPSIZE,"Konami custom DSP Header"); - break; - case meta_PS2_VGV: - snprintf(temp,TEMPSIZE,"Rune: Viking Warlord VGV Header"); - break; - case meta_NGC_GCUB: - snprintf(temp,TEMPSIZE,"GCub Header"); - break; - case meta_NGC_SCK_DSP: - snprintf(temp,TEMPSIZE,"The Scorpion King SCK Header"); - break; - case meta_NGC_SWD: - snprintf(temp,TEMPSIZE,"PSF + Standard DSP Headers"); - break; - case meta_CAFF: - snprintf(temp,TEMPSIZE,"Apple Core Audio Format Header"); - break; - case meta_PC_MXST: - snprintf(temp,TEMPSIZE,"Lego Island MxSt Header"); - break; - case meta_PC_SOB_SAB: - snprintf(temp,TEMPSIZE,"Worms 4: Mayhem SOB/SAB Header"); - break; - case meta_MAXIS_XA: - snprintf(temp,TEMPSIZE,"Maxis XAI/XAJ Header"); - break; - case meta_EXAKT_SC: - snprintf(temp,TEMPSIZE,"assumed Activision / EXAKT SC by extension"); - break; - case meta_WII_BNS: - snprintf(temp,TEMPSIZE,"Nintendo BNS header"); - break; - case meta_WII_WAS: - snprintf(temp,TEMPSIZE,"WAS (iSWS) DSP header"); - break; - case meta_XBOX_HLWAV: - snprintf(temp,TEMPSIZE,"Half Life 2 bgm header"); - break; - case meta_STX: - snprintf(temp,TEMPSIZE,"Nintendo .stx header"); - break; - case meta_PS2_STM: - snprintf(temp,TEMPSIZE,"Red Dead Revolver .stm (.ps2stm)"); - break; - case meta_MYSPD: - snprintf(temp,TEMPSIZE,"U-Sing .myspd header"); - break; - case meta_HIS: - snprintf(temp,TEMPSIZE,"Her Interactive Sound header"); - break; - case meta_PS2_AST: - snprintf(temp,TEMPSIZE,"KOEI AST header"); - break; - case meta_CAPDSP: - snprintf(temp,TEMPSIZE,"Capcom custom DSP header"); - break; - case meta_DMSG: - snprintf(temp,TEMPSIZE,"RIFF/DMSGsegh header"); - break; - case meta_PONA_3DO: - case meta_PONA_PSX: - snprintf(temp,TEMPSIZE,"Policenauts BGM header"); - break; - case meta_NGC_DSP_AAAP: - snprintf(temp,TEMPSIZE,"Double standard dsp header in 'AAAp'"); - break; - case meta_NGC_DSP_KONAMI: - snprintf(temp,TEMPSIZE,"Konami dsp header"); - break; - case meta_PS2_STER: - snprintf(temp,TEMPSIZE,"STER Header"); - break; - case meta_BNSF: - snprintf(temp,TEMPSIZE,"Namco Bandai BNSF header"); - break; - case meta_PS2_WB: - snprintf(temp,TEMPSIZE,"Shooting Love. ~TRIZEAL~ WB header"); - break; - case meta_S14: - snprintf(temp,TEMPSIZE,"assumed Polycom Siren 14 by .s14 extension"); - break; - case meta_SSS: - snprintf(temp,TEMPSIZE,"assumed Polycom Siren 14 by .sss extension"); - break; - case meta_PS2_GCM: - snprintf(temp,TEMPSIZE,"GCM 'MCG' Header"); - break; - case meta_PS2_SMPL: - snprintf(temp,TEMPSIZE,"Homura 'SMPL' Header"); - break; - case meta_PS2_MSA: - snprintf(temp,TEMPSIZE,"Psyvariar -Complete Edition- MSA header"); - break; - case meta_PC_SMP: - snprintf(temp,TEMPSIZE,"Ghostbusters .smp Header"); - break; - case meta_NGC_PDT: - snprintf(temp,TEMPSIZE,"PDT DSP header"); - break; - case meta_NGC_BO2: - snprintf(temp,TEMPSIZE,"Blood Omen 2 DSP header"); - break; - case meta_P3D: - snprintf(temp,TEMPSIZE,"Prototype P3D Header"); - break; - case meta_PS2_TK1: - snprintf(temp,TEMPSIZE,"Tekken TK5STRM1 Header"); - break; - case meta_PS2_ADSC: - snprintf(temp,TEMPSIZE,"ADSC Header"); - break; - case meta_NGC_DSP_MPDS: - snprintf(temp,TEMPSIZE,"MPDS DSP header"); - break; - case meta_DSP_STR_IG: - snprintf(temp,TEMPSIZE,"Infogrames dual dsp header"); - break; - case meta_PSX_MGAV: - snprintf(temp,TEMPSIZE,"Electronic Arts RVWS header"); - break; - case meta_PS2_B1S: - snprintf(temp,TEMPSIZE,"B1S header"); - break; - case meta_PS2_WAD: - snprintf(temp,TEMPSIZE,"WAD header"); - break; - case meta_DSP_XIII: - snprintf(temp,TEMPSIZE,"XIII dsp header"); - break; - case meta_NGC_DSP_STH_STR: - snprintf(temp,TEMPSIZE,"STH dsp header"); - break; - case meta_DSP_CABELAS: - snprintf(temp,TEMPSIZE,"Cabelas games dsp header"); - break; - case meta_PS2_LPCM: - snprintf(temp,TEMPSIZE,"LPCM header"); - break; - case meta_PS2_VMS: - snprintf(temp,TEMPSIZE,"VMS Header"); - break; - case meta_PS2_XAU: - snprintf(temp,TEMPSIZE,"XAU Header"); - break; - case meta_GH3_BAR: - snprintf(temp,TEMPSIZE,"Guitar Hero III Mobile .bar"); - break; - case meta_FFW: - snprintf(temp,TEMPSIZE,"Freedom Fighters BGM header"); - break; - case meta_DSP_DSPW: - snprintf(temp,TEMPSIZE,"DSPW dsp header"); - break; - case meta_PS2_JSTM: - snprintf(temp,TEMPSIZE,"JSTM Header"); - break; - case meta_PS3_XVAG: - snprintf(temp,TEMPSIZE,"XVAG Header"); - break; - case meta_PS3_CPS: - snprintf(temp,TEMPSIZE,"CPS Header"); - break; - case meta_SQEX_SCD: - snprintf(temp,TEMPSIZE,"Square-Enix SCD"); - break; - case meta_NGC_NST_DSP: - snprintf(temp,TEMPSIZE,"Animaniacs NST header"); - break; - case meta_BAF: - snprintf(temp,TEMPSIZE,".baf WAVE header"); - break; - case meta_PS3_MSF: - snprintf(temp,TEMPSIZE,"PS3 MSF header"); - break; - case meta_NUB_VAG: - snprintf(temp,TEMPSIZE,"VAG (NUB) header"); - break; - case meta_PS3_PAST: - snprintf(temp,TEMPSIZE,"SNDP header"); - break; - case meta_PS3_SGDX: - snprintf(temp,TEMPSIZE,"SGXD header"); - break; - case meta_NGCA: - snprintf(temp,TEMPSIZE,"NGCA header"); - break; - case meta_WII_RAS: - snprintf(temp,TEMPSIZE,"RAS header"); - break; - case meta_PS2_SPM: - snprintf(temp,TEMPSIZE,"SPM header"); - break; - case meta_X360_TRA: - snprintf(temp,TEMPSIZE,"assumed DefJam Rapstar Audio File by .tra extension"); - break; - case meta_PS2_VGS: - snprintf(temp,TEMPSIZE,"Princess Soft VGS header"); - break; - case meta_PS2_IAB: - snprintf(temp,TEMPSIZE,"IAB header"); - break; - case meta_PS2_STRLR: - snprintf(temp,TEMPSIZE,"STR L/R header"); - break; - case meta_LSF_N1NJ4N: - snprintf(temp,TEMPSIZE,".lsf !n1nj4n header"); - break; - case meta_VAWX: - snprintf(temp,TEMPSIZE,"feelplus VAWX header"); - break; - case meta_PC_SNDS: - snprintf(temp,TEMPSIZE,"assumed Heavy Iron IMA by .snds extension"); - break; - case meta_PS2_WMUS: - snprintf(temp,TEMPSIZE,"assumed The Warriors Sony ADPCM by .wmus extension"); - break; - case meta_HYPERSCAN_KVAG: - snprintf(temp,TEMPSIZE,"Mattel Hyperscan KVAG"); - break; - case meta_IOS_PSND: - snprintf(temp,TEMPSIZE,"PSND Header"); - break; - case meta_BOS_ADP: - snprintf(temp,TEMPSIZE,"ADP! header"); - break; - case meta_EB_SFX: - snprintf(temp,TEMPSIZE,"Excitebots .sfx header"); - break; - case meta_EB_SF0: - snprintf(temp,TEMPSIZE,"assumed Excitebots .sf0 by extension"); - break; - case meta_PS3_KLBS: - snprintf(temp,TEMPSIZE,"klBS Header"); - break; - case meta_PS2_MTAF: - snprintf(temp,TEMPSIZE,"Konami MTAF header"); - break; - case meta_PS2_VAG1: - snprintf(temp,TEMPSIZE,"Konami VAG Mono header (VAG1)"); - break; - case meta_PS2_VAG2: - snprintf(temp,TEMPSIZE,"Konami VAG Stereo header (VAG2)"); - break; - case meta_TUN: - snprintf(temp,TEMPSIZE,"TUN 'ALP' header"); - break; - case meta_WPD: - snprintf(temp,TEMPSIZE,"WPD 'DPW' header"); - break; - case meta_MN_STR: - snprintf(temp,TEMPSIZE,"Mini Ninjas 'STR' header"); - break; - case meta_PS2_MSS: - snprintf(temp,TEMPSIZE,"Guerilla MSCC header"); - break; - case meta_PS2_HSF: - snprintf(temp,TEMPSIZE,"Lowrider 'HSF' header"); - break; - case meta_PS3_IVAG: - snprintf(temp,TEMPSIZE,"PS3 'IVAG' Header"); - break; - case meta_PS2_2PFS: - snprintf(temp,TEMPSIZE,"PS2 '2PFS' Header"); - break; - case meta_RSD6OOGV: - snprintf(temp,TEMPSIZE,"RSD6/OOGV Header"); - break; - case meta_UBI_CKD: - snprintf(temp,TEMPSIZE,"CKD 'RIFF' Header"); - break; - case meta_PS2_VBK: - snprintf(temp,TEMPSIZE,"PS2 VBK Header"); - break; - case meta_OTM: - snprintf(temp,TEMPSIZE,"Otomedius OTM Header"); - break; - case meta_CSTM: - snprintf(temp,TEMPSIZE,"Nintendo 3DS CSTM Header"); - break; - case meta_FSTM: - snprintf(temp,TEMPSIZE,"Nintendo Wii U FSTM Header"); - break; - case meta_G1L: - snprintf(temp,TEMPSIZE,"Tecmo Koei G1L Header"); - break; - case meta_3DS_IDSP: - snprintf(temp,TEMPSIZE,"Nintendo 3DS IDSP Header"); - break; - case meta_WIIU_BTSND: - snprintf(temp,TEMPSIZE,"Wii U Menu Boot Sound"); - break; - case meta_MCA: - snprintf(temp,TEMPSIZE,"Capcom MCA Header"); - break; - case meta_XB3D_ADX: - snprintf(temp, TEMPSIZE,"Xenoblade 3D ADX Header"); - break; - 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"); - break; -#endif - default: - snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); } concatn(length,desc,temp); } -/* */ +/* filename search pairs for dual file stereo */ const char * const dfs_pairs[][2] = { {"L","R"}, {"l","r"}, From 7e520162a3f61a33285a07fbb673316a6774c6b2 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 02:54:18 +0100 Subject: [PATCH 06/12] FFmpeg: remove ACCURATE_LOOPING flag now it's battle-tested It's fast enough and the older looping code would need to be redone anyway --- fb2k/foo_input_vgmstream.vcproj | 4 ++-- src/coding/ffmpeg_decoder.c | 33 ++------------------------------- src/libvgmstream.vcproj | 4 ++-- src/libvgmstream.vcxproj | 4 ++-- test/Makefile.mingw | 2 +- winamp/Makefile | 2 +- xmp-vgmstream/Makefile | 2 +- 7 files changed, 11 insertions(+), 40 deletions(-) diff --git a/fb2k/foo_input_vgmstream.vcproj b/fb2k/foo_input_vgmstream.vcproj index 7b1ed887..382cf138 100644 --- a/fb2k/foo_input_vgmstream.vcproj +++ b/fb2k/foo_input_vgmstream.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../ext_includes" - PreprocessorDefinitions="WIN32;VGM_USE_FFMPEG;VGM_USE_FFMPEG_ACCURATE_LOOPING;VGM_USE_G719;VGM_USE_G7221;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;" + PreprocessorDefinitions="WIN32;VGM_USE_FFMPEG;VGM_USE_G719;VGM_USE_G7221;_DEBUG;_WINDOWS;_USRDLL;IN_VGMSTREAM_EXPORTS;" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -120,7 +120,7 @@ codec_data; int64_t ts; -#ifndef VGM_USE_FFMPEG_ACCURATE_LOOPING - /* Seek to loop start by timestamp (closest frame) + adjust skipping some samples */ - /* FFmpeg seeks by ts by design (since not all containers can accurately skip to a frame). */ - /* TODO: this seems to be off by +-1 frames in some cases */ - ts = num_sample; - if (ts >= data->sampleRate * 2) { - data->samplesToDiscard = data->sampleRate * 2; - ts -= data->samplesToDiscard; - } - else { - data->samplesToDiscard = (int)ts; - ts = 0; - } - - /* todo fix this properly */ - if (data->totalSamples) { - ts = (int)ts * (data->formatCtx->duration) / data->totalSamples; - } else { - data->samplesToDiscard = num_sample; - ts = 0; - } - - avformat_seek_file(data->formatCtx, data->streamIndex, ts - 1000, ts, ts, AVSEEK_FLAG_ANY); - avcodec_flush_buffers(data->codecCtx); -#endif /* ifndef VGM_USE_FFMPEG_ACCURATE_LOOPING */ - -#ifdef VGM_USE_FFMPEG_ACCURATE_LOOPING - /* Start from 0 and discard samples until loop_start for accurate looping (slower but not too noticeable) */ - /* We could also seek by offset (AVSEEK_FLAG_BYTE) to the frame closest to the loop then discard - * some samples, which is fast but would need calculations per format / when frame size is not constant */ + /* Start from 0 and discard samples until loop_start (slower but not too noticeable) */ + /* Due to various FFmpeg quirks seeking to a sample is erratic in many formats (would need extra steps) */ data->samplesToDiscard = num_sample; ts = 0; avformat_seek_file(data->formatCtx, data->streamIndex, ts, ts, ts, AVSEEK_FLAG_ANY); avcodec_flush_buffers(data->codecCtx); -#endif /* ifdef VGM_USE_FFMPEG_ACCURATE_LOOPING */ data->readNextPacket = 1; data->bytesConsumedFromDecodedFrame = INT_MAX; diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 563fe21d..622ed96d 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -41,7 +41,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../ext_includes" - PreprocessorDefinitions="WIN32;VGM_USE_FFMPEG;VGM_USE_FFMPEG_ACCURATE_LOOPING;VGM_USE_G7221;VGM_USE_G719;USE_ALLOCA;_DEBUG;_LIB;" + PreprocessorDefinitions="WIN32;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;USE_ALLOCA;_DEBUG;_LIB;" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -103,7 +103,7 @@ Disabled ../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - WIN32;VGM_USE_FFMPEG;VGM_USE_FFMPEG_ACCURATE_LOOPING;VGM_USE_G7221;VGM_USE_G719;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;USE_ALLOCA;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;USE_ALLOCA;_DEBUG;_LIB;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebug @@ -71,7 +71,7 @@ ../ext_includes;../../qaac/mp4v2/include;../../fdk-aac/libSYS/include;../../fdk-aac/libAACdec/include;%(AdditionalIncludeDirectories) - _WIN32_WINNT=0x501;WIN32;VGM_USE_FFMPEG;VGM_USE_FFMPEG_ACCURATE_LOOPING;VGM_USE_G7221;VGM_USE_G719;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;USE_ALLOCA;NDEBUG;_LIB;%(PreprocessorDefinitions) + _WIN32_WINNT=0x501;WIN32;VGM_USE_FFMPEG;VGM_USE_G7221;VGM_USE_G719;VGM_USE_MP4V2;VGM_USE_FDKAAC;VGM_USE_MAIATRAC3PLUS;USE_ALLOCA;NDEBUG;_LIB;%(PreprocessorDefinitions) MultiThreaded diff --git a/test/Makefile.mingw b/test/Makefile.mingw index 752f0654..5fc4578f 100644 --- a/test/Makefile.mingw +++ b/test/Makefile.mingw @@ -1,7 +1,7 @@ # optional parts VGM_ENABLE_FFMPEG=1 ifeq ($(VGM_ENABLE_FFMPEG),1) -FFMPEG_CC=-DVGM_USE_FFMPEG -DVGM_USE_FFMPEG_ACCURATE_LOOPING +FFMPEG_CC=-DVGM_USE_FFMPEG FFMPEG_LD=-lavcodec -lavformat -lavutil endif diff --git a/winamp/Makefile b/winamp/Makefile index 6817686c..bd1f96ab 100644 --- a/winamp/Makefile +++ b/winamp/Makefile @@ -1,7 +1,7 @@ # optional parts VGM_ENABLE_FFMPEG=1 ifeq ($(VGM_ENABLE_FFMPEG),1) -FFMPEG_CC=-DVGM_USE_FFMPEG -DVGM_USE_FFMPEG_ACCURATE_LOOPING +FFMPEG_CC=-DVGM_USE_FFMPEG FFMPEG_LD=-lavcodec -lavformat -lavutil endif diff --git a/xmp-vgmstream/Makefile b/xmp-vgmstream/Makefile index 03ca7116..48d2f9c0 100644 --- a/xmp-vgmstream/Makefile +++ b/xmp-vgmstream/Makefile @@ -1,7 +1,7 @@ # optional parts VGM_ENABLE_FFMPEG=1 ifeq ($(VGM_ENABLE_FFMPEG),1) -FFMPEG_CC=-DVGM_USE_FFMPEG -DVGM_USE_FFMPEG_ACCURATE_LOOPING +FFMPEG_CC=-DVGM_USE_FFMPEG FFMPEG_LD=-lavcodec -lavformat -lavutil endif From 86ba7a6a239d7c50bb39ff0d5796e68bf6de96cb Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 02:58:52 +0100 Subject: [PATCH 07/12] Remove some old DEBUG code --- src/coding/ngc_dsp_decoder.c | 10 ---------- src/meta/Cstr.c | 6 ------ src/vgmstream.c | 14 -------------- src/vgmstream.h | 5 ----- 4 files changed, 35 deletions(-) diff --git a/src/coding/ngc_dsp_decoder.c b/src/coding/ngc_dsp_decoder.c index 27825ae9..66dd845d 100644 --- a/src/coding/ngc_dsp_decoder.c +++ b/src/coding/ngc_dsp_decoder.c @@ -20,11 +20,6 @@ void decode_ngc_dsp(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspaci for (i=first_sample,sample_count=0; ioffset+1+i/2,stream->streamfile); -#ifdef DEBUG - if (hist1==stream->loop_history1 && hist2==stream->loop_history2) fprintf(stderr,"yo! %#x (start %#x) %d\n",stream->offset+framesin*8+i/2,stream->channel_start_offset,stream->samples_done); - stream->samples_done++; -#endif - outbuf[sample_count] = clamp16(( (((i&1? get_low_nibble_signed(sample_byte): @@ -61,11 +56,6 @@ void decode_ngc_dsp_mem(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels for (i=first_sample,sample_count=0; iloop_history1 && hist2==stream->loop_history2) fprintf(stderr,"yo! %#x (start %#x) %d\n",stream->offset+framesin*8+i/2,stream->channel_start_offset,stream->samples_done); - stream->samples_done++; -#endif - outbuf[sample_count] = clamp16(( (((i&1? get_low_nibble_signed(sample_byte): diff --git a/src/meta/Cstr.c b/src/meta/Cstr.c index 917f2a9d..41869497 100644 --- a/src/meta/Cstr.c +++ b/src/meta/Cstr.c @@ -273,12 +273,6 @@ VGMSTREAM * init_vgmstream_Cstr(STREAMFILE *streamFile) { for (i=0;i<16;i++) vgmstream->ch[1].adpcm_coef[i]=read_16bitBE(0x9c+i*2,streamFile); } -#ifdef DEBUG - vgmstream->ch[0].loop_history1 = read_16bitBE(0x66,streamFile); - vgmstream->ch[0].loop_history2 = read_16bitBE(0x68,streamFile); - vgmstream->ch[1].loop_history1 = read_16bitBE(0xc6,streamFile); - vgmstream->ch[1].loop_history2 = read_16bitBE(0xc8,streamFile); -#endif /* open the file for reading by each channel */ { diff --git a/src/vgmstream.c b/src/vgmstream.c index 216501cd..32dc3dbb 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -1735,20 +1735,6 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) { } /* todo preserve ADPCM (ex hevag) history? */ -#ifdef DEBUG - { - int i; - for (i=0;ichannels;i++) { - fprintf(stderr,"ch%d hist: %04x %04x loop hist: %04x %04x\n",i, - vgmstream->ch[i].adpcm_history1_16,vgmstream->ch[i].adpcm_history2_16, - vgmstream->loop_ch[i].adpcm_history1_16,vgmstream->loop_ch[i].adpcm_history2_16); - fprintf(stderr,"ch%d offset: %x loop offset: %x\n",i, - vgmstream->ch[i].offset, - vgmstream->loop_ch[i].offset); - } - } -#endif - if (vgmstream->coding_type==coding_CRI_HCA) { hca_codec_data *data = (hca_codec_data *)(vgmstream->codec_data); data->curblock = data->info.loopStart; diff --git a/src/vgmstream.h b/src/vgmstream.h index 026d0619..ab5920b5 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -649,11 +649,6 @@ typedef struct { /* state for G.721 decoder, sort of big but we might as well keep it around */ struct g72x_state g72x_state; -#ifdef DEBUG - int samples_done; - int16_t loop_history1,loop_history2; -#endif - /* ADX encryption */ int adx_channels; uint16_t adx_xor; From 4e6ce8747d4a4aed8726245c8f0b2d2fd9f3a0b8 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 12:03:31 +0100 Subject: [PATCH 08/12] Added .swag [Frantix PSP] --- src/formats.c | 1 + src/header.c | 21 ++++++++-- src/meta/ps2_vag.c | 99 +++++++++++++++++++++++----------------------- 3 files changed, 69 insertions(+), 52 deletions(-) diff --git a/src/formats.c b/src/formats.c index f93376a4..8ca38548 100644 --- a/src/formats.c +++ b/src/formats.c @@ -247,6 +247,7 @@ static const char* extension_list[] = { "stx", "svag", "svs", + "swag", "swav", "swd", diff --git a/src/header.c b/src/header.c index 7e8cc573..70fb0c63 100644 --- a/src/header.c +++ b/src/header.c @@ -42,24 +42,39 @@ int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t star STREAMFILE * file; char filename[PATH_LIMIT]; int ch; + int buffer_size = STREAMFILE_DEFAULT_BUFFER_SIZE; #ifdef VGM_USE_FFMPEG if (vgmstream->coding_type == coding_FFmpeg) /* not needed */ return 1; #endif - streamFile->get_name(streamFile,filename,sizeof(filename)); + /* minor optimizations */ + if (vgmstream->layout_type == layout_interleave + &&vgmstream->interleave_block_size > 0 + && vgmstream->interleave_block_size > buffer_size) { + buffer_size = vgmstream->interleave_block_size; + } + if (buffer_size > 0x8000) { + buffer_size = 0x8000; + /* todo if interleave is big enough open one streamfile per channel so each uses it's own buffer */ + } + + + streamFile->get_name(streamFile,filename,sizeof(filename)); + /* open the file for reading by each channel */ { - file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); + file = streamFile->open(streamFile,filename,buffer_size); if (!file) return 0; for (ch=0; ch < vgmstream->channels; ch++) { + vgmstream->ch[ch].streamfile = file; if (vgmstream->layout_type == layout_none #ifdef VGM_USE_MPEG - || vgmstream->layout_type == layout_mpeg + || vgmstream->layout_type == layout_mpeg //todo simplify using flag "start offset" #endif ) { /* no appreciable difference for mpeg */ /* for some codecs like IMA where channels work with the same bytes */ diff --git a/src/meta/ps2_vag.c b/src/meta/ps2_vag.c index 02024dad..8703a317 100644 --- a/src/meta/ps2_vag.c +++ b/src/meta/ps2_vag.c @@ -1,5 +1,6 @@ #include "meta.h" #include "../util.h" +#include "../header.h" static int vag_find_loop_offsets(STREAMFILE *streamFile, off_t start_offset, off_t * loop_start, off_t * loop_end); @@ -9,26 +10,23 @@ static int vag_find_loop_offsets(STREAMFILE *streamFile, off_t start_offset, off */ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; - char filename[PATH_LIMIT]; - - off_t loopStart = 0; - off_t loopEnd = 0; + off_t start_offset, loopStart = 0, loopEnd = 0; uint8_t vagID; uint32_t version = 0; - size_t filesize = 0, datasize = 0; - size_t interleave; - off_t start_offset; - - int loop_flag=0; - int loop_samples_found = 0; - int channel_count=0; - int i; + size_t filesize = 0, datasize = 0, interleave; + + int loop_flag = 0, loop_samples_found = 0; + int channel_count = 0; + int is_swag = 0; /* check extension, case insensitive */ - streamFile->get_name(streamFile,filename,sizeof(filename)); - if (strcasecmp("vag",filename_extension(filename))) goto fail; + if ( !header_check_extensions(streamFile,"vag,swag") ) + goto fail; + + /* Frantix VAGp .swag: some (not all) fields in LE + 2 VAGp in the same file (full interleave) */ + is_swag = header_check_extensions(streamFile,"swag"); /* check VAG Header */ if (((read_32bitBE(0x00,streamFile) & 0xFFFFFF00) != 0x56414700) && /* "VAG\0" */ @@ -41,7 +39,10 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { * ex: 00000000 = v1.8 PC, 00000002 = v1.3 Mac, 00000003 = v1.6+ Mac, 00000020 = v2.0+ PC */ version = read_32bitBE(0x04,streamFile); /* 0x08-0c: reserved */ - datasize = read_32bitBE(0x0c,streamFile); + if (is_swag) + datasize = read_32bitLE(0x0c,streamFile); + else + datasize = read_32bitBE(0x0c,streamFile); /* 0x14-20 reserved */ /* 0x20-30: name (optional) */ /* 0x30: data start (first 0x10 usually 0s to init SPU) */ @@ -66,8 +67,11 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { break; case 'p': /* "VAGp" (extended) [most common, ex Ratchet & Clank] */ - if ((version <= 0x00000004) && (datasize < filesize / 2)) { - loop_flag=(read_32bitBE(0x14,streamFile)!=0); + if ((version <= 0x00000004) && (datasize < filesize / 2)) { /* two VAGp in the same file */ + if (is_swag) + loop_flag = vag_find_loop_offsets(streamFile, 0x30, &loopStart, &loopEnd); + else + loop_flag = read_32bitBE(0x14,streamFile) != 0; channel_count=2; } else if (version == 0x00020001) { /* HEVAG */ @@ -91,7 +95,10 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { /* fill in the vital statistics */ vgmstream->coding_type = coding_PSX; - vgmstream->sample_rate = read_32bitBE(0x10,streamFile); + if (is_swag) + vgmstream->sample_rate = read_32bitLE(0x10,streamFile); + else + vgmstream->sample_rate = read_32bitBE(0x10,streamFile); switch(vagID) { case '1': // VAG1 @@ -121,23 +128,31 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { if ((version == 0x00000004) && (datasize < filesize / 2)) { vgmstream->channels=2; - vgmstream->num_samples = datasize; /* todo test if datasize/16*28? */ - - if(loop_flag) { - vgmstream->loop_start_sample=read_32bitBE(0x14,streamFile); - vgmstream->loop_end_sample =read_32bitBE(0x18,streamFile); - loop_samples_found = 1; - } - - start_offset=0x80; vgmstream->layout_type=layout_interleave; vgmstream->meta_type=meta_PS2_VAGs; - // Double VAG Header @ 0x0000 & 0x1000 - if(read_32bitBE(0,streamFile)==read_32bitBE(0x1000,streamFile)) { + if (is_swag) { + start_offset = 0x30; + interleave = datasize; vgmstream->num_samples = datasize / 16 * 28; - interleave=0x1000; - start_offset=0; + vgmstream->loop_start_sample = (loopStart-start_offset) / 16 * 28; + vgmstream->loop_end_sample = (loopEnd-start_offset) / 16 * 28; + loop_samples_found = 1; + + } else { + start_offset=0x80; + vgmstream->num_samples = datasize; /* todo test if datasize/16*28? */ + if(loop_flag) { + vgmstream->loop_start_sample=read_32bitBE(0x14,streamFile); + vgmstream->loop_end_sample =read_32bitBE(0x18,streamFile); + loop_samples_found = 1; + // Double VAG Header @ 0x0000 & 0x1000 + if(read_32bitBE(0,streamFile)==read_32bitBE(0x1000,streamFile)) { + vgmstream->num_samples = datasize / 16 * 28; + interleave=0x1000; + start_offset=0; + } + } } } else if (version == 0x40000000) { /* Guerilla VAG (little endian) */ @@ -195,28 +210,14 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile) { } - /* open the file for reading by each channel */ - { - for (i=0;iinterleave_block_size > 0) { - vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size); - } else { - vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); - } - - if (!vgmstream->ch[i].streamfile) goto fail; - - vgmstream->ch[i].channel_start_offset= - vgmstream->ch[i].offset= - (off_t)(start_offset+vgmstream->interleave_block_size*i); - } - } + /* open the file for reading */ + if ( !header_open_stream(vgmstream, streamFile, start_offset) ) + goto fail; return vgmstream; - /* clean up anything we may have opened */ fail: - if (vgmstream) close_vgmstream(vgmstream); + close_vgmstream(vgmstream); return NULL; } From 01981a6686f4444938e82201cab28c04d4339904 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 12:59:04 +0100 Subject: [PATCH 09/12] Added PS2 VDS/VDM [Graffiti Kingdom] --- src/Makefile | 3 +- src/formats.c | 1 + src/libvgmstream.vcproj | 4 +++ src/libvgmstream.vcxproj | 1 + src/libvgmstream.vcxproj.filters | 3 ++ src/meta/Makefile.unix.am | 1 + src/meta/meta.h | 2 ++ src/meta/ps2.c | 50 ++++++++++++++++++++++++++++++++ src/vgmstream.c | 1 + src/vgmstream.h | 1 + 10 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/meta/ps2.c diff --git a/src/Makefile b/src/Makefile index c30191a2..99704ed7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/formats.c b/src/formats.c index 8ca38548..4543a0e2 100644 --- a/src/formats.c +++ b/src/formats.c @@ -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"}, diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 622ed96d..57e6f8ff 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -646,6 +646,10 @@ RelativePath=".\meta\pos.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 370127f6..86dccd0e 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -240,6 +240,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index ed9bbb58..3014e915 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -373,6 +373,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index 3dbfca57..fa0f3d49 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -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 diff --git a/src/meta/meta.h b/src/meta/meta.h index b3267dfc..62156299 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -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 diff --git a/src/meta/ps2.c b/src/meta/ps2.c new file mode 100644 index 00000000..efaa0290 --- /dev/null +++ b/src/meta/ps2.c @@ -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; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 32dc3dbb..fec6927c 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -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, diff --git a/src/vgmstream.h b/src/vgmstream.h index ab5920b5..2a44d21b 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -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 */ From 013d43cccc3a877692066aa6eca24224fbae2c17 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 13:04:23 +0100 Subject: [PATCH 10/12] Add VDS/VDM --- src/formats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/formats.c b/src/formats.c index 4543a0e2..951fb7ab 100644 --- a/src/formats.c +++ b/src/formats.c @@ -270,6 +270,9 @@ static const char* extension_list[] = { "vgv", "vig", + "vds", + "vdm", + "vms", "vms", "voi", "vpk", From 2ac72c1b0e78187358e3a870685b4453c3f66ac3 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 13:16:38 +0100 Subject: [PATCH 11/12] Meta description in formats.c --- BUILD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.md b/BUILD.md index 182464d7..6c681d72 100644 --- a/BUILD.md +++ b/BUILD.md @@ -93,8 +93,8 @@ For new simple formats, assuming existing layout/coding: - *src/meta/(format-name).c*: create new format parser that reads all needed info from the stream header and inits VGMSTREAM - *src/meta/meta.h*: register parser's init - *src/vgmstream.h*: register new meta -- *src/vgmstream.c*: add parser init to search list, add meta description -- *src/formats.c*: add new extension to the format list +- *src/vgmstream.c*: add parser init to search list +- *src/formats.c*: add new extension to the format list, add meta description *fb2k/in_vgmstream.cpp*: add new extension to the file associations list - *src/Makefile* *src/meta/Makefile.unix.am* From 2467f9afdcd3a941911e69b409ec280210446438 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 8 Jan 2017 14:19:32 +0100 Subject: [PATCH 12/12] Added CXS [Eternal Sonata (Xbox 360)] --- src/Makefile | 3 +- src/formats.c | 48 +++++++++++----------- src/libvgmstream.vcproj | 4 ++ src/libvgmstream.vcxproj | 1 + src/libvgmstream.vcxproj.filters | 3 ++ src/meta/Makefile.unix.am | 1 + src/meta/meta.h | 4 +- src/meta/x360.c | 68 ++++++++++++++++++++++++++++++++ src/vgmstream.c | 1 + src/vgmstream.h | 3 +- 10 files changed, 110 insertions(+), 26 deletions(-) create mode 100644 src/meta/x360.c diff --git a/src/Makefile b/src/Makefile index 99704ed7..be54baf2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/formats.c b/src/formats.c index 951fb7ab..b905887a 100644 --- a/src/formats.c +++ b/src/formats.c @@ -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 }; diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 57e6f8ff..194a37d4 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1154,6 +1154,10 @@ RelativePath=".\meta\wvs.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index 86dccd0e..87a8c416 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -139,6 +139,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 3014e915..b318ba93 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1030,5 +1030,8 @@ meta\Source Files + + meta\Source Files + \ No newline at end of file diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index fa0f3d49..e5f5e56f 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -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 diff --git a/src/meta/meta.h b/src/meta/meta.h index 62156299..cf5b3f1f 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -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*/ diff --git a/src/meta/x360.c b/src/meta/x360.c new file mode 100644 index 00000000..66e39d4d --- /dev/null +++ b/src/meta/x360.c @@ -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; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index fec6927c..d7366e8b 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -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, diff --git a/src/vgmstream.h b/src/vgmstream.h index 2a44d21b..79582bdd 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -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 */