Add .sps in Frostbite(?) containers [Need For Speed Rivals (PS4)]

This commit is contained in:
bnnm 2018-04-20 00:22:40 +02:00
parent 46f333cc8e
commit 84b1b31608
3 changed files with 45 additions and 0 deletions

View File

@ -108,6 +108,48 @@ fail:
return NULL;
}
/* .SPS? - from Frostbite engine games? [Need for Speed Rivals (PS4)], v1 header */
VGMSTREAM * init_vgmstream_ea_sps_fb(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset = 0, header_offset = 0, sps_offset, max_offset;
/* checks */
/* assumed to be .sps (no extensions in the archives) */
if (!check_extensions(streamFile,"sps"))
goto fail;
if (read_32bitBE(0x00,streamFile) != 0x011006C0)
goto fail;
/* file has some kind of data before .sps, exact offset unknown.
* Actual offsets are probably somewhere but for now just manually search. */
sps_offset = read_32bitBE(0x08, streamFile); /* points to some kind of table, number of entries unknown */
max_offset = sps_offset + 0x3000;
if (max_offset > get_streamfile_size(streamFile))
max_offset = get_streamfile_size(streamFile);
/* find .sps start block */
while (sps_offset < max_offset) {
if ((read_32bitBE(sps_offset, streamFile) & 0xFFFFFF00) == 0x48000000) {
header_offset = sps_offset + 0x04;
start_offset = sps_offset + (read_32bitBE(sps_offset, streamFile) & 0x00FFFFFF);
break;
}
sps_offset += 0x04;
}
if (!start_offset)
goto fail; /* not found */
vgmstream = init_vgmstream_eaaudiocore_header(streamFile, streamFile, header_offset, start_offset, meta_EA_SPS);
if (!vgmstream) goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}
/* EA newest header from RwAudioCore (RenderWare?) / EAAudioCore library (still generated by sx.exe).
* Audio "assets" come in separate RAM headers (.SNR/SPH) and raw blocked streams (.SNS/SPS),

View File

@ -738,4 +738,6 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_smc_smh(STREAMFILE * streamFile);
VGMSTREAM * init_vgmstream_ea_sps_fb(STREAMFILE *streamFile);
#endif /*_META_H*/

View File

@ -399,6 +399,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_msb_msh,
init_vgmstream_txtp,
init_vgmstream_smc_smh,
init_vgmstream_ea_sps_fb,
init_vgmstream_txth, /* should go at the end (lower priority) */
#ifdef VGM_USE_FFMPEG