bestleag: fix spriteram oob access

This commit is contained in:
hap 2022-11-05 12:57:12 +01:00
parent ae0f665dec
commit e5cd19ce20

View File

@ -142,7 +142,7 @@ Note: sprite chip is different than the other Big Striker sets and they
*/
void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint16_t *spriteram16 = m_spriteram;
uint16_t *src = m_spriteram + 0x16/2;
/*
@ -150,18 +150,16 @@ void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
*/
int offs;
for (offs = 0x16/2;offs < m_spriteram.bytes()/2;offs += 4)
for (int offs = 0; offs < 0x7f4; offs += 4)
{
int code = spriteram16[offs+3] & 0xfff;
int color = (spriteram16[offs+2] & 0xf000) >> 12;
int sx = (spriteram16[offs+2] & 0x1ff) - 20;
int sy = (0xff - (spriteram16[offs+0] & 0xff)) - 15;
int flipx = (spriteram16[offs+0] & 0x4000) >> 14;
int code = src[offs+3] & 0xfff;
int color = (src[offs+2] & 0xf000) >> 12;
int sx = (src[offs+2] & 0x1ff) - 20;
int sy = (0xff - (src[offs+0] & 0xff)) - 15;
int flipx = (src[offs+0] & 0x4000) >> 14;
/* Sprite list end code */
if(spriteram16[offs+0] & 0x2000)
if(src[offs+0] & 0x2000)
return;
/* it can change sprites color mask like the original set */