Merge msv.c and msvp.c

This commit is contained in:
bnnm 2022-01-12 21:13:56 +01:00
parent 755dc01e7c
commit 41eccd8d3e
6 changed files with 49 additions and 121 deletions

View File

@ -339,7 +339,7 @@ static const char* extension_list[] = {
"msf",
"mss",
"msv",
"msvp",
"msvp", //fake extension/header id for .msv
"mta2",
"mtaf",
"mul",
@ -1081,7 +1081,6 @@ static const meta_info meta_info_list[] = {
{meta_ISH_ISD, "ISH+ISD DSP Header"},
{meta_GSP_GSB, "Tecmo GSP+GSB Header"},
{meta_YDSP, "Yuke's DSP (YDSP) Header"},
{meta_MSVP, "MSVP Header"},
{meta_NGC_SSM, "SSM DSP Header"},
{meta_PS2_JOE, "Asobo Studio .JOE header"},
{meta_VGS, "Guitar Hero VGS Header"},

View File

@ -390,7 +390,6 @@
<ClCompile Include="meta\maxis_xa.c" />
<ClCompile Include="meta\mc3.c" />
<ClCompile Include="meta\mca.c" />
<ClCompile Include="meta\msvp.c" />
<ClCompile Include="meta\mus_vc.c" />
<ClCompile Include="meta\mus_acm.c" />
<ClCompile Include="meta\musc.c" />

View File

@ -646,9 +646,6 @@
<ClCompile Include="meta\mca.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\msvp.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\mus_acm.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -1,39 +1,43 @@
#include "meta.h"
#include "../coding/coding.h"
/* MSV - from Sony MultiStream format [Fight Club (PS2)] */
VGMSTREAM * init_vgmstream_msv(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
/* MSV - from Sony MultiStream format [Fight Club (PS2), PoPcap Hits Vol. 1 (PS2)] */
VGMSTREAM* init_vgmstream_msv(STREAMFILE* sf) {
VGMSTREAM* vgmstream = NULL;
off_t start_offset;
size_t channel_size;
int loop_flag, channel_count;
int loop_flag, channels;
if (!is_id32be(0x00,sf, "MSVp"))
goto fail;
/* checks */
if ( !check_extensions(streamFile,"msv") )
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x4D535670) /* "MSVp" */
/* .msv: actual extension
* .msvp: header ID */
if (!check_extensions(sf,"msv,msvp"))
goto fail;
start_offset = 0x30;
channel_count = 1;
channel_size = read_32bitBE(0x0c,streamFile);
channels = 1;
channel_size = read_u32be(0x0c,sf);
loop_flag = 0; /* no looping and last 16 bytes (end frame) are removed, from Sony's docs */
start_offset = 0x30;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
vgmstream = allocate_vgmstream(channels, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_MSV;
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
vgmstream->num_samples = ps_bytes_to_samples(channel_size,1);
vgmstream->sample_rate = read_u32be(0x10,sf);
vgmstream->num_samples = ps_bytes_to_samples(channel_size, 1);
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_none;
read_string(vgmstream->stream_name,0x10+1, 0x20,streamFile);
read_string(vgmstream->stream_name,0x10+1, 0x20,sf);
if ( !vgmstream_open_stream(vgmstream, streamFile, start_offset) )
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
goto fail;
return vgmstream;

View File

@ -1,70 +0,0 @@
#include "meta.h"
#include "../util.h"
/* MSVP (from PoPcap Hits Vol. 1) */
VGMSTREAM * init_vgmstream_msvp(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
char filename[PATH_LIMIT];
off_t start_offset;
int loop_flag = 0;
int channel_count;
/* check extension, case insensitive */
streamFile->get_name(streamFile,filename,sizeof(filename));
if (strcasecmp("msvp",filename_extension(filename))) goto fail;
/* check header */
if (read_32bitBE(0x00,streamFile) != 0x4D535670) /* "MSVp" */
goto fail;
loop_flag = 0;
channel_count = 1;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
/* fill in the vital statistics */
start_offset = 0x30;
vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)*28/16/channel_count;
if (loop_flag) {
vgmstream->loop_start_sample = loop_flag;
vgmstream->loop_end_sample = (read_32bitBE(0x0C,streamFile))*28/16/channel_count;
}
/* Just to be sure that there comes a 2 channel file */
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count == 2) {
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x10; /* Unknown for now */
}
vgmstream->meta_type = meta_MSVP;
/* 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

@ -416,7 +416,6 @@ typedef enum {
meta_FFCC_STR, /* Final Fantasy: Crystal Chronicles */
meta_UBI_JADE, /* Beyond Good & Evil, Rayman Raving Rabbids */
meta_GCA, /* Metal Slug Anthology */
meta_MSVP, /* Popcap Hits */
meta_NGC_SSM, /* Golden Gashbell Full Power */
meta_PS2_JOE, /* Wall-E / Pixar games */
meta_NGC_YMF, /* WWE WrestleMania X8 */
@ -665,7 +664,7 @@ typedef enum {
meta_DSP_ITL, /* Charinko Hero (GC) */
meta_A2M, /* Scooby-Doo! Unmasked (PS2) */
meta_AHV, /* Headhunter (PS2) */
meta_MSV, /* Fight Club (PS2) */
meta_MSV,
meta_SDF,
meta_SVG, /* Hunter - The Reckoning - Wayward (PS2) */
meta_VIS, /* AirForce Delta Strike (PS2) */