From 0f9926f02c1a847603d6e3c8f86655fafedfc13d Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 2 Oct 2020 19:41:16 -0400 Subject: [PATCH] bus/hexbus/hexbus.cpp: Fix initialization problem (device_start was overridden and never called, also broken) --- src/devices/bus/hexbus/hexbus.cpp | 8 +++++--- src/devices/bus/hexbus/hexbus.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index 0b8d7821cb6..53e8a40e7c0 100644 --- a/src/devices/bus/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -224,18 +224,20 @@ uint8_t hexbus_device::read(int dir) hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock): device_t(mconfig, type, tag, owner, clock), device_hexbus_interface(mconfig, *this), + m_hexbus_outbound(nullptr), m_enabled(false), m_myvalue(0xff) { m_hexbus_inbound = dynamic_cast(owner); } -void hexbus_chained_device::device_start() +void hexbus_chained_device::device_resolve_objects() { - m_hexbus_outbound = static_cast(subdevice("hexbus")); + m_hexbus_outbound = dynamic_cast(subdevice("hexbus")); // Establish callback for inbound propagations - m_hexbus_outbound->set_chain_element(this); + if (m_hexbus_outbound != nullptr) + m_hexbus_outbound->set_chain_element(this); } /* diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index 76092c0f16f..7f39400974b 100644 --- a/src/devices/bus/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -60,7 +60,7 @@ protected: void set_outbound_hexbus(hexbus_device *outbound) { m_hexbus_outbound = outbound; } - virtual void device_start() override; + virtual void device_resolve_objects() override; // Link to the inbound Hexbus (if not null, see Oso chip) hexbus_device *m_hexbus_inbound;