From bd681be20a358575b9567a670d2302e38c3597e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Mon, 5 Aug 2013 12:58:39 +0000 Subject: [PATCH] PALETTE_INIT modernizations --- src/mess/drivers/ngp.c | 3 --- src/mess/drivers/ti990_10.c | 2 -- src/mess/drivers/ti990_4.c | 4 ---- src/mess/includes/osi.h | 2 ++ src/mess/video/733_asr.c | 6 +++--- src/mess/video/733_asr.h | 3 +-- src/mess/video/911_vdt.c | 8 ++++---- src/mess/video/911_vdt.h | 3 +-- src/mess/video/k1ge.c | 8 ++++---- src/mess/video/k1ge.h | 12 +++++------- src/mess/video/osi.c | 25 ++++++++++++------------- 11 files changed, 32 insertions(+), 44 deletions(-) diff --git a/src/mess/drivers/ngp.c b/src/mess/drivers/ngp.c index d60d62178c9..1c0f744e489 100644 --- a/src/mess/drivers/ngp.c +++ b/src/mess/drivers/ngp.c @@ -103,7 +103,6 @@ the Neogeo Pocket. #include "sound/dac.h" #include "video/k1ge.h" #include "rendlay.h" -#include "drivlgcy.h" enum flash_state { @@ -844,7 +843,6 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( ngp, ngp_common ) MCFG_PALETTE_LENGTH( 8 ) - MCFG_PALETTE_INIT( k1ge ) MCFG_K1GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) @@ -864,7 +862,6 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( ngpc, ngp_common ) MCFG_PALETTE_LENGTH( 4096 ) - MCFG_PALETTE_INIT( k2ge ) MCFG_K2GE_ADD( "k1ge", XTAL_6_144MHz, "screen", WRITELINE( ngp_state, ngp_vblank_pin_w ), WRITELINE( ngp_state, ngp_hblank_pin_w ) ) diff --git a/src/mess/drivers/ti990_10.c b/src/mess/drivers/ti990_10.c index cc14b6aff54..d24949614b1 100644 --- a/src/mess/drivers/ti990_10.c +++ b/src/mess/drivers/ti990_10.c @@ -75,7 +75,6 @@ TODO : #include "machine/990_hd.h" #include "machine/990_tap.h" #include "video/911_vdt.h" -#include "drivlgcy.h" class ti990_10_state : public driver_device @@ -234,7 +233,6 @@ static MACHINE_CONFIG_START( ti990_10, ti990_10_state ) MCFG_GFXDECODE(vdt911) MCFG_PALETTE_LENGTH(8) - MCFG_PALETTE_INIT(vdt911) MCFG_VDT911_VIDEO_ADD("vdt911", vdt911_intf) /* 911 VDT has a beep tone generator */ diff --git a/src/mess/drivers/ti990_4.c b/src/mess/drivers/ti990_4.c index 69e568ff94a..ab16cb9c785 100644 --- a/src/mess/drivers/ti990_4.c +++ b/src/mess/drivers/ti990_4.c @@ -47,8 +47,6 @@ TODO: #include "imagedev/flopdrv.h" #include "machine/990_dk.h" -#include "drivlgcy.h" - class ti990_4_state : public driver_device { @@ -272,10 +270,8 @@ static MACHINE_CONFIG_START( ti990_4, ti990_4_state ) #endif #if VIDEO_911 - MCFG_PALETTE_INIT(vdt911) MCFG_VDT911_VIDEO_ADD("vdt911", vdt911_intf) #else - MCFG_PALETTE_INIT(asr733) MCFG_ASR733_VIDEO_ADD("asr733", asr733_intf) #endif diff --git a/src/mess/includes/osi.h b/src/mess/includes/osi.h index 004f85e5458..b6da6d79367 100644 --- a/src/mess/includes/osi.h +++ b/src/mess/includes/osi.h @@ -74,6 +74,8 @@ public: /* floppy state */ int m_fdc_index; DECLARE_WRITE_LINE_MEMBER(osi470_index_callback); + + DECLARE_PALETTE_INIT(osi630); required_device m_maincpu; required_device m_cassette; diff --git a/src/mess/video/733_asr.c b/src/mess/video/733_asr.c index 254ad2fe279..bcbb303d6dc 100644 --- a/src/mess/video/733_asr.c +++ b/src/mess/video/733_asr.c @@ -93,10 +93,10 @@ GFXDECODE_START( asr733 ) GFXDECODE_ENTRY( asr733_chr_region, 0, fontlayout, 0, 1 ) GFXDECODE_END -PALETTE_INIT( asr733 ) +void asr733_device::palette_init() { - palette_set_color(machine,0,RGB_WHITE); /* white */ - palette_set_color(machine,1,RGB_BLACK); /* black */ + palette_set_color(machine(),0,RGB_WHITE); /* white */ + palette_set_color(machine(),1,RGB_BLACK); /* black */ } /* diff --git a/src/mess/video/733_asr.h b/src/mess/video/733_asr.h index 3b31768fe6b..0d0cee1dc5e 100644 --- a/src/mess/video/733_asr.h +++ b/src/mess/video/733_asr.h @@ -16,8 +16,6 @@ struct asr733_init_params_t GFXDECODE_EXTERN( asr733 ); -PALETTE_INIT( asr733 ); - void asr733_init(running_machine &machine); class asr733_device : public device_t { @@ -32,6 +30,7 @@ protected: virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); + virtual void palette_init(); private: // internal state void *m_token; diff --git a/src/mess/video/911_vdt.c b/src/mess/video/911_vdt.c index 417ecf1a2f2..67fb094edaa 100644 --- a/src/mess/video/911_vdt.c +++ b/src/mess/video/911_vdt.c @@ -131,20 +131,20 @@ static TIMER_CALLBACK(beep_callback); /* Initialize vdt911 palette */ -PALETTE_INIT( vdt911 ) +void vdt911_device::palette_init() { UINT8 i, r, g, b; - machine.colortable = colortable_alloc(machine, 3); + machine().colortable = colortable_alloc(machine(), 3); for ( i = 0; i < 3; i++ ) { r = vdt911_colors[i*3]; g = vdt911_colors[i*3+1]; b = vdt911_colors[i*3+2]; - colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b)); + colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b)); } for(i=0;i<8;i++) - colortable_entry_set_value(machine.colortable, i, vdt911_palette[i]); + colortable_entry_set_value(machine().colortable, i, vdt911_palette[i]); } /* diff --git a/src/mess/video/911_vdt.h b/src/mess/video/911_vdt.h index c8c0c0acc5b..e9b2f140c38 100644 --- a/src/mess/video/911_vdt.h +++ b/src/mess/video/911_vdt.h @@ -40,8 +40,6 @@ struct vdt911_init_params_t void (*int_callback)(running_machine &machine, int state); }; -PALETTE_INIT( vdt911 ); - void vdt911_init(running_machine &machine); class vdt911_device : public device_t { @@ -55,6 +53,7 @@ protected: // device-level overrides virtual void device_config_complete(); virtual void device_start(); + virtual void palette_init(); private: // internal state void *m_token; diff --git a/src/mess/video/k1ge.c b/src/mess/video/k1ge.c index 5282282e448..fe7aed66500 100644 --- a/src/mess/video/k1ge.c +++ b/src/mess/video/k1ge.c @@ -11,7 +11,7 @@ used in the Neogeo pocket color. #include "k1ge.h" -PALETTE_INIT( k1ge ) +void k1ge_device::palette_init() { int i; @@ -19,12 +19,12 @@ PALETTE_INIT( k1ge ) { int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 ); - palette_set_color_rgb( machine, 7-i, j, j, j ); + palette_set_color_rgb( machine(), 7-i, j, j, j ); } } -PALETTE_INIT( k2ge ) +void k2ge_device::palette_init() { int r,g,b; @@ -34,7 +34,7 @@ PALETTE_INIT( k2ge ) { for ( r = 0; r < 16; r++ ) { - palette_set_color_rgb( machine, ( b << 8 ) | ( g << 4 ) | r, ( r << 4 ) | r, ( g << 4 ) | g, ( b << 4 ) | b ); + palette_set_color_rgb( machine(), ( b << 8 ) | ( g << 4 ) | r, ( r << 4 ) | r, ( g << 4 ) | g, ( b << 4 ) | b ); } } } diff --git a/src/mess/video/k1ge.h b/src/mess/video/k1ge.h index 66bdd1b97fb..a46e00c41de 100644 --- a/src/mess/video/k1ge.h +++ b/src/mess/video/k1ge.h @@ -27,7 +27,7 @@ public: DECLARE_WRITE8_MEMBER( reg_write ); DECLARE_READ8_MEMBER( vram_read ); DECLARE_WRITE8_MEMBER( vram_write ); - + void update( bitmap_ind16 &bitmap, const rectangle &cliprect ); // Static methods @@ -38,7 +38,8 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void device_reset(); + virtual void device_reset(); + virtual void palette_init(); devcb2_write_line m_vblank_pin_w; devcb2_write_line m_hblank_pin_w; @@ -65,6 +66,8 @@ public: k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: + virtual void palette_init(); + virtual void draw(int line); void draw_scroll_plane( UINT16 *p, UINT16 base, int line, int scroll_x, int scroll_y, UINT16 pal_base ); @@ -74,11 +77,6 @@ protected: }; - -PALETTE_INIT( k1ge ); -PALETTE_INIT( k2ge ); - - extern const device_type K1GE; extern const device_type K2GE; diff --git a/src/mess/video/osi.c b/src/mess/video/osi.c index 64bf8f1dd4c..b328de8e207 100644 --- a/src/mess/video/osi.c +++ b/src/mess/video/osi.c @@ -1,23 +1,22 @@ #include "includes/osi.h" -#include "drivlgcy.h" /* Palette Initialization */ -static PALETTE_INIT( osi630 ) +PALETTE_INIT_MEMBER(sb2m600_state, osi630) { /* black and white */ - palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black - palette_set_color_rgb(machine, 1, 0xff, 0xff, 0xff); // white + palette_set_color_rgb(machine(), 0, 0x00, 0x00, 0x00); // black + palette_set_color_rgb(machine(), 1, 0xff, 0xff, 0xff); // white /* color enabled */ - palette_set_color_rgb(machine, 2, 0xff, 0xff, 0x00); // yellow - palette_set_color_rgb(machine, 3, 0xff, 0x00, 0x00); // red - palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green - palette_set_color_rgb(machine, 5, 0x00, 0x80, 0x00); // olive green - palette_set_color_rgb(machine, 6, 0x00, 0x00, 0xff); // blue - palette_set_color_rgb(machine, 7, 0xff, 0x00, 0xff); // purple - palette_set_color_rgb(machine, 8, 0x00, 0x00, 0x80); // sky blue - palette_set_color_rgb(machine, 9, 0x00, 0x00, 0x00); // black + palette_set_color_rgb(machine(), 2, 0xff, 0xff, 0x00); // yellow + palette_set_color_rgb(machine(), 3, 0xff, 0x00, 0x00); // red + palette_set_color_rgb(machine(), 4, 0x00, 0xff, 0x00); // green + palette_set_color_rgb(machine(), 5, 0x00, 0x80, 0x00); // olive green + palette_set_color_rgb(machine(), 6, 0x00, 0x00, 0xff); // blue + palette_set_color_rgb(machine(), 7, 0xff, 0x00, 0xff); // purple + palette_set_color_rgb(machine(), 8, 0x00, 0x00, 0x80); // sky blue + palette_set_color_rgb(machine(), 9, 0x00, 0x00, 0x00); // black } /* Video Start */ @@ -174,5 +173,5 @@ MACHINE_CONFIG_FRAGMENT( osi630_video ) MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) MCFG_PALETTE_LENGTH(8+2) - MCFG_PALETTE_INIT(osi630) + MCFG_PALETTE_INIT_OVERRIDE(sb2m600_state, osi630) MACHINE_CONFIG_END