mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
added WAV+DCS (Evil Twin)
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@500 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
997b2fdd4e
commit
c57d6dd3e4
@ -156,7 +156,10 @@ META_OBJS=meta/adx_header.o \
|
||||
meta/gsp_gsb.o \
|
||||
meta/ngc_ssm.o \
|
||||
meta/msvp.o \
|
||||
meta/ps2_joe.o
|
||||
meta/ps2_joe.o \
|
||||
meta/vgs.o \
|
||||
meta/vs.o \
|
||||
meta/dc_wav_dcs.o
|
||||
|
||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||
|
||||
|
@ -22,5 +22,6 @@ liblayout_la_SOURCES += aix_layout.c
|
||||
liblayout_la_SOURCES += ims_block.c
|
||||
liblayout_la_SOURCES += de2_blocked.c
|
||||
liblayout_la_SOURCES += xvas_block.c
|
||||
liblayout_la_SOURCES += vs_blocked.c
|
||||
|
||||
EXTRA_DIST = layout.h
|
||||
|
@ -255,6 +255,10 @@
|
||||
RelativePath=".\meta\dc_str.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\dc_wav_dcs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\meta\de2.c"
|
||||
>
|
||||
|
@ -125,4 +125,8 @@ libmeta_la_SOURCES += gsp_gsb.c
|
||||
libmeta_la_SOURCES += ngc_ssm.c
|
||||
libmeta_la_SOURCES += msvp.c
|
||||
libmeta_la_SOURCES += ps2_joe.c
|
||||
libmeta_la_SOURCES += vs.c
|
||||
libmeta_la_SOURCES += vgs.c
|
||||
libmeta_la_SOURCES += dc_wav_dcs.c
|
||||
|
||||
EXTRA_DIST = meta.h
|
||||
|
132
src/meta/dc_wav_dcs.c
Normal file
132
src/meta/dc_wav_dcs.c
Normal file
@ -0,0 +1,132 @@
|
||||
#include "meta.h"
|
||||
#include "../util.h"
|
||||
|
||||
/* WAV+DCS
|
||||
|
||||
2008-12-06 - manakoAT : Evil Twin - Cypriens Chronicles...
|
||||
2008-12-07 - manakoAT : Added a function to read the Header file and for
|
||||
retrieving the channels/frequency, Frequency starts
|
||||
always at a "data" chunk - 0x0C bytes, Channels
|
||||
always - 0x0E bytes...
|
||||
*/
|
||||
|
||||
VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE *streamFile) {
|
||||
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
STREAMFILE * streamFileWAV = NULL;
|
||||
char filename[260];
|
||||
char filenameWAV[260];
|
||||
int i;
|
||||
int channel_count;
|
||||
int loop_flag;
|
||||
int frequency;
|
||||
int channels;
|
||||
int dataBuffer = 0;
|
||||
int Founddata = 0;
|
||||
size_t file_size;
|
||||
off_t current_chunk;
|
||||
|
||||
/* check extension, case insensitive */
|
||||
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||
if (strcasecmp("dcs",filename_extension(filename))) goto fail;
|
||||
|
||||
/* Getting the Header file name... */
|
||||
strcpy(filenameWAV,filename);
|
||||
strcpy(filenameWAV+strlen(filenameWAV)-3,"WAV");
|
||||
|
||||
/* Look if the Header file is present, else cancel vgmstream */
|
||||
streamFileWAV = streamFile->open(streamFile,filenameWAV,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!streamFileWAV) goto fail;
|
||||
|
||||
/* check header */
|
||||
if (read_32bitBE(0x00,streamFileWAV) != 0x52494646 || /* "RIFF" */
|
||||
read_32bitBE(0x08,streamFileWAV) != 0x57415645 || /* "WAVE" */
|
||||
read_32bitBE(0x0C,streamFileWAV) != 0x34582E76 || /* 0x34582E76 */
|
||||
read_32bitBE(0x3C,streamFileWAV) != 0x406E616D) /* "@nam" */
|
||||
goto fail;
|
||||
|
||||
|
||||
/* scan file until we find a "data" string */
|
||||
file_size = get_streamfile_size(streamFileWAV);
|
||||
|
||||
{
|
||||
|
||||
current_chunk = 0;
|
||||
|
||||
/* Start at 0 and loop until we reached the
|
||||
file size, or until we found a "data string */
|
||||
while (!Founddata && current_chunk < file_size) {
|
||||
dataBuffer = (read_32bitBE(current_chunk,streamFileWAV));
|
||||
if (dataBuffer == 0x64617461) { /* "data" */
|
||||
/* if "data" string found, retrieve the needed infos */
|
||||
Founddata = 1;
|
||||
/* We will cancel the search here if we have a match */
|
||||
break;
|
||||
}
|
||||
/* else we will increase the search offset by 1 */
|
||||
current_chunk = current_chunk + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Founddata == 0) {
|
||||
goto fail;
|
||||
} else if (Founddata == 1) {
|
||||
channel_count = (uint16_t)read_16bitLE(current_chunk-0x0E,streamFileWAV);
|
||||
frequency = read_32bitLE(current_chunk-0x0C,streamFileWAV);
|
||||
}
|
||||
|
||||
loop_flag = 0;
|
||||
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
/* fill in the vital statistics */
|
||||
vgmstream->channels = channel_count;
|
||||
vgmstream->sample_rate = frequency;
|
||||
vgmstream->num_samples=(get_streamfile_size(streamFile))*2/channel_count;
|
||||
|
||||
if(loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (get_streamfile_size(streamFile))*2/channel_count;
|
||||
}
|
||||
|
||||
switch (channel_count) {
|
||||
case 1:
|
||||
vgmstream->layout_type = layout_none;
|
||||
break;
|
||||
case 2:
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
vgmstream->interleave_block_size = 0x4000;
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
vgmstream->coding_type = coding_AICA;
|
||||
vgmstream->meta_type = meta_DC_WAV_DCS;
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
for (i=0;i<channel_count;i++) {
|
||||
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);
|
||||
vgmstream->ch[i].offset = 0;
|
||||
vgmstream->ch[i].adpcm_step_index = 0x7f; /* AICA */
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
close_streamfile(streamFileWAV); streamFileWAV=NULL;
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (streamFileWAV) close_streamfile(streamFileWAV);
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
@ -309,4 +309,6 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_vgs(STREAMFILE * streamFile);
|
||||
|
||||
VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE * streamFile);
|
||||
|
||||
#endif
|
||||
|
@ -171,6 +171,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
||||
init_vgmstream_ngc_ssm,
|
||||
init_vgmstream_ps2_joe,
|
||||
init_vgmstream_vgs,
|
||||
init_vgmstream_dc_wav_dcs,
|
||||
};
|
||||
|
||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||
@ -1884,6 +1885,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
break;
|
||||
case meta_VGS:
|
||||
snprintf(temp,TEMPSIZE,"Guitar Hero Encore Rocks the 80's Header");
|
||||
break;
|
||||
case meta_DC_WAV_DCS:
|
||||
snprintf(temp,TEMPSIZE,"Evil Twin WAV+DCS Header");
|
||||
break;
|
||||
default:
|
||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||
|
@ -283,6 +283,7 @@ typedef enum {
|
||||
meta_STR_ASR, /* Donkey Kong Jet Race */
|
||||
meta_ZWDSP, /* Zack and Wiki */
|
||||
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
|
||||
meta_DC_WAV_DCS, /* Evil Twin - Cypriens Chronicles (DC) */
|
||||
|
||||
meta_XBOX_WAVM, /* XBOX WAVM File */
|
||||
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
|
||||
|
@ -212,6 +212,7 @@ char * extension_list[] = {
|
||||
"joe\0JOE Audio File (*.JOE)\0",
|
||||
"vgs\0VGS Audio File (*.VGS)\0",
|
||||
"vs\0VS Audio File (*.VS)\0",
|
||||
"dcs\0DCS Audio File (*.DCS)\0",
|
||||
};
|
||||
|
||||
void about(HWND hwndParent) {
|
||||
|
Loading…
Reference in New Issue
Block a user