.vgs added

.vs added (incomplete)

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@497 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2008-12-04 20:11:45 +00:00
parent f39fbb03f0
commit f303c080ac
11 changed files with 233 additions and 2 deletions

View File

@ -84,6 +84,9 @@ void render_vgmstream_blocked(sample * buffer, int32_t sample_count, VGMSTREAM *
break;
case layout_de2_blocked:
de2_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_vs_blocked:
vs_block_update(vgmstream->next_block_offset,vgmstream);
break;
case layout_xvas_blocked:
xvas_block_update(vgmstream->next_block_offset,vgmstream);

View File

@ -28,6 +28,8 @@ void matx_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void de2_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void vs_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void xvas_block_update(off_t block_offset, VGMSTREAM * vgmstream);
void render_vgmstream_interleave(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream);

18
src/layout/vs_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 vs_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,
vgmstream->ch[0].streamfile);
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size + 0x4;
vgmstream->current_block_size/=vgmstream->channels;
for (i=0;i<vgmstream->channels;i++) {
vgmstream->ch[i].offset = vgmstream->current_block_offset + 0x4;
}
}

View File

@ -645,6 +645,14 @@
RelativePath=".\meta\svs.c"
>
</File>
<File
RelativePath=".\meta\vgs.c"
>
</File>
<File
RelativePath=".\meta\vs.c"
>
</File>
<File
RelativePath=".\meta\wii_mus.c"
>
@ -865,6 +873,10 @@
RelativePath=".\layout\str_snds_blocked.c"
>
</File>
<File
RelativePath=".\layout\vs_blocked.c"
>
</File>
<File
RelativePath=".\layout\ws_aud_blocked.c"
>

View File

@ -211,6 +211,8 @@ VGMSTREAM * init_vgmstream_xbox_matx(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_de2(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_vs(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_xbox_xmu(STREAMFILE *streamFile);
VGMSTREAM * init_vgmstream_xbox_xvas(STREAMFILE *streamFile);
@ -305,4 +307,6 @@ VGMSTREAM * init_vgmstream_ngc_ssm(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_vgs(STREAMFILE * streamFile);
#endif

View File

@ -31,7 +31,7 @@ VGMSTREAM * init_vgmstream_ps2_joe(STREAMFILE *streamFile) {
if (read_32bitBE(0x0C,streamFile) != 0xCCCCCCCC)
goto fail;
loop_flag = 0;
loop_flag = 1;
channel_count = 2;
/* build the VGMSTREAM */

100
src/meta/vgs.c Normal file
View File

@ -0,0 +1,100 @@
#include "meta.h"
#include "../util.h"
/* VGS (from Guitar Hero Encore - Rocks the 80s) */
VGMSTREAM * init_vgmstream_vgs(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[260];
off_t start_offset;
int loop_flag;
int channel_flag;
int channel_flag_offset;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("vgs",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x56675321) /* "VgS!" */
goto fail;
loop_flag = 0;
channel_flag_offset = get_streamfile_size(streamFile)-0x10;
channel_flag = read_32bitBE(channel_flag_offset,streamFile);
/* Only seen files up to 5 channels, but just
to be sure we will look up to 8 chanels */
switch (channel_flag) {
case 0x00800000:
channel_count = 1;
break;
case 0x00810000:
channel_count = 2;
break;
case 0x00820000:
channel_count = 3;
break;
case 0x00830000:
channel_count = 4;
break;
case 0x00840000:
channel_count = 5;
break;
case 0x00850000:
channel_count = 6;
break;
case 0x00860000:
channel_count = 7;
break;
case 0x00870000:
channel_count = 8;
break;
default:
goto fail;
}
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x80;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x08,streamFile);
vgmstream->coding_type = coding_PSX_badflags;
vgmstream->num_samples = (read_32bitLE(0x0C,streamFile)*channel_count*0x10)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (read_32bitLE(0x0C,streamFile)*channel_count*0x10)*28/16/channel_count;
}
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_VGS;
/* 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;
}

75
src/meta/vs.c Normal file
View File

@ -0,0 +1,75 @@
#include "meta.h"
#include "../util.h"
/* VS (from Men in Black) */
VGMSTREAM * init_vgmstream_vs(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("vs",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0xC8000000) /* "0xC8000000" */
goto fail;
loop_flag = 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 = 0x08;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
vgmstream->coding_type = coding_PSX;
/* vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset); */
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = (read_32bitLE(0x0c,streamFile)-start_offset);
}
vgmstream->layout_type = layout_vs_blocked;
vgmstream->interleave_block_size = 0x2000;
vgmstream->meta_type = meta_VS;
/* 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;
}
}
/* STREAMFILE_DEFAULT_BUFFER_SIZE */
/* Calc num_samples */
vs_block_update(start_offset,vgmstream);
vgmstream->num_samples=0;
do {
vgmstream->num_samples += vgmstream->current_block_size*28/16/channel_count;
vs_block_update(vgmstream->next_block_offset,vgmstream);
} while (vgmstream->next_block_offset<get_streamfile_size(streamFile));
vs_block_update(start_offset,vgmstream);
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
return NULL;
}

View File

@ -120,6 +120,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_xbox_stma,
init_vgmstream_xbox_matx,
init_vgmstream_de2,
init_vgmstream_vs,
init_vgmstream_dc_str,
init_vgmstream_xbox_xmu,
init_vgmstream_xbox_xvas,
@ -169,6 +170,7 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
init_vgmstream_msvp,
init_vgmstream_ngc_ssm,
init_vgmstream_ps2_joe,
init_vgmstream_vgs,
};
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
@ -523,6 +525,7 @@ void render_vgmstream(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstre
case layout_ws_aud_blocked:
case layout_matx_blocked:
case layout_de2_blocked:
case layout_vs_blocked:
case layout_xvas_blocked:
render_vgmstream_blocked(buffer,sample_count,vgmstream);
break;
@ -1345,6 +1348,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case layout_de2_blocked:
snprintf(temp,TEMPSIZE,"de2 blocked");
break;
case layout_vs_blocked:
snprintf(temp,TEMPSIZE,"vs blocked");
break;
#ifdef VGM_USE_MPEG
case layout_fake_mpeg:
snprintf(temp,TEMPSIZE,"MPEG Audio stream with incorrect frame headers");
@ -1755,6 +1761,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
break;
case meta_DE2:
snprintf(temp,TEMPSIZE,"gurumin .de2 with embedded funky RIFF");
break;
case meta_VS:
snprintf(temp,TEMPSIZE,"Men in Black VS Header");
break;
case meta_DC_STR:
snprintf(temp,TEMPSIZE,"Sega Stream Asset Builder header");
@ -1873,7 +1882,10 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
case meta_PS2_JOE:
snprintf(temp,TEMPSIZE,"Disney/Pixar JOE Header");
break;
default:
case meta_VGS:
snprintf(temp,TEMPSIZE,"Guitar Hero Encore Rocks the 80's Header");
break;
default:
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
}
concatn(length,desc,temp);

View File

@ -119,6 +119,7 @@ typedef enum {
layout_matx_blocked,
layout_de2_blocked,
layout_xvas_blocked,
layout_vs_blocked,
#if 0
layout_strm_blocked, /* */
@ -281,6 +282,7 @@ typedef enum {
meta_NDS_STRM_FFTA2, /* Final Fantasy Tactics A2 */
meta_STR_ASR, /* Donkey Kong Jet Race */
meta_ZWDSP, /* Zack and Wiki */
meta_VGS, /* Guitar Hero Encore - Rocks the 80s */
meta_XBOX_WAVM, /* XBOX WAVM File */
meta_XBOX_RIFF, /* XBOX RIFF/WAVE File */
@ -332,6 +334,7 @@ typedef enum {
meta_ACM, /* InterPlay ACM header */
meta_MUS_ACM, /* MUS playlist of InterPlay ACM files */
meta_DE2, /* Falcom (Gurumin) .de2 */
meta_VS, /* Men in Black .vs */
meta_FFXI_BGW, /* FFXI BGW */
meta_FFXI_SPW, /* FFXI SPW */
} meta_t;

View File

@ -210,6 +210,8 @@ char * extension_list[] = {
"msvp\0MSVP Audio File (*.MSVP)\0",
"ssm\0SSM Audio File (*.SSM)\0",
"joe\0JOE Audio File (*.JOE)\0",
"vgs\0VGS Audio File (*.VGS)\0",
"vs\0VS Audio File (*.VS)\0",
};
void about(HWND hwndParent) {