mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-30 17:24:31 +01:00
DSP: fix asura header checks
This commit is contained in:
parent
b0329b573e
commit
28c6dc4218
@ -18,8 +18,8 @@ VGMSTREAM* init_vgmstream_dsp_asura_sfx(STREAMFILE* sf) {
|
||||
|
||||
/* no clear header id, but this is how they all start */
|
||||
/* the 0x02s are likely channels and codec (DSPADPCM) */
|
||||
if (read_u32be(0x00, sf) != 0x00 &&
|
||||
read_u32be(0x04, sf) != 0x02 &&
|
||||
if (read_u32be(0x00, sf) != 0x00 ||
|
||||
read_u32be(0x04, sf) != 0x02 ||
|
||||
read_u32be(0x08, sf) != 0x02)
|
||||
return NULL;
|
||||
|
||||
@ -44,8 +44,7 @@ VGMSTREAM* init_vgmstream_dsp_asura_sfx(STREAMFILE* sf) {
|
||||
loop_flag = 0;
|
||||
|
||||
/* more safety checks */
|
||||
if (interleave < 0 ||
|
||||
interleave < nibble_count / 2 ||
|
||||
if (interleave < 0 || interleave < nibble_count / 2 ||
|
||||
interleave > get_streamfile_size(sf) / channels)
|
||||
goto fail;
|
||||
|
||||
|
@ -1580,9 +1580,10 @@ VGMSTREAM* init_vgmstream_dsp_asura(STREAMFILE* sf) {
|
||||
uint8_t flag;
|
||||
|
||||
/* checks */
|
||||
if (!is_id32be(0x00, sf, "DSP\x00") && /* GC */
|
||||
!is_id32be(0x00, sf, "DSP\x01") && /* GC/Wii/WiiU */
|
||||
!is_id32be(0x00, sf, "DSP\x02")) /* WiiU */
|
||||
/* "DSP\x00" (GC), "DSP\x01" (GC/Wii/WiiU), "DSP\x02" (WiiU) */
|
||||
if ((read_u32be(0x00, sf) & 0xFFFFFF00) != get_id32be("DSP\0"))
|
||||
return NULL;
|
||||
if (read_u8(0x03, sf) < 0x00 || read_u8(0x03, sf) > 0x02)
|
||||
return NULL;
|
||||
|
||||
/* .dsp: Judge Dredd (GC)
|
||||
@ -1590,7 +1591,7 @@ VGMSTREAM* init_vgmstream_dsp_asura(STREAMFILE* sf) {
|
||||
if (!check_extensions(sf, "dsp,wav,lwav"))
|
||||
return NULL;
|
||||
|
||||
/* flag set to 0x00 so far only seen in Judge Dredd, which also uses 0x01
|
||||
/* flag set to 0x00 so far only seen in Judge Dredd, which also uses 0x01.
|
||||
* at first assumed being 0 means it has a stream name at 0x48 (unlikely) */
|
||||
/* flag set to 0x02 means it's ddsp-like stereo */
|
||||
flag = read_u8(0x03, sf);
|
||||
|
Loading…
Reference in New Issue
Block a user