mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
adding STR + STH Support, fixed MIB with no end loop points
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@181 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
3ae797a88a
commit
696bbdf7af
@ -270,6 +270,10 @@
|
||||
RelativePath=".\meta\ps2_rxw.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_str.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_svag.c"
|
||||
>
|
||||
|
@ -61,4 +61,6 @@ VGMSTREAM * init_vgmstream_ps2_vag(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_psx_gms(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_str(STREAMFILE *streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -28,6 +28,7 @@
|
||||
another MIC format which can be found in Koei Games.
|
||||
|
||||
2008-05-14 - Fastelbja : First version ...
|
||||
2008-05-20 - Fastelbja : Fix loop value when loopEnd==0
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
@ -98,7 +99,7 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
channel_count=read_32bitLE(0x08,streamFileMIH);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,(loopStart!=0));
|
||||
vgmstream = allocate_vgmstream(channel_count,((loopStart!=0) && (loopEnd!=0)));
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
|
84
src/meta/ps2_str.c
Normal file
84
src/meta/ps2_str.c
Normal file
@ -0,0 +1,84 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* STR
|
||||
|
||||
2008-05-19 - Fastelbja : Test version ...
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_str(STREAMFILE *streamFile) {
|
||||
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * infile = NULL;
|
||||
STREAMFILE * infileSTH = NULL;
|
||||
char filename[260];
|
||||
|
||||
char * filenameSTH = NULL;
|
||||
|
||||
int i, 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;
|
||||
|
||||
channel_count=read_32bitLE(0x40,infileSTH)+1;
|
||||
loop_flag = (read_32bitLE(0x2c,infileSTH)==6);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = read_32bitLE(0x40,infileSTH)+1;
|
||||
vgmstream->sample_rate = read_32bitLE(0x24,infileSTH);
|
||||
vgmstream->interleave_block_size = read_32bitLE(0x04,infileSTH)/0x10;
|
||||
vgmstream->num_samples=read_32bitLE(0x20,infileSTH);
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
|
||||
vgmstream->meta_type = meta_PS2_STR;
|
||||
|
||||
if(loop_flag) {
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x28,infileSTH);
|
||||
vgmstream->loop_end_sample = vgmstream->num_samples;
|
||||
}
|
||||
|
||||
close_streamfile(infileSTH); infileSTH=NULL;
|
||||
|
||||
/* 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=0+vgmstream->interleave_block_size*i;
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (infile) close_streamfile(infile);
|
||||
if (infileSTH) close_streamfile(infileSTH);
|
||||
if (filenameSTH) {free(filenameSTH); filenameSTH=NULL;}
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* List of functions that will recognize files. These should correspond pretty
|
||||
* directly to the metadata types
|
||||
*/
|
||||
#define INIT_VGMSTREAM_FCNS 29
|
||||
#define INIT_VGMSTREAM_FCNS 30
|
||||
VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_adx, /* 0 */
|
||||
init_vgmstream_brstm, /* 1 */
|
||||
@ -45,7 +45,8 @@ VGMSTREAM * (*init_vgmstream_fcns[INIT_VGMSTREAM_FCNS])(STREAMFILE *streamFile)
|
||||
init_vgmstream_ngc_dsp_std_int, /* 25 */
|
||||
init_vgmstream_raw, /* 26 */
|
||||
init_vgmstream_ps2_vag, /* 27 */
|
||||
init_vgmstream_psx_gms /* 28 */
|
||||
init_vgmstream_psx_gms, /* 28 */
|
||||
init_vgmstream_ps2_str /* 29 */
|
||||
};
|
||||
|
||||
/* internal version with all parameters */
|
||||
@ -686,12 +687,18 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_PS2_VAGp:
|
||||
snprintf(temp,TEMPSIZE,"Sony VAG Mono header (VAGp)");
|
||||
break;
|
||||
case meta_PS2_VAGm:
|
||||
snprintf(temp,TEMPSIZE,"Sony VAG Mono header (VAGm)");
|
||||
break;
|
||||
case meta_PS2_pGAV:
|
||||
snprintf(temp,TEMPSIZE,"Sony VAG Stereo Little Endian header (pGAV)");
|
||||
break;
|
||||
case meta_PSX_GMS:
|
||||
snprintf(temp,TEMPSIZE,"assumed Grandia GMS file by .gms extension");
|
||||
break;
|
||||
case meta_PS2_STR:
|
||||
snprintf(temp,TEMPSIZE,"assumed STR + STH File by .str & .sth extension");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -90,8 +90,10 @@ typedef enum {
|
||||
meta_PS2_MIC, /* KOEI MIC File */
|
||||
meta_PS2_VAGi, /* VAGi Interleaved File */
|
||||
meta_PS2_VAGp, /* VAGp Mono File */
|
||||
meta_PS2_VAGm, /* VAGp Mono File */
|
||||
meta_PS2_pGAV, /* VAGp with Little Endian Header */
|
||||
meta_PSX_GMS, /* GMS File (used in PS1 & PS2) */
|
||||
meta_PS2_STR, /* Pacman STR+STH files */
|
||||
|
||||
meta_PSX_XA, /* CD-XA with RIFF header */
|
||||
|
||||
|
@ -103,6 +103,7 @@ char * extension_list[] = {
|
||||
"raw\0RAW Audio File (*.RAW)\0",
|
||||
"vag\0VAG Audio File (*.VAG)\0",
|
||||
"gms\0GMS Audio File (*.GMS)\0",
|
||||
"str\0STR Audio File (*.STR)\0"
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
Reference in New Issue
Block a user