From db2c8c9555c6e698e946b7b73a1f552c174b1272 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 14 May 2018 11:36:03 +1000 Subject: [PATCH] moar (nw) --- src/devices/video/315_5313.h | 2 +- src/devices/video/ef9345.h | 2 +- src/devices/video/ef9364.h | 2 +- src/devices/video/ef9365.h | 2 +- src/devices/video/gb_lcd.h | 47 ++++++++++++++++++++---------------- src/devices/video/huc6272.h | 2 +- src/devices/video/pc_vga.h | 2 +- src/mame/drivers/gb.cpp | 12 ++++----- 8 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/devices/video/315_5313.h b/src/devices/video/315_5313.h index 412e28fb094..1d51fa1de91 100644 --- a/src/devices/video/315_5313.h +++ b/src/devices/video/315_5313.h @@ -64,7 +64,7 @@ public: template devcb_base &set_lv4irqline_callback(Object &&cb) { return m_lv4irqline_callback.set_callback(std::forward(cb)); } 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_palette_tag(const char *tag) { m_palette.set_tag(tag); } + template void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward(tag)); } template void set_md_32x_scanline(Object &&cb) { m_32x_scanline_func = std::forward(cb); } template void set_md_32x_interrupt(Object &&cb) { m_32x_interrupt_func = std::forward(cb); } diff --git a/src/devices/video/ef9345.h b/src/devices/video/ef9345.h index b6944dcb548..f55007b49fc 100644 --- a/src/devices/video/ef9345.h +++ b/src/devices/video/ef9345.h @@ -32,7 +32,7 @@ public: ef9345_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } + template void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward(tag)); } // device interface DECLARE_READ8_MEMBER( data_r ); diff --git a/src/devices/video/ef9364.h b/src/devices/video/ef9364.h index 2ecf4079e04..1e895e3add5 100644 --- a/src/devices/video/ef9364.h +++ b/src/devices/video/ef9364.h @@ -43,7 +43,7 @@ public: ef9364_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } + template void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward(tag)); } void set_nb_of_pages(int nb_bitplanes) { if (nb_bitplanes > 0 && nb_bitplanes <= 8) { diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h index 6ecdeec6d72..1a00ca33479 100644 --- a/src/devices/video/ef9365.h +++ b/src/devices/video/ef9365.h @@ -49,7 +49,7 @@ public: ef9365_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - void set_palette_tag(const char *tag) { m_palette.set_tag(tag); } + template void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward(tag)); } void set_nb_bitplanes(int nb_bitplanes ); void set_display_mode(int display_mode ); template devcb_base &set_irq_handler(Object object) { return m_irq_handler.set_callback(std::forward(object)); } diff --git a/src/devices/video/gb_lcd.h b/src/devices/video/gb_lcd.h index 530788d4de2..2de6c66ba10 100644 --- a/src/devices/video/gb_lcd.h +++ b/src/devices/video/gb_lcd.h @@ -15,13 +15,18 @@ -class dmg_ppu_device : public device_t, - public device_video_interface +class dmg_ppu_device : public device_t, public device_video_interface { public: + template + 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(cpu_tag)); + } 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 void set_lr35902_tag(T &&tag) { m_lr35902.set_tag(std::forward(tag)); } 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 { public: + template + 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(cpu_tag)); + } mgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: @@ -243,6 +254,12 @@ protected: class sgb_ppu_device : public dmg_ppu_device { public: + template + 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(cpu_tag)); + } 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); @@ -264,6 +281,12 @@ protected: class cgb_ppu_device : public dmg_ppu_device { public: + template + 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(cpu_tag)); + } cgb_ppu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 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(CGB_PPU, cgb_ppu_device) - -#define MCFG_DMG_PPU_ADD(_tag, _cpu_tag ) \ - MCFG_DEVICE_ADD( _tag, DMG_PPU, 0 ) \ - downcast(*device).set_lr35902_tag(_cpu_tag); - -#define MCFG_MGB_PPU_ADD(_tag, _cpu_tag ) \ - MCFG_DEVICE_ADD( _tag, MGB_PPU, 0 ) \ - downcast(*device).set_lr35902_tag(_cpu_tag); - -#define MCFG_SGB_PPU_ADD(_tag, _cpu_tag ) \ - MCFG_DEVICE_ADD( _tag, SGB_PPU, 0 ) \ - downcast(*device).set_lr35902_tag(_cpu_tag); - -#define MCFG_CGB_PPU_ADD(_tag, _cpu_tag ) \ - MCFG_DEVICE_ADD( _tag, CGB_PPU, 0 ) \ - downcast(*device).set_lr35902_tag(_cpu_tag); - - #endif // MAME_VIDEO_GB_LCD_H diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h index 0c83e275f10..0ceaeb18b9e 100644 --- a/src/devices/video/huc6272.h +++ b/src/devices/video/huc6272.h @@ -41,7 +41,7 @@ public: huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); template devcb_base &set_irq_changed_callback(Object &&cb) { return m_irq_changed_cb.set_callback(std::forward(cb)); } - template void set_rainbow_tag(const char *tag) { m_huc6271.set_tag(std::forward(tag)); } + template void set_rainbow_tag(T &&tag) { m_huc6271.set_tag(std::forward(tag)); } // I/O operations DECLARE_WRITE32_MEMBER( write ); diff --git a/src/devices/video/pc_vga.h b/src/devices/video/pc_vga.h index 5675d8f4de7..6dc4fa6737e 100644 --- a/src/devices/video/pc_vga.h +++ b/src/devices/video/pc_vga.h @@ -278,7 +278,7 @@ class ibm8514a_device : public device_t public: 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 void set_vga(T &&tag) { m_vga.set_tag(std::forward(tag)); } void set_vga_owner() { m_vga.set_tag(DEVICE_SELF); } void enabled(); diff --git a/src/mame/drivers/gb.cpp b/src/mame/drivers/gb.cpp index 19faa85fd4c..4e690bd4637 100644 --- a/src/mame/drivers/gb.cpp +++ b/src/mame/drivers/gb.cpp @@ -634,7 +634,7 @@ MACHINE_CONFIG_START(gb_state::gameboy) MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(gb_state,gb) - MCFG_DMG_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu") /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -676,7 +676,7 @@ MACHINE_CONFIG_START(gb_state::supergb) MCFG_PALETTE_ADD("palette", 32768) MCFG_PALETTE_INIT_OWNER(gb_state,sgb) - MCFG_SGB_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu") /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -714,7 +714,7 @@ MACHINE_CONFIG_START(gb_state::supergb2) MCFG_PALETTE_INIT_OWNER(gb_state,sgb) MCFG_DEVICE_REMOVE("ppu") - MCFG_SGB_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", SGB_PPU, "maincpu") MACHINE_CONFIG_END @@ -726,7 +726,7 @@ MACHINE_CONFIG_START(gb_state::gbpocket) MCFG_PALETTE_INIT_OWNER(gb_state,gbp) MCFG_DEVICE_REMOVE("ppu") - MCFG_MGB_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", MGB_PPU, "maincpu") MACHINE_CONFIG_END MACHINE_CONFIG_START(gb_state::gbcolor) @@ -756,7 +756,7 @@ MACHINE_CONFIG_START(gb_state::gbcolor) MCFG_PALETTE_ADD("palette", 32768) MCFG_PALETTE_INIT_OWNER(gb_state,gbc) - MCFG_CGB_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", CGB_PPU, "maincpu") /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -803,7 +803,7 @@ MACHINE_CONFIG_START(megaduck_state::megaduck) MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(megaduck_state,megaduck) - MCFG_DMG_PPU_ADD("ppu", "maincpu") + MCFG_DEVICE_ADD("ppu", DMG_PPU, "maincpu") /* sound hardware */ SPEAKER(config, "lspeaker").front_left();