From 6b8acd5d5bde57ac81d453f46aada6a6cf0dc9e0 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Mon, 28 Jul 2014 08:34:04 +0000 Subject: [PATCH] gb_lcd.c: Fix another index out of bound access in the supergb driver (nw) --- src/mess/video/gb_lcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mess/video/gb_lcd.c b/src/mess/video/gb_lcd.c index 53d68296779..17e47fcf891 100644 --- a/src/mess/video/gb_lcd.c +++ b/src/mess/video/gb_lcd.c @@ -793,7 +793,8 @@ void sgb_lcd_device::update_sprites() data = (vram[adr + 1] << 8) | vram[adr]; /* Find the palette to use */ - pal = m_sgb_pal_map[(xindex >> 3)][((yindex - SGB_YOFFSET) >> 3)] << 2; + // If sprite started before the start of the line we may need to pick a different pal_map entry? + pal = m_sgb_pal_map[(xindex < 0) ? 0 : (xindex >> 3)][((yindex - SGB_YOFFSET) >> 3)] << 2; /* Offset to center of screen */ xindex += SGB_XOFFSET;