moar (nw)

This commit is contained in:
Vas Crabb 2018-05-14 11:36:03 +10:00
parent 75f1e7f86d
commit db2c8c9555
8 changed files with 38 additions and 33 deletions

View File

@ -64,7 +64,7 @@ public:
template <class Object> devcb_base &set_lv4irqline_callback(Object &&cb) { return m_lv4irqline_callback.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_lv4irqline_callback(Object &&cb) { return m_lv4irqline_callback.set_callback(std::forward<Object>(cb)); }
void set_alt_timing(int use_alt_timing) { m_use_alt_timing = use_alt_timing; } void set_alt_timing(int use_alt_timing) { m_use_alt_timing = use_alt_timing; }
void set_palwrite_base(int palwrite_base) { m_palwrite_base = palwrite_base; } void set_palwrite_base(int palwrite_base) { m_palwrite_base = palwrite_base; }
void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
template <typename Object> void set_md_32x_scanline(Object &&cb) { m_32x_scanline_func = std::forward<Object>(cb); } template <typename Object> void set_md_32x_scanline(Object &&cb) { m_32x_scanline_func = std::forward<Object>(cb); }
template <typename Object> void set_md_32x_interrupt(Object &&cb) { m_32x_interrupt_func = std::forward<Object>(cb); } template <typename Object> void set_md_32x_interrupt(Object &&cb) { m_32x_interrupt_func = std::forward<Object>(cb); }

View File

@ -32,7 +32,7 @@ public:
ef9345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ef9345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration // configuration
void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
// device interface // device interface
DECLARE_READ8_MEMBER( data_r ); DECLARE_READ8_MEMBER( data_r );

View File

@ -43,7 +43,7 @@ public:
ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration // configuration
void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
void set_nb_of_pages(int nb_bitplanes) { void set_nb_of_pages(int nb_bitplanes) {
if (nb_bitplanes > 0 && nb_bitplanes <= 8) if (nb_bitplanes > 0 && nb_bitplanes <= 8)
{ {

View File

@ -49,7 +49,7 @@ public:
ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration // configuration
void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } template <typename T> void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward<T>(tag)); }
void set_nb_bitplanes(int nb_bitplanes ); void set_nb_bitplanes(int nb_bitplanes );
void set_display_mode(int display_mode ); void set_display_mode(int display_mode );
template<class Object> devcb_base &set_irq_handler(Object object) { return m_irq_handler.set_callback(std::forward<Object>(object)); } template<class Object> devcb_base &set_irq_handler(Object object) { return m_irq_handler.set_callback(std::forward<Object>(object)); }

View File

@ -15,13 +15,18 @@
class dmg_ppu_device : public device_t, class dmg_ppu_device : public device_t, public device_video_interface
public device_video_interface
{ {
public: public:
template <typename T>
dmg_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag)
: dmg_ppu_device(mconfig, tag, owner, u32(0))
{
set_lr35902_tag(std::forward<T>(cpu_tag));
}
dmg_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); dmg_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_lr35902_tag(const char *tag) { m_lr35902.set_tag(tag); } template <typename T> void set_lr35902_tag(T &&tag) { m_lr35902.set_tag(std::forward<T>(tag)); }
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -231,6 +236,12 @@ private:
class mgb_ppu_device : public dmg_ppu_device class mgb_ppu_device : public dmg_ppu_device
{ {
public: public:
template <typename T>
mgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag)
: mgb_ppu_device(mconfig, tag, owner, u32(0))
{
set_lr35902_tag(std::forward<T>(cpu_tag));
}
mgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); mgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected: protected:
@ -243,6 +254,12 @@ protected:
class sgb_ppu_device : public dmg_ppu_device class sgb_ppu_device : public dmg_ppu_device
{ {
public: public:
template <typename T>
sgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag)
: sgb_ppu_device(mconfig, tag, owner, u32(0))
{
set_lr35902_tag(std::forward<T>(cpu_tag));
}
sgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); sgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void sgb_io_write_pal(int offs, uint8_t *data); void sgb_io_write_pal(int offs, uint8_t *data);
@ -264,6 +281,12 @@ protected:
class cgb_ppu_device : public dmg_ppu_device class cgb_ppu_device : public dmg_ppu_device
{ {
public: public:
template <typename T>
cgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag)
: cgb_ppu_device(mconfig, tag, owner, u32(0))
{
set_lr35902_tag(std::forward<T>(cpu_tag));
}
cgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); cgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual DECLARE_READ8_MEMBER(video_r) override; virtual DECLARE_READ8_MEMBER(video_r) override;
@ -292,22 +315,4 @@ DECLARE_DEVICE_TYPE(MGB_PPU, mgb_ppu_device)
DECLARE_DEVICE_TYPE(SGB_PPU, sgb_ppu_device) DECLARE_DEVICE_TYPE(SGB_PPU, sgb_ppu_device)
DECLARE_DEVICE_TYPE(CGB_PPU, cgb_ppu_device) DECLARE_DEVICE_TYPE(CGB_PPU, cgb_ppu_device)
#define MCFG_DMG_PPU_ADD(_tag, _cpu_tag ) \
MCFG_DEVICE_ADD( _tag, DMG_PPU, 0 ) \
downcast<dmg_ppu_device &>(*device).set_lr35902_tag(_cpu_tag);
#define MCFG_MGB_PPU_ADD(_tag, _cpu_tag ) \
MCFG_DEVICE_ADD( _tag, MGB_PPU, 0 ) \
downcast<dmg_ppu_device &>(*device).set_lr35902_tag(_cpu_tag);
#define MCFG_SGB_PPU_ADD(_tag, _cpu_tag ) \
MCFG_DEVICE_ADD( _tag, SGB_PPU, 0 ) \
downcast<dmg_ppu_device &>(*device).set_lr35902_tag(_cpu_tag);
#define MCFG_CGB_PPU_ADD(_tag, _cpu_tag ) \
MCFG_DEVICE_ADD( _tag, CGB_PPU, 0 ) \
downcast<dmg_ppu_device &>(*device).set_lr35902_tag(_cpu_tag);
#endif // MAME_VIDEO_GB_LCD_H #endif // MAME_VIDEO_GB_LCD_H

View File

@ -41,7 +41,7 @@ public:
huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward<Object>(cb)); }
template <typename T> void set_rainbow_tag(const char *tag) { m_huc6271.set_tag(std::forward<T>(tag)); } template <typename T> void set_rainbow_tag(T &&tag) { m_huc6271.set_tag(std::forward<T>(tag)); }
// I/O operations // I/O operations
DECLARE_WRITE32_MEMBER( write ); DECLARE_WRITE32_MEMBER( write );

View File

@ -278,7 +278,7 @@ class ibm8514a_device : public device_t
public: public:
ibm8514a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ibm8514a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_vga(const char *tag) { m_vga.set_tag(tag); } template <typename T> void set_vga(T &&tag) { m_vga.set_tag(std::forward<T>(tag)); }
void set_vga_owner() { m_vga.set_tag(DEVICE_SELF); } void set_vga_owner() { m_vga.set_tag(DEVICE_SELF); }
void enabled(); void enabled();

View File

@ -634,7 +634,7 @@ MACHINE_CONFIG_START(gb_state::gameboy)
MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_ADD("palette", 4)
MCFG_PALETTE_INIT_OWNER(gb_state,gb) MCFG_PALETTE_INIT_OWNER(gb_state,gb)
MCFG_DMG_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu")
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -676,7 +676,7 @@ MACHINE_CONFIG_START(gb_state::supergb)
MCFG_PALETTE_ADD("palette", 32768) MCFG_PALETTE_ADD("palette", 32768)
MCFG_PALETTE_INIT_OWNER(gb_state,sgb) MCFG_PALETTE_INIT_OWNER(gb_state,sgb)
MCFG_SGB_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu")
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -714,7 +714,7 @@ MACHINE_CONFIG_START(gb_state::supergb2)
MCFG_PALETTE_INIT_OWNER(gb_state,sgb) MCFG_PALETTE_INIT_OWNER(gb_state,sgb)
MCFG_DEVICE_REMOVE("ppu") MCFG_DEVICE_REMOVE("ppu")
MCFG_SGB_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu")
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -726,7 +726,7 @@ MACHINE_CONFIG_START(gb_state::gbpocket)
MCFG_PALETTE_INIT_OWNER(gb_state,gbp) MCFG_PALETTE_INIT_OWNER(gb_state,gbp)
MCFG_DEVICE_REMOVE("ppu") MCFG_DEVICE_REMOVE("ppu")
MCFG_MGB_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", MGB_PPU, "maincpu")
MACHINE_CONFIG_END MACHINE_CONFIG_END
MACHINE_CONFIG_START(gb_state::gbcolor) MACHINE_CONFIG_START(gb_state::gbcolor)
@ -756,7 +756,7 @@ MACHINE_CONFIG_START(gb_state::gbcolor)
MCFG_PALETTE_ADD("palette", 32768) MCFG_PALETTE_ADD("palette", 32768)
MCFG_PALETTE_INIT_OWNER(gb_state,gbc) MCFG_PALETTE_INIT_OWNER(gb_state,gbc)
MCFG_CGB_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", CGB_PPU, "maincpu")
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -803,7 +803,7 @@ MACHINE_CONFIG_START(megaduck_state::megaduck)
MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_ADD("palette", 4)
MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck) MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck)
MCFG_DMG_PPU_ADD("ppu", "maincpu") MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu")
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();