Red Dead Revolver .stm (needs renamed to .ps2stm to avoid module collision in Winamp, etc)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@715 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2009-11-22 14:06:45 +00:00
parent bca7a460ba
commit 69a1f2be4e
10 changed files with 94 additions and 1 deletions

View File

@ -229,6 +229,7 @@ etc:
- .sc (Activision EXAKT SASSC DPCM)
- .sd9 (MS ADPCM)
- .spw (FFXI PS-like ADPCM)
- .stm renamed .ps2stm (DVI IMA ADPCM)
- .str (SDX2 DPCM)
- .stx (GC AFC ADPCM)
- .um3 (Ogg Vorbis)

View File

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

View File

@ -646,6 +646,10 @@
RelativePath=".\meta\ps2_sps.c"
>
</File>
<File
RelativePath=".\meta\ps2_stm.c"
>
</File>
<File
RelativePath=".\meta\ps2_str.c"
>

View File

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

View File

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

77
src/meta/ps2_stm.c Normal file
View File

@ -0,0 +1,77 @@
#include "meta.h"
#include "../util.h"
/* STM: Red Dead Revolver */
VGMSTREAM * init_vgmstream_ps2_stm(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("ps2stm",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x0,streamFile) != 0x53544d41) goto fail;
if (read_32bitBE(0x4,streamFile) != 0x6b690000) goto fail;
/* check bps */
if (read_32bitLE(0x10,streamFile) != 4) goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x14,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x800;
vgmstream->sample_rate = (uint16_t)read_32bitLE(0xc,streamFile);
vgmstream->coding_type = coding_INT_DVI_IMA;
vgmstream->num_samples = read_32bitLE(0x18,streamFile);
vgmstream->interleave_block_size = read_32bitLE(0x8,streamFile) / channel_count;
if(1 < channel_count)
{
/* not sure if this is right ... */
vgmstream->layout_type = layout_interleave;
} else {
vgmstream->layout_type = layout_none;
}
vgmstream->meta_type = meta_PS2_STM;
if(loop_flag) {
vgmstream->loop_start_sample=0;
vgmstream->loop_end_sample=vgmstream->num_samples;
}
/* 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

@ -234,6 +234,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_pona,
init_vgmstream_xbox_hlwav,
init_vgmstream_stx,
init_vgmstream_ps2_stm,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2348,6 +2349,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_STX:
snprintf(temp,TEMPSIZE,"Nintendo .stx header");
break;
case meta_PS2_STM:
snprintf(temp,TEMPSIZE,"Red Dead Revolver .stm (.ps2stm)");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -337,6 +337,7 @@ typedef enum {
meta_ADS, /* Gauntlet Dark Legends (GC) */
meta_PS2_SPS, /* Ape Escape 2 */
meta_PS2_XA2_RRP, /* RC Revenge Pro */
meta_PS2_STM, /* Red Dead Revolver .stm, renamed .ps2stm */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -126,6 +126,7 @@ gchar *vgmstream_exts [] = {
"pdt",
"pnb",
"pos",
"ps2stm",
"psh",
"psw",

View File

@ -192,6 +192,7 @@ char * extension_list[] = {
"pnb\0PNB Audio File (*.PNB)\0",
"pona\0PONA Audio File (*.PONA)\0",
"pos\0POS Audio File (*.POS)\0",
"ps2stm\0PS2STM Audio File (*.PS2STM)\0",
"psh\0PSH Audio File (*.PSH)\0",
"psw\0PSW Audio File (*.PSW)\0",