Pikmin .stx

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@714 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2009-11-18 00:46:36 +00:00
parent c6ab413a6d
commit bca7a460ba
10 changed files with 88 additions and 2 deletions

View File

@ -225,13 +225,14 @@ etc:
- .mwv (Level-5 0x555 ADPCM)
- .ogg, .logg (Ogg Vorbis)
- .rsf (CCITT G.721 ADPCM)
- .sab (Worms 4 soundpacks)
- .sc (Activision EXAKT SASSC DPCM)
- .sd9 (MS ADPCM)
- .spw (FFXI PS-like ADPCM)
- .str (SDX2 DPCM)
- .stx (GC AFC ADPCM)
- .um3 (Ogg Vorbis)
- .xa (CD-ROM XA audio)
- .sab (Worms 4 soundpacks)
loop assists:
- .mus (playlist for .acm)

View File

@ -214,7 +214,8 @@ META_OBJS=meta/adx_header.o \
meta/wii_was.o \
meta/pona.o \
meta/fsb_test.o \
meta/xbox_hlwav.o
meta/xbox_hlwav.o \
meta/stx.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -778,6 +778,10 @@
RelativePath=".\meta\str_snds.c"
>
</File>
<File
RelativePath=".\meta\stx.c"
>
</File>
<File
RelativePath=".\meta\svs.c"
>

View File

@ -172,5 +172,6 @@ libmeta_la_SOURCES += wii_was.c
libmeta_la_SOURCES += pona.c
libmeta_la_SOURCES += fsb_test.c
libmeta_la_SOURCES += xbox_hlwav.c
libmeta_la_SOURCES += stx.c
EXTRA_DIST = meta.h

View File

@ -425,4 +425,6 @@ VGMSTREAM * init_vgmstream_pona(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_xbox_hlwav(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_stx(STREAMFILE* streamFile);
#endif

70
src/meta/stx.c Normal file
View File

@ -0,0 +1,70 @@
#include "meta.h"
#include "../util.h"
VGMSTREAM * init_vgmstream_stx(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
const int loop_flag = 0;
const int channel_count = 2; /* .stx seems to be stereo only */
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("stx",filename_extension(filename))) goto fail;
/* length of data */
if (read_32bitBE(0x00,streamFile) !=
get_streamfile_size(streamFile) - 0x20) goto fail;
/* bits per sample? */
if (read_16bitBE(0x0a,streamFile) != 4) goto fail;
/* samples per frame? */
if (read_16bitBE(0x0c,streamFile) != 0x10) goto fail;
/* ?? */
if (read_16bitBE(0x0e,streamFile) != 0x1E) goto fail;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->num_samples = read_32bitBE(0x04,streamFile);
vgmstream->sample_rate = (uint16_t)read_16bitBE(0x08,streamFile);
/* channels and loop flag are set by allocate_vgmstream */
vgmstream->coding_type = coding_NGC_AFC;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_STX;
/* frame-level interleave (9 bytes) */
vgmstream->interleave_block_size = 9;
/* open the file for reading by each channel */
{
STREAMFILE *chstreamfile;
int i;
/* both channels use same buffer, as interleave is so small */
chstreamfile = streamFile->open(streamFile,filename,9*channel_count*0x100);
if (!chstreamfile) goto fail;
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = chstreamfile;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
0x20 + i*vgmstream->interleave_block_size;
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -233,6 +233,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_wii_was,
init_vgmstream_pona,
init_vgmstream_xbox_hlwav,
init_vgmstream_stx,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2344,6 +2345,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_XBOX_HLWAV:
snprintf(temp,TEMPSIZE,"Half Life 2 bgm header");
break;
case meta_STX:
snprintf(temp,TEMPSIZE,"Nintendo .stx header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -193,6 +193,7 @@ typedef enum {
meta_NDS_SWAV, /* Asphalt Urban GT 1 & 2 */
meta_NDS_RRDS, /* Ridge Racer DS */
meta_WII_BNS, /* Wii BNS Banner Sound (similar to RSTM) */
meta_STX, /* Pikmin .stx */
/* CRI ADX */
meta_ADX_03, /* ADX "type 03" */

View File

@ -170,6 +170,7 @@ gchar *vgmstream_exts [] = {
"str",
"strm",
"sts",
"stx",
"svag",
"svs",
"swav",

View File

@ -236,6 +236,7 @@ char * extension_list[] = {
"str\0STR Audio File (*.STR)\0",
"strm\0STRM Audio File (*.STRM)\0",
"sts\0PS2 EXST Audio File (*.STS)\0",
"stx\0STX Audio File (*.STX)\0",
"svag\0PS2 SVAG Audio File (*.SVAG)\0",
"svs\0SVS Audio File (*.SVS)\0",
"swav\0SWAV Audio File (*.SWAV)\0",