mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
add support for .vb (dual channels ps2 files)
add support for .tk5 (tekken 5 stream files) git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@584 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
ea3c289d30
commit
ad6bbef79f
@ -582,6 +582,10 @@
|
||||
RelativePath=".\meta\ps2_tec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_tk5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_vag.c"
|
||||
>
|
||||
|
@ -340,4 +340,6 @@ VGMSTREAM * init_vgmstream_ps2_vsf(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_nds_rrds(STREAMFILE *streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_tk5(STREAMFILE *streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -56,7 +56,8 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("mib",filename_extension(filename)) &&
|
||||
strcasecmp("mi4",filename_extension(filename))) goto fail;
|
||||
strcasecmp("mi4",filename_extension(filename)) &&
|
||||
strcasecmp("vb",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check for .MIH file */
|
||||
strcpy(filenameMIH,filename);
|
||||
@ -98,13 +99,20 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
if(gotMIH)
|
||||
channel_count=read_32bitLE(0x08,streamFileMIH);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
// force no loop
|
||||
if(!strcasecmp("vb",filename_extension(filename)))
|
||||
loopStart=0;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,((loopStart!=0) && (loopEnd!=0)));
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
if(interleave==0) interleave=0x10;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
|
||||
if(gotMIH) {
|
||||
// Read stuff from the MIH file
|
||||
vgmstream->channels = read_32bitLE(0x08,streamFileMIH);
|
||||
@ -117,12 +125,19 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->interleave_block_size = interleave;
|
||||
|
||||
if(!strcasecmp("mib",filename_extension(filename)))
|
||||
if(!strcasecmp("mib",filename_extension(filename)))
|
||||
vgmstream->sample_rate = 44100;
|
||||
|
||||
if(!strcasecmp("mi4",filename_extension(filename)))
|
||||
vgmstream->sample_rate = 48000;
|
||||
|
||||
if(!strcasecmp("vb",filename_extension(filename)))
|
||||
{
|
||||
vgmstream->layout_type = layout_none;
|
||||
vgmstream->interleave_block_size=0;
|
||||
vgmstream->sample_rate = 22050;
|
||||
}
|
||||
|
||||
vgmstream->num_samples = (int32_t)(fileLength/16/channel_count*28);
|
||||
}
|
||||
|
||||
@ -138,9 +153,6 @@ VGMSTREAM * init_vgmstream_ps2_mib(STREAMFILE *streamFile) {
|
||||
}
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
|
||||
vgmstream->meta_type = meta_PS2_MIB;
|
||||
|
||||
if (gotMIH) {
|
||||
|
65
src/meta/ps2_tk5.c
Normal file
65
src/meta/ps2_tk5.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* TK5 (Tekken 5 Streams) */
|
||||
VGMSTREAM * init_vgmstream_ps2_tk5(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("tk5",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x544B3553)
|
||||
goto fail;
|
||||
|
||||
loop_flag = (read_32bitLE(0x0C,streamFile)!=0);
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x800;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = 48000;
|
||||
vgmstream->coding_type = coding_PSX_badflags;
|
||||
vgmstream->num_samples = ((get_streamfile_size(streamFile)-0x800))/16*28/2;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->meta_type = meta_PS2_TK5;
|
||||
|
||||
if (vgmstream->loop_flag)
|
||||
{
|
||||
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile)/16*28;
|
||||
vgmstream->loop_end_sample = vgmstream->loop_start_sample + (read_32bitLE(0x0C,streamFile)/16*28);
|
||||
}
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
STREAMFILE * file;
|
||||
file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!file) goto fail;
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = file;
|
||||
|
||||
vgmstream->ch[i].channel_start_offset=
|
||||
vgmstream->ch[i].offset=start_offset+
|
||||
vgmstream->interleave_block_size*i;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -190,6 +190,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_nds_swav,
|
||||
init_vgmstream_ps2_vsf,
|
||||
init_vgmstream_nds_rrds,
|
||||
init_vgmstream_ps2_tk5,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -219,7 +220,8 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) {
|
||||
(vgmstream->meta_type == meta_DSP_STD) ||
|
||||
(vgmstream->meta_type == meta_PS2_VAGp) ||
|
||||
(vgmstream->meta_type == meta_GENH) ||
|
||||
(vgmstream->meta_type == meta_KRAW)
|
||||
(vgmstream->meta_type == meta_KRAW) ||
|
||||
(vgmstream->meta_type == meta_PS2_MIB)
|
||||
) && vgmstream->channels == 1) {
|
||||
try_dual_file_stereo(vgmstream, streamFile);
|
||||
}
|
||||
@ -2059,11 +2061,14 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
snprintf(temp,TEMPSIZE,"SWAV Header");
|
||||
break;
|
||||
case meta_PS2_VSF:
|
||||
snprintf(temp,TEMPSIZE,"Musashi: Samurai Legend VSF Header");
|
||||
snprintf(temp,TEMPSIZE,"Musashi: Samurai Legend VSF Header");
|
||||
break;
|
||||
case meta_NDS_RRDS:
|
||||
snprintf(temp,TEMPSIZE,"Ridger Racer DS Header");
|
||||
break;
|
||||
case meta_PS2_TK5:
|
||||
snprintf(temp,TEMPSIZE,"Tekken 5 Stream Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
}
|
||||
|
@ -368,6 +368,7 @@ typedef enum {
|
||||
meta_PS2_P2BT, /* Pop'n'Music 7 Audio File */
|
||||
meta_PS2_GBTS, /* Pop'n'Music 9 Audio File */
|
||||
meta_NGC_IADP, /* Gamecube Interleave DSP */
|
||||
meta_PS2_TK5, /* Tekken 5 Stream Files */
|
||||
|
||||
} meta_t;
|
||||
|
||||
@ -397,6 +398,9 @@ typedef struct {
|
||||
int32_t adpcm_history3_32;
|
||||
};
|
||||
|
||||
double adpcm_history1_double;
|
||||
double adpcm_history2_double;
|
||||
|
||||
int adpcm_step_index; /* for IMA */
|
||||
int adpcm_scale; /* for MS ADPCM */
|
||||
|
||||
|
@ -226,6 +226,8 @@ char * extension_list[] = {
|
||||
"baka\0BAKA Audio File (*.BAKA)\0",
|
||||
"swav\0SWAV Audio File (*.SWAV)\0",
|
||||
"vsf\0VSF Audio File (*.VSF)\0",
|
||||
"vb\0VB Audio File (*.VB)\0",
|
||||
"tk5\0TK5 Audio File (*.TK5)\0",
|
||||
"rrds\0RRDS Audio File (*.RRDS)\0",
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user