Merge pull request #423 from bnnm/xvag-ckd

xvag ckd
This commit is contained in:
bnnm 2019-06-14 00:04:21 +02:00 committed by GitHub
commit 3267bdd34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View File

@ -44,8 +44,10 @@ VGMSTREAM * init_vgmstream_fsb5(STREAMFILE *streamFile) {
int i; int i;
/* check extension, case insensitive */ /* checks */
if (!check_extensions(streamFile,"fsb")) /* .fsb: standard
* .snd: Alchemy engine (also Unity) */
if (!check_extensions(streamFile,"fsb,snd"))
goto fail; goto fail;
if (read_32bitBE(0x00,streamFile) != 0x46534235) /* "FSB5" */ if (read_32bitBE(0x00,streamFile) != 0x46534235) /* "FSB5" */

View File

@ -139,7 +139,8 @@ VGMSTREAM * init_vgmstream_ubi_raki(STREAMFILE *streamFile) {
vgmstream->interleave_block_size = 0x8; vgmstream->interleave_block_size = 0x8;
/* reading could be improved but should work with some luck since most values are semi-fixed */ /* reading could be improved but should work with some luck since most values are semi-fixed */
{ if (channel_count > 1) {
/* find "dspL" pointing to "CWAV" header and read coefs (separate from data at start_offset) */
off_t chunk_offset = offset+ 0x20 + 0xc; /* after "fmt" */ off_t chunk_offset = offset+ 0x20 + 0xc; /* after "fmt" */
while (chunk_offset < header_size) { while (chunk_offset < header_size) {
if (read_32bitBE(chunk_offset,streamFile) == 0x6473704C) { /* "dspL" found */ if (read_32bitBE(chunk_offset,streamFile) == 0x6473704C) { /* "dspL" found */
@ -152,6 +153,12 @@ VGMSTREAM * init_vgmstream_ubi_raki(STREAMFILE *streamFile) {
chunk_offset += 0xc; chunk_offset += 0xc;
} }
} }
else {
/* CWAV at start (a full CWAV, unlike the above) */
dsp_read_coefs(vgmstream,streamFile, start_offset + 0x7c, 0x00, big_endian);
start_offset += 0xE0;
data_size = get_streamfile_size(streamFile) - start_offset;
}
vgmstream->num_samples = dsp_bytes_to_samples(data_size, channel_count); vgmstream->num_samples = dsp_bytes_to_samples(data_size, channel_count);
break; break;

View File

@ -156,11 +156,8 @@ VGMSTREAM * init_vgmstream_xvag(STREAMFILE *streamFile) {
case 0x08: { /* MPEG: The Last of Us (PS3), Uncharted 3 (PS3), Medieval Moves (PS3) */ case 0x08: { /* MPEG: The Last of Us (PS3), Uncharted 3 (PS3), Medieval Moves (PS3) */
mpeg_custom_config cfg = {0}; mpeg_custom_config cfg = {0};
if (xvag.subsongs > 1) goto fail;
if (xvag.subsongs > 1 && xvag.layers > 1) goto fail;
/* often 2ch per MPEG and rarely 1ch (GoW3 PS4) */ /* often 2ch per MPEG and rarely 1ch (GoW3 PS4) */
if (xvag.layers > 1 && !(xvag.layers*1 == vgmstream->channels || xvag.layers*2 == vgmstream->channels)) goto fail; if (xvag.layers > 1 && !(xvag.layers*1 == vgmstream->channels || xvag.layers*2 == vgmstream->channels)) goto fail;
//todo rare test file in The Last of Us PS4 uses 6ch with one 2ch stream, surround MPEG/mp3pro? (decoded samples map to 6ch)
/* "mpin": mpeg info */ /* "mpin": mpeg info */
/* 0x00/04: mpeg version/layer? other: unknown or repeats of "fmat" */ /* 0x00/04: mpeg version/layer? other: unknown or repeats of "fmat" */
@ -173,6 +170,14 @@ VGMSTREAM * init_vgmstream_xvag(STREAMFILE *streamFile) {
vgmstream->codec_data = init_mpeg_custom(streamFile, start_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_XVAG, &cfg); vgmstream->codec_data = init_mpeg_custom(streamFile, start_offset, &vgmstream->coding_type, vgmstream->channels, MPEG_XVAG, &cfg);
if (!vgmstream->codec_data) goto fail; if (!vgmstream->codec_data) goto fail;
vgmstream->layout_type = layout_none; vgmstream->layout_type = layout_none;
/* interleaved subsongs, rarely [Sly Cooper: Thieves in Time (PS3)] */
if (xvag.subsongs > 1) {
temp_streamFile = setup_xvag_streamfile(streamFile, start_offset, cfg.interleave,cfg.chunk_size, (target_subsong-1), total_subsongs);
if (!temp_streamFile) goto fail;
start_offset = 0;
}
break; break;
} }
#endif #endif