Merge pull request #487 from bxaimc/master

AAC fixes for Star Ocean TLH Intl. (PS3)
This commit is contained in:
bxaimc 2019-10-09 11:33:32 -04:00 committed by GitHub
commit 363b814398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,7 +139,7 @@ VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
off_t start_offset; off_t start_offset;
int loop_flag, channel_count; int loop_flag, channel_count;
uint32_t data_size, loop_start, loop_end, codec_id; uint32_t data_size, loop_start, loop_end, codec_id, asc_chunk;
/* check extension, case insensitive */ /* check extension, case insensitive */
/* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */ /* .aac: expected, .laac/ace: for players to avoid hijacking MP4/AAC */
@ -149,30 +149,31 @@ VGMSTREAM * init_vgmstream_ta_aac_ps3(STREAMFILE *streamFile) {
if (read_32bitBE(0x00, streamFile) != 0x41414320) /* "AAC " */ if (read_32bitBE(0x00, streamFile) != 0x41414320) /* "AAC " */
goto fail; goto fail;
/* Haven't Found a codec flag yet. Let's just use this for now */ /* Find the ASC chunk, That's where the goodies are */
if (read_32bitBE(0x10000, streamFile) != 0x41534320) /* "ASC " */ asc_chunk = read_32bitBE(0x40, streamFile);
if (read_32bitBE(asc_chunk, streamFile) != 0x41534320) /* "ASC " */
goto fail; goto fail;
if (read_32bitBE(0x10104, streamFile) != 0xFFFFFFFF) if (read_32bitBE(asc_chunk+0x104, streamFile) != 0xFFFFFFFF)
loop_flag = 1; loop_flag = 1;
else else
loop_flag = 0; loop_flag = 0;
channel_count = read_32bitBE(0x100F4, streamFile); channel_count = read_32bitBE(asc_chunk + 0xF4, streamFile);
codec_id = read_32bitBE(0x100F0, streamFile); codec_id = read_32bitBE(asc_chunk + 0xF0, streamFile);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, loop_flag); vgmstream = allocate_vgmstream(channel_count, loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* Useless header, let's play the guessing game */ /* ASC header */
start_offset = 0x10110; start_offset = asc_chunk + 0x110;
vgmstream->sample_rate = read_32bitBE(0x100FC, streamFile); vgmstream->sample_rate = read_32bitBE(asc_chunk + 0xFC, streamFile);
vgmstream->channels = channel_count; vgmstream->channels = channel_count;
vgmstream->meta_type = meta_TA_AAC_PS3; vgmstream->meta_type = meta_TA_AAC_PS3;
data_size = read_32bitBE(0x100F8, streamFile); data_size = read_32bitBE(asc_chunk + 0xF8, streamFile);
loop_start = read_32bitBE(0x10104, streamFile); loop_start = read_32bitBE(asc_chunk + 0x104, streamFile);
loop_end = read_32bitBE(0x10108, streamFile); loop_end = read_32bitBE(asc_chunk + 0x108, streamFile);
#ifdef VGM_USE_FFMPEG #ifdef VGM_USE_FFMPEG
{ {