summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/mgames.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
committer Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
commitf1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch)
tree97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame/drivers/mgames.cpp
parent65bfb2654f0c73235f114e9145c766245bed9790 (diff)
Start cleaning up palette configuration:
* Basically, initialisers go in the constructor arguments, and things for setting format go in set_format. * Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag. * Formats can be specified with an enum discriminator or a size and function pointer. * You must always supply the number of entries when setting the format. * When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together. * The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation. * Also killed an overload on delegates that wasn't being useful.
Diffstat (limited to 'src/mame/drivers/mgames.cpp')
-rw-r--r--src/mame/drivers/mgames.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/mame/drivers/mgames.cpp b/src/mame/drivers/mgames.cpp
index 30c1533c586..f171c7ea4ce 100644
--- a/src/mame/drivers/mgames.cpp
+++ b/src/mame/drivers/mgames.cpp
@@ -247,7 +247,7 @@ private:
DECLARE_WRITE8_MEMBER(outport5_w);
DECLARE_WRITE8_MEMBER(outport6_w);
DECLARE_WRITE8_MEMBER(outport7_w);
- DECLARE_PALETTE_INIT(mgames);
+ void mgames_palette(palette_device &palette) const;
uint32_t screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
@@ -270,30 +270,25 @@ void mgames_state::video_start()
uint32_t mgames_state::screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int y,x;
- int count;
- gfx_element *gfx = m_gfxdecode->gfx(0);
+ gfx_element *const gfx = m_gfxdecode->gfx(0);
- count = 0;
- for (y = 0; y < 32; y++)
+ int count = 0;
+ for (int y = 0; y < 32; y++)
{
- for (x = 0; x < 32; x++)
+ for (int x = 0; x < 32; x++)
{
- uint16_t dat = m_video[count];
- uint16_t col = m_video[count + 0x400] & 0x7f;
+ uint16_t const dat = m_video[count];
+ uint16_t const col = m_video[count + 0x400] & 0x7f;
gfx->opaque(bitmap, cliprect, dat, col, 0, 0, x * 16, y * 16);
count++;
}
-
}
return 0;
}
-PALETTE_INIT_MEMBER(mgames_state, mgames)
+void mgames_state::mgames_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
rgb_t color;
@@ -659,11 +654,10 @@ MACHINE_CONFIG_START(mgames_state::mgames)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(mgames_state, screen_update_mgames)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mgames)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(mgames_state, mgames)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mgames);
+ PALETTE(config, m_palette, FUNC(mgames_state::mgames_palette), 0x200);
/* sound hardware */
// to do...