mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 06:50:20 +01:00
Cleanup
This commit is contained in:
parent
f6ccd77b41
commit
7354d12c85
@ -4,18 +4,18 @@
|
||||
#include "../util/companion_files.h"
|
||||
|
||||
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf, const char* mus_name);
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac_main(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) {
|
||||
VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
return NULL;
|
||||
return init_vgmstream_ea_mpf_mus_eaac(sf, NULL);
|
||||
return init_vgmstream_ea_mpf_mus_eaac_main(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) {
|
||||
VGMSTREAM* init_vgmstream_ea_msb_mus_eaac(STREAMFILE* sf) {
|
||||
/* container with MPF, extra info, and a pre-defined MUS filename */
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mpf = NULL;
|
||||
@ -31,7 +31,7 @@ VGMSTREAM* init_vgmstream_ea_msb_eaac(STREAMFILE* sf) {
|
||||
mus_name_offset = 0x30;
|
||||
|
||||
/* 0x08: buffer size of the pre-defined .mus filename? (always 0x20)
|
||||
* 0x20: mpf version number? (always 0x05)
|
||||
* 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 */
|
||||
@ -45,7 +45,7 @@ VGMSTREAM* init_vgmstream_ea_msb_eaac(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);
|
||||
vgmstream = init_vgmstream_ea_mpf_mus_eaac_main(sf_mpf, mus_name);
|
||||
if (!vgmstream) goto fail;
|
||||
close_streamfile(sf_mpf);
|
||||
|
||||
@ -58,7 +58,7 @@ fail:
|
||||
}
|
||||
|
||||
/* EA MPF/MUS combo - used in older 7th gen games for storing interactive music */
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf, const char* mus_name) {
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac_main(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,
|
||||
@ -182,7 +182,7 @@ static VGMSTREAM* init_vgmstream_ea_mpf_mus_eaac(STREAMFILE* sf, const char* mus
|
||||
|
||||
if (index == 0xffff) /* EOF check */
|
||||
goto fail;
|
||||
|
||||
|
||||
entry_offset += 0x0c;
|
||||
if (read_u16(entry_offset + 0x00, sf_mus) != index ||
|
||||
read_u16(entry_offset + 0x02, sf_mus) != sub_index + 1)
|
||||
|
@ -134,7 +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* init_vgmstream_ea_mpf_mus_main(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);
|
||||
@ -316,7 +316,7 @@ VGMSTREAM* init_vgmstream_ea_bnk(STREAMFILE* sf) {
|
||||
|
||||
if (target_stream == 0) target_stream = 1;
|
||||
return parse_bnk_header(sf, 0x00, target_stream - 1, 0);
|
||||
|
||||
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
@ -703,11 +703,11 @@ static STREAMFILE* open_mapfile_pair(STREAMFILE* sf, int track /*, int num_track
|
||||
/* EA loads pairs manually, so complex cases needs .txtm to map
|
||||
* NSF2:
|
||||
* - ZTRxxROK.MAP > ZTRxx.TRJ
|
||||
* - ZTRxxTEC.MAP > ZTRxx.TRM
|
||||
* - ZZSHOW.MAP and ZZSHOW2.MAP > ZZSHOW.MUS
|
||||
* - ZTRxxTEC.MAP > ZTRxx.TRM
|
||||
* - ZZSHOW.MAP and ZZSHOW2.MAP > ZZSHOW.MUS
|
||||
* NSF3:
|
||||
* - ZTRxxROK.MAP > ZZZTRxxA.TRJ
|
||||
* - ZTRxxTEC.MAP > ZZZTRxxB.TRM
|
||||
* - ZTRxxROK.MAP > ZZZTRxxA.TRJ
|
||||
* - ZTRxxTEC.MAP > ZZZTRxxB.TRM
|
||||
* - ZTR00R0A.MAP and ZTR00R0B.MAP > ZZZTR00A.TRJ
|
||||
* SSX 3:
|
||||
* - *.mpf > *.mus,xxloops0.mus
|
||||
@ -861,14 +861,14 @@ fail:
|
||||
}
|
||||
|
||||
/* .MPF - Standard EA MPF+MUS */
|
||||
VGMSTREAM* init_vgmstream_ea_mpf(STREAMFILE* sf) {
|
||||
VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, "mpf"))
|
||||
return NULL;
|
||||
return init_vgmstream_ea_mpf_mus(sf, NULL);
|
||||
return init_vgmstream_ea_mpf_mus_main(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) {
|
||||
VGMSTREAM* init_vgmstream_ea_msb_mus(STREAMFILE* sf) {
|
||||
/* container with MPF, extra info, and a pre-defined MUS filename */
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mpf = NULL;
|
||||
@ -884,7 +884,7 @@ VGMSTREAM* init_vgmstream_ea_msb(STREAMFILE* sf) {
|
||||
mus_name_offset = 0x30;
|
||||
|
||||
/* 0x08: buffer size of the pre-defined .mus filename? (always 0x20)
|
||||
* 0x20: mpf version number? (always 0x05)
|
||||
* 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 */
|
||||
@ -898,7 +898,7 @@ VGMSTREAM* init_vgmstream_ea_msb(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);
|
||||
vgmstream = init_vgmstream_ea_mpf_mus_main(sf_mpf, mus_name);
|
||||
if (!vgmstream) goto fail;
|
||||
close_streamfile(sf_mpf);
|
||||
|
||||
@ -911,7 +911,7 @@ fail:
|
||||
}
|
||||
|
||||
/* EA MPF/MUS combo - used in 6th gen games for interactive music (for EA's PathFinder tool) */
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus(STREAMFILE* sf, const char* mus_name) {
|
||||
static VGMSTREAM* init_vgmstream_ea_mpf_mus_main(STREAMFILE* sf, const char* mus_name) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
STREAMFILE* sf_mus = NULL;
|
||||
segmented_layout_data *data_s = NULL;
|
||||
|
@ -603,8 +603,8 @@ 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 * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf_mus(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb_mus(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);
|
||||
@ -649,8 +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_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_mpf_mus_eaac(STREAMFILE * streamFile);
|
||||
VGMSTREAM * init_vgmstream_ea_msb_mus_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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "meta.h"
|
||||
#include "../coding/coding.h"
|
||||
|
||||
static VGMSTREAM* parse_multistream_header(STREAMFILE* sf_head, STREAMFILE* sf_body, off_t header_offset, off_t start_offset);
|
||||
static VGMSTREAM* init_vgmstream_multistream(STREAMFILE* sf_head, STREAMFILE* sf_body, off_t header_offset, off_t start_offset);
|
||||
|
||||
/* MIH+MIB - SCEE MultiStream interleaved bank (header+data) [namCollection: Ace Combat 2 (PS2), Rampage: Total Destruction (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_mib_mih(STREAMFILE* sf_body) {
|
||||
@ -30,7 +30,7 @@ VGMSTREAM* init_vgmstream_mib_mih(STREAMFILE* sf_body) {
|
||||
}
|
||||
}
|
||||
|
||||
vgmstream = parse_multistream_header(sf_head, sf_body, header_offset, start_offset);
|
||||
vgmstream = init_vgmstream_multistream(sf_head, sf_body, header_offset, start_offset);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_MIB_MIH;
|
||||
@ -61,7 +61,7 @@ VGMSTREAM* init_vgmstream_ps2_mihb(STREAMFILE* sf) {
|
||||
header_offset = 0x00;
|
||||
start_offset = 0x40;
|
||||
|
||||
vgmstream = parse_multistream_header(sf, sf, header_offset, start_offset);
|
||||
vgmstream = init_vgmstream_multistream(sf, sf, header_offset, start_offset);
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
vgmstream->meta_type = meta_PS2_MIHB;
|
||||
@ -73,7 +73,7 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static VGMSTREAM* parse_multistream_header(STREAMFILE* sf_head, STREAMFILE* sf_body, off_t header_offset, off_t start_offset) {
|
||||
static VGMSTREAM* init_vgmstream_multistream(STREAMFILE* sf_head, STREAMFILE* sf_body, off_t header_offset, off_t start_offset) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
size_t data_size, frame_size, frame_last, frame_count;
|
||||
int channels, loop_flag, sample_rate;
|
||||
|
@ -182,8 +182,10 @@ VGMSTREAM* init_vgmstream_vag(STREAMFILE* sf) {
|
||||
/* EoR/Maxis title specific
|
||||
* always blank in Killzone */
|
||||
if (version == 0x02000000) {
|
||||
//uint8_t c = read_u8(0x30, sf); /* maybe better to do (c >= 0x30 && c <= 0x7A)? */
|
||||
if (read_u8(0x30, sf) >= 0x20 && read_u8(0x30, sf) <= 0x7E) stream_name_size = 0x20;
|
||||
//uint8_t c = read_u8(0x30, sf);
|
||||
/* maybe better to do (c >= 0x30 && c <= 0x7A)? */
|
||||
if (read_u8(0x30, sf) >= 0x20 && read_u8(0x30, sf) <= 0x7E)
|
||||
stream_name_size = 0x20;
|
||||
loop_flag = ps_find_loop_offsets(sf, start_offset, channel_size, channels, interleave, &loop_start_sample, &loop_end_sample);
|
||||
}
|
||||
}
|
||||
@ -414,7 +416,7 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* VAGp (footer) - Sims 2 console spinoffs [The Sims 2: Pets (PS2), The Sims 2: Castaway (PS2)] */
|
||||
/* VAGp footer - sound data first, header at the end [The Sims 2: Pets (PS2), The Sims 2: Castaway (PS2)] */
|
||||
VGMSTREAM* init_vgmstream_vag_footer(STREAMFILE* sf) {
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
size_t file_size, stream_size;
|
||||
@ -424,11 +426,9 @@ VGMSTREAM* init_vgmstream_vag_footer(STREAMFILE* sf) {
|
||||
uint32_t version;
|
||||
|
||||
|
||||
file_size = get_streamfile_size(sf);
|
||||
header_offset = file_size - 0x40;
|
||||
|
||||
/* checks */
|
||||
if (!is_id32be(header_offset, sf, "VAGp"))
|
||||
/* check if this begins with valid PS-ADPCM */
|
||||
if (!ps_check_format(sf, 0x00, 0x40))
|
||||
return NULL;
|
||||
|
||||
/* (extensionless): Sims 2 console spinoffs
|
||||
@ -436,6 +436,12 @@ VGMSTREAM* init_vgmstream_vag_footer(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, ",vag"))
|
||||
return NULL;
|
||||
|
||||
file_size = get_streamfile_size(sf);
|
||||
header_offset = file_size - 0x40;
|
||||
|
||||
if (!is_id32be(header_offset, sf, "VAGp"))
|
||||
return NULL;
|
||||
|
||||
|
||||
/* all the data is in little endian */
|
||||
version = read_u32le(header_offset + 0x04, sf);
|
||||
|
@ -293,8 +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,
|
||||
init_vgmstream_ea_msb,
|
||||
init_vgmstream_ea_mpf_mus,
|
||||
init_vgmstream_ea_msb_mus,
|
||||
init_vgmstream_ea_schl_fixed,
|
||||
init_vgmstream_sk_aud,
|
||||
init_vgmstream_stma,
|
||||
@ -321,8 +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_eaac,
|
||||
init_vgmstream_ea_msb_eaac,
|
||||
init_vgmstream_ea_mpf_mus_eaac,
|
||||
init_vgmstream_ea_msb_mus_eaac,
|
||||
init_vgmstream_ea_tmx,
|
||||
init_vgmstream_ea_sbr,
|
||||
init_vgmstream_ea_sbr_harmony,
|
||||
|
Loading…
Reference in New Issue
Block a user