summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author MooglyGuy <therealmogminer@gmail.com>2019-01-20 18:38:16 +0100
committer MooglyGuy <therealmogminer@gmail.com>2019-01-20 18:38:26 +0100
commit30ca803ec56da895533d7eed5e81cacb4f0a786b (patch)
tree01c2528132527a9cadc6dd1d62a0e911c70b1211
parent83d558d0962efbb20cfa8e3589b9377e10818e1c (diff)
-spg2xx: Early-out if trying to blit a scanline outside the visible range. Fixes palette trashing in jak_disf. [Ryan Holtz]
-rw-r--r--src/devices/machine/spg2xx.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp
index 64c6e95d2f1..dcebfa1275a 100644
--- a/src/devices/machine/spg2xx.cpp
+++ b/src/devices/machine/spg2xx.cpp
@@ -323,10 +323,13 @@ void spg2xx_device::blit(const rectangle &cliprect, uint32_t line, uint32_t xoff
if (yy >= 0x01c0)
yy -= 0x0200;
- if (SPG_DEBUG_VIDEO && m_debug_blit)
+ if (yy > 240 || yy < 0)
+ return;
+
+ if (SPG_DEBUG_VIDEO && m_debug_blit)
printf("%3d:\n", yy);
- int y_index = yy * 320;
+ int y_index = yy * 320;
for (int32_t x = FlipX ? (w - 1) : 0; FlipX ? x >= 0 : x < w; FlipX ? x-- : x++)
{
@@ -692,19 +695,21 @@ uint32_t spg2xx_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
if (SPG_DEBUG_VIDEO && m_debug_palette)
{
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ printf("Palette entry 0x37 is: %04x, which maps to an RGB value of %08x\n", m_paletteram[0x37], m_rgb555_to_rgb888[m_paletteram[0x37] & 0x7fff]);
+ for (int y = cliprect.min_y; y <= cliprect.max_y && y < 128; y++)
{
const uint16_t high_nybble = (y / 8) << 4;
uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.min_x; x <= cliprect.max_x && x < 256; x++)
{
const uint16_t low_nybble = x / 16;
const uint16_t palette_entry = high_nybble | low_nybble;
const uint16_t color = m_paletteram[palette_entry];
if (!(color & 0x8000))
{
- *dest++ = m_rgb555_to_rgb888[color & 0x7fff];
+ *dest = m_rgb555_to_rgb888[color & 0x7fff];
}
+ dest++;
}
}
}