Add .MSA support for Psyvariar -Complete Edition- (PS2) and .SMPL support for Homura. Add frequency switch for .TK5

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@769 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
bxaimc 2010-03-31 01:57:34 +00:00
parent bb9985e6e6
commit f35de62b8e
12 changed files with 294 additions and 133 deletions

View File

@ -228,7 +228,9 @@ META_OBJS=meta/adx_header.o \
meta/ps2_wb.o \
meta/bnsf.o \
meta/s14_sss.o \
meta/ps2_gcm.o
meta/ps2_gcm.o \
meta/ps2_smpl.o \
meta/ps2_msa.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -618,6 +618,10 @@
RelativePath=".\meta\ps2_mihb.c"
>
</File>
<File
RelativePath=".\meta\ps2_msa.c"
>
</File>
<File
RelativePath=".\meta\ps2_npsf.c"
>
@ -666,6 +670,10 @@
RelativePath=".\meta\ps2_sl3.c"
>
</File>
<File
RelativePath=".\meta\ps2_smpl.c"
>
</File>
<File
RelativePath=".\meta\ps2_snd.c"
>

View File

@ -185,5 +185,7 @@ libmeta_la_SOURCES += bnsf.c
libmeta_la_SOURCES += ps2_wb.c
libmeta_la_SOURCES += s14_sss.c
libmeta_la_SOURCES += ps2_gcm.c
libmeta_la_SOURCES += ps2_smpl.c
libmeta_la_SOURCES += ps2_msa.c
EXTRA_DIST = meta.h

View File

@ -455,4 +455,8 @@ VGMSTREAM * init_vgmstream_s14_sss(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_gcm(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_smpl(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_msa(STREAMFILE* streamFile);
#endif

60
src/meta/ps2_msa.c Normal file
View File

@ -0,0 +1,60 @@
#include "meta.h"
#include "../util.h"
/* MSA (from Psyvariar -Complete Edition-) */
VGMSTREAM * init_vgmstream_ps2_msa(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("msa",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x00000000)
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 = 0x14;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x4,streamFile)*28/32;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4000;
vgmstream->meta_type = meta_PS2_MSA;
/* 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;
}

63
src/meta/ps2_smpl.c Normal file
View File

@ -0,0 +1,63 @@
#include "meta.h"
#include "../util.h"
/* SMPL (from Homura) */
VGMSTREAM * init_vgmstream_ps2_smpl(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("smpl",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x534D504C) /* "SMPL" */
goto fail;
loop_flag = 1;
channel_count = 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x40;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
vgmstream->coding_type = coding_PSX_badflags;
vgmstream->num_samples = read_32bitBE(0xc,streamFile)*56/32;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x30,streamFile);
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_PS2_SMPL;
/* 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

@ -1,3 +1,4 @@
#include "meta.h"
#include "../util.h"
@ -8,6 +9,7 @@ VGMSTREAM * init_vgmstream_ps2_tk5(STREAMFILE *streamFile) {
off_t start_offset;
int loop_flag = 0;
int channel_count;
int freq_switch;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
@ -27,7 +29,15 @@ VGMSTREAM * init_vgmstream_ps2_tk5(STREAMFILE *streamFile) {
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->channels = channel_count;
vgmstream->sample_rate = 48000;
freq_switch = read_16bitLE(0x7,streamFile);
switch (freq_switch){
case 0x30:
vgmstream->sample_rate = 48000;
break;
case 0x31:
vgmstream->sample_rate = 44100;
break;
}
vgmstream->coding_type = coding_PSX_badflags;
vgmstream->num_samples = ((get_streamfile_size(streamFile)-0x800))/16*28/2;
vgmstream->layout_type = layout_interleave;

View File

@ -1,132 +1,132 @@
#include "meta.h"
#include "../util.h"
/* VSF (from Musashi: Samurai Legend) */
VGMSTREAM * init_vgmstream_ps2_vsf(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("vsf",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x56534600) /* "VSF" */
goto fail;
loop_flag = (read_32bitLE(0x1c,streamFile)==0x13);
#include "meta.h"
#include "../util.h"
/* VSF (from Musashi: Samurai Legend) */
VGMSTREAM * init_vgmstream_ps2_vsf(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("vsf",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x56534600) /* "VSF" */
goto fail;
loop_flag = (read_32bitLE(0x1c,streamFile)==0x13);
if(read_32bitLE(0x8,streamFile)==0x0)
channel_count = 1;
else
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 = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x10,streamFile)*28;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile)*28;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x400;
vgmstream->meta_type = meta_PS2_VSF;
/* 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;
}
/* VSF with SMSS header (from Tiny Toon Adventures: Defenders of the Universe */
VGMSTREAM * init_vgmstream_ps2_vsf_tta(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("vsf",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x534D5353) /* "SMSS" */
goto fail;
loop_flag = read_32bitLE(0x18,streamFile);
channel_count = read_32bitLE(0x0c,streamFile);
/* 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 = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*2)*28/16/channel_count;
vgmstream->loop_end_sample = (read_32bitLE(0x1c,streamFile)*2)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x8,streamFile);
vgmstream->meta_type = meta_PS2_VSF_TTA;
/* 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;
}
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 = 44100;
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x10,streamFile)*28;
if (loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile)*28;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x400;
vgmstream->meta_type = meta_PS2_VSF;
/* 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;
}
/* VSF with SMSS header (from Tiny Toon Adventures: Defenders of the Universe */
VGMSTREAM * init_vgmstream_ps2_vsf_tta(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("vsf",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x534D5353) /* "SMSS" */
goto fail;
loop_flag = read_32bitLE(0x18,streamFile);
channel_count = read_32bitLE(0x0c,streamFile);
/* 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 = read_32bitLE(0x10,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*2)*28/16/channel_count;
vgmstream->loop_end_sample = (read_32bitLE(0x1c,streamFile)*2)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x8,streamFile);
vgmstream->meta_type = meta_PS2_VSF_TTA;
/* 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

@ -248,6 +248,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_bnsf,
init_vgmstream_s14_sss,
init_vgmstream_ps2_gcm,
init_vgmstream_ps2_smpl,
init_vgmstream_ps2_msa,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -281,7 +283,8 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
(vgmstream->meta_type == meta_PS2_MIB) ||
(vgmstream->meta_type == meta_NGC_LPS) ||
(vgmstream->meta_type == meta_DSP_YGO) ||
(vgmstream->meta_type == meta_DSP_AGSC)
(vgmstream->meta_type == meta_DSP_AGSC) ||
(vgmstream->meta_type == meta_PS2_SMPL)
) && vgmstream->channels == 1) {
try_dual_file_stereo(vgmstream, streamFile);
}
@ -2487,7 +2490,10 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"assumed Polycom Siren 14 by .sss extension");
break;
case meta_PS2_GCM:
snprintf(temp,TEMPSIZE,"NamCollection");
snprintf(temp,TEMPSIZE,"GCM 'MCG' Header");
break;
case meta_PS2_SMPL:
snprintf(temp,TEMPSIZE,"Homura 'SMPL' Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -447,6 +447,8 @@ typedef enum {
meta_S14, /* raw Siren 14, 24kbit mono */
meta_SSS, /* raw Siren 14, 48kbit stereo */
meta_PS2_GCM, /* NamCollection */
meta_PS2_SMPL, /* Homura */
meta_PS2_MSA /* Psyvariar -Complete Edition- */
} meta_t;
typedef struct {

View File

@ -111,6 +111,7 @@ gchar *vgmstream_exts [] = {
"mic",
"mihb",
"mpdsp",
"msa",
"mss",
"msvp",
"mus",
@ -163,6 +164,7 @@ gchar *vgmstream_exts [] = {
"sl3",
"sli",
"smp",
"smpl",
"snd",
"sng",
"sns",

View File

@ -178,6 +178,7 @@ char * extension_list[] = {
"mic\0PS2 MIC Audio File (*.MIC)\0",
"mihb\0MIHB Audio File (*.MIHB)\0",
"mpdsp\0MPDSP Audio File (*.MPDSP)\0",
"msa\0MSA Audio File (*.MSA)\0",
"mss\0MSS Audio File (*.MSS)\0",
"msvp\0MSVP Audio File (*.MSVP)\0",
"mus\0MUS Playlist File (*.MUS)\0",
@ -231,6 +232,7 @@ char * extension_list[] = {
"sl3\0SL3 Audio File (*.SL3)\0",
"sli\0SLI Audio File (*.SLI)\0",
"smp\0SMP Audio File (*.SMP)\0",
"smpl\0SMPL Audio File (*.SMPL)\0",
"snd\0SND Audio File (*.SND)\0",
"sng\0SNG Audio File (*.SNG)\0",
"sns\0SNS Audio File (*.SNS)\0",