.isws added (Sega Superstars Tennis Wii)

Multi-Channel support for IDSP

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@728 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-01-24 21:27:22 +00:00
parent 7093c2b17f
commit 8ddf6990c9
9 changed files with 125 additions and 25 deletions

View File

@ -218,7 +218,8 @@ META_OBJS=meta/adx_header.o \
meta/stx.o \
meta/ps2_stm.o \
meta/myspd.o \
meta/his.o
meta/his.o \
meta/isws.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"
@ -340,6 +340,10 @@
RelativePath=".\meta\ish_isd.c"
>
</File>
<File
RelativePath=".\meta\isws.c"
>
</File>
<File
RelativePath=".\meta\ivaud.c"
>

View File

@ -176,5 +176,6 @@ libmeta_la_SOURCES += stx.c
libmeta_la_SOURCES += ps2_stm.c
libmeta_la_SOURCES += myspd.c
libmeta_la_SOURCES += his.c
libmeta_la_SOURCES += isws.c
EXTRA_DIST = meta.h

View File

@ -90,7 +90,7 @@ VGMSTREAM * init_vgmstream_idsp2(STREAMFILE *streamFile) {
off_t start_offset;
int loop_flag;
int channel_count;
int i;
int i, j;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
@ -122,38 +122,43 @@ VGMSTREAM * init_vgmstream_idsp2(STREAMFILE *streamFile) {
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
if (read_32bitBE(0xD8,streamFile) == 0) {
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = (get_streamfile_size(streamFile)-start_offset)/2;
} else if (read_32bitBE(0xD8,streamFile) > 0) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitBE(0xD8,streamFile);
vgmstream->interleave_block_size = read_32bitBE(0xD8,streamFile);
}
}
vgmstream->meta_type = meta_IDSP2;
{
if (vgmstream->coding_type == coding_NGC_DSP) {
for (i=0;i<16;i++)
vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x118+i*2,streamFile);
}
if (channel_count == 2) {
for (i=0;i<16;i++)
vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x178+i*2,streamFile);
off_t coef_table[8] = {0x118,0x178,0x1D8,0x238,0x298,0x2F8,0x358,0x3B8};
for (j=0;j<vgmstream->channels;j++) {
for (i=0;i<16;i++) {
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
}
}
}
}
/* 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;
}
}
/* 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;

81
src/meta/isws.c Normal file
View File

@ -0,0 +1,81 @@
#include "meta.h"
#include "../util.h"
VGMSTREAM * init_vgmstream_isws(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_count;
int i, j;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("isws",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x69535753) /* iSWS */
goto fail;
loop_flag = 0; // read_32bitBE(0x20,streamFile);
channel_count = read_32bitBE(0x08,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = (channel_count * 0x60) + 0x20;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x28,streamFile);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->num_samples = (read_32bitBE(0x20,streamFile));
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (read_32bitBE(0x20,streamFile));
}
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
// vgmstream->layout_type = layout_interleave;
vgmstream->layout_type = layout_interleave_shortblock;
vgmstream->interleave_block_size = read_32bitBE(0x10,streamFile);
vgmstream->interleave_smallblock_size = (((read_32bitBE(0x24,streamFile))-start_offset)%(vgmstream->channels*vgmstream->interleave_block_size))/vgmstream->channels;
}
vgmstream->meta_type = meta_ISWS;
{
if (vgmstream->coding_type == coding_NGC_DSP) {
off_t coef_table[8] = {0x3C,0x9C,0xFC,0x15C,0x1BC,0x21C,0x27C,0x2DC};
for (j=0;j<vgmstream->channels;j++) {
for (i=0;i<16;i++) {
vgmstream->ch[j].adpcm_coef[i] = read_16bitBE(coef_table[j]+i*2,streamFile);
}
}
}
}
/* 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

@ -433,4 +433,6 @@ VGMSTREAM * init_vgmstream_myspd(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_his(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_isws(STREAMFILE* streamFile);
#endif

View File

@ -237,6 +237,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_stm,
init_vgmstream_myspd,
init_vgmstream_his,
init_vgmstream_isws,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2372,6 +2373,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_HIS:
snprintf(temp,TEMPSIZE,"Her Interactive Sound header");
break;
case meta_ISWS:
snprintf(temp,TEMPSIZE,"SEGA Superstars Tennis iSWS header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -425,6 +425,7 @@ typedef enum {
meta_WII_WAS, /* DiRT 2 (WII) */
meta_PONA, /* Policenauts (3DO + PSX) */
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
meta_ISWS, /* SEGA Superstars Tennis (Wii) */
} meta_t;
typedef struct {

View File

@ -152,6 +152,7 @@ char * extension_list[] = {
"ild\0ILD Audio File (*.ILD)\0",
"int\0PS2 RAW Interleaved PCM (*.INT)\0",
"isd\0ISD Audio File (*.ISD)\0",
"isws\0ISWS Audio File (*.ISWS)\0",
"ivaud\0IVAUD Audio File (*.IVAUD)\0",
"ivb\0IVB Audio File (*.IVB)\0",