From 25a100d773579751d4dd58c9d4276eabdb648c3a Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Wed, 24 Jul 2013 19:20:59 +0000 Subject: Created new device_video_interface. Right now its sole purpose is to house a screen tag and to find the screen at startup, providing an m_screen object that can be used. One nice feature is that if there is only one screen and no screen has been specified, it will auto configure to that screen. This removes the need to explicitly specify a screen in the configuration for a large chunk of drivers (though doing so never hurts). A new macro MCFG_VIDEO_SET_SCREEN is provided, though devices are encouraged to define their own that maps there so it is obvious which device is being targeted. The device_video_interface's validation function will error if an invalid screen is specified or if no screen is provided but there are multiple screens present. Updated all devices that currently had an m_screen in them to use the device_video_interface instead. This also has the nice benefit of flagging video-related devices for categorization purposes. It also means all these devices inherit the same screen-finding behaviors. For devices that had interfaces that specified a screen tag, those have been removed and all existing structs updated. Added an optional_device m_screen to the base driver_device. If you name your screen "screen" (as most drivers do), you will have free access to your screen this way. Future updates include: * Updating all devices referencing machine.primary_screen to use the device_video_interface instead * Updating all drivers referencing machine.primary_screen to use the m_screen instead * Removing machine.primary_screen entirely --- src/emu/sound/cdp1864.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/emu/sound/cdp1864.h') diff --git a/src/emu/sound/cdp1864.h b/src/emu/sound/cdp1864.h index 56d12771ea2..0b5407715ea 100644 --- a/src/emu/sound/cdp1864.h +++ b/src/emu/sound/cdp1864.h @@ -82,7 +82,7 @@ #define MCFG_CDP1864_ADD(_tag, _screen_tag, _clock, _inlace, _irq, _dma_out, _efx, _hsync, _rdata, _bdata, _gdata) \ MCFG_SOUND_ADD(_tag, CDP1864, _clock) \ - downcast(device)->set_screen_tag(_screen_tag); \ + MCFG_VIDEO_SET_SCREEN(_screen_tag) \ downcast(device)->set_inlace_callback(DEVCB2_##_inlace); \ downcast(device)->set_irq_callback(DEVCB2_##_irq); \ downcast(device)->set_dma_out_callback(DEVCB2_##_dma_out); \ @@ -108,13 +108,13 @@ // ======================> cdp1864_device class cdp1864_device : public device_t, - public device_sound_interface + public device_sound_interface, + public device_video_interface { public: // construction/destruction cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; } template void set_inlace_callback(_inlace inlace) { m_read_inlace.set_callback(inlace); } template void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); } template void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); } @@ -168,8 +168,6 @@ private: devcb2_write_line m_write_efx; devcb2_write_line m_write_hsync; - const char *m_screen_tag; - screen_device *m_screen; // screen bitmap_rgb32 m_bitmap; // bitmap sound_stream *m_stream; // sound output -- cgit v1.2.3-70-g09d2