.dmsg added (Nightcaster II - Equinox)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@734 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2010-02-05 18:25:31 +00:00
parent cb37d60dac
commit 41afdcddfa
8 changed files with 127 additions and 3 deletions

View File

@ -219,7 +219,8 @@ META_OBJS=meta/adx_header.o \
meta/ps2_stm.o \
meta/myspd.o \
meta/his.o \
meta/ps2_ast.o
meta/ps2_ast.o \
meta/dmsg_segh.o
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)

View File

@ -284,6 +284,10 @@
RelativePath=".\meta\de2.c"
>
</File>
<File
RelativePath=".\meta\dmsg_segh.c"
>
</File>
<File
RelativePath=".\meta\ea_header.c"
>

View File

@ -177,5 +177,6 @@ libmeta_la_SOURCES += ps2_stm.c
libmeta_la_SOURCES += myspd.c
libmeta_la_SOURCES += his.c
libmeta_la_SOURCES += ps2_ast.c
libmeta_la_SOURCES += dmsg_segh.c
EXTRA_DIST = meta.h

110
src/meta/dmsg_segh.c Normal file
View File

@ -0,0 +1,110 @@
#include "meta.h"
#include "../util.h"
/* DMSG
found in: Nightcaster II - Equinox
2010-01-05 (manakoAT): Seems it's a corrupted "SGT" file, but I'm not sure...
*/
VGMSTREAM * init_vgmstream_dmsg(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
int loop_flag = 0;
int frequency;
int channel_count;
int dataBuffer = 0;
int Founddata = 0;
size_t file_size;
off_t current_chunk;
off_t start_offset;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("dmsg",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x52494646) /* "RIFF" */
goto fail;
if (read_32bitBE(0x08,streamFile) != 0x444D5347) /* "DMSG" */
goto fail;
if (read_32bitBE(0x0C,streamFile) != 0x73656768) /* "segh" */
goto fail;
if (read_32bitBE(0x10,streamFile) != 0x38000000) /* "0x38" */
goto fail;
/* scan file until we find a "data" string */
file_size = get_streamfile_size(streamFile);
{
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,streamFile));
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-0x10,streamFile);
frequency = read_32bitLE(current_chunk-0xE,streamFile);
}
loop_flag = 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
if (Founddata == 0) {
goto fail;
} else if (Founddata == 1) {
start_offset = current_chunk+0x8;
vgmstream->channels = channel_count;
vgmstream->sample_rate = frequency;
vgmstream->coding_type = coding_PCM16LE;
vgmstream->num_samples = (read_32bitLE(current_chunk+0x4,streamFile)/2/channel_count);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (read_32bitLE(current_chunk+0x4,streamFile)/2/channel_count);
}
}
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x2;
}
vgmstream->meta_type = meta_DMSG;
/* 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

@ -435,4 +435,6 @@ VGMSTREAM * init_vgmstream_his(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_ps2_ast(STREAMFILE* streamFile);
VGMSTREAM * init_vgmstream_dmsg(STREAMFILE* streamFile);
#endif

View File

@ -238,6 +238,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_myspd,
init_vgmstream_his,
init_vgmstream_ps2_ast,
init_vgmstream_dmsg,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -2323,7 +2324,7 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
snprintf(temp,TEMPSIZE,"beatmaniaIIDX 2DX9 header");
break;
case meta_DSP_YGO:
snprintf(temp,TEMPSIZE,"Yu-Gi-Oh! The Falsebound Kingdom DSP Header");
snprintf(temp,TEMPSIZE,"Konami custom DSP Header");
break;
case meta_PS2_VGV:
snprintf(temp,TEMPSIZE,"Rune: Viking Warlord VGV Header");
@ -2378,6 +2379,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_CAPDSP:
snprintf(temp,TEMPSIZE,"Capcom custom DSP header");
break;
case meta_DMSG:
snprintf(temp,TEMPSIZE,"RIFF/DMSGsegh header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -178,7 +178,7 @@ typedef enum {
meta_DSP_WII_MUS, /* .mus */
meta_DSP_WII_WSD, /* Phantom Brave (WII) */
meta_WII_NDP, /* Vertigo (Wii) */
meta_DSP_YGO, /* Yu-Gi-Oh! The Falsebound Kingdom (GC) */
meta_DSP_YGO, /* Yu-Gi-Oh! The Falsebound Kingdom (NGC), Hikaru no Go 3 (NGC) */
/* Nintendo */
meta_STRM, /* STRM */
@ -426,6 +426,7 @@ typedef enum {
meta_PONA, /* Policenauts (3DO + PSX) */
meta_XBOX_HLWAV, /* Half Life 2 (XBOX) */
meta_PS2_AST, /* Some KOEI game (PS2) */
meta_DMSG, /* Nightcaster II - Equinox (XBOX) */
} meta_t;
typedef struct {

View File

@ -119,6 +119,7 @@ char * extension_list[] = {
"dcs\0DCS Audio File (*.DCS)\0",
"de2\0DE2 Audio File (*.DE2)\0",
"dmsg\0DMSG Audio File (*.DMSG)\0",
"dsp\0DSP Audio File (*.DSP)\0",
"dtk\0DTK Audio File (*.DTK)\0",
"dvi\0DVI Audio File (*.DVI)\0",