mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
Added .CPS support for Eternal Sonata (PS3)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@830 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
3210d31d12
commit
51a12c5e30
@ -294,6 +294,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
||||
if(!stricmp_utf8(p_extension,"ccc")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"cfn")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"cnk")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"cps")) return 1;
|
||||
|
||||
if(!stricmp_utf8(p_extension,"dcs")) return 1;
|
||||
if(!stricmp_utf8(p_extension,"de2")) return 1;
|
||||
@ -574,6 +575,7 @@ DECLARE_MULTIPLE_FILE_TYPE("CBD2 Audio File (*.CBD2)", cbd2);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("CCC Audio File (*.CCC)", ccc);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("CFN Audio File (*.CFN)", cfn);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("CNK Audio File (*.CNK)", cnk);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("CPS Audio File (*.CPS)", cps);
|
||||
|
||||
DECLARE_MULTIPLE_FILE_TYPE("DCS Audio File (*.DCS)", dcs);
|
||||
DECLARE_MULTIPLE_FILE_TYPE("DE2 Audio File (*.DE2)", de2);
|
||||
|
@ -251,7 +251,8 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/gh3_bar.o \
|
||||
meta/ffw.o \
|
||||
meta/ps2_jstm.o \
|
||||
meta/ps3_xvag.o
|
||||
meta/ps3_xvag.o \
|
||||
meta/ps3_cps.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -806,6 +806,10 @@
|
||||
RelativePath=".\meta\ps2_xau.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps3_cps.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps3_xvag.c"
|
||||
>
|
||||
|
@ -204,5 +204,6 @@ libmeta_la_SOURCES += gh3_bar.c
|
||||
libmeta_la_SOURCES += ffw.c
|
||||
libmeta_la_SOURCES += ps2_jstm.c
|
||||
libmeta_la_SOURCES += ps3_xvag.c
|
||||
libmeta_la_SOURCES += ps3_cps.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -519,4 +519,7 @@ VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps3_xvag(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE* streamFile);
|
||||
|
||||
|
||||
#endif
|
||||
|
66
src/meta/ps3_cps.c
Normal file
66
src/meta/ps3_cps.c
Normal file
@ -0,0 +1,66 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* CPS (from Eternal Sonata) */
|
||||
VGMSTREAM * init_vgmstream_ps3_cps(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("cps",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x43505320) /* "CPS" */
|
||||
goto fail;
|
||||
|
||||
loop_flag = read_32bitBE(0x18,streamFile);
|
||||
|
||||
channel_count = read_32bitBE(0x8,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitBE(0x4,streamFile);
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->num_samples = read_32bitBE(0xc,streamFile)*28/32;
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile)*28/32;
|
||||
vgmstream->loop_end_sample = read_32bitBE(0x18,streamFile)*28/32;
|
||||
}
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->meta_type = meta_PS3_CPS;
|
||||
|
||||
/* 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;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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -282,6 +282,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_dsp_dspw,
|
||||
init_vgmstream_ps2_jstm,
|
||||
init_vgmstream_ps3_xvag,
|
||||
init_vgmstream_ps3_cps,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2660,6 +2661,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS3_XVAG:
|
||||
snprintf(temp,TEMPSIZE,"XVAG Header");
|
||||
break;
|
||||
case meta_PS3_CPS:
|
||||
snprintf(temp,TEMPSIZE,"CPS Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -483,6 +483,7 @@ typedef enum {
|
||||
meta_DSP_DSPW, /* Sengoku Basara 3 [WII] */
|
||||
meta_PS2_JSTM, /* Tantei Jinguji Saburo - Kind of Blue (PS2) */
|
||||
meta_PS3_XVAG, /* Ratchet & Clank Future: Quest for Booty (PS3) */
|
||||
meta_PS3_CPS, /* Eternal Sonata (PS3) */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -57,6 +57,7 @@ gchar *vgmstream_exts [] = {
|
||||
"ccc",
|
||||
"cfn",
|
||||
"cnk",
|
||||
"cps",
|
||||
|
||||
"dcs",
|
||||
"de2",
|
||||
@ -240,6 +241,7 @@ gchar *vgmstream_exts [] = {
|
||||
"xmu",
|
||||
"xsf",
|
||||
"xss",
|
||||
"xvag",
|
||||
"xvas",
|
||||
"xwav",
|
||||
"xwb",
|
||||
|
@ -120,6 +120,7 @@ char * extension_list[] = {
|
||||
"ccc\0CCC Audio File (*.CCC)\0",
|
||||
"cfn\0CFN Audio File (*.CFN)\0",
|
||||
"cnk\0CNK Audio File (*.CNK)\0",
|
||||
"cps\0CPS Audio File (*.CPS)\0",
|
||||
|
||||
"dcs\0DCS Audio File (*.DCS)\0",
|
||||
"de2\0DE2 Audio File (*.DE2)\0",
|
||||
|
Loading…
Reference in New Issue
Block a user