Add PS2 WMUS for "The Warriors" PS2

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@919 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
snakemeat 2011-02-13 02:23:53 +00:00
parent 16bae0a74d
commit 85e4780db3
9 changed files with 107 additions and 2 deletions

View File

@ -488,6 +488,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
if(!stricmp_utf8(p_extension,"wavm")) return 1;
if(!stricmp_utf8(p_extension,"was")) return 1;
if(!stricmp_utf8(p_extension,"wii")) return 1;
if(!stricmp_utf8(p_extension,"wmus")) return 1;
if(!stricmp_utf8(p_extension,"wp2")) return 1;
if(!stricmp_utf8(p_extension,"wsd")) return 1;
if(!stricmp_utf8(p_extension,"wsi")) return 1;
@ -787,6 +788,7 @@ DECLARE_MULTIPLE_FILE_TYPE("WAM Audio File (*.WAM)", wam);
DECLARE_MULTIPLE_FILE_TYPE("WAVM Audio File (*.WAVM)", wavm);
DECLARE_MULTIPLE_FILE_TYPE("WAS Audio File (*.WAS)", was);
DECLARE_MULTIPLE_FILE_TYPE("WII Audio File (*.WII)", wii);
DECLARE_MULTIPLE_FILE_TYPE("WMUS Audio File (*.WMUS)", wmus);
DECLARE_MULTIPLE_FILE_TYPE("WP2 Audio File (*.WP2)", wp2);
DECLARE_MULTIPLE_FILE_TYPE("WSD Audio File (*.WSD)", wsd);
DECLARE_MULTIPLE_FILE_TYPE("WSI Audio File (*.WSI)", wsi);

View File

@ -273,7 +273,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_strlr.o \
meta/lsf.o \
meta/ps3_vawx.o \
meta/pc_snds.o
meta/pc_snds.o \
meta/ps2_wmus.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -826,6 +826,10 @@
RelativePath=".\meta\ps2_wb.c"
>
</File>
<File
RelativePath=".\meta\ps2_wmus.c"
>
</File>
<File
RelativePath=".\meta\ps2_xa2.c"
>

View File

@ -559,4 +559,6 @@ VGMSTREAM * init_vgmstream_ps3_vawx(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_pc_snds(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE* streamFile);
#endif

89
src/meta/ps2_wmus.c Normal file
View File

@ -0,0 +1,89 @@
#include "meta.h"
#include "../util.h"
/* WMUS - Arbitrary extension chosen for The Warriors (PS2) */
VGMSTREAM * init_vgmstream_ps2_wmus(STREAMFILE *streamFile)
{
VGMSTREAM * vgmstream = NULL;
char filename[260];
int loop_flag = 1;
int channel_count;
off_t start_offset;
int i;
int blockCount;
int shortBlockSize;
char filenameWHED[260];
STREAMFILE * streamFileWHED = NULL;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("wmus",filename_extension(filename)))
{
goto fail;
}
/* check for .WHED file */
strcpy(filenameWHED, filename);
strcpy(filenameWHED + strlen(filenameWHED) - 4, "WHED");
streamFileWHED = streamFile->open(streamFile, filenameWHED, STREAMFILE_DEFAULT_BUFFER_SIZE);
if (!streamFileWHED)
{
goto fail;
}
/* check loopand channel */
loop_flag = 1;
channel_count = read_32bitLE(0x14, streamFileWHED);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream)
{
goto fail;
}
/* fill in the vital statistics */
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x04, streamFileWHED);
vgmstream->coding_type = coding_PSX;
vgmstream->interleave_block_size = read_32bitLE(0x18, streamFileWHED);
blockCount = read_32bitLE(0x1C, streamFileWHED) * channel_count;
shortBlockSize = read_32bitLE(0x20, streamFileWHED);
vgmstream->num_samples = (vgmstream->interleave_block_size * blockCount) / 16 / channel_count * 28;
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples - (vgmstream->interleave_block_size - shortBlockSize);
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_WMUS;
start_offset = 0;
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
(off_t)(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

@ -301,6 +301,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_lsf_n1nj4n,
init_vgmstream_ps3_vawx,
init_vgmstream_pc_snds,
init_vgmstream_ps2_wmus,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2802,6 +2803,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_PC_SNDS:
snprintf(temp,TEMPSIZE,"assumed Heavy Iron IMA by .snds extension");
break;
case meta_PS2_WMUS:
snprintf(temp,TEMPSIZE,"assumed The Warriors Sony ADPCM by .wmus extension");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -514,6 +514,7 @@ typedef enum {
meta_LSF_N1NJ4N, /* .lsf n1nj4n Fastlane Street Racing (iPhone) */
meta_PS3_VAWX, // No More Heroes: Heroes Paradise (PS3)
meta_PC_SNDS, // Incredibles PC .snds
meta_PS2_WMUS, // The Warriors (PS2)
} meta_t;
typedef struct {

View File

@ -244,6 +244,7 @@ gchar *vgmstream_exts [] = {
"wavm",
"wb",
"wii",
"wmus",
"wp2",
"wsd",
"wsi",

View File

@ -315,7 +315,8 @@ char * extension_list[] = {
"was\0WAS Audio File (*.WAS)\0",
"wb\0WB Audio File (*.WB)\0",
"wii\0WII Audio File (*.WII)\0",
"wp2\0WP2 Audio File (*.WP2)\0",
"wmus\0WMUS Audio File (*.WMUS)\0",
"wp2\0WP2 Audio File (*.WP2)\0",
"wsd\0WSD Audio File (*.WSD)\0",
"wsi\0WSI Audio File (*.WSI)\0",
"wvs\0WVS Audio File (*.WVS)\0",