From da5f3a737643f359be7a4059f450ca3268e10983 Mon Sep 17 00:00:00 2001 From: manakoAT Date: Wed, 24 Sep 2008 05:56:25 +0000 Subject: [PATCH] .CCC added -> Tokyo Xtreme Racer DRIFT 2 (PS2) .FAG added -> Jackie Chan - Stuntmaster (PSX) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@440 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/Makefile | 4 ++- src/libvgmstream.vcproj | 8 +++++ src/meta/Makefile.unix.am | 2 ++ src/meta/meta.h | 4 +++ src/meta/ps2_ccc.c | 69 +++++++++++++++++++++++++++++++++++++++ src/meta/psx_fag.c | 65 ++++++++++++++++++++++++++++++++++++ src/vgmstream.c | 8 +++++ src/vgmstream.h | 2 ++ winamp/in_vgmstream.c | 4 +++ 9 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 src/meta/ps2_ccc.c create mode 100644 src/meta/psx_fag.c diff --git a/src/Makefile b/src/Makefile index f9517368..be6831aa 100644 --- a/src/Makefile +++ b/src/Makefile @@ -135,7 +135,9 @@ META_OBJS=meta/adx_header.o \ meta/ps2_xa2.o \ meta/idsp.o \ meta/ngc_ymf.o \ - meta/nds_sad.o + meta/nds_sad.o \ + meta/ps2_ccc.o \ + meta/psx_fag.o OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS) diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 725a040b..e85db88c 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -385,6 +385,10 @@ RelativePath=".\meta\ps2_bmdx.c" > + + @@ -513,6 +517,10 @@ RelativePath=".\meta\psx_cdxa.c" > + + diff --git a/src/meta/Makefile.unix.am b/src/meta/Makefile.unix.am index 3ed5345f..9b3ee96c 100644 --- a/src/meta/Makefile.unix.am +++ b/src/meta/Makefile.unix.am @@ -104,4 +104,6 @@ libmeta_la_SOURCES += ps2_xa2.c libmeta_la_SOURCES += idsp.c libmeta_la_SOURCES += ngc_ymf.c libmeta_la_SOURCES += nds_sad.c +libmeta_la_SOURCES += ps2_ccc.c +libmeta_la_SOURCES += psx_fag.c EXTRA_DIST = meta.h diff --git a/src/meta/meta.h b/src/meta/meta.h index 9da9611a..f572ae21 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -229,4 +229,8 @@ VGMSTREAM * init_vgmstream_ngc_ymf(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_sadl(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_ps2_ccc(STREAMFILE * streamFile); + +VGMSTREAM * init_vgmstream_psx_fag(STREAMFILE * streamFile); + #endif diff --git a/src/meta/ps2_ccc.c b/src/meta/ps2_ccc.c new file mode 100644 index 00000000..dd87a9bc --- /dev/null +++ b/src/meta/ps2_ccc.c @@ -0,0 +1,69 @@ +#include "meta.h" +#include "../util.h" + +/* CCC (from Unlimited Saga) */ +VGMSTREAM * init_vgmstream_ps2_ccc(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + char filename[260]; + off_t start_offset; + + int loop_flag = 0; + int channel_count; + + /* check extension, case insensitive */ + streamFile->get_name(streamFile,filename,sizeof(filename)); + if (strcasecmp("ccc",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x01000000) + goto fail; + + /* check file size */ + if (read_32bitLE(0x0C,streamFile)+0x50 != get_streamfile_size(streamFile)) + goto fail; + + loop_flag = 0; + channel_count = 2; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = 0x50; + vgmstream->channels = channel_count; + vgmstream->sample_rate = read_32bitLE(0x04,streamFile); + vgmstream->coding_type = coding_PSX; + vgmstream->num_samples = (read_32bitLE(0x08,streamFile))/channel_count/32*28; + if (loop_flag) { + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample = (read_32bitLE(0x08,streamFile))/channel_count/32*28; + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x2000; + vgmstream->meta_type = meta_PS2_CCC; + + /* 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; + + } + } + + return vgmstream; + + /* clean up anything we may have opened */ +fail: + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/meta/psx_fag.c b/src/meta/psx_fag.c new file mode 100644 index 00000000..59bde036 --- /dev/null +++ b/src/meta/psx_fag.c @@ -0,0 +1,65 @@ +#include "meta.h" +#include "../util.h" + +/* FAG (Jackie Chan - Stuntmaster) */ +VGMSTREAM * init_vgmstream_psx_fag(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + char filename[260]; + off_t start_offset; + + int loop_flag = 0; + int channel_count; + + /* check extension, case insensitive */ + streamFile->get_name(streamFile,filename,sizeof(filename)); + if (strcasecmp("fag",filename_extension(filename))) goto fail; + + /* check header */ + if (read_32bitBE(0x00,streamFile) != 0x01000000) + goto fail; + + loop_flag = 0; + channel_count = 2; + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count,loop_flag); + if (!vgmstream) goto fail; + + /* fill in the vital statistics */ + start_offset = read_32bitLE(0x04,streamFile); + vgmstream->channels = channel_count; + vgmstream->sample_rate = 24000; + vgmstream->coding_type = coding_PSX; + vgmstream->num_samples = (read_32bitLE(0x08,streamFile))/channel_count/32*28; + if (loop_flag) { + vgmstream->loop_start_sample = 0; + vgmstream->loop_end_sample = (read_32bitLE(0x08,streamFile))/channel_count/32*28; + } + + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x8000; + vgmstream->meta_type = meta_PSX_FAG; + + /* 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; + + } + } + + return vgmstream; + + /* clean up anything we may have opened */ +fail: + if (vgmstream) close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 963fbb5d..9ac6f773 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -130,6 +130,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = { init_vgmstream_idsp, init_vgmstream_ngc_ymf, init_vgmstream_sadl, + init_vgmstream_ps2_ccc, + init_vgmstream_psx_fag, }; #define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0])) @@ -1695,6 +1697,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { 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; default: snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET"); diff --git a/src/vgmstream.h b/src/vgmstream.h index 96c1e640..91e4b9f4 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -237,6 +237,8 @@ typedef enum { meta_IDSP, /* Chronicles of Narnia */ meta_NGC_YMF, /* WWE WrestleMania X8 */ meta_SADL, /* .sad */ + meta_PS2_CCC, /* Tokyo Xtreme Racer DRIFT 2 */ + meta_PSX_FAG, /* Jackie Chan - Stuntmaster */ meta_XBOX_WAVM, /* XBOX WAVM File */ meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */ diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index 5669db83..7c466f50 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -183,7 +183,11 @@ char * extension_list[] = { "kraw\0KRAW Audio File (*.KRAW)\0", "omu\0OMU Audio File (*.OMU)\0", "xa2\0XA2 Audio File (*.XA2)\0", + "idsp\0IDSP Audio File (*.IDSP)\0", "xsf\0XSF Audio File (*.XSF)\0", + "ymf\0YMF Audio File (*.YMF)\0", + "ccc\0CCC Audio File (*.CCC)\0", + "fag\0FAG Audio File (*.FAG)\0", }; void about(HWND hwndParent) {