Merge pull request #57 from bnnm/format-fsb4-misc

Formats: FSB4, etc
This commit is contained in:
Christopher Snowhill 2017-01-02 10:18:32 -08:00 committed by GitHub
commit afe81ca836
35 changed files with 1106 additions and 1185 deletions

View File

@ -14,6 +14,7 @@
//-------------------------------------------------- //--------------------------------------------------
// インライン関数 // インライン関数
//-------------------------------------------------- //--------------------------------------------------
#if 0
static inline unsigned short get_le16(unsigned short v_){const unsigned char *v=(const unsigned char *)&v_;unsigned short r=v[1];r<<=8;r|=v[0];return r;} static inline unsigned short get_le16(unsigned short v_){const unsigned char *v=(const unsigned char *)&v_;unsigned short r=v[1];r<<=8;r|=v[0];return r;}
static inline unsigned short get_be16(unsigned short v_){const unsigned char *v=(const unsigned char *)&v_;unsigned short r=v[0];r<<=8;r|=v[1];return r;} static inline unsigned short get_be16(unsigned short v_){const unsigned char *v=(const unsigned char *)&v_;unsigned short r=v[0];r<<=8;r|=v[1];return r;}
static inline unsigned int get_be24(unsigned int v_){const unsigned char *v=(const unsigned char *)&v_;unsigned int r=v[0];r<<=8;r|=v[1];r<<=8;r|=v[2];return r;}; static inline unsigned int get_be24(unsigned int v_){const unsigned char *v=(const unsigned char *)&v_;unsigned int r=v[0];r<<=8;r|=v[1];r<<=8;r|=v[2];return r;};
@ -21,7 +22,6 @@ static inline unsigned int get_le32(unsigned int v_){const unsigned char *v=(con
static inline unsigned int get_be32(unsigned int v_){const unsigned char *v=(const unsigned char *)&v_;unsigned int r=v[0];r<<=8;r|=v[1];r<<=8;r|=v[2];r<<=8;r|=v[3];return r;} static inline unsigned int get_be32(unsigned int v_){const unsigned char *v=(const unsigned char *)&v_;unsigned int r=v[0];r<<=8;r|=v[1];r<<=8;r|=v[2];r<<=8;r|=v[3];return r;}
static inline float get_bef32(float v_){union{float f;unsigned int i;}v;v.f=v_;v.i=get_be32(v.i);return v.f;} static inline float get_bef32(float v_){union{float f;unsigned int i;}v;v.f=v_;v.i=get_be32(v.i);return v.f;}
#if 0
static union { unsigned int i; unsigned char c[4]; } g_is_le = {1}; static union { unsigned int i; unsigned char c[4]; } g_is_le = {1};
static inline unsigned short swap_u16(unsigned short v){unsigned short r=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;return r;} static inline unsigned short swap_u16(unsigned short v){unsigned short r=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;return r;}
static inline unsigned short swap_u32(unsigned int v){unsigned int r=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;return r;} static inline unsigned short swap_u32(unsigned int v){unsigned int r=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;r<<=8;v>>=8;r|=v&0xFF;return r;}
@ -191,9 +191,11 @@ static void clHCA_destructor(clHCA *hca)
//-------------------------------------------------- //--------------------------------------------------
// HCAチェック // HCAチェック
//-------------------------------------------------- //--------------------------------------------------
#if 0
static int clHCA_CheckFile(void *data,unsigned int size){ static int clHCA_CheckFile(void *data,unsigned int size){
return (data&&size>=4&&(get_le32(*(unsigned int *)data)&0x7F7F7F7F)==0x00414348); return (data&&size>=4&&(get_be32(*(unsigned int *)data)&0x7F7F7F7F)==0x48434100);/*'HCA\0'*/
} }
#endif
//-------------------------------------------------- //--------------------------------------------------
// チェックサム // チェックサム
@ -366,7 +368,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// HCA // HCA
if(size>=sizeof(stHeader) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='HCA\0'){ if(size>=sizeof(stHeader) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x48434100){/*'HCA\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
_version=clData_GetBit(&d,16); _version=clData_GetBit(&d,16);
_dataOffset=clData_GetBit(&d,16); _dataOffset=clData_GetBit(&d,16);
@ -380,7 +382,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// fmt // fmt
if(size>=sizeof(stFormat) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)=='fmt\0'){ if(size>=sizeof(stFormat) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)==0x666D7400){/*'fmt\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
_channelCount=clData_GetBit(&d,8); _channelCount=clData_GetBit(&d,8);
_samplingRate=clData_GetBit(&d,24); _samplingRate=clData_GetBit(&d,24);
@ -408,7 +410,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// comp // comp
if(size>=sizeof(stCompress) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)=='comp'){ if(size>=sizeof(stCompress) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)==0x636F6D70){/*'comp'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
_blockSize=clData_GetBit(&d,16); _blockSize=clData_GetBit(&d,16);
_comp_r01=clData_GetBit(&d,8); _comp_r01=clData_GetBit(&d,8);
@ -443,7 +445,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// dec // dec
else if(size>=sizeof(stDecode) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)=='dec\0'){ else if(size>=sizeof(stDecode) && (clData_CheckBit(&d, 32)&0x7F7F7F7F)==0x64656300){/*'dec\0'*/
unsigned char count1,count2,enableCount2; unsigned char count1,count2,enableCount2;
clData_AddBit(&d, 32); clData_AddBit(&d, 32);
_blockSize=clData_GetBit(&d,16); _blockSize=clData_GetBit(&d,16);
@ -482,7 +484,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// vbr // vbr
if(size>=sizeof(stVBR) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='vbr\0'){ if(size>=sizeof(stVBR) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x76627200){/*'vbr\0'*/
clData_AddBit(&d, 32); clData_AddBit(&d, 32);
_vbr_r01=clData_GetBit(&d,16); _vbr_r01=clData_GetBit(&d,16);
_vbr_r02=clData_GetBit(&d,16); _vbr_r02=clData_GetBit(&d,16);
@ -502,7 +504,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// ath // ath
if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='ath\0'){ if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x61746800){/*'ath\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
_ath_type=clData_GetBit(&d,16); _ath_type=clData_GetBit(&d,16);
printf("ATHタイプ:%d ※v2.0から廃止されています。\n",_ath_type); printf("ATHタイプ:%d ※v2.0から廃止されています。\n",_ath_type);
@ -514,7 +516,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// loop // loop
if(size>=sizeof(stLoop) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='loop'){ if(size>=sizeof(stLoop) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x6C6F6F70){/*'loop'*/
clData_AddBit(&d, 32); clData_AddBit(&d, 32);
_loopStart=clData_GetBit(&d,32); _loopStart=clData_GetBit(&d,32);
_loopEnd=clData_GetBit(&d,32); _loopEnd=clData_GetBit(&d,32);
@ -531,7 +533,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// ciph // ciph
if(size>=6 && (clData_CheckBit(&d, 32)&0x7F7F7F7F)=='ciph'){ if(size>=6 && (clData_CheckBit(&d, 32)&0x7F7F7F7F)==0x63697068){/*'ciph'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
_ciph_type=clData_GetBit(&d,16); _ciph_type=clData_GetBit(&d,16);
switch(_ciph_type){ switch(_ciph_type){
@ -547,7 +549,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// rva // rva
if(size>=sizeof(stRVA) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='rva\0'){ if(size>=sizeof(stRVA) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x72766100){/*'rva\0'*/
union { unsigned int i; float f; } v; union { unsigned int i; float f; } v;
clData_AddBit(&d,32); clData_AddBit(&d,32);
v.i=clData_GetBit(&d,32); v.i=clData_GetBit(&d,32);
@ -557,7 +559,7 @@ static int clHCA_PrintInfo(const char *filenameHCA){
} }
// comm // comm
if(size>=5 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='comm'){ if(size>=5 && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x636F6D6D){/*'comm'*/
int i; int i;
clData_AddBit(&d,32); clData_AddBit(&d,32);
_comm_len=clData_GetBit(&d,8); _comm_len=clData_GetBit(&d,8);
@ -758,7 +760,7 @@ int clHCA_DecodeToWavefile_Decode(clHCA *hca,void *fp1,void *fp2,unsigned int ad
int clHCA_isOurFile0(const void *data){ int clHCA_isOurFile0(const void *data){
clData d; clData d;
clData_constructor(&d, data, 8); clData_constructor(&d, data, 8);
if((clData_CheckBit(&d,32)&0x7F7F7F7F)=='HCA\0'){ if((clData_CheckBit(&d,32)&0x7F7F7F7F)==0x48434100){/*'HCA\0'*/
clData_AddBit(&d,32+16); clData_AddBit(&d,32+16);
return clData_CheckBit(&d,16); return clData_CheckBit(&d,16);
} }
@ -1067,7 +1069,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
if(size<sizeof(stHeader))return -1; if(size<sizeof(stHeader))return -1;
// HCA // HCA
if((clData_CheckBit(&d,32)&0x7F7F7F7F)=='HCA\0'){ if((clData_CheckBit(&d,32)&0x7F7F7F7F)==0x48434100){/*'HCA\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_version=clData_GetBit(&d,16); hca->_version=clData_GetBit(&d,16);
hca->_dataOffset=clData_GetBit(&d,16); hca->_dataOffset=clData_GetBit(&d,16);
@ -1080,7 +1082,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// fmt // fmt
if(size>=sizeof(stFormat) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='fmt\0'){ if(size>=sizeof(stFormat) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x666D7400){/*'fmt\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_channelCount=clData_GetBit(&d,8); hca->_channelCount=clData_GetBit(&d,8);
hca->_samplingRate=clData_GetBit(&d,24); hca->_samplingRate=clData_GetBit(&d,24);
@ -1095,7 +1097,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// comp // comp
if(size>=sizeof(stCompress) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='comp'){ if(size>=sizeof(stCompress) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x636F6D70){/*'comp'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_blockSize=clData_GetBit(&d,16); hca->_blockSize=clData_GetBit(&d,16);
hca->_comp_r01=clData_GetBit(&d,8); hca->_comp_r01=clData_GetBit(&d,8);
@ -1113,7 +1115,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// dec // dec
else if(size>=sizeof(stDecode) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='dec\0'){ else if(size>=sizeof(stDecode) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x64656300){/*'dec\0'*/
unsigned char count1,count2,enableCount2; unsigned char count1,count2,enableCount2;
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_blockSize=clData_GetBit(&d,16); hca->_blockSize=clData_GetBit(&d,16);
@ -1137,7 +1139,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// vbr // vbr
if(size>=sizeof(stVBR) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='vbr\0'){ if(size>=sizeof(stVBR) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x76627200){/*'vbr\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_vbr_r01=clData_GetBit(&d,16); hca->_vbr_r01=clData_GetBit(&d,16);
hca->_vbr_r02=clData_GetBit(&d,16); hca->_vbr_r02=clData_GetBit(&d,16);
@ -1148,7 +1150,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// ath // ath
if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='ath\0'){ if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x61746800){/*'ath\0'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_ath_type=clData_GetBit(&d,16); hca->_ath_type=clData_GetBit(&d,16);
}else{ }else{
@ -1156,7 +1158,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// loop // loop
if(size>=sizeof(stLoop) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='loop'){ if(size>=sizeof(stLoop) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x6C6F6F70){/*'loop'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_loopStart=clData_GetBit(&d,32); hca->_loopStart=clData_GetBit(&d,32);
hca->_loopEnd=clData_GetBit(&d,32); hca->_loopEnd=clData_GetBit(&d,32);
@ -1174,7 +1176,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// ciph // ciph
if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='ciph'){ if(size>=6 && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x63697068){/*'ciph'*/
clData_AddBit(&d,32); clData_AddBit(&d,32);
hca->_ciph_type=clData_GetBit(&d,16); hca->_ciph_type=clData_GetBit(&d,16);
if(!(hca->_ciph_type==0||hca->_ciph_type==1||hca->_ciph_type==0x38))return -1; if(!(hca->_ciph_type==0||hca->_ciph_type==1||hca->_ciph_type==0x38))return -1;
@ -1184,7 +1186,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// rva // rva
if(size>=sizeof(stRVA) && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='rva\0'){ if(size>=sizeof(stRVA) && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x72766100){/*'rva\0'*/
union { unsigned int i; float f; } v; union { unsigned int i; float f; } v;
clData_AddBit(&d,32); clData_AddBit(&d,32);
v.i=clData_GetBit(&d,32); v.i=clData_GetBit(&d,32);
@ -1195,7 +1197,7 @@ int clHCA_Decode(clHCA *hca,void *data,unsigned int size,unsigned int address){
} }
// comm // comm
if(size>=5 && (clData_CheckBit(&d,32)&0x7F7F7F7F)=='comm'){ if(size>=5 && (clData_CheckBit(&d,32)&0x7F7F7F7F)==0x636F6D6D){/*'comm'*/
void * newmem; void * newmem;
unsigned int i; unsigned int i;
clData_AddBit(&d,32); clData_AddBit(&d,32);

View File

@ -49,13 +49,14 @@ static size_t read_the_rest_foo(uint8_t * dest, off_t offset, size_t length, FOO
streamfile->validsize=0; streamfile->validsize=0;
try { try {
if(offset >= streamfile->m_file->get_size(*streamfile->p_abort)) { if(offset > streamfile->m_file->get_size(*streamfile->p_abort)) {
/* Update offset at end of file */ /* Update offset at end of file */
streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort); streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort);
return length_read; return length_read;
} }
streamfile->m_file->seek(offset,*streamfile->p_abort); streamfile->m_file->seek(offset,*streamfile->p_abort);
if (streamfile->m_file->is_eof(*streamfile->p_abort)) return length_read; //if (streamfile->m_file->is_eof(*streamfile->p_abort)) /* allow edge case of offset=filesize */
// return length_read;
} catch (...) { } catch (...) {
streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort); streamfile->offset = streamfile->m_file->get_size(*streamfile->p_abort);
#ifdef PROFILE_STREAMFILE #ifdef PROFILE_STREAMFILE

View File

@ -311,7 +311,7 @@ META_OBJS=meta/adx_header.o \
EXT_LIBS = ../ext_libs/clHCA.o EXT_LIBS = ../ext_libs/clHCA.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) $(EXT_LIBS) OBJECTS=vgmstream.o streamfile.o util.o header.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) $(EXT_LIBS)
libvgmstream.a: $(OBJECTS) libvgmstream.a: $(OBJECTS)
$(AR) crs libvgmstream.a $(OBJECTS) $(AR) crs libvgmstream.a $(OBJECTS)

View File

@ -4,8 +4,8 @@ AM_CFLAGS = -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir)
AM_MAKEFLAGS=-f Makefile.unix AM_MAKEFLAGS=-f Makefile.unix
libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la
libvgmstream_la_SOURCES = vgmstream.c util.c streamfile.c ../ext_libs/clHCA.c libvgmstream_la_SOURCES = vgmstream.c util.c streamfile.c header.c ../ext_libs/clHCA.c
SUBDIRS = coding layout meta SUBDIRS = coding layout meta
EXTRA_DIST = pstdint.h streamfile.h streamtypes.h util.h vgmstream.h EXTRA_DIST = pstdint.h streamfile.h streamtypes.h util.h header.h vgmstream.h

View File

@ -56,13 +56,9 @@ void decode_invert_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelsp
void decode_psx_badflags(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_ffxi_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_baf_adpcm(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_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_short_vag_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);
void decode_xa(VGMSTREAM * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel); 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 init_get_high_nibble(VGMSTREAM * vgmstream);
@ -87,14 +83,11 @@ void decode_cbd2_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
void decode_ws(VGMSTREAM * vgmstream, int channel, 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);
#ifdef VGM_USE_MPEG #ifdef VGM_USE_MPEG
void decode_fake_mpeg2_l2(VGMSTREAMCHANNEL * stream,
mpeg_codec_data * data,
sample * outbuf, int32_t samples_to_do);
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); 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);
void decode_mpeg(VGMSTREAMCHANNEL * stream, mpeg_codec_data * data, sample * outbuf, int32_t samples_to_do, int channels);
long mpeg_bytes_to_samples(long bytes, const struct mpg123_frameinfo *mi); long mpeg_bytes_to_samples(long bytes, const struct mpg123_frameinfo *mi);
void decode_mpeg(VGMSTREAMCHANNEL * stream, void mpeg_set_error_logging(mpeg_codec_data * data, int enable);
mpeg_codec_data * data,
sample * outbuf, int32_t samples_to_do, int channels);
#endif #endif
#ifdef VGM_USE_G7221 #ifdef VGM_USE_G7221

View File

@ -226,4 +226,11 @@ long mpeg_bytes_to_samples(long bytes, const struct mpg123_frameinfo *mi) {
return (int64_t)bytes * mi->rate * 8 / (mi->bitrate * 1000); return (int64_t)bytes * mi->rate * 8 / (mi->bitrate * 1000);
} }
/**
* disables/enables stderr output, useful for MPEG known to contain recoverable errors
*/
void mpeg_set_error_logging(mpeg_codec_data * data, int enable) {
mpg123_param(data->m, MPG123_ADD_FLAGS, MPG123_QUIET, !enable);
}
#endif #endif

View File

@ -3,6 +3,8 @@
#include "coding.h" #include "coding.h"
#include "../util.h" #include "../util.h"
#define MTAF_BLOCK_SUPPORT 0
// A hybrid of IMA and Yamaha ADPCM found in Metal Gear Solid 3 // A hybrid of IMA and Yamaha ADPCM found in Metal Gear Solid 3
// Thanks to X_Tra (http://metalgear.in/) for pointing me to the step size table. // Thanks to X_Tra (http://metalgear.in/) for pointing me to the step size table.
@ -81,62 +83,79 @@ static int16_t step_size[32][16] = {
void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels) { void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int channels) {
int32_t sample_count; int32_t sample_count;
unsigned long cur_off = stream->offset; off_t cur_off = stream->offset;
int i; int i;
int c = channel%2; int c = channel%2; /* global channel to stream channel */
int16_t init_idx;
int16_t init_hist;
int32_t hist = stream->adpcm_history1_16; int32_t hist = stream->adpcm_history1_16;
int step_idx = stream->adpcm_step_index; int32_t step_idx = stream->adpcm_step_index;
uint8_t byte = 0;
//printf("channel %d: first_sample = %d, stream->offset = 0x%lx, cur_off = 0x%lx init_idx = %d\n", channel, first_sample, (unsigned long)stream->offset, cur_off, init_idx);
#if 0
if (init_idx < 0 || init_idx > 31) { #if MTAF_BLOCK_SUPPORT
fprintf(stderr, "step idx out of range at 0x%lx ch %d\n", cur_off, c); {
exit(1); /* "macroblock" support (layout/mtaf_block.c) was removed since the extractor now produces clean files;
} * this a hack to skip those blocks, left as a reminder (not well tested) */
if (0 != read_16bitLE(cur_off+10+c*4, stream->streamfile)) { int unk, size, empty, frames, repeat = 1;
fprintf(stderr, "exp. zero after hist at 0x%lx ch %d\n", cur_off, c); do {
exit(1); unk = read_32bitLE(cur_off+0x00, stream->streamfile); /* always BE 0x01001100? */
size = read_32bitLE(cur_off+0x04, stream->streamfile); /* block size */
empty = read_32bitLE(cur_off+0x08, stream->streamfile); /* always 0? */
frames = read_32bitLE(cur_off+0x0c, stream->streamfile); /* total frames of 0x110 */
if (unk == 0x00110001 && empty == 0 && size > 0) {
if (frames == 0) {
stream->offset += size; /* full skip */
} else if ((size-0x10) == frames*0x110) {
stream->offset += 0x10; /* header skip */
repeat = 0;
}
cur_off = stream->offset;
}
else {
repeat = 0;
}
} while(repeat);
} }
#endif #endif
first_sample = first_sample%0x100; first_sample = first_sample % 0x100;
if (first_sample%0x100 == 0) {
while (read_8bit(cur_off, stream->streamfile) != 0) {
cur_off += 16;
}
stream->offset = cur_off;
init_idx = read_16bitLE(cur_off+4+c*2, stream->streamfile); /* read header when we hit a new frame every 0x100 samples */
init_hist = read_16bitLE(cur_off+8+c*4, stream->streamfile); if (first_sample == 0) {
int32_t init_idx, init_hist;
hist = init_hist;
#if 0 /* 0x10 header: owner stream, frame count, step-L, step-R, hist-L, hist-R */
if (step_idx != init_idx) { /* uint32_t stream = read_8bit(cur_off+0+c*2, stream->streamfile); */ /* 0=first */
fprintf(stderr, "step_idx does not match at 0x%lx, %d!=%d\n",cur_off,step_idx, init_idx); /* uint24_t frames = (uint24_t)read_16bitLE(cur_off+1, stream->streamfile); */ /* 1=first */
exit(1); init_idx = read_16bitLE(cur_off+4+c*2, stream->streamfile); /* step-L/R */
init_hist = read_16bitLE(cur_off+4+4+c*4, stream->streamfile); /* hist-L/R: hist 16bit + empty 16bit */
VGM_ASSERT( read_16bitLE(cur_off+4+4+2+c*4, stream->streamfile) != 0,
"init_hist not 16bit at 0x%lx, ch=%d\n", cur_off, c);
VGM_ASSERT( init_idx < 0 || init_idx > 31,
"init_idx out of range at 0x%lx, ch=%d\n", cur_off, c);
VGM_ASSERT( step_idx != init_idx,
"step_idx does not match init_idx at 0x%lx, step=%d, init=%d\n",cur_off,step_idx, init_idx);
/* avoid index out of range in corrupt files */
if (init_idx < 0) {
init_idx = 0;
} else if (init_idx > 31) {
init_idx = 31;
} }
#endif
step_idx = init_idx; step_idx = init_idx;
hist = init_hist;
} }
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) { for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
uint8_t byte, nibble; uint8_t nibble;
byte = read_8bit(cur_off + 0x10 + 0x80*c + i/2, stream->streamfile);
if (i%2!=1) if (i%2 != 1) { /* low nibble first */
{ byte = read_8bit(cur_off + 0x10 + 0x80*c + i/2, stream->streamfile);
// low nibble first nibble = byte & 0x0f;
nibble = byte&0xf; } else { /* high nibble last */
}
else
{
// high nibble last
nibble = byte >> 4; nibble = byte >> 4;
} }
@ -145,12 +164,9 @@ void decode_mtaf(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing,
outbuf[sample_count] = hist; outbuf[sample_count] = hist;
step_idx += index_table[nibble]; step_idx += index_table[nibble];
if (step_idx < 0) if (step_idx < 0) { /* clip step */
{
step_idx = 0; step_idx = 0;
} } else if (step_idx > 31) {
if (step_idx > 31)
{
step_idx = 31; step_idx = 31;
} }
} /* end sample loop */ } /* end sample loop */

View File

@ -3,8 +3,7 @@
#include "../util.h" #include "../util.h"
/* for some algos, maybe closer to the real thing */ /* for some algos, maybe closer to the real thing */
#define VAG_USE_INTEGER_TABLE 0 #define VAG_USE_INTEGER_TABLE 0
/* PS ADPCM table (precalculated divs) */ /* PS ADPCM table (precalculated divs) */
static const double VAG_f[5][2] = { static const double VAG_f[5][2] = {
@ -14,6 +13,7 @@ static const double VAG_f[5][2] = {
{ 98.0 / 64.0 , -55.0 / 64.0 }, { 98.0 / 64.0 , -55.0 / 64.0 },
{ 122.0 / 64.0 , -60.0 / 64.0 } { 122.0 / 64.0 , -60.0 / 64.0 }
}; };
#if VAG_USE_INTEGER_TABLE
/* PS ADPCM table */ /* PS ADPCM table */
static const int8_t VAG_coefs[5][2] = { static const int8_t VAG_coefs[5][2] = {
{ 0 , 0 }, { 0 , 0 },
@ -22,7 +22,7 @@ static const int8_t VAG_coefs[5][2] = {
{ 98 , -55 }, { 98 , -55 },
{ 122 , -60 } { 122 , -60 }
}; };
#endif
/* PSVita ADPCM table */ /* PSVita ADPCM table */
static const int16_t HEVAG_coefs[128][4] = { static const int16_t HEVAG_coefs[128][4] = {
@ -294,84 +294,6 @@ void decode_psx_badflags(VGMSTREAMCHANNEL * stream, sample * outbuf, int channel
stream->adpcm_history2_32=hist2; stream->adpcm_history2_32=hist2;
} }
/* FF XI's Vag-ish format */
void decode_ffxi_adpcm(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;
int32_t hist2=stream->adpcm_history2_32;
short scale;
int i;
int32_t sample_count;
int32_t predictor;
int framesin = first_sample/16;
predict_nr = read_8bit(stream->offset+framesin*9,stream->streamfile) >> 4;
shift_factor = read_8bit(stream->offset+framesin*9,stream->streamfile) & 0xf;
first_sample = first_sample % 16;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
short sample_byte = (short)read_8bit(stream->offset+(framesin*9)+1+i/2,stream->streamfile);
sample=0;
scale = ((i&1 ?
sample_byte >> 4 :
sample_byte & 0x0f)<<12);
#if !VAG_USE_INTEGER_TABLE
predictor =
(int)((hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1]));
#else
predictor =
(hist1*VAG_coefs[predict_nr][0]+hist2*VAG_coefs[predict_nr][1])/64;
#endif
sample=(scale >> shift_factor) + predictor;
outbuf[sample_count] = clamp16(sample);
hist2=hist1;
hist1=sample;
}
stream->adpcm_history1_32=hist1;
stream->adpcm_history2_32=hist2;
}
void decode_baf_adpcm(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;
int32_t hist2=stream->adpcm_history2_32;
short scale;
int i;
int32_t sample_count;
int framesin = first_sample/64;
predict_nr = read_8bit(stream->offset+framesin*33,stream->streamfile) >> 4;
shift_factor = read_8bit(stream->offset+framesin*33,stream->streamfile) & 0xf;
first_sample = first_sample % 64;
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
short sample_byte = (short)read_8bit(stream->offset+(framesin*33)+1+i/2,stream->streamfile);
scale = ((i&1 ?
sample_byte >> 4 :
sample_byte & 0x0f)<<12);
sample=(int)((scale >> shift_factor)+hist1*VAG_f[predict_nr][0]+hist2*VAG_f[predict_nr][1]);
outbuf[sample_count] = clamp16(sample);
hist2=hist1;
hist1=sample;
}
stream->adpcm_history1_32=hist1;
stream->adpcm_history2_32=hist2;
}
/** /**
* Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded). * Sony's HEVAG (High Efficiency VAG) ADPCM, used in PSVita games (hardware decoded).
@ -442,11 +364,10 @@ void decode_hevag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels
/** /**
* Short VAG ADPCM, found in PS3 Afrika (SGDX type 5). * PS ADPCM of configurable size, with no flag.
* Uses 8 byte blocks and 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_short_vag_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) {
uint8_t predict_nr, shift, byte; uint8_t predict_nr, shift, byte;
int16_t scale = 0; int16_t scale = 0;
@ -454,37 +375,45 @@ void decode_short_vag_adpcm(VGMSTREAMCHANNEL * stream, sample * outbuf, int chan
int32_t hist1 = stream->adpcm_history1_32; int32_t hist1 = stream->adpcm_history1_32;
int32_t hist2 = stream->adpcm_history2_32; int32_t hist2 = stream->adpcm_history2_32;
int i, sample_count; int i, sample_count, bytes_per_frame, samples_per_frame;
const int header_size = 1;
bytes_per_frame = frame_size - header_size;
samples_per_frame = bytes_per_frame * 2;
int framesin = first_sample / 6; int framesin = first_sample / samples_per_frame;
/* 2 byte header: predictor = 1st, shift = 2nd */ /* 1 byte header: predictor = 1st, shift = 2nd */
byte = (uint8_t)read_8bit(stream->offset+framesin*8+0,stream->streamfile); byte = (uint8_t)read_8bit(stream->offset+framesin*frame_size+0,stream->streamfile);
predict_nr = byte >> 4; predict_nr = byte >> 4;
shift = byte & 0x0f; shift = byte & 0x0f;
first_sample = first_sample % 6; first_sample = first_sample % samples_per_frame;
for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) { for (i = first_sample, sample_count = 0; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
sample = 0; sample = 0;
if (predict_nr < 5) { if (predict_nr < 5) {
if (i%2 != 1) { /* low nibble first */
if (i & 1) {/* odd/even nibble */ byte = (uint8_t)read_8bit(stream->offset+(framesin*frame_size)+header_size+i/2,stream->streamfile);
scale = byte >> 4;
} else {
byte = (uint8_t)read_8bit(stream->offset+(framesin*8)+1+i/2,stream->streamfile);
scale = (byte & 0x0f); scale = (byte & 0x0f);
} else { /* high nibble last */
scale = byte >> 4;
} }
scale = scale << 12; /* shift + sign extend (only if scale is int16_t) */
/*if (scale > 7) { /*if (scale > 7) {
scale = scale - 16; scale = scale - 16;
}*/ }*/
scale = scale << 12; /* shift + sign extend only if scale is int16_t */ #if VAG_USE_INTEGER_TABLE
sample = (scale >> shift) +
sample = (hist1 * VAG_coefs[predict_nr][0] + (hist1 * VAG_coefs[predict_nr][0] +
hist2 * VAG_coefs[predict_nr][1] ) / 64; hist2 * VAG_coefs[predict_nr][1] ) / 64;
sample = sample + (scale >> shift); sample = sample + ;
#else
sample = (int)( (scale >> shift) +
(hist1 * VAG_f[predict_nr][0] +
hist2 * VAG_f[predict_nr][1]) );
#endif
} }
outbuf[sample_count] = clamp16(sample); outbuf[sample_count] = clamp16(sample);

187
src/header.c Normal file
View File

@ -0,0 +1,187 @@
#include <string.h>
#include "header.h"
#include "vgmstream.h"
#include "streamfile.h"
#include "streamtypes.h"
#include "util.h"
/**
* checks if the stream filename is one of the extensions (comma-separated, ex. "adx" or "adx,aix")
*
* returns 0 on failure
*/
int header_check_extensions(STREAMFILE *streamFile, const char * cmpexts) {
char filename[PATH_LIMIT];
const char * ext = NULL;
const char * cmpext = NULL;
size_t ext_len;
streamFile->get_name(streamFile,filename,sizeof(filename));
ext = filename_extension(filename);
ext_len = strlen(ext);
cmpext = cmpexts;
do {
if (strncasecmp(ext,cmpext, ext_len)==0 )
return 1;
cmpext = strstr(cmpext, ",");
if (cmpext != NULL)
cmpext = cmpext + 1; /* skip comma */
} while (cmpext != NULL);
return 0;
}
/**
* opens a stream at offset
*
* returns 0 on failure
*/
int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset) {
STREAMFILE * file;
char filename[PATH_LIMIT];
int ch;
streamFile->get_name(streamFile,filename,sizeof(filename));
{
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) return 0;
for (ch=0; ch < vgmstream->channels; ch++) {
vgmstream->ch[ch].streamfile = file;
if (vgmstream->layout_type == layout_none
|| vgmstream->layout_type == layout_mpeg) { /* 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;
}
else {
vgmstream->ch[ch].channel_start_offset =
vgmstream->ch[ch].offset = start_offset
+ vgmstream->interleave_block_size*ch;
}
}
}
return 1;
}
/**
* Copies a XMA2 riff to buf
*
* returns number of bytes in buf or -1 when buf is not big enough
*/
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) {
uint16_t codec_XMA2 = 0x0166;
size_t riff_size = 4+4+ 4 + 0x3c + 4+4;
size_t bytecount;
uint32_t streams = 0;
uint32_t speakers = 0; /* see audiodefs.h */
if (buf_size < riff_size)
return -1;
bytecount = sample_count * channels * sizeof(sample);
/* untested (no support for > 2ch xma for now) */
switch (channels) {
case 1:
streams = 1;
speakers = 0x00000004; /* FC */
break;
case 2:
streams = 1;
speakers = 0x00000001 | 0x00000002; /* FL FR */
break;
case 3:
streams = 3;
speakers = 0x00000001 | 0x00000002 | 0x00000004; /* FL FC FR */
break;
case 4:
streams = 2;
speakers = 0x00000001 | 0x00000002 | 0x00000010 | 0x00000020; /* FL FR BL BR */
break;
case 5:
streams = 3;
speakers = 0x00000001 | 0x00000002 | 0x00000010 | 0x00000020 | 0x00000004; /* FL C FR BL BR*/
break;
case 6:
streams = 3;
speakers = 0x00000001 | 0x00000002 | 0x00000010 | 0x00000020 | 0x00000200 | 0x00000400; /* FL FR BL BR SL SR */
break;
default:
streams = 1;
speakers = 0x80000000;
break;
}
/*memset(buf,0, sizeof(uint8_t) * fmt_size);*/
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, 0x34);/*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_16bitLE(buf+0x20, (int16_t)(channels*sizeof(sample))); /* block align */
put_16bitLE(buf+0x22, sizeof(sample)*8); /* bits per sample */
put_16bitLE(buf+0x24, 0x22); /* extra data size */
put_16bitLE(buf+0x26, streams); /* number of streams */
put_32bitLE(buf+0x28, speakers); /* speaker position */
put_32bitLE(buf+0x2c, bytecount); /* PCM samples */
put_32bitLE(buf+0x30, block_size); /* XMA block size */
/* (looping values not set, expected to be handled externally) */
put_32bitLE(buf+0x34, 0); /* play begin */
put_32bitLE(buf+0x38, 0); /* play length */
put_32bitLE(buf+0x3c, 0); /* loop begin */
put_32bitLE(buf+0x40, 0); /* loop length */
put_8bit(buf+0x44, 0); /* loop count */
put_8bit(buf+0x45, 4); /* encoder version */
put_16bitLE(buf+0x46, block_count); /* blocks count = entried in seek table */
memcpy(buf+0x48, "data", 4);
put_32bitLE(buf+0x4c, data_size); /* data size */
return riff_size;
}
/**
* reads DSP coefs built in the streamfile
*/
void header_dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing) {
int ch, i;
/* get ADPCM coefs */
for (ch=0; ch < vgmstream->channels; ch++) {
for (i=0; i < 16; i++) {
vgmstream->ch[ch].adpcm_coef[i] =
read_16bitBE(offset + ch*spacing + i*2, streamFile);
}
}
}
#if 0
/**
* Converts a data offset (without headers) to sample, so full datasize would be num_samples
*
* return -1 on failure
*/
int data_offset_to_samples(layout_t layout, int channels, size_t interleave, size_t data_offset) {
// todo get samples per block
// VAG: datasize * 28 / 16 / channels;
// IMA: (datasize / 0x24 / channels) * ((0x24-4)*2);//0x24 = interleave?
// DSP: datasize / 8 / channel_count * 14;
}
#endif

22
src/header.h Normal file
View File

@ -0,0 +1,22 @@
/*
* header.h - utilities for common/repetitive actions in stream headers (more complex than those in util.h)
*/
#ifndef _HEADER_H_
#define _HEADER_H_
#include "util.h"
#include "streamfile.h"
#include "vgmstream.h"
int header_check_extensions(STREAMFILE *streamFile, const char * cmpexts);
int header_open_stream(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t start_offset);
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);;
void header_dsp_read_coefs_be(VGMSTREAM * vgmstream, STREAMFILE *streamFile, off_t offset, off_t spacing);
#endif /* _HEADER_H_ */

View File

@ -68,12 +68,8 @@ void dsp_bdsp_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream); void tra_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void mtaf_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_iab_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); void ps2_strlr_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void ps2_mtaf_block_update(off_t block_ofset, VGMSTREAM * vgmstream);
#endif #endif

View File

@ -147,6 +147,10 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd" Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> >
<File
RelativePath=".\header.h"
>
</File>
<File <File
RelativePath=".\streamfile.h" RelativePath=".\streamfile.h"
> >
@ -169,6 +173,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\header.c"
>
</File>
<File <File
RelativePath=".\streamfile.c" RelativePath=".\streamfile.c"
> >

View File

@ -82,6 +82,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\ext_includes\clHCA.h" /> <ClInclude Include="..\ext_includes\clHCA.h" />
<ClInclude Include="header.h" />
<ClInclude Include="streamfile.h" /> <ClInclude Include="streamfile.h" />
<ClInclude Include="streamtypes.h" /> <ClInclude Include="streamtypes.h" />
<ClInclude Include="util.h" /> <ClInclude Include="util.h" />
@ -138,6 +139,7 @@
<ClCompile Include="meta\wii_ras.c" /> <ClCompile Include="meta\wii_ras.c" />
<ClCompile Include="meta\wpd.c" /> <ClCompile Include="meta\wpd.c" />
<ClCompile Include="meta\x360_tra.c" /> <ClCompile Include="meta\x360_tra.c" />
<ClCompile Include="header.c" />
<ClCompile Include="streamfile.c" /> <ClCompile Include="streamfile.c" />
<ClCompile Include="util.c" /> <ClCompile Include="util.c" />
<ClCompile Include="vgmstream.c" /> <ClCompile Include="vgmstream.c" />

View File

@ -47,6 +47,9 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="header.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="streamfile.h"> <ClInclude Include="streamfile.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -82,6 +85,9 @@
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="header.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="streamfile.c"> <ClCompile Include="streamfile.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -41,7 +41,7 @@ VGMSTREAM * init_vgmstream_2dx(STREAMFILE *streamFile) {
vgmstream->num_samples = read_32bitLE(0x66,streamFile); vgmstream->num_samples = read_32bitLE(0x66,streamFile);
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bitLE(0x38,streamFile); vgmstream->interleave_block_size = read_16bitLE(0x38,streamFile);
vgmstream->meta_type = meta_2DX; vgmstream->meta_type = meta_2DX9;
/* open the file for reading */ /* open the file for reading */
{ {

View File

@ -1,36 +1,44 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../util.h"
#include "../header.h"
/* .BAF - Bizarre Creations (Blur, James Bond 007: Blood Stone, etc) */ /* .BAF - Bizarre Creations (Blur, James Bond 007: Blood Stone, etc) */
VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT]; off_t WAVE_size, DATA_size;
off_t WAVE_size,DATA_size;
off_t start_offset; off_t start_offset;
long sample_count; long sample_count;
int sample_rate;
const int frame_size = 33; const int frame_size = 33;
const int frame_samples = 64; const int frame_samples = (frame_size-1) * 2;
int channels; int channels;
int loop_flag = 0; int loop_flag = 0;
/* check extension, case insensitive */ /* check extensions */
streamFile->get_name(streamFile,filename,sizeof(filename)); if ( !header_check_extensions(streamFile, "baf") )
if (strcasecmp("baf",filename_extension(filename))) goto fail; goto fail;
/* check WAVE */ /* check WAVE */
if (read_32bitBE(0,streamFile) != 0x57415645) goto fail; if (read_32bitBE(0,streamFile) != 0x57415645) /* "WAVE" */
goto fail;
WAVE_size = read_32bitBE(4,streamFile); WAVE_size = read_32bitBE(4,streamFile);
if (WAVE_size != 0x4c) goto fail; if (WAVE_size != 0x4c) /* && WAVE_size != 0x50*/
goto fail;
/* check for DATA after WAVE */ /* check for DATA after WAVE */
if (read_32bitBE(WAVE_size,streamFile) != 0x44415441) goto fail; if (read_32bitBE(WAVE_size,streamFile) != 0x44415441) /* "DATA"*/
goto fail;
/* check that WAVE size is data size */ /* check that WAVE size is data size */
DATA_size = read_32bitBE(0x30,streamFile); DATA_size = read_32bitBE(0x30,streamFile);
if (read_32bitBE(WAVE_size+4,streamFile)-8 != DATA_size) goto fail; if (read_32bitBE(WAVE_size+4,streamFile)-8 != DATA_size) goto fail;
/*if (WAVE_size == 0x50) sample_count = DATA_size * frame_samples / frame_size / channels;*/
sample_count = read_32bitBE(0x44,streamFile); sample_count = read_32bitBE(0x44,streamFile);
/*if (WAVE_size == 0x50) sample_rate = read_32bitBE(0x3c,streamFile);*/
sample_rate = read_32bitBE(0x40,streamFile);
/* unsure how to detect channel count, so use a hack */ /* unsure how to detect channel count, so use a hack */
channels = (long long)DATA_size / frame_size * frame_samples / sample_count; channels = (long long)DATA_size / frame_size * frame_samples / sample_count;
@ -40,33 +48,22 @@ VGMSTREAM * init_vgmstream_baf(STREAMFILE *streamFile) {
/* fill in the vital statistics */ /* fill in the vital statistics */
start_offset = WAVE_size + 8; start_offset = WAVE_size + 8;
vgmstream->sample_rate = read_32bitBE(0x40,streamFile); vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = sample_count; vgmstream->num_samples = sample_count;
vgmstream->coding_type = coding_BAF_ADPCM; vgmstream->coding_type = coding_VAG_ADPCM_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = frame_size; vgmstream->interleave_block_size = frame_size;
vgmstream->meta_type = meta_BAF; vgmstream->meta_type = meta_BAF;
/* open the file for reading by each channel */ /* open the file for reading */
{ if ( !header_open_stream(vgmstream, streamFile, start_offset) )
int i; goto fail;
STREAMFILE *file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channels;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+vgmstream->interleave_block_size*i;
}
}
return vgmstream; return vgmstream;
/* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -7,8 +7,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
coding_t coding_type; coding_t coding_type;
off_t info_offset, seek_offset, data_offset, regn_offset, pdat_offset; off_t info_offset = 0, seek_offset = 0, data_offset = 0;
size_t info_size, seek_size, data_size, regn_size, pdat_size;
uint16_t temp_id; uint16_t temp_id;
int codec_number; int codec_number;
int channel_count; int channel_count;
@ -35,23 +34,23 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
switch(temp_id) { switch(temp_id) {
case 0x4000: case 0x4000:
info_offset = read_32bitLE(0x18 + i * 0xc, streamFile); info_offset = read_32bitLE(0x18 + i * 0xc, streamFile);
info_size = read_32bitLE(0x1c + i * 0xc, streamFile); /* size_t info_size = read_32bitLE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4001: case 0x4001:
seek_offset = read_32bitLE(0x18 + i * 0xc, streamFile); seek_offset = read_32bitLE(0x18 + i * 0xc, streamFile);
seek_size = read_32bitLE(0x1c + i * 0xc, streamFile); /* size_t seek_size = read_32bitLE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4002: case 0x4002:
data_offset = read_32bitLE(0x18 + i * 0xc, streamFile); data_offset = read_32bitLE(0x18 + i * 0xc, streamFile);
data_size = read_32bitLE(0x1c + i * 0xc, streamFile); /* size_t data_size = read_32bitLE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4003: case 0x4003:
regn_offset = read_32bitLE(0x18 + i * 0xc, streamFile); /* off_t regn_offset = read_32bitLE(0x18 + i * 0xc, streamFile); */
regn_size = read_32bitLE(0x1c + i * 0xc, streamFile); /* size_t regn_size = read_32bitLE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4004: case 0x4004:
pdat_offset = read_32bitLE(0x18 + i * 0xc, streamFile); /* off_t pdat_offset = read_32bitLE(0x18 + i * 0xc, streamFile); */
pdat_size = read_32bitLE(0x1c + i * 0xc, streamFile); /* size_t pdat_size = read_32bitLE(0x1c + i * 0xc, streamFile); */
break; break;
default: default:
break; break;
@ -62,6 +61,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
/* check type details */ /* check type details */
if (info_offset == 0) goto fail;
codec_number = read_8bit(info_offset + 0x20, streamFile); codec_number = read_8bit(info_offset + 0x20, streamFile);
loop_flag = read_8bit(info_offset + 0x21, streamFile); loop_flag = read_8bit(info_offset + 0x21, streamFile);
channel_count = read_8bit(info_offset + 0x22, streamFile); channel_count = read_8bit(info_offset + 0x22, streamFile);
@ -74,6 +74,7 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
coding_type = coding_PCM16LE; coding_type = coding_PCM16LE;
break; break;
case 2: case 2:
if (seek_offset == 0) goto fail;
if ((uint32_t)read_32bitBE(seek_offset, streamFile) != 0x5345454B) { /* "SEEK" If this header doesn't exist, assuming that the file is IMA */ if ((uint32_t)read_32bitBE(seek_offset, streamFile) != 0x5345454B) { /* "SEEK" If this header doesn't exist, assuming that the file is IMA */
ima = 1; ima = 1;
coding_type = coding_INT_IMA; coding_type = coding_INT_IMA;
@ -157,10 +158,13 @@ VGMSTREAM * init_vgmstream_bcstm(STREAMFILE *streamFile) {
} }
} }
if (ima) // No SEEK (ADPC) header, so just start where the SEEK header is supposed to be. if (ima) { // No SEEK (ADPC) header, so just start where the SEEK header is supposed to be.
if (seek_offset == 0) goto fail;
start_offset = seek_offset; start_offset = seek_offset;
else } else {
if (data_offset == 0) goto fail;
start_offset = data_offset + 0x20; start_offset = data_offset + 0x20;
}

View File

@ -8,8 +8,7 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
coding_t coding_type; coding_t coding_type;
off_t info_offset, seek_offset, data_offset, regn_offset, pdat_offset; off_t info_offset = 0, seek_offset = 0, data_offset = 0;
size_t info_size, seek_size, data_size, regn_size, pdat_size;
uint16_t temp_id; uint16_t temp_id;
int codec_number; int codec_number;
int channel_count; int channel_count;
@ -17,7 +16,6 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
int i, j; int i, j;
int ima = 0; int ima = 0;
off_t start_offset; off_t start_offset;
int founddata;
off_t tempoffset1; off_t tempoffset1;
int section_count; int section_count;
@ -39,23 +37,23 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
switch(temp_id) { switch(temp_id) {
case 0x4000: case 0x4000:
info_offset = read_32bitBE(0x18 + i * 0xc, streamFile); info_offset = read_32bitBE(0x18 + i * 0xc, streamFile);
info_size = read_32bitBE(0x1c + i * 0xc, streamFile); /* size_t info_size = read_32bitBE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4001: case 0x4001:
seek_offset = read_32bitBE(0x18 + i * 0xc, streamFile); seek_offset = read_32bitBE(0x18 + i * 0xc, streamFile);
seek_size = read_32bitBE(0x1c + i * 0xc, streamFile); /* size_t seek_size = read_32bitBE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4002: case 0x4002:
data_offset = read_32bitBE(0x18 + i * 0xc, streamFile); data_offset = read_32bitBE(0x18 + i * 0xc, streamFile);
data_size = read_32bitBE(0x1c + i * 0xc, streamFile); /* size_t data_size = read_32bitBE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4003: case 0x4003:
regn_offset = read_32bitBE(0x18 + i * 0xc, streamFile); /* off_t regn_offset = read_32bitBE(0x18 + i * 0xc, streamFile); */
regn_size = read_32bitBE(0x1c + i * 0xc, streamFile); /* size_t regn_size = read_32bitBE(0x1c + i * 0xc, streamFile); */
break; break;
case 0x4004: case 0x4004:
pdat_offset = read_32bitBE(0x18 + i * 0xc, streamFile); /* off_t pdat_offset = read_32bitBE(0x18 + i * 0xc, streamFile); */
pdat_size = read_32bitBE(0x1c + i * 0xc, streamFile); /* size_t pdat_size = read_32bitBE(0x1c + i * 0xc, streamFile); */
break; break;
default: default:
break; break;
@ -63,6 +61,7 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
} }
if (info_offset == 0) goto fail;
if ((uint32_t)read_32bitBE(info_offset, streamFile) != 0x494E464F) /* "INFO" */ if ((uint32_t)read_32bitBE(info_offset, streamFile) != 0x494E464F) /* "INFO" */
goto fail; goto fail;
@ -152,10 +151,13 @@ VGMSTREAM * init_vgmstream_bfstm(STREAMFILE *streamFile) {
} }
} }
if (ima) // No SEEK (ADPC) header, so just start where the SEEK header is supposed to be. if (ima) { // No SEEK (ADPC) header, so just start where the SEEK header is supposed to be.
if (seek_offset == 0) goto fail;
start_offset = seek_offset; start_offset = seek_offset;
else } else {
if (data_offset == 0) goto fail;
start_offset = data_offset + 0x20; start_offset = data_offset + 0x20;
}

View File

@ -7,7 +7,7 @@ VGMSTREAM * init_vgmstream_bfwav(STREAMFILE *streamFile) {
coding_t coding_type; coding_t coding_type;
int ima = 0; /*int ima = 0;*/
int nsmbu_flag = 0; int nsmbu_flag = 0;
int32_t(*read_32bit)(off_t, STREAMFILE*) = read_32bitBE; int32_t(*read_32bit)(off_t, STREAMFILE*) = read_32bitBE;
int16_t(*read_16bit)(off_t, STREAMFILE*) = read_16bitBE; int16_t(*read_16bit)(off_t, STREAMFILE*) = read_16bitBE;
@ -149,4 +149,4 @@ VGMSTREAM * init_vgmstream_bfwav(STREAMFILE *streamFile) {
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); if (vgmstream) close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -1,140 +1,179 @@
#include "meta.h" #include "meta.h"
#include "../util.h" #include "../util.h"
#include "../header.h"
/* BGW (FF XI) */ /**
* BGW - Final Fantasy XI (PC) music files.
*
* Some info from POLUtils
*/
VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_bgw(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT]; uint32_t codec, filesize, blocksize, sample_rate;
off_t start_offset;
int32_t loop_start; int32_t loop_start;
uint8_t block_align;
off_t start_offset;
int loop_flag = 0; int channel_count, loop_flag = 0;
int channel_count;
/* check extension, case insensitive */ /* check extensions */
streamFile->get_name(streamFile,filename,sizeof(filename)); if ( !header_check_extensions(streamFile, "bgw") )
if (strcasecmp("bgw",filename_extension(filename))) goto fail;
/* "BGMStream" */
if (read_32bitBE(0,streamFile) != 0x42474d53 ||
read_32bitBE(4,streamFile) != 0x74726561 ||
read_32bitBE(8,streamFile) != 0x6d000000 ||
read_32bitBE(12,streamFile) != 0) goto fail;
/* check file size with header value */
if (read_32bitLE(0x10,streamFile) != get_streamfile_size(streamFile))
goto fail; goto fail;
channel_count = read_8bit(0x2e,streamFile); /* check header */
if (read_32bitBE(0x00,streamFile) != 0x42474d53 || /* "BGMS" */
read_32bitBE(0x04,streamFile) != 0x74726561 || /* "trea" */
read_32bitBE(0x08,streamFile) != 0x6d000000 ) /* "m\0\0\0" */
goto fail;
codec = read_32bitLE(0x0c,streamFile);
filesize = read_32bitLE(0x10,streamFile);
/*file_id = read_32bitLE(0x14,streamFile);*/
blocksize = read_32bitLE(0x18,streamFile);
loop_start = read_32bitLE(0x1c,streamFile); loop_start = read_32bitLE(0x1c,streamFile);
sample_rate = (read_32bitLE(0x20,streamFile) + read_32bitLE(0x24,streamFile)) & 0xFFFFFFFF; /* bizarrely obfuscated sample rate */
start_offset = read_32bitLE(0x28,streamFile);
/*0x2c: unk (vol?) */
/*0x2d: unk (0x10?) */
channel_count = read_8bit(0x2e,streamFile);
block_align = read_8bit(0x2f,streamFile);
/* check file size with header value */
if (filesize != get_streamfile_size(streamFile))
goto fail;
loop_flag = (loop_start > 0); loop_flag = (loop_start > 0);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ /* fill in the vital statistics */
start_offset = read_32bitLE(0x28,streamFile); vgmstream->meta_type = meta_FFXI_BGW;
vgmstream->channels = channel_count; vgmstream->sample_rate = sample_rate;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_FFXI; switch (codec) {
vgmstream->num_samples = read_32bitLE(0x18,streamFile)*16; case 0: /* PS ADPCM */
if (loop_flag) { vgmstream->coding_type = coding_VAG_ADPCM_cfg;
vgmstream->loop_start_sample = (loop_start-1)*16; vgmstream->layout_type = layout_interleave;
vgmstream->loop_end_sample = vgmstream->num_samples; vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */
vgmstream->num_samples = blocksize * block_align;
if (loop_flag) {
vgmstream->loop_start_sample = (loop_start-1) * block_align;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
break;
case 3: /* ATRAC3 (encrypted) */
default:
goto fail;
} }
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 9;
vgmstream->meta_type = meta_FFXI_BGW;
/* open the file for reading */ /* open the file for reading */
{ if ( !header_open_stream(vgmstream, streamFile, start_offset) )
int i; goto fail;
STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+i*9;
}
}
return vgmstream; return vgmstream;
/* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }
/* .spw (SEWave, PlayOnline viewer for FFXI), very similar to bgw */ /**
* SPW (SEWave), PlayOnline viewer for Final Fantasy XI (PC)
*/
VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_spw(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT]; uint32_t codec, filesize, blocksize, sample_rate;
int32_t loop_start;
uint8_t block_align;
off_t start_offset; off_t start_offset;
int loop_flag = 0; int channel_count, loop_flag = 0;
int32_t loop_start;
int channel_count;
/* check extension, case insensitive */ /* check extensions */
streamFile->get_name(streamFile,filename,sizeof(filename)); if ( !header_check_extensions(streamFile, "spw") )
if (strcasecmp("spw",filename_extension(filename))) goto fail; goto fail;
/* "SeWave" */ /* check header */
if (read_32bitBE(0,streamFile) != 0x53655761 || if (read_32bitBE(0,streamFile) != 0x53655761 || /* "SeWa" */
read_32bitBE(4,streamFile) != 0x76650000) goto fail; read_32bitBE(4,streamFile) != 0x76650000) /* "ve\0\0" */
goto fail;
/* check file size with header value */ /* check file size with header value */
if (read_32bitLE(0x8,streamFile) != get_streamfile_size(streamFile)) if (read_32bitLE(0x8,streamFile) != get_streamfile_size(streamFile))
goto fail; goto fail;
channel_count = read_8bit(0x2a,streamFile); filesize = read_32bitLE(0x08,streamFile);
codec = read_32bitLE(0x0c,streamFile);
/*file_id = read_32bitLE(0x10,streamFile);*/
blocksize = read_32bitLE(0x14,streamFile);
loop_start = read_32bitLE(0x18,streamFile); loop_start = read_32bitLE(0x18,streamFile);
sample_rate = (read_32bitLE(0x1c,streamFile) + read_32bitLE(0x20,streamFile)) & 0xFFFFFFFF; /* bizarrely obfuscated sample rate */
start_offset = read_32bitLE(0x24,streamFile);
/*0x2c: unk (0x00?) */
/*0x2d: unk (0x00/01?) */
channel_count = read_8bit(0x2a,streamFile);
block_align = read_8bit(0x2b,streamFile);
/*0x2c: unk (0x01 when PCM, 0x10 when VAG?) */
/* check file size with header value */
if (filesize != get_streamfile_size(streamFile))
goto fail;
loop_flag = (loop_start > 0); loop_flag = (loop_start > 0);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ /* fill in the vital statistics */
start_offset = read_32bitLE(0x24,streamFile); vgmstream->meta_type = meta_FFXI_SPW;
vgmstream->channels = channel_count; vgmstream->sample_rate = sample_rate;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_FFXI; switch (codec) {
vgmstream->num_samples = read_32bitLE(0x14,streamFile)*16; case 0: /* PS ADPCM */
if (loop_flag) { vgmstream->coding_type = coding_VAG_ADPCM_cfg;
vgmstream->loop_start_sample = (loop_start-1)*16; vgmstream->layout_type = layout_interleave;
vgmstream->loop_end_sample = vgmstream->num_samples; vgmstream->interleave_block_size = (block_align / 2) + 1; /* half, even if channels = 1 */
vgmstream->num_samples = blocksize * block_align;
if (loop_flag) {
vgmstream->loop_start_sample = (loop_start-1) * block_align;;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
break;
case 1: /* PCM */
vgmstream->coding_type = coding_PCM16LE;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x02;
vgmstream->num_samples = blocksize;
if (loop_flag) {
vgmstream->loop_start_sample = (loop_start-1);
vgmstream->loop_end_sample = vgmstream->num_samples;
}
break;
default:
goto fail;
} }
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 9;
vgmstream->meta_type = meta_FFXI_SPW;
/* open the file for reading */ /* open the file for reading */
{ if ( !header_open_stream(vgmstream, streamFile, start_offset) )
int i; goto fail;
STREAMFILE * file;
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+i*9;
}
}
return vgmstream; return vgmstream;
/* clean up anything we may have opened */
fail: fail:
if (vgmstream) close_vgmstream(vgmstream); close_vgmstream(vgmstream);
return NULL; return NULL;
} }

View File

@ -8,7 +8,6 @@ Wii U boot sound file for each game/app.
VGMSTREAM * init_vgmstream_btsnd(STREAMFILE *streamFile) { VGMSTREAM * init_vgmstream_btsnd(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT]; char filename[PATH_LIMIT];
coding_t coding_type;
int channel_count = 2; int channel_count = 2;
int loop_flag; int loop_flag;
off_t start_offset = 0x8; off_t start_offset = 0x8;

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
int NumSamples; int NumSamples;
int ChannelCount; int ChannelCount;
int SampleRate; int SampleRate;
int DSPInfoStart; int DSPInfoStart = 0;
int SampleHeaderStart, SampleHeaderLength, NameTableLength, SampleDataLength, CodingID, SampleMode; int SampleHeaderStart, SampleHeaderLength, NameTableLength, SampleDataLength, CodingID, SampleMode;
int ExtraFlag, ExtraFlagStart, ExtraFlagType, ExtraFlagSize, ExtraFlagEnd; int ExtraFlag, ExtraFlagStart, ExtraFlagType, ExtraFlagSize, ExtraFlagEnd;
@ -298,3 +298,155 @@ fail:
if (vgmstream) close_vgmstream(vgmstream); if (vgmstream) close_vgmstream(vgmstream);
return NULL; return NULL;
} }
#if 0
// FSB5 MPEG
VGMSTREAM * init_vgmstream_fsb5_mpeg(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int channel_count, channels, loop_flag, fsb_mainheader_len, fsb_subheader_len, FSBFlag, rate;
long sample_rate = 0, num_samples = 0;
uint16_t mp3ID;
#ifdef VGM_USE_MPEG
mpeg_codec_data *mpeg_data = NULL;
coding_t mpeg_coding_type = coding_MPEG1_L3;
#endif
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("fsb",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) == 0x46534235) /* "FSB5" */
{
fsb_mainheader_len = 0x3C;
}
else
{
goto fail;
}
//fsb_subheader_len = read_16bitLE(fsb_mainheader_len,streamFile);
/* "Check if the FSB is used as conatiner or as single file" */
if (read_32bitBE(0x04,streamFile) != 0x01000000)
goto fail;
#if 0
/* Check channel count, multi-channel not supported and will be refused */
if ((read_16bitLE(0x6E,streamFile) != 0x2) &&
(read_16bitLE(0x6E,streamFile) != 0x1))
goto fail;
#endif
start_offset = fsb_mainheader_len+fsb_subheader_len+0x10;
/* Check the MPEG Sync Header */
mp3ID = read_16bitBE(start_offset,streamFile);
if ((mp3ID&0xFFE0) != 0xFFE0)
goto fail;
channel_count = read_16bitLE(fsb_mainheader_len+0x3E,streamFile);
if (channel_count != 1 && channel_count != 2)
goto fail;
FSBFlag = read_32bitLE(fsb_mainheader_len+0x30,streamFile);
if (FSBFlag&0x2 || FSBFlag&0x4 || FSBFlag&0x6)
loop_flag = 1;
num_samples = (read_32bitLE(fsb_mainheader_len+0x2C,streamFile));
#ifdef VGM_USE_MPEG
mpeg_data = init_mpeg_codec_data(streamFile, start_offset, -1, -1, &mpeg_coding_type, &rate, &channels); // -1 to not check sample rate or channels
if (!mpeg_data) goto fail;
//channel_count = channels;
sample_rate = rate;
#else
// reject if no MPEG support
goto fail;
#endif
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = num_samples;
vgmstream->channels = channel_count;
/* Still WIP */
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(fsb_mainheader_len+0x28,streamFile);
vgmstream->loop_end_sample = read_32bitLE(fsb_mainheader_len+0x2C,streamFile);
}
vgmstream->meta_type = meta_FSB_MPEG;
#ifdef VGM_USE_MPEG
/* NOTE: num_samples seems to be quite wrong for MPEG */
vgmstream->codec_data = mpeg_data;
vgmstream->layout_type = layout_mpeg;
vgmstream->coding_type = mpeg_coding_type;
#else
// reject if no MPEG support
goto fail;
#endif
#if 0
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitBE(0x18,streamFile)/960*1152;
vgmstream->loop_end_sample = read_32bitBE(0x1C,streamFile)/960*1152;
}
#endif
/* open the file for reading */
{
int i;
STREAMFILE * file;
if(vgmstream->layout_type == layout_interleave)
{
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!file) goto fail;
for (i=0;i<channel_count;i++)
{
vgmstream->ch[i].streamfile = file;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=start_offset+
vgmstream->interleave_block_size*i;
}
}
#ifdef VGM_USE_MPEG
else if(vgmstream->layout_type == layout_mpeg) {
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,MPEG_BUFFER_SIZE);
vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=start_offset;
}
}
#endif
else { goto fail; }
}
return vgmstream;
/* clean up anything we may have opened */
fail:
#ifdef VGM_USE_MPEG
if (mpeg_data) {
mpg123_delete(mpeg_data->m);
free(mpeg_data);
if (vgmstream) {
vgmstream->codec_data = NULL;
}
}
#endif
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
#endif

View File

@ -7,7 +7,7 @@ VGMSTREAM * init_vgmstream_g1l(STREAMFILE *streamFile) {
coding_t coding_type; coding_t coding_type;
off_t head_offset; /*off_t head_offset;*/
int channel_count; int channel_count;
int loop_flag; int loop_flag;

View File

@ -182,18 +182,12 @@ VGMSTREAM * init_vgmstream_aus(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rws(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rws(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb1(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_fsb(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb3(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb4(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb4_wav(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_fsb4_wav(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb5(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_fsb5(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_fsb_mpeg(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_rwx(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_rwx(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_xwb(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_xwb(STREAMFILE * streamFile);

View File

@ -2686,9 +2686,9 @@ VGMSTREAM * init_vgmstream_ngc_dsp_csmp(STREAMFILE *streamFile) {
goto fail; goto fail;
if (header.loop_flag) { if (header.loop_flag) {
off_t loop_off; // off_t loop_off;
/* check loop predictor/scale */ /* check loop predictor/scale */
loop_off = header.loop_start_offset/16*8; // loop_off = header.loop_start_offset/16*8;
/* Retro doesn't seem to abide by this */ /* Retro doesn't seem to abide by this */
// if (header.loop_ps != (uint8_t)read_8bit(current_offset + start_offset+loop_off,streamFile)) // if (header.loop_ps != (uint8_t)read_8bit(current_offset + start_offset+loop_off,streamFile))
// goto fail; // goto fail;

View File

@ -10,8 +10,8 @@ VGMSTREAM * init_vgmstream_ps3_klbs(STREAMFILE *streamFile)
size_t fileLength; size_t fileLength;
off_t readOffset = 0; off_t readOffset = 0;
off_t start_offset; off_t start_offset;
off_t loop_start_offset; off_t loop_start_offset = 0;
off_t loop_end_offset; off_t loop_end_offset = 0;
uint8_t testBuffer[0x10]; uint8_t testBuffer[0x10];
int loop_flag = 0; int loop_flag = 0;

View File

@ -228,7 +228,7 @@ fail:
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
if (ffmpeg_data) { if (ffmpeg_data) {
free_ffmpeg(ffmpeg_data); free_ffmpeg(ffmpeg_data);
vgmstream->codec_data = NULL; if (vgmstream) vgmstream->codec_data = NULL;
} }
#endif #endif
if (vgmstream) close_vgmstream(vgmstream); if (vgmstream) close_vgmstream(vgmstream);

View File

@ -195,7 +195,7 @@ VGMSTREAM * init_vgmstream_ps3_sgdx(STREAMFILE *streamFile) {
} }
#endif #endif
case 0x05: /* Short VAG ADPCM */ case 0x05: /* Short VAG ADPCM */
vgmstream->coding_type = coding_SHORT_VAG_ADPCM; vgmstream->coding_type = coding_VAG_ADPCM_cfg;
vgmstream->layout_type = layout_interleave; vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4; vgmstream->interleave_block_size = 0x4;

View File

@ -7,19 +7,24 @@
#define _STREAMTYPES_H #define _STREAMTYPES_H
#ifdef _MSC_VER #ifdef _MSC_VER
#if (_MSC_VER >= 1600) #if (_MSC_VER >= 1600)
#include <stdint.h> #include <stdint.h>
#else #else
#include <pstdint.h> #include <pstdint.h>
#endif #endif /* (_MSC_VER >= 1600) */
#define inline _inline #define inline _inline
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if (_MSC_VER < 1900) #if (_MSC_VER < 1900)
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif /* (_MSC_VER < 1900) */
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif /* _MSC_VER */
typedef int16_t sample; typedef int16_t sample;

View File

@ -72,4 +72,24 @@ void concatn(int length, char * dst, const char * src);
void concatn_doublenull(int length, char * dst, const char * src); void concatn_doublenull(int length, char * dst, const char * src);
void concatn_fitting_doublenull(int length, char * dst, const char * src); void concatn_fitting_doublenull(int length, char * dst, const char * src);
/* Simple stdout logging for debugging and regression testing purposes.
* Needs C99 variadic macros. */
#ifdef VGM_DEBUG_OUTPUT
#define VGM_ASSERT(condition, ...) \
do { if (condition) printf(__VA_ARGS__); } while (0)
#define VGM_LOG(...) \
do { printf(__VA_ARGS__); } while (0)
#define VGM_LOGF() \
do { printf("%s:%i '%s'\n", __FILE__, __LINE__, __func__); } while (0)
#else
#define VGM_ASSERT(condition,fmt, ...) /* nothing */
#define VGM_LOG(...) /* nothing */
#define VGM_LOGF(...) /* nothing */
#endif
#endif #endif

View File

@ -92,10 +92,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_hgc1, init_vgmstream_hgc1,
init_vgmstream_aus, init_vgmstream_aus,
init_vgmstream_rws, init_vgmstream_rws,
init_vgmstream_fsb1, init_vgmstream_fsb,
// init_vgmstream_fsb2,
init_vgmstream_fsb3,
init_vgmstream_fsb4,
init_vgmstream_fsb4_wav, init_vgmstream_fsb4_wav,
init_vgmstream_fsb5, init_vgmstream_fsb5,
init_vgmstream_rwx, init_vgmstream_rwx,
@ -300,7 +297,6 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ngc_nst_dsp, init_vgmstream_ngc_nst_dsp,
init_vgmstream_baf, init_vgmstream_baf,
init_vgmstream_ps3_msf, init_vgmstream_ps3_msf,
init_vgmstream_fsb_mpeg,
init_vgmstream_nub_vag, init_vgmstream_nub_vag,
init_vgmstream_ps3_past, init_vgmstream_ps3_past,
init_vgmstream_ps3_sgdx, init_vgmstream_ps3_sgdx,
@ -455,7 +451,7 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
#endif #endif
if (vgmstream->coding_type==coding_CRI_HCA) { if (vgmstream->coding_type==coding_CRI_HCA) {
hca_codec_data *data = vgmstream->codec_data; hca_codec_data *data = vgmstream->codec_data;
clHCA *hca = (clHCA *)(data + 1); /*clHCA *hca = (clHCA *)(data + 1);*/
data->curblock = 0; data->curblock = 0;
data->sample_ptr = clHCA_samplesPerBlock; data->sample_ptr = clHCA_samplesPerBlock;
data->samples_discard = 0; data->samples_discard = 0;
@ -1028,20 +1024,16 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_AICA: case coding_AICA:
return 2; return 2;
case coding_NGC_AFC: case coding_NGC_AFC:
case coding_FFXI:
return 16;
case coding_PSX: case coding_PSX:
case coding_PSX_badflags: case coding_PSX_badflags:
case coding_invert_PSX: case coding_invert_PSX:
case coding_HEVAG_ADPCM: case coding_HEVAG_ADPCM:
case coding_XA: case coding_XA:
return 28; return 28;
case coding_SHORT_VAG_ADPCM: case coding_VAG_ADPCM_cfg:
return 6; return (vgmstream->interleave_block_size - 1) * 2; /* decodes 1 byte into 2 bytes */
case coding_XBOX: case coding_XBOX:
case coding_INT_XBOX: case coding_INT_XBOX:
case coding_BAF_ADPCM:
return 64;
case coding_EAXA: case coding_EAXA:
return 28; return 28;
case coding_MAXIS_ADPCM: case coding_MAXIS_ADPCM:
@ -1159,16 +1151,14 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_SNDS_IMA: case coding_SNDS_IMA:
return 0; return 0;
case coding_NGC_AFC: case coding_NGC_AFC:
case coding_FFXI:
return 9;
case coding_PSX: case coding_PSX:
case coding_PSX_badflags: case coding_PSX_badflags:
case coding_HEVAG_ADPCM: case coding_HEVAG_ADPCM:
case coding_invert_PSX: case coding_invert_PSX:
case coding_NDS_PROCYON: case coding_NDS_PROCYON:
return 16; return 16;
case coding_SHORT_VAG_ADPCM: case coding_VAG_ADPCM_cfg:
return 4; return vgmstream->interleave_block_size;
case coding_XA: case coding_XA:
return 14*vgmstream->channels; return 14*vgmstream->channels;
case coding_XBOX: case coding_XBOX:
@ -1188,8 +1178,6 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return 1; return 1;
case coding_APPLE_IMA4: case coding_APPLE_IMA4:
return 34; return 34;
case coding_BAF_ADPCM:
return 33;
case coding_LSF: case coding_LSF:
return 28; return 28;
#ifdef VGM_USE_G7221 #ifdef VGM_USE_G7221
@ -1428,20 +1416,6 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
case coding_FFXI:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_ffxi_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block,
samples_to_do);
}
break;
case coding_BAF_ADPCM:
for (chan=0;chan<vgmstream->channels;chan++) {
decode_baf_adpcm(&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_ADPCM:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_hevag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_hevag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
@ -1449,11 +1423,11 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
samples_to_do); samples_to_do);
} }
break; break;
case coding_SHORT_VAG_ADPCM: case coding_VAG_ADPCM_cfg:
for (chan=0;chan<vgmstream->channels;chan++) { for (chan=0;chan<vgmstream->channels;chan++) {
decode_short_vag_adpcm(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan, decode_vag_adpcm_configurable(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
vgmstream->channels,vgmstream->samples_into_block, vgmstream->channels,vgmstream->samples_into_block,
samples_to_do); samples_to_do, vgmstream->interleave_block_size);
} }
break; break;
case coding_XA: case coding_XA:
@ -1767,7 +1741,7 @@ int vgmstream_do_loop(VGMSTREAM * vgmstream) {
vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32; vgmstream->loop_ch[i].adpcm_history2_32 = vgmstream->ch[i].adpcm_history2_32;
} }
} }
/* todo preserve hevag, baf_adpcm, etc history? */ /* todo preserve hevag/adjustable_vag_adpcm/others history? */
#ifdef DEBUG #ifdef DEBUG
{ {
@ -1977,17 +1951,11 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case coding_invert_PSX: case coding_invert_PSX:
snprintf(temp,TEMPSIZE,"BMDX \"encrypted\" Playstation 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"BMDX \"encrypted\" Playstation 4-bit ADPCM");
break; break;
case coding_FFXI:
snprintf(temp,TEMPSIZE,"FFXI Playstation-ish 4-bit ADPCM");
break;
case coding_BAF_ADPCM:
snprintf(temp,TEMPSIZE,"Bizarre Creations Playstation-ish 4-bit ADPCM");
break;
case coding_HEVAG_ADPCM: case coding_HEVAG_ADPCM:
snprintf(temp,TEMPSIZE,"PSVita HEVAG ADPCM"); snprintf(temp,TEMPSIZE,"PSVita HEVAG ADPCM");
break; break;
case coding_SHORT_VAG_ADPCM: case coding_VAG_ADPCM_cfg:
snprintf(temp,TEMPSIZE,"Short VAG (SGXD type 5) ADPCM"); snprintf(temp,TEMPSIZE,"Playstation 4-bit ADPCM (configurable)");
break; break;
case coding_XA: case coding_XA:
snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM"); snprintf(temp,TEMPSIZE,"CD-ROM XA 4-bit ADPCM");
@ -2620,18 +2588,15 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_FSB1: case meta_FSB1:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB1) Header"); snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB1) Header");
break; break;
case meta_FSB3_0: case meta_FSB2:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB3.0) Header"); snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB2) Header");
break; break;
case meta_FSB3_1: case meta_FSB3:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB3.1) Header"); snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB3) Header");
break; break;
case meta_FSB4: case meta_FSB4:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB4) Header"); snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB4) Header");
break; break;
case meta_FSB4_WAV:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB4) with additional 'WAV' Header");
break;
case meta_FSB5: case meta_FSB5:
snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB5) Header"); snprintf(temp,TEMPSIZE,"FMOD Sample Bank (FSB5) Header");
break; break;
@ -3170,9 +3135,6 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break; break;
case meta_PS3_MSF: case meta_PS3_MSF:
snprintf(temp,TEMPSIZE,"PS3 MSF header"); snprintf(temp,TEMPSIZE,"PS3 MSF header");
break;
case meta_FSB_MPEG:
snprintf(temp,TEMPSIZE,"FSB MPEG header");
break; break;
case meta_NUB_VAG: case meta_NUB_VAG:
snprintf(temp,TEMPSIZE,"VAG (NUB) header"); snprintf(temp,TEMPSIZE,"VAG (NUB) header");

View File

@ -91,10 +91,8 @@ typedef enum {
coding_PSX, /* PSX & PS2 ADPCM */ coding_PSX, /* PSX & PS2 ADPCM */
coding_invert_PSX, /* PSX ADPCM with some weirdness */ coding_invert_PSX, /* PSX ADPCM with some weirdness */
coding_PSX_badflags, /* with garbage in the flags byte */ coding_PSX_badflags, /* with garbage in the flags byte */
coding_FFXI, /* FF XI PSX-ish ADPCM */
coding_BAF_ADPCM, /* Bizarre Creations PSX-ish ADPCM */
coding_HEVAG_ADPCM, /* PSVita games */ coding_HEVAG_ADPCM, /* PSVita games */
coding_SHORT_VAG_ADPCM, /* SGXD type 5 (PS3 Afrika) */ coding_VAG_ADPCM_cfg, /* VAG with configurable frame size: FF XI, SGXD type 5, Bizarre Creations */
coding_XA, /* PSX CD-XA */ coding_XA, /* PSX CD-XA */
coding_XBOX, /* XBOX IMA */ coding_XBOX, /* XBOX IMA */
coding_INT_XBOX, /* XBOX 'real interleaved' IMA */ coding_INT_XBOX, /* XBOX 'real interleaved' IMA */
@ -328,11 +326,9 @@ typedef enum {
meta_AUS, /* Variuos Capcom Games */ meta_AUS, /* Variuos Capcom Games */
meta_RWS, /* Variuos Konami Games */ meta_RWS, /* Variuos Konami Games */
meta_FSB1, /* FMOD Sample Bank, version 1 */ meta_FSB1, /* FMOD Sample Bank, version 1 */
meta_FSB3_0, /* FMOD Sample Bank, version 3.0 */ meta_FSB2, /* FMOD Sample Bank, version 2 */
meta_FSB3_1, /* FMOD Sample Bank, version 3.1 */ meta_FSB3, /* FMOD Sample Bank, version 3.0/3.1 */
meta_FSB4, /* FMOD Sample Bank, version 4 */ meta_FSB4, /* FMOD Sample Bank, version 4 */
meta_FSB_MPEG, /* Just Test */
meta_FSB4_WAV, /* FMOD Sample Bank, version 4 with "WAV" Header */
meta_FSB5, /* FMOD Sample Bank, version 5 */ meta_FSB5, /* FMOD Sample Bank, version 5 */
meta_RWX, /* Air Force Delta Storm (XBOX) */ meta_RWX, /* Air Force Delta Storm (XBOX) */
meta_XWB, /* King of Fighters (XBOX) */ meta_XWB, /* King of Fighters (XBOX) */

View File

@ -22,8 +22,8 @@ endif
# config # config
export SHELL = /bin/sh export SHELL = /bin/sh
export CFLAGS=-Wall -O3 $(MPEG_CC) -DVGM_USE_G7221 -DVGM_USE_G719 $(MAT3P_CC) -DVAR_ARRAYS -I../ext_includes $(FFMPEG_CC) export CFLAGS=-Wall -O3 $(MPEG_CC) -DVGM_USE_G7221 -DVGM_USE_G719 $(MAT3P_CC) $(FFMPEG_CC) -DVAR_ARRAYS -I../ext_includes $(EXTRA_CFLAGS)
export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis $(MPEG_LD) -lg7221_decode -lg719_decode $(MAT3P_LD) -lm $(FFMPEG_LD) export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis $(MPEG_LD) -lg7221_decode -lg719_decode $(MAT3P_LD) $(FFMPEG_LD) -lm $(EXTRA_LDFLAGS)
#export CC=i586-mingw32msvc-gcc #export CC=i586-mingw32msvc-gcc
#export AR=i586-mingw32msvc-ar #export AR=i586-mingw32msvc-ar
#export STRIP=i586-mingw32msvc-strip #export STRIP=i586-mingw32msvc-strip

View File

@ -22,8 +22,8 @@ endif
# config # config
export SHELL = /bin/sh export SHELL = /bin/sh
export CFLAGS=-Wall -O3 $(MPEG_CC) -DVGM_USE_G7221 -DVGM_USE_G719 $(MAT3P_CC) -DWIN32 -DUSE_ALLOCA -I../ext_includes $(FFMPEG_CC) export CFLAGS=-Wall -O3 $(MPEG_CC) -DVGM_USE_G7221 -DVGM_USE_G719 $(MAT3P_CC) $(FFMPEG_CC) -DUSE_ALLOCA -DWIN32 -I../ext_includes $(EXTRA_CFLAGS)
export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis $(MPEG_LD) -lg7221_decode -lg719_decode $(MAT3P_LD) -lm $(FFMPEG_LD) export LDFLAGS=-L../src -L../ext_libs -lvgmstream -lvorbis $(MPEG_LD) -lg7221_decode -lg719_decode $(MAT3P_LD) $(FFMPEG_LD) -lm $(EXTRA_LDFLAGS)
export CC=i586-mingw32msvc-gcc export CC=i586-mingw32msvc-gcc
export AR=i586-mingw32msvc-ar export AR=i586-mingw32msvc-ar
export STRIP=i586-mingw32msvc-strip export STRIP=i586-mingw32msvc-strip