Reject wrong RWSD and lower priority

This commit is contained in:
bnnm 2022-12-31 17:05:43 +01:00
parent 4e3c3f13de
commit 5fdb71dbb1
2 changed files with 9 additions and 3 deletions

View File

@ -106,6 +106,12 @@ VGMSTREAM* init_vgmstream_rwsd(STREAMFILE* sf) {
stream_size = read_32bitBE(wave_offset + 0x50,sf);
/* this meta is a hack as WSD is just note info, and data offsets are elsewhere in the brsar,
* while this assumes whatever data follows RWSD must belong to it (common but fails in Wii Sports),
* detect data excess and reject (probably should use brawlbox's info offsets) */
if (stream_size * channels + 0x10000 < get_streamfile_size(sf) - start_offset)
goto fail;
/* open the file for reading by each channel */
{
int i;

View File

@ -38,7 +38,6 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_gcsw,
init_vgmstream_ads,
init_vgmstream_nps,
init_vgmstream_rwsd,
init_vgmstream_xa,
init_vgmstream_rxws,
init_vgmstream_ngc_dsp_stm,
@ -542,10 +541,10 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
init_vgmstream_txth, /* proper parsers should supersede TXTH, once added */
init_vgmstream_dtk,
init_vgmstream_dtk, /* semi-raw GC streamed files */
init_vgmstream_mpeg, /* semi-raw MP3 */
init_vgmstream_encrypted, /* encrypted stuff */
init_vgmstream_btsnd, /* semi-headerless */
init_vgmstream_encrypted, /* encrypted stuff */
init_vgmstream_raw_int, /* .int raw PCM */
init_vgmstream_ps_headerless, /* tries to detect a bunch of PS-ADPCM formats */
init_vgmstream_raw_snds, /* .snds raw SNDS IMA */
@ -560,6 +559,7 @@ VGMSTREAM* (*init_vgmstream_functions[])(STREAMFILE* sf) = {
init_vgmstream_ps2_adm, /* weird non-constant PSX blocks */
init_vgmstream_baf_badrip, /* crap, to be removed */
init_vgmstream_rxws_badrip, /* crap, to be removed */
init_vgmstream_rwsd, /* crap, to be removed */
#ifdef VGM_USE_FFMPEG
init_vgmstream_ffmpeg, /* may play anything incorrectly, since FFmpeg doesn't check extensions */
#endif