diff --git a/src/meta/meta.h b/src/meta/meta.h index a8fc3886..edf0eefc 100644 --- a/src/meta/meta.h +++ b/src/meta/meta.h @@ -645,6 +645,7 @@ VGMSTREAM * init_vgmstream_opus_nxa(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_opus_opusx(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_opus_prototype(STREAMFILE * streamFile); VGMSTREAM * init_vgmstream_opus_opusnx(STREAMFILE * streamFile); +VGMSTREAM * init_vgmstream_opus_sqex(STREAMFILE* streamFile); VGMSTREAM * init_vgmstream_pc_al2(STREAMFILE * streamFile); diff --git a/src/meta/opus.c b/src/meta/opus.c index b9e593ae..5007e758 100644 --- a/src/meta/opus.c +++ b/src/meta/opus.c @@ -411,3 +411,29 @@ VGMSTREAM * init_vgmstream_opus_opusnx(STREAMFILE *streamFile) { fail: return NULL; } + +/* Square Enix variation [Dragon Quest I-III (Switch)] */ +VGMSTREAM * init_vgmstream_opus_sqex(STREAMFILE *streamFile) { + off_t offset = 0; + int num_samples = 0, loop_start = 0, loop_end = 0, loop_flag; + + /* checks */ + if (!check_extensions(streamFile, "opus,lopus")) + goto fail; + if (read_64bitBE(0x00, streamFile) != 0x0100000002000000) + goto fail; + + offset = read_32bitLE(0x0C, streamFile); + num_samples = read_32bitLE(0x1C, streamFile); + + /* Check if there's a loop end value to determine loop_flag*/ + loop_flag = read_32bitLE(0x18, streamFile); + if (loop_flag) { + loop_start = read_32bitLE(0x14, streamFile); + loop_end = read_32bitLE(0x18, streamFile); + } + + return init_vgmstream_opus(streamFile, meta_OPUS, offset, num_samples, loop_start, loop_end); +fail: + return NULL; +} diff --git a/src/vgmstream.c b/src/vgmstream.c index 15b4e29d..b7223522 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -480,6 +480,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = { init_vgmstream_ubi_hx, init_vgmstream_bmp_konami, init_vgmstream_opus_opusnx, + init_vgmstream_opus_sqex, /* 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 */