diff options
Diffstat (limited to 'src/mess/drivers/vboy.c')
-rw-r--r-- | src/mess/drivers/vboy.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/mess/drivers/vboy.c b/src/mess/drivers/vboy.c index 6daf247c354..2379174c904 100644 --- a/src/mess/drivers/vboy.c +++ b/src/mess/drivers/vboy.c @@ -211,7 +211,7 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - virtual void palette_init(); + DECLARE_PALETTE_INIT(vboy); UINT32 screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(timer_main_tick); @@ -264,7 +264,7 @@ void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, if (dat) { if (cliprect.contains(res_x, res_y)) - bitmap.pix16((res_y), (res_x)) = machine().pens[col]; + bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); } } } @@ -379,7 +379,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, UI } if(pix != -1) - bitmap.pix16(y1, x1) = machine().pens[pix & 3]; + bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -424,7 +424,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect if(pix != -1) if (cliprect.contains(x1, y1)) - bitmap.pix16(y1, x1) = machine().pens[pix & 3]; + bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -545,7 +545,7 @@ UINT8 vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle & UINT32 vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bitmap.fill(machine().pens[m_vip_regs.BKCOL], cliprect); + bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); int cur_spt; if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ @@ -571,7 +571,7 @@ UINT32 vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 & yi = ((y & 0x3)*2); pix = (pen >> yi) & 3; - bitmap.pix16(y, x) = machine().pens[pix & 3]; + bitmap.pix16(y, x) = m_palette->pen(pix & 3); } } } @@ -581,7 +581,7 @@ UINT32 vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 & UINT32 vboy_state::screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bitmap.fill(machine().pens[m_vip_regs.BKCOL], cliprect); + bitmap.fill(m_palette->pen(m_vip_regs.BKCOL), cliprect); int cur_spt; if(!(m_vip_regs.DPCTRL & 2)) /* Don't bother if screen is off */ @@ -757,9 +757,9 @@ void vboy_state::m_set_brightness(void) if(c > 0xff) { c = 0xff; } // popmessage("%02x %02x %02x %02x",m_vip_regs.BRTA,m_vip_regs.BRTB,m_vip_regs.BRTC,m_vip_regs.REST); - palette_set_color_rgb(machine(), 1, a,0,0); - palette_set_color_rgb(machine(), 2, b,0,0); - palette_set_color_rgb(machine(), 3, c,0,0); + m_palette->set_pen_color(1, a,0,0); + m_palette->set_pen_color(2, b,0,0); + m_palette->set_pen_color(3, c,0,0); } READ16_MEMBER( vboy_state::vip_r ) @@ -1249,12 +1249,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_pad_tick) m_maincpu->set_input_line(0, HOLD_LINE); } -void vboy_state::palette_init() +PALETTE_INIT_MEMBER(vboy_state, vboy) { - palette_set_color(machine(), 0, rgb_t::black); - palette_set_color(machine(), 1, rgb_t::black); - palette_set_color(machine(), 2, rgb_t::black); - palette_set_color(machine(), 3, rgb_t::black); + palette.set_pen_color(0, rgb_t::black); + palette.set_pen_color(1, rgb_t::black); + palette.set_pen_color(2, rgb_t::black); + palette.set_pen_color(3, rgb_t::black); } void vboy_state::m_set_irq(UINT16 irq_vector) @@ -1430,7 +1430,8 @@ static MACHINE_CONFIG_START( vboy, vboy_state ) /* video hardware */ MCFG_DEFAULT_LAYOUT(layout_vboy) - MCFG_PALETTE_LENGTH(4) + MCFG_PALETTE_ADD("palette", 4) + MCFG_PALETTE_INIT_OWNER(vboy_state, vboy) /* Left screen */ MCFG_SCREEN_ADD("3dleft", RASTER) |