Add .diva [Hatsune Miku: Project DIVA Arcade Future Tone (AC)]

This commit is contained in:
M&M 2020-04-14 20:42:55 -07:00
parent 14dc85664d
commit 55072211cb
7 changed files with 48 additions and 0 deletions

View File

@ -145,6 +145,7 @@ static const char* extension_list[] = {
"ddsp",
"de2",
"dec",
"diva",
"dmsg",
"ds2", //txth/reserved [Star Wars Bounty Hunter (GC)]
"dsf",
@ -1285,6 +1286,7 @@ static const meta_info meta_info_list[] = {
{meta_KWB, "Koei Tecmo WaveBank header"},
{meta_LRMD, "Sony LRMD header"},
{meta_WWISE_FX, "Audiokinetic Wwise FX header"},
{meta_DIVA, "DIVA header"},
};

View File

@ -301,6 +301,7 @@
<ClCompile Include="meta\dc_str.c" />
<ClCompile Include="meta\dec.c" />
<ClCompile Include="meta\derf.c" />
<ClCompile Include="meta\diva.c" />
<ClCompile Include="meta\dmsg_segh.c" />
<ClCompile Include="meta\dsf.c" />
<ClCompile Include="meta\dsp_adx.c" />

View File

@ -1747,5 +1747,8 @@
<ClCompile Include="meta\tgc.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\diva.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

38
src/meta/diva.c Normal file
View File

@ -0,0 +1,38 @@
#include "meta.h"
#include "../coding/coding.h"
/* DIVA - Hatsune Miku: Project DIVA Arcade */
VGMSTREAM * init_vgmstream_diva(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int channel_count, loop_flag = 0;
/* checks */
if (!check_extensions(streamFile, "diva"))
goto fail;
if (read_32bitBE(0x00, streamFile) != 0x44495641) /* "DIVA" */
goto fail;
start_offset = 0x40;
channel_count = read_8bit(0x1C, streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x0C, streamFile);
vgmstream->num_samples = read_32bitLE(0x10, streamFile);
vgmstream->meta_type = meta_DIVA;
vgmstream->layout_type = layout_none;
vgmstream->coding_type = coding_DVI_IMA;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -893,4 +893,6 @@ VGMSTREAM* init_vgmstream_bkhd_fx(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_encrypted(STREAMFILE* sf);
VGMSTREAM* init_vgmstream_diva(STREAMFILE* sf);
#endif /*_META_H*/

View File

@ -492,6 +492,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_lrmd,
init_vgmstream_bkhd,
init_vgmstream_bkhd_fx,
init_vgmstream_diva,
/* 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

@ -726,6 +726,7 @@ typedef enum {
meta_KWB,
meta_LRMD,
meta_WWISE_FX,
meta_DIVA,
} meta_t;
/* standard WAVEFORMATEXTENSIBLE speaker positions */