diff --git a/src/coding/mpeg_custom_utils_ealayer3.c b/src/coding/mpeg_custom_utils_ealayer3.c index 84f6cc74..c50f6d85 100644 --- a/src/coding/mpeg_custom_utils_ealayer3.c +++ b/src/coding/mpeg_custom_utils_ealayer3.c @@ -150,6 +150,8 @@ int mpeg_custom_parse_frame_ealayer3(VGMSTREAMCHANNEL *stream, mpeg_codec_data * } + // todo rarely there is a block between granules (ex. EAL3 v2P in FIFA 2016) + /* get second frame/granule (MPEG1 only) if first granule was found */ granule_found = 0; while (eaf_0.common_size && eaf_0.mpeg1 && !granule_found) { @@ -665,6 +667,7 @@ static int ealayer3_skip_data(VGMSTREAMCHANNEL *stream, mpeg_codec_data *data, i if (!ok) goto fail; stream->offset += eaf.eaframe_size; + //;VGM_LOG("s%i: skipping %x, now at %lx\n", num_stream,eaf.eaframe_size,stream->offset); } //;VGM_LOG("s%i: skipped %i frames, now at %lx\n", num_stream,skips,stream->offset); diff --git a/src/layout/blocked_ea_sns.c b/src/layout/blocked_ea_sns.c index 827ecc93..12afab00 100644 --- a/src/layout/blocked_ea_sns.c +++ b/src/layout/blocked_ea_sns.c @@ -2,7 +2,7 @@ #include "../coding/coding.h" #include "../vgmstream.h" -/* EA "SNS "blocks (most common in .SNS) */ +/* EA SNS/SPS blocks */ void block_update_ea_sns(off_t block_offset, VGMSTREAM * vgmstream) { STREAMFILE* streamFile = vgmstream->ch[0].streamfile; uint32_t block_size, block_samples; @@ -21,16 +21,10 @@ void block_update_ea_sns(off_t block_offset, VGMSTREAM * vgmstream) { return; } - /* 0x80: last block - * 0x40: new block for some codecs? - * 0x08: ? - * 0x04: new block for some codecs? - * 0x01: last block for some codecs? - * 0x00: none? */ - if (block_size & 0xFF000000) { - //VGM_ASSERT(!(block_size & 0x80000000), "EA SNS: unknown flag found at %lx\n", block_offset); - block_size &= 0x00FFFFFF; - } + /* At 0x00(1): block flag + * - in SNS: 0x00=normal block, 0x80=last block (not mandatory) + * - in SPS: 0x48=header, 0x44=normal block, 0x45=last block (empty) */ + block_size &= 0x00FFFFFF; for (i = 0; i < vgmstream->channels; i++) { off_t channel_start = 0x00; diff --git a/src/meta/ea_eaac.c b/src/meta/ea_eaac.c index 2f77004e..03eb0ebd 100644 --- a/src/meta/ea_eaac.c +++ b/src/meta/ea_eaac.c @@ -48,12 +48,10 @@ VGMSTREAM * init_vgmstream_ea_sps(STREAMFILE * streamFile) { if (!check_extensions(streamFile,"sps")) goto fail; - /* Very hacky but the original check for 0x48000000 rejected some playable files */ - if (((read_16bitBE(0x00,streamFile) & 0xFFFFFF00) != 0x4800) && - ((read_8bit(0x00, streamFile) & 0xFFFFFF00) != 0x00)) + /* SPS block start: 0x00(1): block flag (header=0x48); 0x01(3): block size (usually 0x0c-0x14) */ + if (read_8bit(0x00, streamFile) != 0x48) goto fail; - - start_offset = read_8bit(0x03, streamFile); + start_offset = read_32bitBE(0x00, streamFile) & 0x00FFFFFF; vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, 0x04, start_offset, meta_EA_SPS); if (!vgmstream) goto fail;