From 7a7b1105ba9af5e2cf319aea44f2ff1818e79981 Mon Sep 17 00:00:00 2001 From: NicknineTheEagle Date: Fri, 2 Sep 2022 05:23:21 +0300 Subject: [PATCH 1/2] Minor fixes --- src/meta/ea_eaac.c | 2 +- src/meta/ea_schl.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/meta/ea_eaac.c b/src/meta/ea_eaac.c index e4caa22d..50d6be60 100644 --- a/src/meta/ea_eaac.c +++ b/src/meta/ea_eaac.c @@ -756,7 +756,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) { for (i = 0; i < ram_segments; i++) { entry_offset = table_offset + (bnk_sound_index + i) * 0x0c; snr_offset = read_u32(entry_offset + 0x04, sf_mus); - data_s->segments[i] = init_vgmstream_eaaudiocore_header(sf_mus, sf_mus, + data_s->segments[i] = init_vgmstream_eaaudiocore_header(sf_mus, NULL, snr_offset, 0, meta_EA_SNR_SNS, 0); if (!data_s->segments[i]) goto fail; diff --git a/src/meta/ea_schl.c b/src/meta/ea_schl.c index 9d312e42..14672811 100644 --- a/src/meta/ea_schl.c +++ b/src/meta/ea_schl.c @@ -132,7 +132,7 @@ typedef struct { size_t stream_size; } ea_header; -static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset, int standalone); +static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset); static VGMSTREAM* parse_bnk_header(STREAMFILE* sf, off_t offset, int target_stream, int is_embedded); static int parse_variable_header(STREAMFILE* sf, ea_header* ea, off_t begin_offset, int max_length, int bnk_version); static uint32_t read_patch(STREAMFILE* sf, off_t* offset); @@ -184,7 +184,7 @@ VGMSTREAM* init_vgmstream_ea_schl(STREAMFILE* sf) { /* Stream is divided into blocks/chunks: SCHl=audio header, SCCl=count of SCDl, SCDl=data xN, SCLl=loop end, SCEl=end. * Video uses picture blocks (MVhd/MV0K/etc) and sometimes multiaudio blocks (SHxx/SCxx/SDxx/SExx where xx=language). * The number/size is affected by: block rate setting, sample rate, channels, CPU location (SPU/main/DSP/others), etc */ - return parse_schl_block(sf, 0x00, 1); + return parse_schl_block(sf, 0x00); fail: return NULL; @@ -275,7 +275,7 @@ VGMSTREAM* init_vgmstream_ea_schl_video(STREAMFILE* sf) { if (target_subsong < 0 || target_subsong > total_subsongs || total_subsongs < 1) goto fail; - vgmstream = parse_schl_block(sf, start_offset, 1); + vgmstream = parse_schl_block(sf, start_offset); if (!vgmstream) goto fail; vgmstream->num_streams = total_subsongs; @@ -428,7 +428,7 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) { if (read_32bitBE(schl_offset, astData) != EA_BLOCKID_HEADER) goto fail; - vgmstream = parse_schl_block(astData, schl_offset, 0); + vgmstream = parse_schl_block(astData, schl_offset); if (!vgmstream) goto fail; @@ -455,9 +455,9 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) { if (!data_s) goto fail; /* load intro and loop segments */ - data_s->segments[0] = parse_schl_block(astData, schl_offset, 0); + data_s->segments[0] = parse_schl_block(astData, schl_offset); if (!data_s->segments[0]) goto fail; - data_s->segments[1] = parse_schl_block(astData, schl_loop_offset, 0); + data_s->segments[1] = parse_schl_block(astData, schl_loop_offset); if (!data_s->segments[1]) goto fail; /* setup segmented VGMSTREAMs */ @@ -545,7 +545,7 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) { /* offsets are always big endian */ sound_offset = read_u16be(0x0C + (0x02 + userdata_size) * (target_stream - 1), sf) * offset_mult; if (read_u32be(sound_offset, sf_dat) == EA_BLOCKID_HEADER) { /* "SCHl" */ - vgmstream = parse_schl_block(sf_dat, sound_offset, 0); + vgmstream = parse_schl_block(sf_dat, sound_offset); if (!vgmstream) goto fail; } else if (read_u32be(sound_offset, sf_dat) == 0x56414770) { /* "VAGp" */ @@ -633,7 +633,7 @@ VGMSTREAM* init_vgmstream_ea_hdr_dat_v2(STREAMFILE* sf) { if (read_u32be(sound_offset, sf_dat) != EA_BLOCKID_HEADER) goto fail; - vgmstream = parse_schl_block(sf_dat, sound_offset, 0); + vgmstream = parse_schl_block(sf_dat, sound_offset); if (!vgmstream) goto fail; @@ -803,7 +803,7 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) { if (read_32bitBE(schl_offset, sf_mus) != EA_BLOCKID_HEADER) goto fail; - vgmstream = parse_schl_block(sf_mus, schl_offset, 0); + vgmstream = parse_schl_block(sf_mus, schl_offset); if (!vgmstream) goto fail; @@ -1050,7 +1050,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) { if (version == 5) { track_checksum = read_u32be(entry_offset + 0x14 + 0x10 * bnk_index, sf); - if (read_u32be(0x00, sf_mus) != track_checksum) + if (track_checksum && read_u32be(0x00, sf_mus) != track_checksum) goto fail; } @@ -1086,11 +1086,11 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) { if (version == 5 && track_checksum && read_u32be(0x00, sf_mus) != track_checksum) goto fail; - sound_offset *= off_mult;; + sound_offset *= off_mult; if (read_u32be(sound_offset, sf_mus) != EA_BLOCKID_HEADER) goto fail; - vgmstream = parse_schl_block(sf_mus, sound_offset, 0); + vgmstream = parse_schl_block(sf_mus, sound_offset); } if (!vgmstream) @@ -1109,7 +1109,7 @@ fail: } /* EA SCHl with variable header - from EA games (roughly 1997~2010); generated by EA Canada's sx.exe/Sound eXchange */ -static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset, int standalone) { +static VGMSTREAM* parse_schl_block(STREAMFILE* sf, off_t offset) { off_t start_offset, header_offset; size_t header_size; uint32_t header_id; From 0d5ced64682100e5bd1780423e4f2333142c4630 Mon Sep 17 00:00:00 2001 From: NicknineTheEagle Date: Fri, 2 Sep 2022 06:04:03 +0300 Subject: [PATCH 2/2] EA MPF: Fixed v4 parsing --- src/meta/ea_schl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/meta/ea_schl.c b/src/meta/ea_schl.c index 14672811..a2eaa990 100644 --- a/src/meta/ea_schl.c +++ b/src/meta/ea_schl.c @@ -943,10 +943,8 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) { } section_offset = entry_offset + 0x10 + subentry_num * 0x10; - /* TODO: verify this */ - section_offset = read_u32(section_offset, sf) * 0x04; section_offset += num_routers * 0x04; - section_offset += num_vars * 0x04; + section_offset = read_u32(section_offset, sf) * 0x04; tracks_table = section_offset; samples_table = tracks_table + (num_tracks + 1) * 0x04;