mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
adding STMA support (XBOX)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@400 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
a3b1dfd277
commit
992bef1dc4
@ -536,6 +536,10 @@
|
||||
RelativePath=".\meta\ws_aud.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\xbox_stma.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\xbox_wavm.c"
|
||||
>
|
||||
|
@ -83,6 +83,8 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_amts(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_xbox_stma(STREAMFILE *streamFile);
|
||||
|
||||
#ifdef VGM_USE_VORBIS
|
||||
VGMSTREAM * init_vgmstream_ogg_vorbis(STREAMFILE *streamFile);
|
||||
|
||||
|
64
src/meta/xbox_stma.c
Normal file
64
src/meta/xbox_stma.c
Normal file
@ -0,0 +1,64 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* STMA
|
||||
|
||||
STMA (found in Midnight Club 2)
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_xbox_stma(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
|
||||
int loop_flag=0;
|
||||
int channel_count;
|
||||
int i;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("stma",filename_extension(filename))) goto fail;
|
||||
|
||||
if(read_32bitBE(0x0,streamFile)!=0x53544D41)
|
||||
goto fail;
|
||||
|
||||
loop_flag = ((read_32bitLE(0x20,streamFile)==1) || (read_32bitLE(0x18,streamFile)>read_32bitLE(0x1C,streamFile)));
|
||||
|
||||
/* Seems that the loop flag is not allways well defined */
|
||||
/* Some of the tracks should loop, but without flag set */
|
||||
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 */
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
|
||||
vgmstream->coding_type = coding_INT_DVI_IMA;
|
||||
vgmstream->num_samples = read_32bitLE(0x18,streamFile)*2/vgmstream->channels;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size=0x40;
|
||||
vgmstream->meta_type = meta_XBOX_STMA;
|
||||
|
||||
if(loop_flag) {
|
||||
vgmstream->loop_start_sample=read_32bitLE(0x24,streamFile);
|
||||
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,36);
|
||||
vgmstream->ch[i].offset = 0x800+(i*vgmstream->interleave_block_size);
|
||||
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -113,6 +113,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ngc_vjdsp,
|
||||
init_vgmstream_ngc_biodsp,
|
||||
init_vgmstream_xbox_wvs,
|
||||
init_vgmstream_xbox_stma,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -1593,6 +1594,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case meta_XBOX_WVS:
|
||||
snprintf(temp,TEMPSIZE,"Metal Arms WVS Header");
|
||||
break;
|
||||
case meta_XBOX_STMA:
|
||||
snprintf(temp,TEMPSIZE,"Midnight Club 2 STMA Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ typedef enum {
|
||||
with smaple-level interleave handled by the
|
||||
decoder */
|
||||
coding_DVI_IMA, /* DVI (bare IMA, high nibble first), aka ADP4 */
|
||||
coding_INT_DVI_IMA, /* Interlaved DVI */
|
||||
coding_INT_DVI_IMA, /* Interleaved DVI */
|
||||
coding_EACS_IMA,
|
||||
coding_IMA, /* bare IMA, low nibble first */
|
||||
coding_WS, /* Westwood Studios' custom VBR ADPCM */
|
||||
@ -225,6 +225,7 @@ typedef enum {
|
||||
meta_XBOX_WAVM, /* XBOX WAVM File */
|
||||
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
|
||||
meta_XBOX_WVS, /* XBOX WVS */
|
||||
meta_XBOX_STMA, /* XBOX STMA */
|
||||
|
||||
meta_EAXA_R2, /* EA XA Release 2 */
|
||||
meta_EAXA_R3, /* EA XA Release 3 */
|
||||
|
@ -172,6 +172,7 @@ char * extension_list[] = {
|
||||
"vjdsp\0VJDSP Audio File (*.VJDSP)\0",
|
||||
"biodsp\0BIODSP Audio File (*.BIODSP)\0",
|
||||
"wvs\0WVS Audio File (*.WVS)\0",
|
||||
"stma\0STMA Audio File (*.STMA)\0",
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user