Add KID .WAF [Ever 17 (PC)]

This commit is contained in:
bnnm 2018-03-03 18:46:12 +01:00
parent 50354e404c
commit 789ca26e8a
7 changed files with 55 additions and 0 deletions

View File

@ -354,6 +354,7 @@ static const char* extension_list[] = {
"waa", "waa",
"wac", "wac",
"wad", "wad",
"waf",
"wam", "wam",
"was", "was",
//"wav", //common //"wav", //common
@ -963,6 +964,7 @@ static const meta_info meta_info_list[] = {
{meta_SQEX_SAB, "Square-Enix SAB header"}, {meta_SQEX_SAB, "Square-Enix SAB header"},
{meta_SQEX_MAB, "Square-Enix MAB header"}, {meta_SQEX_MAB, "Square-Enix MAB header"},
{meta_OGG_L2SD, "Ogg Vorbis (L2SD)"}, {meta_OGG_L2SD, "Ogg Vorbis (L2SD)"},
{meta_WAF, "KID WAF header"},
#ifdef VGM_USE_MP4V2 #ifdef VGM_USE_MP4V2
{meta_MP4, "AAC header"}, {meta_MP4, "AAC header"},

View File

@ -1278,6 +1278,10 @@
RelativePath=".\meta\waa_wac_wad_wam.c" RelativePath=".\meta\waa_wac_wad_wam.c"
> >
</File> </File>
<File
RelativePath=".\meta\waf.c"
>
</File>
<File <File
RelativePath=".\meta\wii_04sw.c" RelativePath=".\meta\wii_04sw.c"
> >

View File

@ -397,6 +397,7 @@
<ClCompile Include="meta\vsf_tta.c" /> <ClCompile Include="meta\vsf_tta.c" />
<ClCompile Include="meta\vxn.c" /> <ClCompile Include="meta\vxn.c" />
<ClCompile Include="meta\waa_wac_wad_wam.c" /> <ClCompile Include="meta\waa_wac_wad_wam.c" />
<ClCompile Include="meta\waf.c" />
<ClCompile Include="meta\wii_04sw.c" /> <ClCompile Include="meta\wii_04sw.c" />
<ClCompile Include="meta\wii_bns.c" /> <ClCompile Include="meta\wii_bns.c" />
<ClCompile Include="meta\wii_mus.c" /> <ClCompile Include="meta\wii_mus.c" />

View File

@ -781,6 +781,9 @@
<ClCompile Include="meta\waa_wac_wad_wam.c"> <ClCompile Include="meta\waa_wac_wad_wam.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="meta\waf.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\wii_04sw.c"> <ClCompile Include="meta\wii_04sw.c">
<Filter>meta\Source Files</Filter> <Filter>meta\Source Files</Filter>
</ClCompile> </ClCompile>

43
src/meta/waf.c Normal file
View File

@ -0,0 +1,43 @@
#include "meta.h"
#include "../coding/coding.h"
/* WAF - KID's earlier PC games [ever17 (PC)] (for RLE-compressed WAFs see https://github.com/dsp2003/e17p) */
VGMSTREAM * init_vgmstream_waf(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset;
int loop_flag, channel_count;
/* check extension */
if (!check_extensions(streamFile, "waf"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x57414600) /* "WAF\0" "*/
goto fail;
if (read_32bitLE(0x34,streamFile) + 0x38 != get_streamfile_size(streamFile))
goto fail;
channel_count = read_16bitLE(0x06,streamFile);
loop_flag = 0;
start_offset = 0x38;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = read_32bitLE(0x08, streamFile);
vgmstream->meta_type = meta_WAF;
vgmstream->coding_type = coding_MSADPCM;
vgmstream->layout_type = layout_none;
vgmstream->interleave_block_size = read_16bitLE(0x10, streamFile);
vgmstream->num_samples = msadpcm_bytes_to_samples(read_32bitLE(0x34,streamFile), vgmstream->interleave_block_size, channel_count);
/* 0x04: null?, 0x0c: avg br, 0x12: bps, 0x14: s_p_f, 0x16~34: count + standard MSADPCM coefs (a modified RIFF fmt) */
if (!vgmstream_open_stream(vgmstream,streamFile,start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -379,6 +379,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_sps_n1, init_vgmstream_sps_n1,
init_vgmstream_atx, init_vgmstream_atx,
init_vgmstream_sqex_sead, init_vgmstream_sqex_sead,
init_vgmstream_waf,
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

@ -661,6 +661,7 @@ typedef enum {
meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */ meta_SQEX_SAB, /* Square-Enix newest middleware (sound) */
meta_SQEX_MAB, /* Square-Enix newest middleware (music) */ meta_SQEX_MAB, /* Square-Enix newest middleware (music) */
meta_OGG_L2SD, /* Ogg Vorbis with obfuscation [Lineage II Chronicle 4 (PC)] */ meta_OGG_L2SD, /* Ogg Vorbis with obfuscation [Lineage II Chronicle 4 (PC)] */
meta_WAF, /* KID WAF [Ever 17 (PC)] */
#ifdef VGM_USE_MP4V2 #ifdef VGM_USE_MP4V2
meta_MP4, /* AAC (iOS) */ meta_MP4, /* AAC (iOS) */