mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
Merge pull request #1214 from NicknineTheEagle/ea
EA MPF: Fixed v4 parsing
This commit is contained in:
commit
d2cecba34d
@ -756,7 +756,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
|
|||||||
for (i = 0; i < ram_segments; i++) {
|
for (i = 0; i < ram_segments; i++) {
|
||||||
entry_offset = table_offset + (bnk_sound_index + i) * 0x0c;
|
entry_offset = table_offset + (bnk_sound_index + i) * 0x0c;
|
||||||
snr_offset = read_u32(entry_offset + 0x04, sf_mus);
|
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,
|
snr_offset, 0,
|
||||||
meta_EA_SNR_SNS, 0);
|
meta_EA_SNR_SNS, 0);
|
||||||
if (!data_s->segments[i]) goto fail;
|
if (!data_s->segments[i]) goto fail;
|
||||||
|
@ -132,7 +132,7 @@ typedef struct {
|
|||||||
size_t stream_size;
|
size_t stream_size;
|
||||||
} ea_header;
|
} 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 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 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);
|
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.
|
/* 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).
|
* 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 */
|
* 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:
|
fail:
|
||||||
return NULL;
|
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;
|
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;
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
vgmstream->num_streams = total_subsongs;
|
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)
|
if (read_32bitBE(schl_offset, astData) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
vgmstream = parse_schl_block(astData, schl_offset, 0);
|
vgmstream = parse_schl_block(astData, schl_offset);
|
||||||
if (!vgmstream)
|
if (!vgmstream)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -455,9 +455,9 @@ VGMSTREAM* init_vgmstream_ea_abk(STREAMFILE* sf) {
|
|||||||
if (!data_s) goto fail;
|
if (!data_s) goto fail;
|
||||||
|
|
||||||
/* load intro and loop segments */
|
/* 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;
|
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;
|
if (!data_s->segments[1]) goto fail;
|
||||||
|
|
||||||
/* setup segmented VGMSTREAMs */
|
/* setup segmented VGMSTREAMs */
|
||||||
@ -545,7 +545,7 @@ VGMSTREAM *init_vgmstream_ea_hdr_dat(STREAMFILE *sf) {
|
|||||||
/* offsets are always big endian */
|
/* offsets are always big endian */
|
||||||
sound_offset = read_u16be(0x0C + (0x02 + userdata_size) * (target_stream - 1), sf) * offset_mult;
|
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" */
|
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)
|
if (!vgmstream)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else if (read_u32be(sound_offset, sf_dat) == 0x56414770) { /* "VAGp" */
|
} 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)
|
if (read_u32be(sound_offset, sf_dat) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
vgmstream = parse_schl_block(sf_dat, sound_offset, 0);
|
vgmstream = parse_schl_block(sf_dat, sound_offset);
|
||||||
if (!vgmstream)
|
if (!vgmstream)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -803,7 +803,7 @@ VGMSTREAM* init_vgmstream_ea_map_mus(STREAMFILE* sf) {
|
|||||||
if (read_32bitBE(schl_offset, sf_mus) != EA_BLOCKID_HEADER)
|
if (read_32bitBE(schl_offset, sf_mus) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
vgmstream = parse_schl_block(sf_mus, schl_offset, 0);
|
vgmstream = parse_schl_block(sf_mus, schl_offset);
|
||||||
if (!vgmstream)
|
if (!vgmstream)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -943,10 +943,8 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
|||||||
}
|
}
|
||||||
section_offset = entry_offset + 0x10 + subentry_num * 0x10;
|
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_routers * 0x04;
|
||||||
section_offset += num_vars * 0x04;
|
section_offset = read_u32(section_offset, sf) * 0x04;
|
||||||
|
|
||||||
tracks_table = section_offset;
|
tracks_table = section_offset;
|
||||||
samples_table = tracks_table + (num_tracks + 1) * 0x04;
|
samples_table = tracks_table + (num_tracks + 1) * 0x04;
|
||||||
@ -1050,7 +1048,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
|||||||
|
|
||||||
if (version == 5) {
|
if (version == 5) {
|
||||||
track_checksum = read_u32be(entry_offset + 0x14 + 0x10 * bnk_index, sf);
|
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;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,11 +1084,11 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
|||||||
if (version == 5 && track_checksum && read_u32be(0x00, sf_mus) != track_checksum)
|
if (version == 5 && track_checksum && read_u32be(0x00, sf_mus) != track_checksum)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
sound_offset *= off_mult;;
|
sound_offset *= off_mult;
|
||||||
if (read_u32be(sound_offset, sf_mus) != EA_BLOCKID_HEADER)
|
if (read_u32be(sound_offset, sf_mus) != EA_BLOCKID_HEADER)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
vgmstream = parse_schl_block(sf_mus, sound_offset, 0);
|
vgmstream = parse_schl_block(sf_mus, sound_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vgmstream)
|
if (!vgmstream)
|
||||||
@ -1109,7 +1107,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* EA SCHl with variable header - from EA games (roughly 1997~2010); generated by EA Canada's sx.exe/Sound eXchange */
|
/* 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;
|
off_t start_offset, header_offset;
|
||||||
size_t header_size;
|
size_t header_size;
|
||||||
uint32_t header_id;
|
uint32_t header_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user