Add PS2 2PFS meta. Cannot determine loop points.

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@984 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
snakemeat 2012-08-15 03:41:24 +00:00
parent 1cb9456138
commit 1c67f85bc7
10 changed files with 105 additions and 2 deletions

View File

@ -266,6 +266,7 @@ void input_vgmstream::retag(const file_info & p_info,abort_callback & p_abort) {
bool input_vgmstream::g_is_our_content_type(const char * p_content_type) {return false;}
bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension) {
if(!stricmp_utf8(p_extension,"2dx9")) return 1;
if(!stricmp_utf8(p_extension,"2pfs")) return 1;
if(!stricmp_utf8(p_extension,"aaap")) return 1;
if(!stricmp_utf8(p_extension,"aax")) return 1;
@ -579,6 +580,7 @@ VALIDATE_COMPONENT_FILENAME("foo_input_vgmstream.dll");
// File types go down here (and in the large chunk of IFs above
// these are declared statically, and if anyone has a better idea i'd like to hear it - josh.
DECLARE_MULTIPLE_FILE_TYPE("2DX9 Audio File (*.2DX9)", 2dx9);
DECLARE_MULTIPLE_FILE_TYPE("2PFS Audio File (*.2PFS)", 2pfs);
DECLARE_MULTIPLE_FILE_TYPE("AAAP Audio File (*.AAAP)", aaap);
DECLARE_MULTIPLE_FILE_TYPE("AAX Audio File (*.AAX)", aax);

View File

@ -286,7 +286,8 @@ META_OBJS=meta/adx_header.o \
meta/mn_str.o \
meta/ps2_mss.o \
meta/ps2_hsf.o \
meta/ps3_ivag.o
meta/ps3_ivag.o \
meta/2pfs.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -590,6 +590,10 @@
RelativePath=".\meta\pos.c"
>
</File>
<File
RelativePath=".\meta\ps2_2pfs.c"
>
</File>
<File
RelativePath=".\meta\ps2_adm.c"
>

View File

@ -683,7 +683,7 @@ fail:
}
// FSB5 MPEG
VGMSTREAM * init_vgmstream_fsb_mpeg(STREAMFILE *streamFile) {
VGMSTREAM * init_vgmstream_fsb5_mpeg(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;

View File

@ -608,4 +608,6 @@ VGMSTREAM * init_vgmstream_ps2_hsf(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_ivag(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_2pfs(STREAMFILE* streamFile);
#endif

87
src/meta/ps2_2pfs.c Normal file
View File

@ -0,0 +1,87 @@
#include "meta.h"
#include "../util.h"
/* 2PFS
- Mahoromatic: Moetto - KiraKira Maid-San (PS2)
*/
VGMSTREAM * init_vgmstream_ps2_2pfs(STREAMFILE *streamFile)
{
VGMSTREAM * vgmstream = NULL;
char filename[260];
size_t fileLength;
off_t readOffset = 0;
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("2pfs",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x32504653)
goto fail;
// channel count
channel_count = 2;
// header size
start_offset = 0x800;
// loop flag
//if ((read_32bitLE(0x38, streamFile) != 0 ||
// (read_32bitLE(0x34, streamFile) != 0)))
//{
// loop_flag = 1;
//}
// Loop info unknown right now
//if (loop_flag)
//{
// vgmstream->loop_start_sample = read_32bitLE(0x38,streamFile)*28/16/channel_count;
// vgmstream->loop_end_sample = read_32bitLE(0x34,streamFile)*28/16/channel_count;
//}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x44,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x1000;
vgmstream->meta_type = meta_PS2_2PFS;
/* 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;
}

View File

@ -317,6 +317,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_mss,
init_vgmstream_ps2_hsf,
init_vgmstream_ps3_ivag,
init_vgmstream_ps2_2pfs,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2885,6 +2886,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_PS3_IVAG:
snprintf(temp,TEMPSIZE,"PS3 'IVAG' Header");
break;
case meta_PS2_2PFS:
snprintf(temp,TEMPSIZE,"PS2 '2PFS' Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -531,6 +531,7 @@ typedef enum {
meta_PS2_MSS, // ShellShock Nam '67 (PS2)
meta_PS2_HSF, // Lowrider (PS2)
meta_PS3_IVAG, // Interleaved VAG files (PS3)
meta_PS2_2PFS, // Mahoromatic: Moetto - KiraKira Maid-San (PS2)
} meta_t;
typedef struct {

View File

@ -15,6 +15,7 @@ Tuple * vgmstream_probe_for_tuple(const gchar *uri, VFSFile *fd);
gchar *vgmstream_exts [] = {
"2dx9",
"2pfs",
"aax",
"acm",

View File

@ -76,6 +76,7 @@ char working_extension_list[EXTENSION_LIST_SIZE] = {0};
char * extension_list[] = {
"2dx9\0""2DX9 Audio File (*.2DX9)\0",
"2pfs\0""2PFS Audio File (*.2PFS)\0",
"aax\0AAX Audio File (*.AAX)\0",
"aaap\0AAAP Audio File (*.AAAP)\0",