From 46b0fa88be0bce3d39ca0daa204f2500263802cc Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 12 Jul 2019 09:39:39 -0400 Subject: bus/gamegear, bus/nes_ctrl, bus/sms_ctrl: Prevent crashing during validation (nw) --- src/devices/bus/gamegear/smsctrladp.cpp | 3 ++- src/devices/bus/nes_ctrl/hori.cpp | 18 ++++++++++++------ src/devices/bus/nes_ctrl/joypad.cpp | 3 ++- src/devices/bus/sms_ctrl/multitap.cpp | 11 +++++++---- src/devices/bus/sms_ctrl/rfu.cpp | 3 ++- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/devices/bus/gamegear/smsctrladp.cpp b/src/devices/bus/gamegear/smsctrladp.cpp index 8308c55d81a..d066f815697 100644 --- a/src/devices/bus/gamegear/smsctrladp.cpp +++ b/src/devices/bus/gamegear/smsctrladp.cpp @@ -77,7 +77,8 @@ WRITE_LINE_MEMBER( sms_ctrl_adaptor_device::th_pin_w ) void sms_ctrl_adaptor_device::device_add_mconfig(machine_config &config) { SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad"); - m_subctrl_port->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + m_subctrl_port->set_screen_tag(m_port->m_screen); m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w)); } diff --git a/src/devices/bus/nes_ctrl/hori.cpp b/src/devices/bus/nes_ctrl/hori.cpp index 394ebcc9239..5c4f33c8ca9 100644 --- a/src/devices/bus/nes_ctrl/hori.cpp +++ b/src/devices/bus/nes_ctrl/hori.cpp @@ -63,8 +63,11 @@ void nes_horitwin_device::device_add_mconfig(machine_config &config) { NES_CONTROL_PORT(config, m_port1, hori_adapter, "joypad"); NES_CONTROL_PORT(config, m_port2, hori_adapter, "joypad"); - m_port1->set_screen_tag(m_port->m_screen); - m_port2->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + { + m_port1->set_screen_tag(m_port->m_screen); + m_port2->set_screen_tag(m_port->m_screen); + } } void nes_hori4p_device::device_add_mconfig(machine_config &config) @@ -73,10 +76,13 @@ void nes_hori4p_device::device_add_mconfig(machine_config &config) NES_CONTROL_PORT(config, m_port2, hori_adapter, "joypad"); NES_CONTROL_PORT(config, m_port3, hori_adapter, "joypad"); NES_CONTROL_PORT(config, m_port4, hori_adapter, "joypad"); - m_port1->set_screen_tag(m_port->m_screen); - m_port2->set_screen_tag(m_port->m_screen); - m_port3->set_screen_tag(m_port->m_screen); - m_port4->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + { + m_port1->set_screen_tag(m_port->m_screen); + m_port2->set_screen_tag(m_port->m_screen); + m_port3->set_screen_tag(m_port->m_screen); + m_port4->set_screen_tag(m_port->m_screen); + } } diff --git a/src/devices/bus/nes_ctrl/joypad.cpp b/src/devices/bus/nes_ctrl/joypad.cpp index 0605eea2d9a..1027340cf63 100644 --- a/src/devices/bus/nes_ctrl/joypad.cpp +++ b/src/devices/bus/nes_ctrl/joypad.cpp @@ -175,7 +175,8 @@ void nes_arcstick_device::device_add_mconfig(machine_config &config) { // expansion port to allow daisy chaining NES_CONTROL_PORT(config, m_daisychain, arcstick_daisy, nullptr); - m_daisychain->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + m_daisychain->set_screen_tag(m_port->m_screen); } diff --git a/src/devices/bus/sms_ctrl/multitap.cpp b/src/devices/bus/sms_ctrl/multitap.cpp index 2e5c0e0701a..74d6c749cb5 100644 --- a/src/devices/bus/sms_ctrl/multitap.cpp +++ b/src/devices/bus/sms_ctrl/multitap.cpp @@ -131,8 +131,11 @@ void sms_multitap_device::device_add_mconfig(machine_config &config) SMS_CONTROL_PORT(config, m_subctrl2_port, sms_control_port_devices, "joypad"); SMS_CONTROL_PORT(config, m_subctrl3_port, sms_control_port_devices, "joypad"); SMS_CONTROL_PORT(config, m_subctrl4_port, sms_control_port_devices, "joypad"); - m_subctrl1_port->set_screen_tag(m_port->m_screen); - m_subctrl2_port->set_screen_tag(m_port->m_screen); - m_subctrl3_port->set_screen_tag(m_port->m_screen); - m_subctrl4_port->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + { + m_subctrl1_port->set_screen_tag(m_port->m_screen); + m_subctrl2_port->set_screen_tag(m_port->m_screen); + m_subctrl3_port->set_screen_tag(m_port->m_screen); + m_subctrl4_port->set_screen_tag(m_port->m_screen); + } } diff --git a/src/devices/bus/sms_ctrl/rfu.cpp b/src/devices/bus/sms_ctrl/rfu.cpp index b8e991e71d3..d28a2ded703 100644 --- a/src/devices/bus/sms_ctrl/rfu.cpp +++ b/src/devices/bus/sms_ctrl/rfu.cpp @@ -135,6 +135,7 @@ WRITE_LINE_MEMBER( sms_rapid_fire_device::th_pin_w ) void sms_rapid_fire_device::device_add_mconfig(machine_config &config) { SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad"); - m_subctrl_port->set_screen_tag(m_port->m_screen); + if (m_port != nullptr) + m_subctrl_port->set_screen_tag(m_port->m_screen); m_subctrl_port->th_input_handler().set(FUNC(sms_rapid_fire_device::th_pin_w)); } -- cgit v1.2.3