.kces added

.dxh added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@351 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-07-20 16:34:01 +00:00
parent 941b4d49cb
commit 1fd66dd519
10 changed files with 279 additions and 108 deletions

View File

@ -95,8 +95,10 @@ META_OBJS=meta/adx_header.o \
meta/ps2_bg00.o \
meta/dc_kcey.o \
meta/ps2_rstm.o \
meta/acm.o
meta/acm.o \
meta/ps2_kces.o \
meta/ps2_dxh.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
libvgmstream.a: $(OBJECTS)

View File

@ -314,6 +314,10 @@
RelativePath=".\meta\ps2_bmdx.c"
>
</File>
<File
RelativePath=".\meta\ps2_dxh.c"
>
</File>
<File
RelativePath=".\meta\ps2_exst.c"
>
@ -338,6 +342,10 @@
RelativePath=".\meta\ps2_int.c"
>
</File>
<File
RelativePath=".\meta\ps2_kces.c"
>
</File>
<File
RelativePath=".\meta\ps2_leg.c"
>

View File

@ -72,5 +72,7 @@ libmeta_la_SOURCES += ps2_bg00.c
libmeta_la_SOURCES += dc_kcey.c
libmeta_la_SOURCES += ps2_rstm.c
libmeta_la_SOURCES += acm.c
libmeta_la_SOURCES += ps2_kces.c
libmeta_la_SOURCES += ps2_dxh.c
EXTRA_DIST = meta.h

View File

@ -157,4 +157,8 @@ VGMSTREAM * init_vgmstream_ps2_rstm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_acm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_kces(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_dxh(STREAMFILE * streamFile);
#endif

View File

@ -1,108 +1,108 @@
#include "meta.h"
#include "../util.h"
/* Sony .ADS with SShd & SSbd Headers */
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
int loop_flag=0;
int channel_count;
off_t start_offset,test_offset;
int ads_type_2=0;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("ads",filename_extension(filename)) &&
strcasecmp("ss2",filename_extension(filename))) goto fail;
/* check SShd Header */
if (read_32bitBE(0x00,streamFile) != 0x53536864)
goto fail;
/* check SSbd Header */
if (read_32bitBE(0x20,streamFile) != 0x53536264)
goto fail;
/* check if file is not corrupt */
if (get_streamfile_size(streamFile)<(size_t)(read_32bitLE(0x24,streamFile) + 0x28))
goto fail;
/* check loop */
loop_flag = (read_32bitLE(0x1C,streamFile)!=0xFFFFFFFF);
channel_count=read_32bitLE(0x10,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = read_32bitLE(0x10,streamFile);
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
/* Check for Compression Scheme */
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x24,streamFile)/16*28/vgmstream->channels;
/* SS2 container with RAW Interleaved PCM */
if (read_32bitLE(0x08,streamFile)!=0x10) {
vgmstream->coding_type=coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x24,streamFile)/2/vgmstream->channels;
}
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_SShd;
/* Get loop point values */
if(vgmstream->loop_flag) {
if(vgmstream->interleave_block_size==0x10) {
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
} else {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*0x10)/16*28;
vgmstream->loop_end_sample = (read_32bitLE(0x1C,streamFile)*0x10)/16*28;
}
}
/* don't know why, but it does happen, in ps2 too :( */
if (vgmstream->loop_end_sample > vgmstream->num_samples)
vgmstream->loop_end_sample = vgmstream->num_samples;
start_offset=0x28;
// Hack for files with start_offset = 0x800
ads_type_2=1;
for(test_offset=start_offset;test_offset<0x800;test_offset+=4) {
#include "meta.h"
#include "../util.h"
/* Sony .ADS with SShd & SSbd Headers */
VGMSTREAM * init_vgmstream_ps2_ads(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
int loop_flag=0;
int channel_count;
off_t start_offset,test_offset;
int ads_type_2=0;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("ads",filename_extension(filename)) &&
strcasecmp("ss2",filename_extension(filename))) goto fail;
/* check SShd Header */
if (read_32bitBE(0x00,streamFile) != 0x53536864)
goto fail;
/* check SSbd Header */
if (read_32bitBE(0x20,streamFile) != 0x53536264)
goto fail;
/* check if file is not corrupt */
if (get_streamfile_size(streamFile)<(size_t)(read_32bitLE(0x24,streamFile) + 0x28))
goto fail;
/* check loop */
loop_flag = (read_32bitLE(0x1C,streamFile)!=0xFFFFFFFF);
channel_count=read_32bitLE(0x10,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
vgmstream->channels = read_32bitLE(0x10,streamFile);
vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
/* Check for Compression Scheme */
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x24,streamFile)/16*28/vgmstream->channels;
/* SS2 container with RAW Interleaved PCM */
if (read_32bitLE(0x08,streamFile)!=0x10) {
vgmstream->coding_type=coding_PCM16LE;
vgmstream->num_samples = read_32bitLE(0x24,streamFile)/2/vgmstream->channels;
}
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_SShd;
/* Get loop point values */
if(vgmstream->loop_flag) {
if(vgmstream->interleave_block_size==0x10) {
vgmstream->loop_start_sample = read_32bitLE(0x18,streamFile);
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
} else {
vgmstream->loop_start_sample = (read_32bitLE(0x18,streamFile)*0x10)/16*28;
vgmstream->loop_end_sample = (read_32bitLE(0x1C,streamFile)*0x10)/16*28;
}
}
/* don't know why, but it does happen, in ps2 too :( */
if (vgmstream->loop_end_sample > vgmstream->num_samples)
vgmstream->loop_end_sample = vgmstream->num_samples;
start_offset=0x28;
// Hack for files with start_offset = 0x800
ads_type_2=1;
for(test_offset=start_offset;test_offset<0x800;test_offset+=4) {
if (read_32bitLE(test_offset,streamFile)!=0)
ads_type_2=0;
}
if((ads_type_2==1)){
start_offset=0x800;
}
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
(off_t)(start_offset+vgmstream->interleave_block_size*i);
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}
}
if((ads_type_2==1)){
start_offset=0x800;
}
/* open the file for reading by each channel */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=
(off_t)(start_offset+vgmstream->interleave_block_size*i);
}
}
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

78
src/meta/ps2_dxh.c Normal file
View File

@ -0,0 +1,78 @@
#include "meta.h"
#include "../util.h"
/* DXH (from Tokobot Plus - Mysteries of the Karakuri) */
VGMSTREAM * init_vgmstream_ps2_dxh(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int illegal_loopend;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("dxh",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x00445848) /* 0\DXH" */
goto fail;
loop_flag = (read_32bitLE(0x50,streamFile)!=0);
channel_count = read_32bitLE(0x08,streamFile);
/* 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 = read_32bitLE(0x20,streamFile);
if (read_32bitBE(0x54,streamFile) == 0) {
/* if (loop_flag) { */
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = get_streamfile_size(streamFile)*28/16/channel_count;
vgmstream->num_samples = get_streamfile_size(streamFile)*28/16/channel_count;
/* } */
} else {
if (loop_flag) {
vgmstream->loop_start_sample = (read_32bitLE(0x50,streamFile)*0x20)*28/16/channel_count;
vgmstream->loop_end_sample = (read_32bitLE(0x54,streamFile)*0x20)*28/16/channel_count;
vgmstream->num_samples = (read_32bitLE(0x54,streamFile)*0x20)*28/16/channel_count;
}
}
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x14,streamFile);
vgmstream->meta_type = meta_PS2_DXH;
/* 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;
}

65
src/meta/ps2_kces.c Normal file
View File

@ -0,0 +1,65 @@
#include "meta.h"
#include "../util.h"
/* KCES (from Dance Dance Revolution) */
VGMSTREAM * init_vgmstream_ps2_kces(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("kces",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x01006408)
goto fail;
loop_flag = 0; /* (read_32bitLE(0x08,streamFile)!=0); */
channel_count = read_32bitLE(0x1C,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = read_32bitLE(0x08,streamFile);
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x0C,streamFile)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x24,streamFile);
vgmstream->meta_type = meta_PS2_KCES;
/* 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;
}

View File

@ -94,6 +94,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_kcey,
init_vgmstream_ps2_rstm,
init_vgmstream_acm,
init_vgmstream_ps2_kces,
init_vgmstream_ps2_dxh,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -1365,6 +1367,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_ACM:
snprintf(temp,TEMPSIZE,"InterPlay ACM Header");
break;
case meta_PS2_KCES:
snprintf(temp,TEMPSIZE,"Konami KCES Header");
break;
case meta_PS2_DXH:
snprintf(temp,TEMPSIZE,"Tokobot Plus DXH Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -193,6 +193,8 @@ typedef enum {
meta_SFS, /* Baroque */
meta_BG00, /* Ibara, Mushihimesama */
meta_PS2_RSTM, /* Midnight Club 3 */
meta_PS2_KCES, /* Dance Dance Revolution */
meta_PS2_DXH, /* Tokobot Plus - Myteries of the Karakuri */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -150,6 +150,8 @@ char * extension_list[] = {
"kcey\0KCEY Audio File (*.KCEY)\0",
"rstm\0RSTM Audio File (*.RSTM)\0",
"acm\0ACM Audio File (*.ACM)\0",
"kces\0KCES Audio File (*.KCES)\0",
"dxh\0DXH Audio File (*.DXH)\0",
};
void about(HWND hwndParent) {