summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/screen.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-10-31 16:57:59 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-11-13 00:07:48 -0500
commitbf8eac0fbb8ba1b5b11c38758424744df55b81db (patch)
tree80efeb8fe3bb288f9d6287145b05237a8310151f /src/emu/screen.cpp
parent55010e6fadcc121607a0d33a82419f5108714ae5 (diff)
Various palette and screen improvements (nw)
- Use device_resolve_objects to remove the need for resolve_palette - Palette format no longer depends on configuration of first screen
Diffstat (limited to 'src/emu/screen.cpp')
-rw-r--r--src/emu/screen.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 2d5c177f9b9..52e5cefe37c 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -804,6 +804,39 @@ void screen_device::device_validity_check(validity_checker &valid) const
//-------------------------------------------------
+// device_resolve_objects - resolve objects that
+// may be needed for other devices to set
+// initial conditions at start time
+//-------------------------------------------------
+
+void screen_device::device_resolve_objects()
+{
+ // bind our handlers
+ m_screen_update_ind16.bind_relative_to(*owner());
+ m_screen_update_rgb32.bind_relative_to(*owner());
+ m_screen_vblank.resolve_safe();
+
+ // find the specified palette
+ if (m_palette_tag != nullptr && m_palette == nullptr)
+ {
+ // find our palette as a sibling device
+ device_t *palette = owner()->subdevice(m_palette_tag);
+ if (palette == nullptr)
+ fatalerror("Screen '%s' specifies nonexistent device '%s' as palette\n",
+ tag(),
+ m_palette_tag);
+ if (!palette->interface(m_palette))
+ fatalerror("Screen '%s' specifies device '%s' as palette, but it has no palette interface\n",
+ tag(),
+ m_palette_tag);
+
+ // assign our format to the palette before it starts
+ m_palette->m_format = format();
+ }
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -826,13 +859,7 @@ void screen_device::device_start()
}
}
- // bind our handlers
- m_screen_update_ind16.bind_relative_to(*owner());
- m_screen_update_rgb32.bind_relative_to(*owner());
- m_screen_vblank.resolve_safe();
-
// if we have a palette and it's not started, wait for it
- resolve_palette();
if (m_palette != nullptr && !m_palette->device().started())
throw device_missing_dependencies();
@@ -1482,28 +1509,6 @@ void screen_device::register_screen_bitmap(bitmap_t &bitmap)
//-------------------------------------------------
-// resolve_palette - find the specified palette
-//-------------------------------------------------
-
-void screen_device::resolve_palette()
-{
- if (m_palette_tag != nullptr && m_palette == nullptr)
- {
- // find our palette as a sibling device
- device_t *palette = owner()->subdevice(m_palette_tag);
- if (palette == nullptr)
- fatalerror("Screen '%s' specifies nonexistent device '%s' as palette\n",
- tag(),
- m_palette_tag);
- if (!palette->interface(m_palette))
- fatalerror("Screen '%s' specifies device '%s' as palette, but it has no palette interface\n",
- tag(),
- m_palette_tag);
- }
-}
-
-
-//-------------------------------------------------
// vblank_begin - call any external callbacks to
// signal the VBLANK period has begun
//-------------------------------------------------