From 8711f5325e938ba18ff0a96ffb4903f6992e6a5c Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 25 Jan 2018 22:08:41 -0600 Subject: [PATCH] Nop format support --- src/formats.c | 1 + src/meta/nsw_opus.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/formats.c b/src/formats.c index 0d3e3f11..f234fbf0 100644 --- a/src/formats.c +++ b/src/formats.c @@ -206,6 +206,7 @@ static const char* extension_list[] = { "naac", "ndp", "ngca", + "nop", "nps", "npsf", //fake extension/header id for .nps (to be removed) "nus3bank", diff --git a/src/meta/nsw_opus.c b/src/meta/nsw_opus.c index a95a18f1..89bb1ef6 100644 --- a/src/meta/nsw_opus.c +++ b/src/meta/nsw_opus.c @@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_nsw_opus(STREAMFILE *streamFile) { off_t offset = 0; /* check extension, case insensitive */ - if ( !check_extensions(streamFile,"opus,lopus")) /* no relation to Ogg Opus */ + if ( !check_extensions(streamFile,"opus,lopus,nop")) /* no relation to Ogg Opus */ goto fail; /* variations, maybe custom */ @@ -32,6 +32,16 @@ VGMSTREAM * init_vgmstream_nsw_opus(STREAMFILE *streamFile) { loop_start = read_32bitLE(0x08,streamFile); loop_end = read_32bitLE(0x0c,streamFile); } + else if (read_32bitBE(0x00, streamFile) == 0x73616466 && read_32bitBE(0x08, streamFile) == 0x6f707573) { /* Xenoblade Chronicles 2 */ + offset = read_32bitLE(0x1c, streamFile); + + num_samples = read_32bitLE(0x28, streamFile); + loop_flag = read_8bit(0x19, streamFile); + if (loop_flag) { + loop_start = read_32bitLE(0x2c, streamFile); + loop_end = read_32bitLE(0x30, streamFile); + } + } else { offset = 0x00; }