mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-16 10:52:32 +01:00
EA MPF+MUS: EA Redwood Shores variant
This commit is contained in:
parent
a22377f980
commit
f6ccd77b41
@ -365,6 +365,7 @@ static const char* extension_list[] = {
|
||||
"mss",
|
||||
"msv",
|
||||
"msvp", //fake extension/header id for .msv
|
||||
"msx",
|
||||
"mta2",
|
||||
"mtaf",
|
||||
"mtt", //txth/reserved [Splinter Cell: Pandora Tomorrow (PS2)]
|
||||
|
@ -4,11 +4,61 @@
|
||||
#include "../util/companion_files.h"
|
||||
|
||||
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf, const char* mus_name);
|
||||
static STREAMFILE *open_mapfile_pair(STREAMFILE* sf, int track /*, int num_tracks*/);
|
||||
|
||||
/* .MPF - Standard EA MPF+MUS */
|
||||
VGMSTREAM* init_vgmstream_ea_mpf_eaac(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
return NULL;
|
||||
return init_vgmstream_ea_mpf_mus_eaac(sf, NULL);
|
||||
}
|
||||
|
||||
/* .MSB/.MSX - EA Redwood Shores (MSB/MSX)+MUS [The Godfather (PS3/360), The Simpsons Game (PS3/360)] */
|
||||
VGMSTREAM* init_vgmstream_ea_msb_eaac(STREAMFILE* sf) {
|
||||
/* container with MPF, extra info, and a pre-defined MUS filename */
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mpf = NULL;
|
||||
const char* mus_name[0x20 + 1];
|
||||
size_t header_size;
|
||||
off_t info_offset, mus_name_offset;
|
||||
read_u32_t read_u32;
|
||||
|
||||
if (!check_extensions(sf, "msb,msx"))
|
||||
return NULL;
|
||||
|
||||
header_size = 0x50;
|
||||
mus_name_offset = 0x30;
|
||||
|
||||
/* 0x08: buffer size of the pre-defined .mus filename? (always 0x20)
|
||||
* 0x20: mpf version number? (always 0x05)
|
||||
* 0x24: offset to a chunk of plaintext data w/ event and node info & names
|
||||
* 0x2C: some hash?
|
||||
* 0x30: intended .mus filename */
|
||||
read_u32 = guess_read_u32(0x08, sf);
|
||||
|
||||
/* not exactly the same as mpf size since it's aligned, but doesn't matter here */
|
||||
info_offset = read_u32(0x24, sf); //+ header_size;
|
||||
read_string(mus_name, 0x20 + 1, mus_name_offset, sf);
|
||||
|
||||
sf_mpf = open_wrap_streamfile(sf);
|
||||
sf_mpf = open_clamp_streamfile(sf_mpf, header_size, info_offset);
|
||||
if (!sf_mpf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_ea_mpf_mus_eaac(sf_mpf, mus_name);
|
||||
if (!vgmstream) goto fail;
|
||||
close_streamfile(sf_mpf);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
close_streamfile(sf_mpf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* EA MPF/MUS combo - used in older 7th gen games for storing interactive music */
|
||||
VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf, const char* mus_name) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE *sf_mus = NULL;
|
||||
uint32_t num_tracks, track_start, track_checksum = 0, mus_sounds, mus_stream = 0, bnk_index = 0, bnk_sound_index = 0,
|
||||
@ -34,9 +84,6 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
return NULL;
|
||||
|
||||
version = read_u8(0x04, sf);
|
||||
sub_version = read_u8(0x05, sf);
|
||||
if (version != 5 || sub_version < 2 || sub_version > 3) goto fail;
|
||||
@ -69,7 +116,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
|
||||
}
|
||||
|
||||
/* open MUS file that matches this track */
|
||||
sf_mus = open_mapfile_pair(sf, i);//, num_tracks
|
||||
sf_mus = mus_name ? open_streamfile_by_filename(sf, mus_name) : open_mapfile_pair(sf, i);//, num_tracks
|
||||
if (!sf_mus) goto fail;
|
||||
|
||||
/* sample offsets table is still there but it just holds SNS offsets, we only need it for RAM sound indexes */
|
||||
|
@ -64,9 +64,8 @@ VGMSTREAM* init_vgmstream_ea_sbk(STREAMFILE* sf) {
|
||||
* 0x04: 0x0313BABE (?)
|
||||
* 0x08: stream offset
|
||||
* 0x0C: 0xFEEDFEED (?)
|
||||
*
|
||||
* Dead Space 3 has non-placeholder data at 0x04 (SPS related?)
|
||||
*/
|
||||
/* Dead Space 3 has non-placeholder data at 0x04 (SPS related?) */
|
||||
entry_offset = sdat_offset + 0x08 + target_stream * 0x10;
|
||||
|
||||
if (read_u32(entry_offset + 0x00, sf) != target_stream) goto fail;
|
||||
|
@ -134,6 +134,7 @@ typedef struct {
|
||||
size_t stream_size;
|
||||
} ea_header;
|
||||
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf, const char* mus_name);
|
||||
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);
|
||||
@ -859,8 +860,58 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* .MPF - Standard EA MPF+MUS */
|
||||
VGMSTREAM* init_vgmstream_ea_mpf(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
return NULL;
|
||||
return init_vgmstream_ea_mpf_mus(sf, NULL);
|
||||
}
|
||||
|
||||
/* .MSB/.MSX - EA Redwood Shores (MSB/MSX)+MUS [007: From Russia with Love, The Godfather (PC/PS2/Wii)] */
|
||||
VGMSTREAM* init_vgmstream_ea_msb(STREAMFILE* sf) {
|
||||
/* container with MPF, extra info, and a pre-defined MUS filename */
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mpf = NULL;
|
||||
const char* mus_name[0x20 + 1];
|
||||
size_t header_size;
|
||||
off_t info_offset, mus_name_offset;
|
||||
read_u32_t read_u32;
|
||||
|
||||
if (!check_extensions(sf, "msb,msx"))
|
||||
return NULL;
|
||||
|
||||
header_size = 0x50;
|
||||
mus_name_offset = 0x30;
|
||||
|
||||
/* 0x08: buffer size of the pre-defined .mus filename? (always 0x20)
|
||||
* 0x20: mpf version number? (always 0x05)
|
||||
* 0x24: offset to a chunk of plaintext data w/ event and node info & names
|
||||
* 0x2C: some hash?
|
||||
* 0x30: intended .mus filename */
|
||||
read_u32 = guess_read_u32(0x08, sf);
|
||||
|
||||
/* not exactly the same as mpf size since it's aligned, but correct size is only needed for v3 */
|
||||
info_offset = read_u32(0x24, sf); //+ header_size;
|
||||
read_string(mus_name, 0x20 + 1, mus_name_offset, sf);
|
||||
|
||||
sf_mpf = open_wrap_streamfile(sf);
|
||||
sf_mpf = open_clamp_streamfile(sf_mpf, header_size, info_offset);
|
||||
if (!sf_mpf) goto fail;
|
||||
|
||||
vgmstream = init_vgmstream_ea_mpf_mus(sf_mpf, mus_name);
|
||||
if (!vgmstream) goto fail;
|
||||
close_streamfile(sf_mpf);
|
||||
|
||||
return vgmstream;
|
||||
|
||||
fail:
|
||||
close_vgmstream(vgmstream);
|
||||
close_streamfile(sf_mpf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* EA MPF/MUS combo - used in 6th gen games for interactive music (for EA's PathFinder tool) */
|
||||
VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf, const char* mus_name) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mus = NULL;
|
||||
segmented_layout_data *data_s = NULL;
|
||||
@ -873,10 +924,6 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
||||
uint32_t(*read_u32)(off_t, STREAMFILE *);
|
||||
uint16_t(*read_u16)(off_t, STREAMFILE *);
|
||||
|
||||
/* check extension */
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
goto fail;
|
||||
|
||||
/* detect endianness */
|
||||
if (is_id32be(0x00, sf, "PFDx")) {
|
||||
read_u32 = read_u32be;
|
||||
@ -1041,7 +1088,7 @@ VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
||||
goto fail;
|
||||
|
||||
/* open MUS file that matches this track */
|
||||
sf_mus = open_mapfile_pair(sf, i); //, num_tracks
|
||||
sf_mus = mus_name ? open_streamfile_by_filename(sf, mus_name) : open_mapfile_pair(sf, i); //, num_tracks
|
||||
if (!sf_mus)
|
||||
goto fail;
|
||||
|
||||
|
@ -602,8 +602,9 @@ VGMSTREAM * init_vgmstream_ea_bnk(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_abk(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_hdr_dat(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_hdr_dat_v2(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_map_mus(STREAMFILE * steeamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf_mus(STREAMFILE * steeamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_map_mus(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb(STREAMFILE * streamFile);
|
||||
VGMSTREAM* load_vgmstream_ea_bnk(STREAMFILE* sf, off_t offset, int target_stream, int is_embedded);
|
||||
|
||||
VGMSTREAM * init_vgmstream_ea_schl_fixed(STREAMFILE * streamFile);
|
||||
@ -648,7 +649,8 @@ VGMSTREAM * init_vgmstream_ea_snr_sns(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_sps(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_abk_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_hdr_sth_dat(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf_mus_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_tmx(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_sbr(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_sbr_harmony(STREAMFILE * streamFile);
|
||||
|
@ -293,7 +293,8 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_ea_hdr_dat,
|
||||
init_vgmstream_ea_hdr_dat_v2,
|
||||
init_vgmstream_ea_map_mus,
|
||||
init_vgmstream_ea_mpf_mus,
|
||||
init_vgmstream_ea_mpf,
|
||||
init_vgmstream_ea_msb,
|
||||
init_vgmstream_ea_schl_fixed,
|
||||
init_vgmstream_sk_aud,
|
||||
init_vgmstream_stma,
|
||||
@ -320,7 +321,8 @@ init_vgmstream_t init_vgmstream_functions[] = {
|
||||
init_vgmstream_ea_sps,
|
||||
init_vgmstream_ea_abk_eaac,
|
||||
init_vgmstream_ea_hdr_sth_dat,
|
||||
init_vgmstream_ea_mpf_mus_eaac,
|
||||
init_vgmstream_ea_mpf_eaac,
|
||||
init_vgmstream_ea_msb_eaac,
|
||||
init_vgmstream_ea_tmx,
|
||||
init_vgmstream_ea_sbr,
|
||||
init_vgmstream_ea_sbr_harmony,
|
||||
|
Loading…
x
Reference in New Issue
Block a user