added .mms support (ShellSHock Nam '67)

added WIP support for Mini Minjas (.mnstr)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@965 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoat 2011-07-22 05:32:10 +00:00
parent 1c2ebea3bf
commit 85e9303b61
10 changed files with 179 additions and 4 deletions

View File

@ -379,6 +379,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"mib")) return 1;
if(!stricmp_utf8(p_extension,"mic")) return 1;
if(!stricmp_utf8(p_extension,"mihb")) return 1;
if(!stricmp_utf8(p_extension,"mnstr")) return 1;
if(!stricmp_utf8(p_extension,"mpdsp")) return 1;
if(!stricmp_utf8(p_extension,"mpds")) return 1;
if(!stricmp_utf8(p_extension,"msa")) return 1;
@ -689,6 +690,7 @@ DECLARE_MULTIPLE_FILE_TYPE("PS2 MI4 Audio File (*.MI4)", mi4);
DECLARE_MULTIPLE_FILE_TYPE("PS2 MIB Audio File (*.MIB)", mib);
DECLARE_MULTIPLE_FILE_TYPE("PS2 MIC Audio File (*.MIC)", mic);
DECLARE_MULTIPLE_FILE_TYPE("MIHB Audio File (*.MIHB)", mihb);
DECLARE_MULTIPLE_FILE_TYPE("MNSTR Audio File (*.MNSTR)", mnstr);
DECLARE_MULTIPLE_FILE_TYPE("MPDSP Audio File (*.MPDSP)", mpdsp);
DECLARE_MULTIPLE_FILE_TYPE("MPDS Audio File (*.MPDS)", mpds);
DECLARE_MULTIPLE_FILE_TYPE("MSA Audio File (*.MSA)", msa);

View File

@ -282,7 +282,9 @@ META_OBJS=meta/adx_header.o \
meta/ps3_klbs.o \
meta/ps2_mtaf.o \
meta/tun.o \
meta/wpd.o
meta/wpd.o \
meta/mn_str.o \
meta/ps2_mss.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="libvgmstream"
ProjectGUID="{54A6AD11-5369-4895-A06F-E255ABB99B11}"
RootNamespace="libvgmstream"
@ -396,6 +396,10 @@
RelativePath=".\meta\maxis_xa.c"
>
</File>
<File
RelativePath=".\meta\mn_str.c"
>
</File>
<File
RelativePath=".\meta\msvp.c"
>
@ -714,6 +718,10 @@
RelativePath=".\meta\ps2_msa.c"
>
</File>
<File
RelativePath=".\meta\ps2_mss.c"
>
</File>
<File
RelativePath=".\meta\ps2_mtaf.c"
>

View File

@ -229,5 +229,7 @@ libmeta_la_SOURCES += ps2_mtaf.c
libmeta_la_SOURCES += ps3_klbs.c
libmeta_la_SOURCES += tun.c
libmeta_la_SOURCES += wpd.c
libmeta_la_SOURCES += mn_str.c
libmeta_la_SOURCES += ps2_mss.c
EXTRA_DIST = meta.h

View File

@ -596,4 +596,8 @@ VGMSTREAM * init_vgmstream_wpd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps3_sgd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_mn_str(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_mss(STREAMFILE* streamFile);
#endif

78
src/meta/mn_str.c Normal file
View File

@ -0,0 +1,78 @@
#include "meta.h"
#include "../util.h"
VGMSTREAM * init_vgmstream_mn_str(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int bitspersample;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("mnstr",filename_extension(filename))) goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x50,streamFile);
bitspersample = read_32bitLE(0x58,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x20,streamFile)+0x48;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x54,streamFile);
switch (bitspersample) {
case 0x10:
vgmstream->coding_type = coding_PCM16LE;
if (channel_count = 1)
{
vgmstream->layout_type = layout_none;
}
else
{
vgmstream->interleave_block_size = 0x2;
vgmstream->layout_type = layout_interleave;
}
break;
case 0x4:
if (read_32bitLE(0x20,streamFile) == 0x24)
{
vgmstream->interleave_block_size = 0x800;
vgmstream->layout_type = layout_none;
}
}
vgmstream->num_samples = read_32bitLE(0x4C,streamFile);
//vgmstream->layout_type = layout_interleave;
//vgmstream->interleave_block_size = 0x2;
vgmstream->meta_type = meta_MN_STR;
/* 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;
}

68
src/meta/ps2_mss.c Normal file
View File

@ -0,0 +1,68 @@
#include "meta.h"
#include "../util.h"
VGMSTREAM * init_vgmstream_ps2_mss(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("mss",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D435353) /* "MCSS" */
goto fail;
loop_flag = 0;
channel_count = read_16bitLE(0x16,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x08,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x1C,streamFile);
if (channel_count == 1)
{
vgmstream->layout_type = layout_none;
}
else
{
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x18,streamFile);
}
vgmstream->meta_type = meta_PS2_MSS;
/* 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

@ -313,6 +313,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_tun,
init_vgmstream_wpd,
init_vgmstream_ps3_sgd,
init_vgmstream_mn_str,
init_vgmstream_ps2_mss,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2863,6 +2865,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_WPD:
snprintf(temp,TEMPSIZE,"WPD 'DPW' header");
break;
case meta_MN_STR:
snprintf(temp,TEMPSIZE,"Mini Ninjas 'STR' header");
break;
case meta_PS2_MSS:
snprintf(temp,TEMPSIZE,"ShellShock Nam '67 'MSCC' header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -526,6 +526,8 @@ typedef enum {
meta_PS2_VAG2, // Metal Gear Solid 3 VAG2
meta_TUN, // LEGO Racers (PC)
meta_WPD, // Shuffle! (PC)
meta_MN_STR, // Mini Ninjas (PC/PS3/WII)
meta_PS2_MSS, // ShellShock Nam '67 (PS2)
} meta_t;
typedef struct {

View File

@ -194,6 +194,7 @@ char * extension_list[] = {
"mib\0PS2 MIB Audio File (*.MIB)\0",
"mic\0PS2 MIC Audio File (*.MIC)\0",
"mihb\0MIHB Audio File (*.MIHB)\0",
"mnstr\0MNSTR Audio File (*.MNSTR)\0",
"mpdsp\0MPDSP Audio File (*.MPDSP)\0",
"mpds\0MPDS Audio File (*.MPDS)\0",
"msa\0MSA Audio File (*.MSA)\0",