diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-08-21 09:04:09 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-08-21 09:04:09 -0400 |
commit | b3e306b985c98019687f46fb08cd4f999ec751f7 (patch) | |
tree | f24ea3b993f6486db005634b84856ccc90346e71 /src/devices | |
parent | afdcf4dcec6e38611f4266ae78a612025d1cdc05 (diff) |
divideo: Fetch screen to be potentially configured during device_config_complete (nw)
- Allow device finder to be used as an argument for set_screen (nw)
screen: Calculate physical aspect ratio whenever required, not in device_config_complete, since the renderer caches the result anyway (nw)
cdp1861, cdp1864: Eliminate the "magic reference" constructors, doing their work in device_config_complete instead (nw)
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/sound/cdp1864.cpp | 22 | ||||
-rw-r--r-- | src/devices/sound/cdp1864.h | 4 | ||||
-rw-r--r-- | src/devices/video/cdp1861.cpp | 23 | ||||
-rw-r--r-- | src/devices/video/cdp1861.h | 4 |
4 files changed, 37 insertions, 16 deletions
diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp index 6e69a2a1853..c8d13cda92c 100644 --- a/src/devices/sound/cdp1864.cpp +++ b/src/devices/sound/cdp1864.cpp @@ -23,6 +23,7 @@ #include "emu.h" #include "cdp1864.h" +#include "screen.h" @@ -78,12 +79,23 @@ cdp1864_device::cdp1864_device(const machine_config &mconfig, const char *tag, d { } -cdp1864_device::cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, screen_device &screen) - : cdp1864_device(mconfig, tag, owner, clock) + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cdp1864_device::device_config_complete() { - set_screen(screen, DEVICE_SELF); - screen.set_screen_update(screen_update_rgb32_delegate(FUNC(cdp1864_device::screen_update), this)); - screen.set_raw(clock, SCREEN_WIDTH, HBLANK_END, HBLANK_START, TOTAL_SCANLINES, SCANLINE_VBLANK_END, SCANLINE_VBLANK_START); + if (!has_screen()) + return; + + if (!screen().refresh_attoseconds()) + screen().set_raw(clock(), SCREEN_WIDTH, HBLANK_END, HBLANK_START, TOTAL_SCANLINES, SCANLINE_VBLANK_END, SCANLINE_VBLANK_START); + + if (!screen().have_screen_update()) + screen().set_screen_update(screen_update_rgb32_delegate(FUNC(cdp1864_device::screen_update), this)); } diff --git a/src/devices/sound/cdp1864.h b/src/devices/sound/cdp1864.h index ef8caba13e8..ff66122dfbd 100644 --- a/src/devices/sound/cdp1864.h +++ b/src/devices/sound/cdp1864.h @@ -40,8 +40,6 @@ #include "machine/rescap.h" #include "video/resnet.h" -#include "screen.h" - //************************************************************************** @@ -83,7 +81,6 @@ public: // construction/destruction cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, screen_device &screen); auto inlace_cb() { return m_read_inlace.bind(); } auto int_cb() { return m_write_int.bind(); } @@ -112,6 +109,7 @@ public: protected: // device-level overrides + virtual void device_config_complete() override; virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp index 09a6810c426..9748d5e03c1 100644 --- a/src/devices/video/cdp1861.cpp +++ b/src/devices/video/cdp1861.cpp @@ -9,6 +9,8 @@ #include "emu.h" #include "cdp1861.h" +#include "screen.h" + //************************************************************************** @@ -51,12 +53,23 @@ cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, d { } -cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, screen_device &screen) - : cdp1861_device(mconfig, tag, owner, clock) + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cdp1861_device::device_config_complete() { - set_screen(screen, DEVICE_SELF); - screen.set_screen_update(screen_update_rgb32_delegate(FUNC(cdp1861_device::screen_update), this)); - screen.set_raw(clock, SCREEN_WIDTH, HBLANK_END, HBLANK_START, TOTAL_SCANLINES, SCANLINE_VBLANK_END, SCANLINE_VBLANK_START); + if (!has_screen()) + return; + + if (!screen().refresh_attoseconds()) + screen().set_raw(clock(), SCREEN_WIDTH, HBLANK_END, HBLANK_START, TOTAL_SCANLINES, SCANLINE_VBLANK_END, SCANLINE_VBLANK_START); + + if (!screen().have_screen_update()) + screen().set_screen_update(screen_update_rgb32_delegate(FUNC(cdp1861_device::screen_update), this)); } diff --git a/src/devices/video/cdp1861.h b/src/devices/video/cdp1861.h index 9b523402410..77f350d5afe 100644 --- a/src/devices/video/cdp1861.h +++ b/src/devices/video/cdp1861.h @@ -26,8 +26,6 @@ #pragma once -#include "screen.h" - //************************************************************************** // TYPE DEFINITIONS @@ -65,7 +63,6 @@ public: // construction/destruction cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, screen_device &screen); auto int_cb() { return m_write_int.bind(); } auto dma_out_cb() { return m_write_dma_out.bind(); } @@ -81,6 +78,7 @@ public: protected: // device-level overrides + virtual void device_config_complete() override; virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; |