Add .STR + .STR WII (HOTD Overkill)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@598 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
fastelbja 2009-03-12 21:25:41 +00:00
parent ad8d4286a6
commit b818f00297
7 changed files with 108 additions and 4 deletions

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"
@ -722,6 +722,10 @@
RelativePath=".\meta\wii_sng.c"
>
</File>
<File
RelativePath=".\meta\wii_str.c"
>
</File>
<File
RelativePath=".\meta\wii_sts.c"
>

View File

@ -353,4 +353,6 @@ VGMSTREAM * init_vgmstream_ps2_vsf_tta(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_ads(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_wii_str(STREAMFILE *streamFile);
#endif

View File

@ -19,7 +19,7 @@ VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE *streamFile) {
if (read_32bitBE(0x00,streamFile) != 0x01006408)
goto fail;
loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */
loop_flag = (read_32bitLE(0x14,streamFile)!=0);
channel_count = read_32bitLE(0x1C,streamFile);
/* build the VGMSTREAM */
@ -33,7 +33,7 @@ VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_start_sample = (read_32bitLE(0x0C,streamFile)-read_32bitLE(0x14,streamFile))*28/16/channel_count;
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
}

View File

@ -34,6 +34,9 @@ VGMSTREAM * init_vgmstream_ps2_str(STREAMFILE *streamFile) {
/* with others .STR file as it is a very common extension */
if (!infileSTH) goto fail;
if(read_32bitLE(0x2C,infileSTH)==0)
goto fail;
if((read_32bitLE(0x2C,infileSTH)==0x07) ||
(read_32bitLE(0x2C,infileSTH)==0x06))
channel_count=2;
@ -78,6 +81,7 @@ VGMSTREAM * init_vgmstream_ps2_str(STREAMFILE *streamFile) {
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset+=(off_t)(vgmstream->interleave_block_size*i);
}
}

90
src/meta/wii_str.c Normal file
View File

@ -0,0 +1,90 @@
#include "meta.h"
#include "../util.h"
VGMSTREAM * init_vgmstream_wii_str(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
STREAMFILE * infileSTH = NULL;
char filename[260];
char * filenameSTH = NULL;
int i, j, channel_count, loop_flag;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("str",filename_extension(filename))) goto fail;
/* check for .MIH file */
filenameSTH=(char *)malloc(strlen(filename)+1);
if (!filenameSTH) goto fail;
strcpy(filenameSTH,filename);
strcpy(filenameSTH+strlen(filenameSTH)-3,"STH");
infileSTH = streamFile->open(streamFile,filenameSTH,STREAMFILE_DEFAULT_BUFFER_SIZE);
/* STH File is necessary, so we can't confuse those file */
/* with others .STR file as it is a very common extension */
if (!infileSTH) goto fail;
if(read_32bitLE(0x2C,infileSTH)!=0)
goto fail;
channel_count = read_32bitBE(0x70,infileSTH);
if(channel_count==1)
loop_flag = (read_32bitBE(0xD4,infileSTH)==0x00740000);
else
loop_flag = (read_32bitBE(0x124,infileSTH)==0x00740000);
/* 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_32bitBE(0x38,infileSTH);
vgmstream->interleave_block_size=0x8000;
vgmstream->num_samples=read_32bitBE(0x34,infileSTH);
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_WII_STR;
if(loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples;
}
/* 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)(vgmstream->interleave_block_size*i);
for(j=0; j<16; j++) {
vgmstream->ch[i].adpcm_coef[j]=read_16bitBE(0xAC+(j*2)+(i*0x50),infileSTH);
}
}
}
close_streamfile(infileSTH); infileSTH=NULL;
return vgmstream;
/* clean up anything we may have opened */
fail:
if (infileSTH) close_streamfile(infileSTH);
if (filenameSTH) {free(filenameSTH); filenameSTH=NULL;}
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -196,6 +196,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_ps2_tk5,
init_vgmstream_ps2_vsf_tta,
init_vgmstream_ads,
init_vgmstream_wii_str,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2099,6 +2100,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_ADS:
snprintf(temp,TEMPSIZE,"dhSS Header");
break;
case meta_WII_STR:
snprintf(temp,TEMPSIZE,"HOTD Overkill - STR+STH WII Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}

View File

@ -375,7 +375,7 @@ typedef enum {
meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */
meta_NGC_IADP, /* Gamecube Interleave DSP */
meta_PS2_TK5, /* Tekken 5 Stream Files */
meta_WII_STR, /* House of The Dead Overkill STR+STH */
} meta_t;
typedef struct {