mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Clean Melbourne House .vs
This commit is contained in:
parent
bff7c58c8c
commit
1d97f9ad78
@ -672,7 +672,7 @@ static const layout_info layout_info_list[] = {
|
||||
{layout_blocked_ws_aud, "blocked (Westwood Studios .aud)"},
|
||||
{layout_blocked_matx, "blocked (Matrix .matx)"},
|
||||
{layout_blocked_dec, "blocked (DEC)"},
|
||||
{layout_blocked_vs, "blocked (vs)"},
|
||||
{layout_blocked_vs, "blocked (VS)"},
|
||||
{layout_blocked_emff_ps2, "blocked (EMFF PS2)"},
|
||||
{layout_blocked_emff_ngc, "blocked (EMFF NGC)"},
|
||||
{layout_blocked_gsb, "blocked (GSB)"},
|
||||
@ -823,7 +823,7 @@ static const meta_info meta_info_list[] = {
|
||||
{meta_NGC_WVS, "Metal Arms WVS Header (GameCube)"},
|
||||
{meta_XBOX_MATX, "assumed Matrix file by .matx extension"},
|
||||
{meta_DEC, "Falcom DEC RIFF header"},
|
||||
{meta_VS, "Men in Black VS Header"},
|
||||
{meta_VS, "Melbourne House .VS header"},
|
||||
{meta_DC_STR, "Sega Stream Asset Builder header"},
|
||||
{meta_DC_STR_V2, "variant of Sega Stream Asset Builder header"},
|
||||
{meta_XBOX_XMU, "XMU header"},
|
||||
|
@ -1,17 +1,16 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* set up for the block at the given offset */
|
||||
/* mini-blocks of size + data */
|
||||
void block_update_vs(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
|
||||
int i;
|
||||
|
||||
for (i=0;i<vgmstream->channels;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->ch[i].offset = vgmstream->current_block_offset + 0x4;
|
||||
if(i==0) block_offset=vgmstream->next_block_offset;
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = read_32bitLE(vgmstream->current_block_offset,streamFile);
|
||||
vgmstream->next_block_offset = vgmstream->current_block_offset + vgmstream->current_block_size + 0x04;
|
||||
vgmstream->ch[i].offset = vgmstream->current_block_offset + 0x04;
|
||||
if (i == 0) block_offset=vgmstream->next_block_offset;
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +1,52 @@
|
||||
#include "meta.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../util.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
/* VS (from Men in Black) */
|
||||
/* .VS - from Melbourne House games [Men in Black II (PS2), Grand Prix Challenge (PS2) */
|
||||
VGMSTREAM * init_vgmstream_vs(STREAMFILE *streamFile) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
|
||||
char filename[PATH_LIMIT];
|
||||
off_t start_offset;
|
||||
int loop_flag = 0;
|
||||
int channel_count;
|
||||
int i;
|
||||
int loop_flag, channel_count;
|
||||
|
||||
|
||||
/* 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" */
|
||||
/* checks */
|
||||
if (!check_extensions(streamFile, "vs"))
|
||||
goto fail;
|
||||
if (read_32bitBE(0x00,streamFile) != 0xC8000000)
|
||||
goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
channel_count = 2;
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
start_offset = 0x08;
|
||||
|
||||
|
||||
/* 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->interleave_block_size=0x10;
|
||||
vgmstream->meta_type = meta_VS;
|
||||
vgmstream->sample_rate = read_32bitLE(0x04,streamFile);
|
||||
vgmstream->coding_type = coding_PSX;
|
||||
vgmstream->layout_type = layout_blocked_vs;
|
||||
|
||||
#if 0
|
||||
if (loop_flag) {
|
||||
vgmstream->loop_start_sample = 0;
|
||||
vgmstream->loop_end_sample = (read_32bitLE(0x0c,streamFile)-start_offset);
|
||||
}
|
||||
#endif
|
||||
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
|
||||
goto fail;
|
||||
|
||||
vgmstream->layout_type = layout_blocked_vs;
|
||||
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,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||
/* calc num_samples */
|
||||
{
|
||||
vgmstream->next_block_offset = start_offset;
|
||||
do {
|
||||
block_update(vgmstream->next_block_offset,vgmstream);
|
||||
vgmstream->num_samples += ps_bytes_to_samples(vgmstream->current_block_size, 1);
|
||||
}
|
||||
while (vgmstream->next_block_offset < get_streamfile_size(streamFile));
|
||||
block_update(start_offset, vgmstream);
|
||||
|
||||
}
|
||||
|
||||
/* Calc num_samples */
|
||||
block_update_vs(start_offset,vgmstream);
|
||||
vgmstream->num_samples=0;
|
||||
|
||||
do {
|
||||
vgmstream->num_samples += vgmstream->current_block_size*28/16;
|
||||
block_update_vs(vgmstream->next_block_offset,vgmstream);
|
||||
} while (vgmstream->next_block_offset<get_streamfile_size(streamFile));
|
||||
|
||||
block_update_vs(start_offset,vgmstream);
|
||||
|
||||
|
||||
return vgmstream;
|
||||
|
||||
/* clean up anything we may have opened */
|
||||
fail:
|
||||
if (vgmstream) close_vgmstream(vgmstream);
|
||||
close_vgmstream(vgmstream);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user