mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
ps2 EXST support added
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@112 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
afbf7fb543
commit
8257e32f71
@ -246,6 +246,10 @@
|
|||||||
RelativePath=".\meta\ps2_ads.c"
|
RelativePath=".\meta\ps2_ads.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\meta\ps2_exst.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\meta\ps2_int.c"
|
RelativePath=".\meta\ps2_int.c"
|
||||||
>
|
>
|
||||||
|
85
src/meta/ps2_exst.c
Normal file
85
src/meta/ps2_exst.c
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "meta.h"
|
||||||
|
#include "../util.h"
|
||||||
|
|
||||||
|
/* EXST
|
||||||
|
|
||||||
|
PS2 INT format is an interleaved format found in Shadow of the Colossus
|
||||||
|
The header start with a EXST id.
|
||||||
|
The headers and bgm datas was separated in the game, and joined in order
|
||||||
|
to add support for vgmstream
|
||||||
|
|
||||||
|
The interleave value is allways 0x400
|
||||||
|
known extensions : .STS
|
||||||
|
|
||||||
|
2008-05-13 - Fastelbja : First version ...
|
||||||
|
*/
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_ps2_ads(const char * const filename) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
STREAMFILE * infile = NULL;
|
||||||
|
|
||||||
|
int loop_flag=0;
|
||||||
|
int channel_count;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* check extension, case insensitive */
|
||||||
|
if (strcasecmp("sts",filename_extension(filename))) goto fail;
|
||||||
|
|
||||||
|
/* try to open the file for header reading */
|
||||||
|
infile = open_streamfile(filename);
|
||||||
|
if (!infile) goto fail;
|
||||||
|
|
||||||
|
/* check EXST Header */
|
||||||
|
if (read_32bitBE(0x00,infile) != 0x45585354)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* check loop */
|
||||||
|
loop_flag = (read_32bitLE(0x0C,infile)==1);
|
||||||
|
|
||||||
|
channel_count=read_16bitLE(0x06,infile);
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
/* fill in the vital statistics */
|
||||||
|
vgmstream->channels = read_16bitLE(0x06,infile);
|
||||||
|
vgmstream->sample_rate = read_32bitLE(0x08,infile);
|
||||||
|
|
||||||
|
/* Compression Scheme */
|
||||||
|
vgmstream->coding_type = coding_PSX;
|
||||||
|
vgmstream->num_samples = (read_32bitLE(0x14,infile)*0x400)/16*28;
|
||||||
|
|
||||||
|
/* Get loop point values */
|
||||||
|
if(vgmstream->loop_flag) {
|
||||||
|
vgmstream->loop_start_sample = (read_32bitLE(0x10,infile)*0x400)/16*28;
|
||||||
|
vgmstream->loop_end_sample = (read_32bitLE(0x14,infile)*0x400)/16*28;
|
||||||
|
}
|
||||||
|
|
||||||
|
vgmstream->interleave_block_size = 0x400;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->meta_type = meta_PS2_EXST;
|
||||||
|
|
||||||
|
close_streamfile(infile); infile=NULL;
|
||||||
|
|
||||||
|
/* open the file for reading by each channel */
|
||||||
|
{
|
||||||
|
for (i=0;i<channel_count;i++) {
|
||||||
|
vgmstream->ch[i].streamfile = open_streamfile_buffer(filename,0x8000);
|
||||||
|
|
||||||
|
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||||
|
|
||||||
|
vgmstream->ch[i].channel_start_offset=
|
||||||
|
vgmstream->ch[i].offset=
|
||||||
|
0x800+vgmstream->interleave_block_size*i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
/* clean up anything we may have opened */
|
||||||
|
fail:
|
||||||
|
if (infile) close_streamfile(infile);
|
||||||
|
if (vgmstream) close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -598,6 +598,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
case meta_DSP_STM:
|
case meta_DSP_STM:
|
||||||
snprintf(temp,TEMPSIZE,"Nintendo STM header");
|
snprintf(temp,TEMPSIZE,"Nintendo STM header");
|
||||||
break;
|
break;
|
||||||
|
case meta_PS2_EXST:
|
||||||
|
snprintf(temp,TEMPSIZE,"EXST File (Shadow of the Colossus)");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ typedef enum {
|
|||||||
meta_PS2_NPSF, /* Namco Production Sound File */
|
meta_PS2_NPSF, /* Namco Production Sound File */
|
||||||
meta_PS2_RXW, /* Sony Arc The Lad Sound File */
|
meta_PS2_RXW, /* Sony Arc The Lad Sound File */
|
||||||
meta_PS2_RAW, /* RAW Interleaved Format */
|
meta_PS2_RAW, /* RAW Interleaved Format */
|
||||||
|
meta_PS2_EXST, /* Shadow of Colossus EXST */
|
||||||
meta_PSX_XA, /* CD-XA with RIFF header */
|
meta_PSX_XA, /* CD-XA with RIFF header */
|
||||||
|
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
@ -45,7 +45,7 @@ int fade_samples = 0;
|
|||||||
|
|
||||||
#define EXTENSION_LIST_SIZE 1024
|
#define EXTENSION_LIST_SIZE 1024
|
||||||
char working_extension_list[EXTENSION_LIST_SIZE] = {0};
|
char working_extension_list[EXTENSION_LIST_SIZE] = {0};
|
||||||
#define EXTENSION_COUNT 18
|
#define EXTENSION_COUNT 19
|
||||||
char * extension_list[EXTENSION_COUNT] = {
|
char * extension_list[EXTENSION_COUNT] = {
|
||||||
"adx\0ADX Audio File (*.ADX)\0",
|
"adx\0ADX Audio File (*.ADX)\0",
|
||||||
"afc\0AFC Audio File (*.AFC)\0",
|
"afc\0AFC Audio File (*.AFC)\0",
|
||||||
@ -65,6 +65,7 @@ char * extension_list[EXTENSION_COUNT] = {
|
|||||||
"xa\0PSX CD-XA File (*.XA)\0",
|
"xa\0PSX CD-XA File (*.XA)\0",
|
||||||
"rxw\0PS2 RXWS File (*.RXW)\0",
|
"rxw\0PS2 RXWS File (*.RXW)\0",
|
||||||
"int\0PS2 RAW Interleaved PCM (*.INT)\0",
|
"int\0PS2 RAW Interleaved PCM (*.INT)\0",
|
||||||
|
"sts\0PS2 EXST Audio File (*.STS)\0",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* stubs, we don't do anything fancy yet */
|
/* stubs, we don't do anything fancy yet */
|
||||||
|
Loading…
Reference in New Issue
Block a user