Added .SPM support for Lethal Skies - Elite Pilot: Team SW (PS2)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@884 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-11-29 02:02:27 +00:00
parent 1519d29183
commit 16f554d23b
10 changed files with 83 additions and 1 deletions

View File

@ -434,6 +434,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"sng")) return 1;
if(!stricmp_utf8(p_extension,"sns")) return 1;
if(!stricmp_utf8(p_extension,"spd")) return 1;
if(!stricmp_utf8(p_extension,"spm")) return 1;
if(!stricmp_utf8(p_extension,"sps")) return 1;
if(!stricmp_utf8(p_extension,"spsd")) return 1;
if(!stricmp_utf8(p_extension,"spw")) return 1;
@ -728,6 +729,7 @@ DECLARE_MULTIPLE_FILE_TYPE("SND Audio File (*.SND)", snd);
DECLARE_MULTIPLE_FILE_TYPE("SNG Audio File (*.SNG)", sng);
DECLARE_MULTIPLE_FILE_TYPE("SNS Audio File (*.SNS)", sns);
DECLARE_MULTIPLE_FILE_TYPE("SPD Audio File (*.SPD)", spd);
DECLARE_MULTIPLE_FILE_TYPE("SPM Audio File (*.SPM)", spm);
DECLARE_MULTIPLE_FILE_TYPE("SPS Audio File (*.SPS)", sps);
DECLARE_MULTIPLE_FILE_TYPE("SPSD Audio File (*.SPSD)", spsd);
DECLARE_MULTIPLE_FILE_TYPE("SPW Audio File (*.SPW)", spw);

View File

@ -261,7 +261,8 @@ META_OBJS=meta/adx_header.o \
meta/ps3_past.o \
meta/ps3_sgh_sgb.o \
meta/ngca.o \
meta/wii_ras.o
meta/wii_ras.o \
meta/ps2_spm.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -746,6 +746,10 @@
RelativePath=".\meta\ps2_snd.c"
>
</File>
<File
RelativePath=".\meta\ps2_spm.c"
>
</File>
<File
RelativePath=".\meta\ps2_sps.c"
>

View File

@ -214,5 +214,6 @@ libmeta_la_SOURCES += ps3_past.c
libmeta_la_SOURCES += ps3_sgh_sgb.c
libmeta_la_SOURCES += ngca.c
libmeta_la_SOURCES += wii_ras.c
libmeta_la_SOURCES += ps2_spm.c
EXTRA_DIST = meta.h

View File

@ -543,5 +543,7 @@ VGMSTREAM * init_vgmstream_ngca(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_wii_ras(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_spm(STREAMFILE* streamFile);
#endif

65
src/meta/ps2_spm.c Normal file
View File

@ -0,0 +1,65 @@
#include "meta.h"
#include "../util.h"
/* SPM (from Lethal Skies Elite Pilot: Team SW) */
VGMSTREAM * init_vgmstream_ps2_spm(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("spm",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x53504D00) /* "SPM" */
goto fail;
loop_flag = 1;
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 48000;
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x4,streamFile)/4;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x8,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0xC,streamFile);
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 2;
vgmstream->meta_type = meta_PS2_SPM;
/* 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

@ -293,6 +293,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps3_sgh_sgb,
init_vgmstream_ngca,
init_vgmstream_wii_ras,
init_vgmstream_ps2_spm,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2719,6 +2720,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_WII_RAS:
snprintf(temp,TEMPSIZE,"RAS header");
break;
case meta_PS2_SPM:
snprintf(temp,TEMPSIZE,"SPM header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -497,6 +497,7 @@ typedef enum {
meta_PS3_SGH_SGB, /* Folklore (PS3) */
meta_NGCA, /* GoldenEye 007 (Wii) */
meta_WII_RAS, /* Donkey Kong Country Returns (Wii) */
meta_PS2_SPM /* Lethal Skies Elite Pilot: Team SW */
} meta_t;
typedef struct {

View File

@ -190,6 +190,7 @@ gchar *vgmstream_exts [] = {
"sng",
"sns",
"spd",
"spm",
"sps",
"spsd",
"spw",

View File

@ -257,6 +257,7 @@ char * extension_list[] = {
"sng\0SNG Audio File (*.SNG)\0",
"sns\0SNS Audio File (*.SNS)\0",
"spd\0SPD Audio File (*.SPD)\0",
"spm\0SPM Audio File (*.SPM)\0",
"sps\0SPS Audio File (*.SPS)\0",
"spsd\0SPSD Audio File (*.SPSD)\0",
"spw\0SPW Audio File (*.SPW)\0",