diff --git a/src/formats.c b/src/formats.c index 298cc3c2..f8788d99 100644 --- a/src/formats.c +++ b/src/formats.c @@ -610,6 +610,7 @@ static const char* extension_list[] = { "zsm", "zss", "zwdsp", + "zwv", "vgmstream" /* fake extension, catch-all for FFmpeg/txth/etc */ diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 3dba4986..4bf18b90 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -1946,10 +1946,14 @@ RelativePath=".\meta\zsnd.c" > - - + + + + + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 90608578..fbd0fa57 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -1216,6 +1216,9 @@ meta\Source Files + + meta\Source Files + coding\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index 1d704492..72106a6a 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -911,4 +911,6 @@ VGMSTREAM* init_vgmstream_ktsc(STREAMFILE* sf); VGMSTREAM* init_vgmstream_adp_konami(STREAMFILE* sf); +VGMSTREAM* init_vgmstream_zwv(STREAMFILE* sf); + #endif /*_META_H*/ diff --git a/src/meta/zwv.c b/src/meta/zwv.c new file mode 100644 index 00000000..70f436cc --- /dev/null +++ b/src/meta/zwv.c @@ -0,0 +1,52 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* .zwv - from Namco games [THE iDOLM@STER Shiny TV (PS3)] */ +VGMSTREAM* init_vgmstream_zwv(STREAMFILE* sf) { + VGMSTREAM* vgmstream = NULL; + STREAMFILE* temp_sf = NULL; + off_t subfile_offset; + size_t subfile_size; + + + /* checks */ + if (!check_extensions(sf,"zwv")) + goto fail; + if (read_u32be(0x00,sf) != 0x77617665) /* "wave" */ + goto fail; + + /* has a mini header then a proper MSF: + * 0x04: null + * 0x08: null + * 0x0c: version/config? (0x06040000) + * 0x10: version/config? (0x00030210) + * 0x14: sample rate + * 0x18: ? (related to sample rate) + * 0x1c: null + * 0x20: data offset + * 0x24: data size + * 0x28: loop flag (0x30+ is removed if no loop) + * 0x2c: ? (related to loop, or null) + * 0x30: null + * 0x30: loop start offset (same as MSF) + * 0x30: loop end offset (same as MSF start+length) + * 0x3c: null + */ + + subfile_offset = read_u32be(0x20, sf) - 0x40; + subfile_size = read_u32be(0x24, sf) + 0x40; + + temp_sf = setup_subfile_streamfile(sf, subfile_offset, subfile_size, "msf"); + if (!temp_sf) goto fail; + + vgmstream = init_vgmstream_msf(temp_sf); + if (!vgmstream) goto fail; + + close_streamfile(temp_sf); + return vgmstream; + +fail: + close_streamfile(temp_sf); + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 819bb354..a6d625c6 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -505,6 +505,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = { init_vgmstream_pcm_success, init_vgmstream_ktsc, init_vgmstream_adp_konami, + init_vgmstream_zwv, /* 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 */