.emff added (Eidos games)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@509 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-12-10 12:30:23 +00:00
parent f2d631b8d4
commit 96bc7f3bf6
9 changed files with 117 additions and 19 deletions

View File

@ -85,8 +85,8 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
case layout_de2_blocked:
de2_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_test_blocked:
test_block_update(vgmstream->next_block_offset,vgmstream);
case layout_emff_blocked:
emff_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_vs_blocked:
vs_block_update(vgmstream->next_block_offset,vgmstream);

18
src/layout/emff_blocked.c Normal file
View File

@ -0,0 +1,18 @@
#include "layout.h"
#include "../vgmstream.h"
/* set up for the block at the given offset */
void emff_block_update(off_t block_offset, VGMSTREAM * vgmstream) {
int i;
vgmstream->current_block_offset = block_offset;
vgmstream->current_block_size = read_32bitLE(
vgmstream->current_block_offset+0x10,
vgmstream->ch[0].streamfile);
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size+0x20;
vgmstream->current_block_size/=vgmstream->channels;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = vgmstream->current_block_offset+0x20+(vgmstream->current_block_size*i);
}
}

View File

@ -30,7 +30,7 @@ void de2_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void vs_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void test_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void emff_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void xvas_block_update(off_t block_offset, VGMSTREAM * vgmstream);

View File

@ -196,10 +196,6 @@
<Filter
Name="Source Files"
>
<File
RelativePath=".\meta\_test.c"
>
</File>
<File
RelativePath=".\meta\acm.c"
>
@ -276,6 +272,10 @@
RelativePath=".\meta\ea_old.c"
>
</File>
<File
RelativePath=".\meta\emff.c"
>
</File>
<File
RelativePath=".\meta\fsb.c"
>
@ -862,6 +862,10 @@
RelativePath=".\layout\ea_block.c"
>
</File>
<File
RelativePath=".\layout\emff_blocked.c"
>
</File>
<File
RelativePath=".\layout\halpst_blocked.c"
>
@ -890,10 +894,6 @@
RelativePath=".\layout\str_snds_blocked.c"
>
</File>
<File
RelativePath=".\layout\test_blocked.c"
>
</File>
<File
RelativePath=".\layout\vs_blocked.c"
>

77
src/meta/emff.c Normal file
View File

@ -0,0 +1,77 @@
#include "meta.h"
#include "../util.h"
/*
...EMFF - Eidos Music File Format...
*/
VGMSTREAM * init_vgmstream_emff(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int i;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("emff",filename_extension(filename))) goto fail;
/* check header */
#if 0
if (read_32bitBE(0x00,streamFile) != 0x53565300) /* "SVS\0" */
goto fail;
#endif
loop_flag = (read_32bitLE(0x04,streamFile) != 0xFFFFFFFF);
channel_count = read_32bitLE(0x0C,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(0x00,streamFile);
vgmstream->coding_type = coding_PSX;
/* vgmstream->num_samples = read_32bitLE(0x08,streamFile); */
if (loop_flag) {
vgmstream->loop_start_sample = loop_flag;
vgmstream->loop_end_sample = read_32bitLE(0x08,streamFile);
}
vgmstream->layout_type = layout_emff_blocked;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_EMFF;
/* open the file for reading */
{
for (i=0;i<channel_count;i++) {
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x2000);
if (!vgmstream->ch[i].streamfile) goto fail;
}
}
/* Calc num_samples */
emff_block_update(start_offset,vgmstream);
vgmstream->num_samples=0;
do {
vgmstream->num_samples += vgmstream->current_block_size*28/16/channel_count;
emff_block_update(vgmstream->next_block_offset,vgmstream);
} while (vgmstream->next_block_offset<get_streamfile_size(streamFile));
emff_block_update(start_offset,vgmstream);
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -314,6 +314,6 @@ VGMSTREAM * init_vgmstream_dc_wav_dcs(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_wii_smp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_test(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_emff(STREAMFILE * streamFile);
#endif

View File

@ -173,8 +173,8 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_vgs,
init_vgmstream_dc_wav_dcs,
init_vgmstream_wii_smp,
init_vgmstream_emff,
init_vgmstream_ss_stream,
init_vgmstream_test,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -530,7 +530,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_matx_blocked:
case layout_de2_blocked:
case layout_vs_blocked:
case layout_test_blocked:
case layout_emff_blocked:
case layout_xvas_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
@ -1356,8 +1356,8 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case layout_vs_blocked:
snprintf(temp,TEMPSIZE,"vs blocked");
break;
case layout_test_blocked:
snprintf(temp,TEMPSIZE,"TEST blocked");
case layout_emff_blocked:
snprintf(temp,TEMPSIZE,"EMFF blocked");
break;
#ifdef VGM_USE_MPEG
case layout_fake_mpeg:
@ -1898,6 +1898,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_WII_SMP:
snprintf(temp,TEMPSIZE,"SMP DSP Header");
break;
case meta_EMFF:
snprintf(temp,TEMPSIZE,"Eidos Music File Format Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");

View File

@ -120,7 +120,7 @@ typedef enum {
layout_de2_blocked,
layout_xvas_blocked,
layout_vs_blocked,
layout_test_blocked,
layout_emff_blocked,
#if 0
layout_strm_blocked, /* */
@ -286,7 +286,7 @@ typedef enum {
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
meta_DC_WAV_DCS, /* Evil Twin - Cypriens Chronicles (DC) */
meta_WII_SMP, /* Mushroom Men - The Spore Wars */
meta_TEST, /* Test META */
meta_EMFF, /* Eidos Music File Format */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */

View File

@ -215,7 +215,7 @@ char * extension_list[] = {
"vs\0VS Audio File (*.VS)\0",
"dcs\0DCS Audio File (*.DCS)\0",
"smp\0SMP Audio File (*.SMP)\0",
"test\0TEST Audio File (*.TEST)\0",
"emff\0EMFF Audio File (*.EMFF)\0",
};
void about(HWND hwndParent) {