Add .MS/VBX/SLB/OVB extensions;cleanup

- .MS: Test Drive Unlimited (PS2)
- .VBX: THE Taxi 2 (PS2)
- .SLB: THE Nekomura no Hitobito (PS2)
- .OVB: namCollection - Tekken (PS2)
This commit is contained in:
bnnm 2018-04-07 12:35:18 +02:00
parent 36c00208d9
commit 5ad5943c2a
3 changed files with 38 additions and 75 deletions

View File

@ -198,6 +198,7 @@ static const char* extension_list[] = {
//"mpc", //FFmpeg, not parsed (musepack) //common
"mpdsp",
"mpds",
"ms",
"msa",
"msd",
"msf",
@ -292,6 +293,7 @@ static const char* extension_list[] = {
"sgd",
"sgx",
"sl3",
"slb", //txth/reserved [THE Nekomura no Hitobito (PS2)]
"sli",
"smp",
"smpl", //fake extension (to be removed)
@ -347,6 +349,7 @@ static const char* extension_list[] = {
"vawx",
"vb",
"vbk",
"vbx", //txth/reserved [THE Taxi 2 (PS2)]
"vds",
"vdm",
"vgs",
@ -683,7 +686,7 @@ static const meta_info meta_info_list[] = {
{meta_AUS, "Capcom AUS Header"},
{meta_RWS, "RenderWare RWS header"},
{meta_EA_1SNH, "Electronic Arts 1SNh/EACS header"},
{meta_SL3, "SL3 Header"},
{meta_SL3, "Atari Melbourne House SL3 header"},
{meta_FSB1, "FMOD Sample Bank (FSB1) Header"},
{meta_FSB2, "FMOD Sample Bank (FSB2) Header"},
{meta_FSB3, "FMOD Sample Bank (FSB3) Header"},

View File

@ -1,65 +1,45 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* SL3 (from Test Drive Unlimited, Transformers) */
/* SL3 - Atari Melbourne House games [ Test Drive Unlimited (PS2), Transformers (PS2)] */
VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag = 0, channel_count;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("sl3",filename_extension(filename))) goto fail;
/* check header */
/* checks */
/* .ms: actual extension, sl3: header id */
if (!check_extensions(streamFile, "ms,sl3"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */
goto fail;
loop_flag = 0;
channel_count = read_32bitLE(0x14,streamFile);
start_offset = 0x8000; /* also at 0x24? */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x8000;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (get_streamfile_size(streamFile)-0x8000)*28/16/channel_count;
vgmstream->num_samples = ps_bytes_to_samples(get_streamfile_size(streamFile)-start_offset,channel_count);
if (loop_flag) {
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile);
}
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = read_32bitLE(0x20,streamFile);
vgmstream->meta_type = meta_SL3;
/* 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;
}
}
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -1,6 +1,5 @@
#include "meta.h"
#include "../util.h"
#include "../coding/coding.h"
/* TK5 (Tekken 5 Streams) */
VGMSTREAM * init_vgmstream_ps2_tk5(STREAMFILE *streamFile) {
@ -65,65 +64,46 @@ fail:
return NULL;
}
/* TK1 (Tekken 5 Streams from Tekken (NamCollection)) */
/* OVB - Tekken 5 Streams from Tekken (NamCollection) */
VGMSTREAM * init_vgmstream_ps2_tk1(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag = 0;
int channel_count;
int loop_flag = 0, channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("tk1",filename_extension(filename))) goto fail;
/* checks */
/* .ovb: actual extension, tk1: fake extension */
if (!check_extensions(streamFile, "ovb,tk1"))
goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x544B3553)
goto fail;
loop_flag = (read_32bitLE(0x0C,streamFile)!=0);
channel_count = 2;
start_offset = 0x800;
/* NamCollection uses 44100 while Tekken 5 48000, no apparent way to tell them apart */
/* 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 = 44100;
vgmstream->num_samples = ps_bytes_to_samples(read_32bitLE(0x08,streamFile)*channel_count, channel_count);
if (vgmstream->loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile)/16*28;
vgmstream->loop_end_sample = vgmstream->loop_start_sample + ps_bytes_to_samples(read_32bitLE(0x0c,streamFile)*channel_count, channel_count);
}
vgmstream->coding_type = coding_PSX_badflags;
vgmstream->num_samples = read_32bitLE(0x08,streamFile)/16*28;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10;
vgmstream->meta_type = meta_PS2_TK1;
if (vgmstream->loop_flag)
{
vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile)/16*28;
vgmstream->loop_end_sample = vgmstream->loop_start_sample + (read_32bitLE(0x0C,streamFile)/16*28);
}
/* 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;
}
}
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
/* clean up anything we may have opened */
fail:
if (vgmstream) close_vgmstream(vgmstream);
close_vgmstream(vgmstream);
return NULL;
}