mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Add TK1 from Tekken (NamCollection) to avoid conflict with TK5 infos. Add ADSC .ads from Kenka Bancho 2: Full Throttle
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@776 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
2c292eb086
commit
a1797ac9ee
@ -232,8 +232,10 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/ps2_smpl.o \
|
||||
meta/ps2_msa.o \
|
||||
meta/pc_smp.o \
|
||||
meta/p3d.o
|
||||
|
||||
meta/p3d.o \
|
||||
meta/ps2_tk1.o \
|
||||
meta/ps2_adsc.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
libvgmstream.a: $(OBJECTS)
|
||||
|
@ -534,6 +534,10 @@
|
||||
RelativePath=".\meta\ps2_ads.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_adsc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\ps2_ass.c"
|
||||
>
|
||||
|
@ -189,5 +189,6 @@ libmeta_la_SOURCES += ps2_smpl.c
|
||||
libmeta_la_SOURCES += ps2_msa.c
|
||||
libmeta_la_SOURCES += pc_smp.c
|
||||
libmeta_la_SOURCES += p3d.c
|
||||
libmeta_la_SOURCES += ps2_adsc.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
@ -463,4 +463,8 @@ VGMSTREAM * init_vgmstream_pc_smp(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_p3d(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_tk1(STREAMFILE* streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ps2_adsc(STREAMFILE* streamFile);
|
||||
|
||||
#endif
|
||||
|
63
src/meta/ps2_adsc.c
Normal file
63
src/meta/ps2_adsc.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* ADSC (from Kenka Bancho 2: Full Throttle) */
|
||||
VGMSTREAM * init_vgmstream_ps2_adsc(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
char filename[260];
|
||||
off_t start_offset;
|
||||
|
||||
int loop_flag;
|
||||
int channel_count;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("ads",filename_extension(filename))) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFile) != 0x41445343) /* ADSC */
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = read_32bitLE(0x18,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
start_offset = 0x1000;
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = read_32bitLE(0x14,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
if(read_32bitLE(0x18,streamFile)==0x01)
|
||||
vgmstream->num_samples = read_32bitLE(0x2c,streamFile)*56/32;
|
||||
else
|
||||
vgmstream->num_samples = read_32bitLE(0x2c,streamFile)*28/32;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x400;
|
||||
vgmstream->meta_type = meta_PS2_ADSC;
|
||||
|
||||
/* 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;
|
||||
}
|
@ -1,75 +1,129 @@
|
||||
|
||||
#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;
|
||||
int freq_switch;
|
||||
|
||||
/* 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;
|
||||
freq_switch = read_16bitLE(0x7,streamFile);
|
||||
switch (freq_switch){
|
||||
case 0x30:
|
||||
vgmstream->sample_rate = 48000;
|
||||
break;
|
||||
case 0x31:
|
||||
vgmstream->sample_rate = 44100;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/* TK1 (Tekken 5 Streams from Tekken (NamCollection)) */
|
||||
VGMSTREAM * init_vgmstream_ps2_tk1(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("tk1",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 = 44100;
|
||||
vgmstream->coding_type = coding_PSX_badflags;
|
||||
vgmstream->num_samples = read_32bitLE(0x08,streamFile)/16*28;
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x10;
|
||||
vgmstream->meta_type = meta_PS2_TK1;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -254,6 +254,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ps2_msa,
|
||||
init_vgmstream_pc_smp,
|
||||
init_vgmstream_p3d,
|
||||
init_vgmstream_ps2_tk1,
|
||||
init_vgmstream_ps2_adsc,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -2521,6 +2523,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_P3D:
|
||||
snprintf(temp,TEMPSIZE,"P3D Header");
|
||||
break;
|
||||
case meta_PS2_TK1:
|
||||
snprintf(temp,TEMPSIZE,"Tekken TK5STRM1 Header");
|
||||
break;
|
||||
case meta_PS2_ADSC:
|
||||
snprintf(temp,TEMPSIZE,"ADSC Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -453,6 +453,8 @@ typedef enum {
|
||||
meta_PS2_MSA, /* Psyvariar -Complete Edition- */
|
||||
meta_PC_SMP, /* unknown PC game .smp */
|
||||
meta_P3D, /* Prototype P3D */
|
||||
meta_PS2_TK1, /* Tekken (NamCollection) */
|
||||
meta_PS2_ADSC, /* Kenka Bancho 2: Full Throttle */
|
||||
} meta_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -191,6 +191,7 @@ gchar *vgmstream_exts [] = {
|
||||
|
||||
"tec",
|
||||
"thp",
|
||||
"tk1",
|
||||
"tk5",
|
||||
"tydsp",
|
||||
|
||||
|
@ -259,6 +259,7 @@ char * extension_list[] = {
|
||||
|
||||
"tec\0TEC Audio File (*.TEC)\0",
|
||||
"thp\0THP Audio File (*.THP)\0",
|
||||
"tk1\0TK1 Audio File (*.TK1)\0",
|
||||
"tk5\0TK5 Audio File (*.TK5)\0",
|
||||
"tydsp\0TYDSP Audio File (*.TYDSP)\0",
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user