diff --git a/src/libvgmstream.vcproj b/src/libvgmstream.vcproj index 895c7064..80343b88 100644 --- a/src/libvgmstream.vcproj +++ b/src/libvgmstream.vcproj @@ -702,6 +702,10 @@ RelativePath=".\meta\nwa.c" > + + diff --git a/src/libvgmstream.vcxproj b/src/libvgmstream.vcxproj index e871715b..f8017b17 100644 --- a/src/libvgmstream.vcxproj +++ b/src/libvgmstream.vcxproj @@ -278,6 +278,7 @@ + diff --git a/src/libvgmstream.vcxproj.filters b/src/libvgmstream.vcxproj.filters index 46abb73e..da892890 100644 --- a/src/libvgmstream.vcxproj.filters +++ b/src/libvgmstream.vcxproj.filters @@ -418,6 +418,9 @@ meta\Source Files + + meta\Source Files + meta\Source Files diff --git a/src/meta/meta.h b/src/meta/meta.h index f993a1a3..c6af2edd 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -714,4 +714,6 @@ VGMSTREAM * init_vgmstream_wave_segmented(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_smv(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_nxap(STREAMFILE * streamFile); + #endif /*_META_H*/ diff --git a/src/meta/nxap.c b/src/meta/nxap.c new file mode 100644 index 00000000..813ec164 --- /dev/null +++ b/src/meta/nxap.c @@ -0,0 +1,49 @@ +#include "meta.h" +#include "../coding/coding.h" + +/* NXAP - Nex Entertainment header [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */ +VGMSTREAM * init_vgmstream_nxap(STREAMFILE *streamFile) { + VGMSTREAM * vgmstream = NULL; + off_t start_offset; + int loop_flag, channel_count; + + + /* checks */ + if (!check_extensions(streamFile, "adp")) + goto fail; + if (read_32bitBE(0x00,streamFile) != 0x4E584150) /* "NXAP" */ + goto fail; + if (read_32bitLE(0x14,streamFile) != 0x40 || /* expected frame size? */ + read_32bitLE(0x18,streamFile) != 0x40) /* expected interleave? */ + goto fail; + + start_offset = read_32bitLE(0x04,streamFile); + channel_count = read_32bitLE(0x0c,streamFile); + loop_flag = 0; //(read_32bitLE(0x24,streamFile) > 0); //todo + + + /* build the VGMSTREAM */ + vgmstream = allocate_vgmstream(channel_count, loop_flag); + if (!vgmstream) goto fail; + + vgmstream->sample_rate = read_32bitLE(0x10, streamFile); + vgmstream->num_samples = read_32bitLE(0x1c,streamFile) * (0x40-0x04)*2 / channel_count; /* number of frames */ + + /* unknown loop format, also 0x28/2c values seem related */ + //vgmstream->loop_start_sample = read_32bitLE(0x20,streamFile) * (0x40-0x04)*2 / channel_count; + //vgmstream->loop_end_sample = read_32bitLE(0x24,streamFile) * (0x40-0x04)*2 / channel_count; + //vgmstream->loop_end_sample = vgmstream->loop_start_sample + vgmstream->loop_end_sample; + + vgmstream->meta_type = meta_NXAP; + vgmstream->coding_type = coding_YAMAHA_NXAP; + vgmstream->layout_type = layout_interleave; + vgmstream->interleave_block_size = 0x40; + + if (!vgmstream_open_stream(vgmstream,streamFile,start_offset)) + goto fail; + return vgmstream; + +fail: + close_vgmstream(vgmstream); + return NULL; +} diff --git a/src/vgmstream.h b/src/vgmstream.h index 33365e15..8594c508 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -657,9 +657,10 @@ typedef enum { meta_SQEX_MAB, /* Square-Enix newest middleware (music) */ meta_OGG_L2SD, /* Ogg Vorbis with obfuscation [Lineage II Chronicle 4 (PC)] */ meta_WAF, /* KID WAF [Ever 17 (PC)] */ - 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, /* EngineBlack games [Mighty Switch Force! (3DS)] */ + meta_WAVE_segmented, /* EngineBlack games, segmented [Shantae and the Pirate's Curse (PC)] */ meta_SMV, /* Cho Aniki Zero (PSP) */ + meta_NXAP, /* Nex Entertainment games [Time Crisis 4 (PS3), Time Crisis Razing Storm (PS3)] */ #ifdef VGM_USE_MP4V2 meta_MP4, /* AAC (iOS) */