summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author MooglyGuy <therealmogminer@gmail.com>2019-01-20 17:33:10 +0100
committer MooglyGuy <therealmogminer@gmail.com>2019-01-20 17:33:21 +0100
commite1486c9a2a05fbe4833e47a276be95f0660b3c7f (patch)
tree6edecf00e7efda08a9603aa15a515b91bbc53d24
parent202ccfc3bda1c23c75183c576ec670df2fc3d38e (diff)
-spg2xx: Added palette viewer mode when video debugging is turned on, nw
-rw-r--r--src/devices/machine/spg2xx.cpp26
-rw-r--r--src/devices/machine/spg2xx.h1
2 files changed, 24 insertions, 3 deletions
diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp
index 96336571dc5..64c6e95d2f1 100644
--- a/src/devices/machine/spg2xx.cpp
+++ b/src/devices/machine/spg2xx.cpp
@@ -170,6 +170,7 @@ void spg2xx_device::device_start()
save_item(NAME(m_hide_sprites));
save_item(NAME(m_debug_sprites));
save_item(NAME(m_debug_blit));
+ save_item(NAME(m_debug_palette));
save_item(NAME(m_sprite_index_to_debug));
save_item(NAME(m_debug_samples));
@@ -255,7 +256,8 @@ void spg2xx_device::device_reset()
m_hide_sprites = false;
m_debug_sprites = false;
m_debug_blit = false;
- m_sprite_index_to_debug = 44;
+ m_debug_palette = false;
+ m_sprite_index_to_debug = 0;
m_debug_samples = false;
m_debug_rates = false;
@@ -531,8 +533,6 @@ void spg2xx_device::blit_sprite(const rectangle &cliprect, uint32_t scanline, in
if (test_y != scanline)
{
- if (SPG_DEBUG_VIDEO && machine().input().code_pressed(KEYCODE_L))
- printf("Rejecting because %d > %d\n", test_y, scanline);
return;
}
@@ -690,6 +690,24 @@ uint32_t spg2xx_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma
memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1));
}
+ if (SPG_DEBUG_VIDEO && m_debug_palette)
+ {
+ for (int y = cliprect.min_y; y <= cliprect.max_y; 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++)
+ {
+ 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];
+ }
+ }
+ }
+ }
return 0;
}
@@ -944,6 +962,8 @@ WRITE_LINE_MEMBER(spg2xx_device::vblank)
m_sprite_index_to_debug--;
if (machine().input().code_pressed_once(KEYCODE_0))
m_sprite_index_to_debug++;
+ if (machine().input().code_pressed_once(KEYCODE_L))
+ m_debug_palette = !m_debug_palette;
#endif
#if SPG_DEBUG_AUDIO
diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h
index 7f18d5c8125..78532a5d60e 100644
--- a/src/devices/machine/spg2xx.h
+++ b/src/devices/machine/spg2xx.h
@@ -466,6 +466,7 @@ protected:
bool m_hide_sprites;
bool m_debug_sprites;
bool m_debug_blit;
+ bool m_debug_palette;
uint8_t m_sprite_index_to_debug;
bool m_debug_samples;