Merge pull request #211 from bnnm/quick-fixes

Quick fixes
This commit is contained in:
Christopher Snowhill 2018-04-01 18:15:04 -07:00 committed by GitHub
commit aaedb81c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 14 deletions

View File

@ -124,8 +124,8 @@ static VGMSTREAM * init_vgmstream_eaaudiocore_header(STREAMFILE * streamHead, ST
codec = (read_8bit(header_offset + 0x00,streamHead) >> 0) & 0xf; codec = (read_8bit(header_offset + 0x00,streamHead) >> 0) & 0xf;
channel_config = read_8bit(header_offset + 0x01,streamHead); channel_config = read_8bit(header_offset + 0x01,streamHead);
sample_rate = (uint16_t)read_16bitBE(header_offset + 0x02,streamHead); sample_rate = (uint16_t)read_16bitBE(header_offset + 0x02,streamHead);
flags = (uint8_t)read_8bit(header_offset + 0x04,streamHead); /* upper nibble only? */ flags = (uint8_t)read_8bit(header_offset + 0x04,streamHead) & 0xFE; //todo upper nibble only? (the first bit is part of size)
num_samples = (uint32_t)read_32bitBE(header_offset + 0x04,streamHead) & 0x00FFFFFF; num_samples = (uint32_t)read_32bitBE(header_offset + 0x04,streamHead) & 0x01FFFFFF;
/* rest is optional, depends on flags header used (ex. SNU and SPS may have bigger headers): /* rest is optional, depends on flags header used (ex. SNU and SPS may have bigger headers):
* &0x20: 1 int (usually 0x00), &0x00/40: nothing, &0x60: 2 ints (usually 0x00 and 0x14) */ * &0x20: 1 int (usually 0x00), &0x00/40: nothing, &0x60: 2 ints (usually 0x00 and 0x14) */
@ -135,9 +135,10 @@ static VGMSTREAM * init_vgmstream_eaaudiocore_header(STREAMFILE * streamHead, ST
goto fail; goto fail;
} }
/* 0x40: stream asset, 0x20: full loop, 0x00: default/RAM asset, 0x01: loop? */ /* 0x40: stream asset, 0x20: full loop, 0x00: default/RAM asset */
if (flags != 0x60 && flags != 0x40 && flags != 0x20 && flags != 0x00) { if (flags != 0x60 && flags != 0x40 && flags != 0x20 && flags != 0x00) {
VGM_LOG("EA SNS/SPS: unknown flag 0x%02x\n", flags); VGM_LOG("EA SNS/SPS: unknown flag 0x%02x\n", flags);
goto fail;
} }
/* seen in sfx and Dead Space ambient tracks */ /* seen in sfx and Dead Space ambient tracks */

View File

@ -2075,29 +2075,24 @@ VGMSTREAM * init_vgmstream_dsp_mcadpcm(STREAMFILE *streamFile) {
/* checks */ /* checks */
if (!check_extensions(streamFile, "mcadpcm")) if (!check_extensions(streamFile, "mcadpcm"))
goto fail; goto fail;
VGM_LOG("1\n");
if (read_32bitLE(0x08,streamFile) != read_32bitLE(0x10,streamFile)) /* dsp sizes */ if (read_32bitLE(0x08,streamFile) != read_32bitLE(0x10,streamFile)) /* dsp sizes */
goto fail; goto fail;
VGM_LOG("2\n");
channel_count = read_32bitLE(0x00,streamFile); channel_count = read_32bitLE(0x00,streamFile);
if (channel_count > MCADPCM_MAX_CHANNELS) goto fail; if (channel_count > MCADPCM_MAX_CHANNELS) goto fail;
header_offset = read_32bitLE(0x04,streamFile); header_offset = read_32bitLE(0x04,streamFile);
header_spacing = read_32bitLE(0x08,streamFile); /* technically dsp size but eh */ header_spacing = read_32bitLE(0x0c,streamFile) - header_offset; /* channel 2 start */
start_offset = header_offset + 0x60; start_offset = header_offset + 0x60;
interleave = header_spacing; interleave = header_spacing;
VGM_LOG("3\n");
/* read dsp */ /* read dsp */
if (!dsp_load_header_le(ch_header, channel_count, streamFile,header_offset,header_spacing)) goto fail; if (!dsp_load_header_le(ch_header, channel_count, streamFile,header_offset,header_spacing)) goto fail;
VGM_LOG("4\n");
if (!check_dsp_format(ch_header, channel_count)) goto fail; if (!check_dsp_format(ch_header, channel_count)) goto fail;
VGM_LOG("5\n");
if (!check_dsp_samples(ch_header, channel_count)) goto fail; if (!check_dsp_samples(ch_header, channel_count)) goto fail;
VGM_LOG("6\n");
if (!check_dsp_initial_ps(ch_header, channel_count, streamFile,start_offset,interleave)) goto fail; if (!check_dsp_initial_ps(ch_header, channel_count, streamFile,start_offset,interleave)) goto fail;
VGM_LOG("7\n");
if (!check_dsp_loop_ps(ch_header, channel_count, streamFile,start_offset,interleave)) goto fail; if (!check_dsp_loop_ps(ch_header, channel_count, streamFile,start_offset,interleave)) goto fail;
VGM_LOG("8\n");
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,ch_header[0].loop_flag); vgmstream = allocate_vgmstream(channel_count,ch_header[0].loop_flag);

View File

@ -16,7 +16,7 @@ VGMSTREAM * init_vgmstream_nsw_opus(STREAMFILE *streamFile) {
goto fail; goto fail;
/* variations, maybe custom */ /* variations, maybe custom */
if (read_32bitBE(0x00,streamFile) == 0x01000080) { /* Lego City Undercover */ if (read_32bitBE(0x00,streamFile) == 0x01000080) { /* standard, Lego City Undercover */
offset = 0x00; offset = 0x00;
} }
else if ((read_32bitBE(0x04,streamFile) == 0x00000000 && read_32bitBE(0x0c,streamFile) == 0x00000000) || else if ((read_32bitBE(0x04,streamFile) == 0x00000000 && read_32bitBE(0x0c,streamFile) == 0x00000000) ||
@ -26,12 +26,17 @@ VGMSTREAM * init_vgmstream_nsw_opus(STREAMFILE *streamFile) {
loop_start = read_32bitLE(0x00,streamFile); loop_start = read_32bitLE(0x00,streamFile);
loop_end = read_32bitLE(0x08,streamFile); loop_end = read_32bitLE(0x08,streamFile);
} }
else if (read_32bitLE(0x04,streamFile) == 0x02) { /* Ultra Street Fighter II */ else if (read_32bitLE(0x04,streamFile) == 0x01 ||
read_32bitLE(0x04,streamFile) == 0x02) { /* Ultra Street Fighter II, RE: Revelations */
offset = read_32bitLE(0x1c,streamFile); offset = read_32bitLE(0x1c,streamFile);
num_samples = read_32bitLE(0x00,streamFile); num_samples = read_32bitLE(0x00,streamFile);
/* 0x04: channels, 6 uses interleaved streams (2ch+2ch+2ch) */
loop_start = read_32bitLE(0x08,streamFile); loop_start = read_32bitLE(0x08,streamFile);
loop_end = read_32bitLE(0x0c,streamFile); loop_end = read_32bitLE(0x0c,streamFile);
/* 0x10: frame size (with extra data) */
/* 0x14: extra chunk count (each of 0x08, after 0x30) */
/* 0x18: null */
} }
else if (read_32bitBE(0x00, streamFile) == 0x73616466 && read_32bitBE(0x08, streamFile) == 0x6f707573) { /* Xenoblade Chronicles 2 */ else if (read_32bitBE(0x00, streamFile) == 0x73616466 && read_32bitBE(0x08, streamFile) == 0x6f707573) { /* Xenoblade Chronicles 2 */
offset = read_32bitLE(0x1c, streamFile); offset = read_32bitLE(0x1c, streamFile);