Add .smv [Cho Aniki Zero (PSP)]

This commit is contained in:
bnnm 2018-03-23 22:41:42 +01:00
parent 08875e9a95
commit 13a5322e26
8 changed files with 65 additions and 0 deletions

View File

@ -291,6 +291,7 @@ static const char* extension_list[] = {
"sli", "sli",
"smp", "smp",
"smpl", //fake extension (to be removed) "smpl", //fake extension (to be removed)
"smv",
"snd", "snd",
"snds", "snds",
"sng", "sng",
@ -963,6 +964,7 @@ static const meta_info meta_info_list[] = {
{meta_WAF, "KID WAF header"}, {meta_WAF, "KID WAF header"},
{meta_WAVE, "EngineBlack .WAVE header"}, {meta_WAVE, "EngineBlack .WAVE header"},
{meta_WAVE_segmented, "EngineBlack .WAVE header (segmented)"}, {meta_WAVE_segmented, "EngineBlack .WAVE header (segmented)"},
{meta_SMV, "Cho Aniki Zero .SMV header"},
#ifdef VGM_USE_MP4V2 #ifdef VGM_USE_MP4V2
{meta_MP4, "AAC header"}, {meta_MP4, "AAC header"},

View File

@ -1190,6 +1190,10 @@
RelativePath=".\meta\sli.c" RelativePath=".\meta\sli.c"
> >
</File> </File>
<File
RelativePath=".\meta\smv.c"
>
</File>
<File <File
RelativePath=".\meta\sps_n1.c" RelativePath=".\meta\sps_n1.c"
> >

View File

@ -381,6 +381,7 @@
<ClCompile Include="meta\sdt.c" /> <ClCompile Include="meta\sdt.c" />
<ClCompile Include="meta\sfl.c" /> <ClCompile Include="meta\sfl.c" />
<ClCompile Include="meta\sli.c" /> <ClCompile Include="meta\sli.c" />
<ClCompile Include="meta\smv.c" />
<ClCompile Include="meta\sps_n1.c" /> <ClCompile Include="meta\sps_n1.c" />
<ClCompile Include="meta\spt_spd.c" /> <ClCompile Include="meta\spt_spd.c" />
<ClCompile Include="meta\stm.c" /> <ClCompile Include="meta\stm.c" />

View File

@ -727,6 +727,9 @@
<ClCompile Include="meta\sli.c"> <ClCompile Include="meta\sli.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\smv.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\sps_n1.c"> <ClCompile Include="meta\sps_n1.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -711,4 +711,7 @@ VGMSTREAM * init_vgmstream_waf(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_wave(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_wave(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_smv(STREAMFILE * streamFile);
#endif /*_META_H*/ #endif /*_META_H*/

50
src/meta/smv.c Normal file
View File

@ -0,0 +1,50 @@
#include "meta.h"
#include "../coding/coding.h"
/* .SMV - from Cho Aniki Zero (PSP) */
VGMSTREAM * init_vgmstream_smv(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
size_t channel_size, loop_start;
/* check extension */
if (!check_extensions(streamFile, "smv"))
goto fail;
channel_size = read_32bitLE(0x00,streamFile);
/* 0x08: number of full interleave blocks */
channel_count = read_16bitLE(0x0a,streamFile);
loop_start = read_32bitLE(0x18,streamFile);
loop_flag = (loop_start != -1);
start_offset = 0x800;
if (channel_size * channel_count + start_offset != get_streamfile_size(streamFile))
goto fail;
channel_size -= 0x10; /* last value has SPU end frame without flag 0x7 as it should */
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x10, streamFile);
vgmstream->num_samples = ps_bytes_to_samples(channel_size*channel_count, channel_count);
vgmstream->loop_start_sample = ps_bytes_to_samples(loop_start*channel_count, channel_count);
vgmstream->loop_end_sample = vgmstream->num_samples;
vgmstream->meta_type = meta_SMV;
vgmstream->coding_type = coding_PSX;
vgmstream->layout_type = layout_interleave_shortblock;
vgmstream->interleave_block_size = read_32bitLE(0x04, streamFile);
vgmstream->interleave_smallblock_size = read_32bitLE(0x0c, streamFile);
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -384,6 +384,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_wave_segmented, init_vgmstream_wave_segmented,
init_vgmstream_rsd6at3p, init_vgmstream_rsd6at3p,
init_vgmstream_rsd6wma, init_vgmstream_rsd6wma,
init_vgmstream_smv,
init_vgmstream_txth, /* should go at the end (lower priority) */ init_vgmstream_txth, /* should go at the end (lower priority) */
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG

View File

@ -657,6 +657,7 @@ typedef enum {
meta_WAF, /* KID WAF [Ever 17 (PC)] */ meta_WAF, /* KID WAF [Ever 17 (PC)] */
meta_WAVE, /* WayForward "EngineBlack" games [Mighty Switch Force! (3DS)] */ meta_WAVE, /* WayForward "EngineBlack" games [Mighty Switch Force! (3DS)] */
meta_WAVE_segmented, /* WayForward "EngineBlack" games, segmented [Shantae and the Pirate's Curse (PC)] */ meta_WAVE_segmented, /* WayForward "EngineBlack" games, segmented [Shantae and the Pirate's Curse (PC)] */
meta_SMV, /* Cho Aniki Zero (PSP) */
#ifdef VGM_USE_MP4V2 #ifdef VGM_USE_MP4V2
meta_MP4, /* AAC (iOS) */ meta_MP4, /* AAC (iOS) */