Skip to content

Commit

Permalink
add Square Enix Opus for Dragon Quest I-III (Switch)
Browse files Browse the repository at this point in the history
  • Loading branch information
bxaimc committed Oct 3, 2019
1 parent 60d9895 commit 122e65c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/meta/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
26 changes: 26 additions & 0 deletions src/meta/opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions src/vgmstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 122e65c

Please sign in to comment.