diff options
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 |
commit | f1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch) | |
tree | 97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame/drivers/fresh.cpp | |
parent | 65bfb2654f0c73235f114e9145c766245bed9790 (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/fresh.cpp')
-rw-r--r-- | src/mame/drivers/fresh.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/mame/drivers/fresh.cpp b/src/mame/drivers/fresh.cpp index 469fad4bcc1..7201533c326 100644 --- a/src/mame/drivers/fresh.cpp +++ b/src/mame/drivers/fresh.cpp @@ -34,18 +34,22 @@ rom 5 and 6 are prg roms class fresh_state : public driver_device { public: - fresh_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + fresh_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_bg_videoram(*this, "bg_videoram"), m_bg_2_videoram(*this, "bg_videoram_2"), m_attr_videoram(*this, "attr_videoram"), m_attr_2_videoram(*this, "attr_videoram_2"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette") + { } void fresh(machine_config &config); +protected: + virtual void video_start() override; + private: tilemap_t *m_bg_tilemap; tilemap_t *m_bg_2_tilemap; @@ -55,6 +59,10 @@ private: required_shared_ptr<uint16_t> m_attr_videoram; required_shared_ptr<uint16_t> m_attr_2_videoram; + required_device<cpu_device> m_maincpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + DECLARE_WRITE16_MEMBER(fresh_bg_videoram_w); DECLARE_WRITE16_MEMBER(fresh_attr_videoram_w); TILE_GET_INFO_MEMBER(get_fresh_bg_tile_info); @@ -97,12 +105,7 @@ private: TIMER_DEVICE_CALLBACK_MEMBER(fake_scanline); - - virtual void video_start() override; uint32_t screen_update_fresh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; void fresh_map(address_map &map); }; @@ -608,12 +611,10 @@ MACHINE_CONFIG_START(fresh_state::fresh) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) MCFG_SCREEN_UPDATE_DRIVER(fresh_state, screen_update_fresh) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 0x1000) // or 0xc00 - MCFG_PALETTE_FORMAT(XBGR) + MCFG_SCREEN_PALETTE(m_palette) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fresh) + PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 0x1000); // or 0xc00 + GFXDECODE(config, m_gfxdecode, m_palette, gfx_fresh); /* sound hw? */ SPEAKER(config, "mono").front_center(); |