Add Vicious Cycle .mus [Dinotopia (Xbox/GC)]

This commit is contained in:
bnnm 2019-02-24 11:34:09 +01:00
parent 7372ffdc5c
commit 40c23dc3f5
8 changed files with 96 additions and 4 deletions

View File

@ -1172,6 +1172,7 @@ static const meta_info meta_info_list[] = {
{meta_DSF, "Ocean DSF header"},
{meta_208, "Ocean .208 header"},
{meta_DSP_DS2, "LucasArts .DS2 header"},
{meta_MUS_VC, "Vicious Cycle .MUS header"},
};

View File

@ -704,10 +704,14 @@
RelativePath=".\meta\mogg.c"
>
</File>
<File
RelativePath=".\meta\msvp.c"
>
</File>
<File
RelativePath=".\meta\msvp.c"
>
</File>
<File
RelativePath=".\meta\mus_vc.c"
>
</File>
<File
RelativePath=".\meta\mus_acm.c"
>

View File

@ -288,6 +288,7 @@
<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">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>

View File

@ -439,6 +439,9 @@
<ClCompile Include="meta\mus_acm.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\mus_vc.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\musc.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

View File

@ -833,4 +833,6 @@ VGMSTREAM * init_vgmstream_208(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ffdl(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_mus_vc(STREAMFILE * streamFile);
#endif /*_META_H*/

79
src/meta/mus_vc.c Normal file
View File

@ -0,0 +1,79 @@
#include "meta.h"
#include "../coding/coding.h"
/* .MUS - Vicious Cycle games [Dinotopia: The Sunstone Odyssey (GC/Xbox), Robotech: Battlecry (PS2/Xbox)] */
VGMSTREAM * init_vgmstream_mus_vc(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count, sample_rate;
int big_endian, type;
int32_t(*read_32bit)(off_t, STREAMFILE*) = NULL;
/* checks */
if (!check_extensions(streamFile, "mus"))
goto fail;
if (read_32bitBE(0x08,streamFile) != 0xBBBBBBBB &&
read_32bitBE(0x14,streamFile) != 0xBBBBBBBB &&
read_32bitBE(0x2c,streamFile) != 0xBEBEBEBE)
goto fail;
big_endian = (read_32bitBE(0x00,streamFile) == 0xFBBFFBBF);
read_32bit = big_endian ? read_32bitBE : read_32bitLE;
type = read_32bit(0x04, streamFile);
/* 0x08: pseudo size? */
/* other fields may be chunk sizes and lesser stuff */
/* 0x88: codec header */
channel_count = read_32bit(0x54,streamFile); /* assumed */
if (channel_count != 1) goto fail;
sample_rate = read_32bit(0x58,streamFile);
loop_flag = 1; /* most files repeat except small jingles, but smaller ambient tracks also repeat */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_MUS_VC;
vgmstream->sample_rate = sample_rate;
switch(type) {
case 0x01:
vgmstream->coding_type = coding_NGC_DSP;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = dsp_bytes_to_samples(read_32bit(0xB0,streamFile), vgmstream->channels);
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples;
start_offset = 0xB8;
dsp_read_coefs_be(vgmstream,streamFile,0x88,0x00);
dsp_read_hist_be (vgmstream,streamFile,0xac,0x00);
break;
case 0x02:
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = xbox_ima_bytes_to_samples(read_32bit(0x9a,streamFile), vgmstream->channels);
vgmstream->loop_start_sample = 0;
vgmstream->loop_end_sample = vgmstream->num_samples;
start_offset = 0x9e;
break;
default:
goto fail;
}
read_string(vgmstream->stream_name,0x14, 0x34,streamFile); /* repeated at 0x64, size at 0x30/0x60 */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -467,6 +467,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_208,
init_vgmstream_dsp_ds2,
init_vgmstream_ffdl,
init_vgmstream_mus_vc,
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */

View File

@ -720,6 +720,7 @@ typedef enum {
meta_DSF,
meta_208,
meta_DSP_DS2,
meta_MUS_VC,
} meta_t;