From f565f3bdbb54791e2086756249b24d95b63eff58 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 13 May 2018 12:07:08 -0400 Subject: [PATCH] konppc.cpp: Use device finders and eliminate machine().device(tag) (nw) --- src/mame/machine/konppc.cpp | 28 ++++++++++++---------------- src/mame/machine/konppc.h | 6 +++++- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mame/machine/konppc.cpp b/src/mame/machine/konppc.cpp index 9c26cae4226..abede9970fb 100644 --- a/src/mame/machine/konppc.cpp +++ b/src/mame/machine/konppc.cpp @@ -3,9 +3,6 @@ /* Konami PowerPC-based 3D games common functions */ #include "emu.h" -#include "cpu/sharc/sharc.h" -#include "machine/k033906.h" -#include "video/voodoo.h" #include "konppc.h" #define DSP_BANK_SIZE 0x10000 @@ -18,6 +15,8 @@ DEFINE_DEVICE_TYPE(KONPPC, konppc_device, "konppc", "Konami PowerPC Common Funct konppc_device::konppc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, KONPPC, tag, owner, clock) + , m_dsp(*this, {"^dsp", "^dsp2"}) + , m_k033906(*this, "^k033906_%u", 1U) , m_voodoo(*this, "^voodoo%u", 0U) , cgboard_type(0) , num_cgboards(0) @@ -126,10 +125,7 @@ READ32_MEMBER( konppc_device::cgboard_dsp_comm_r_ppc ) WRITE32_MEMBER( konppc_device::cgboard_dsp_comm_w_ppc ) { - const char *dsptag = (cgboard_id == 0) ? "dsp" : "dsp2"; - const char *pcitag = (cgboard_id == 0) ? "k033906_1" : "k033906_2"; - device_t *dsp = machine().device(dsptag); - k033906_device *k033906 = machine().device(pcitag); + cpu_device &dsp = *m_dsp[cgboard_id]; // osd_printf_debug("%s dsp_cmd_w: (board %d) %08X, %08X, %08X\n", machine().describe_context().c_str(), cgboard_id, data, offset, mem_mask); if (cgboard_id < MAX_CG_BOARDS) @@ -144,19 +140,19 @@ WRITE32_MEMBER( konppc_device::cgboard_dsp_comm_w_ppc ) if (data & 0x80000000) dsp_state[cgboard_id] |= 0x10; - if (k033906 != nullptr) /* zr107.c has no PCI and some games only have one PCI Bridge */ - k033906->set_reg((data & 0x20000000) ? 1 : 0); + if (m_k033906[cgboard_id].found()) /* zr107.c has no PCI and some games only have one PCI Bridge */ + m_k033906[cgboard_id]->set_reg((data & 0x20000000) ? 1 : 0); if (data & 0x10000000) - dsp->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + dsp.set_input_line(INPUT_LINE_RESET, CLEAR_LINE); else - dsp->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + dsp.set_input_line(INPUT_LINE_RESET, ASSERT_LINE); if (data & 0x02000000) - dsp->execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + dsp.set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); if (data & 0x04000000) - dsp->execute().set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE); + dsp.set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE); } if (ACCESSING_BITS_0_7) @@ -211,13 +207,13 @@ void konppc_device::dsp_comm_sharc_w(address_space &space, int board, int offset case CGBOARD_TYPE_ZR107: case CGBOARD_TYPE_GTICLUB: { - //machine.device("dsp")->execute().set_input_line(SHARC_INPUT_FLAG0, ASSERT_LINE); - machine().device("dsp")->set_flag_input(0, ASSERT_LINE); + //m_dsp[0]->set_input_line(SHARC_INPUT_FLAG0, ASSERT_LINE); + m_dsp[0]->set_flag_input(0, ASSERT_LINE); if (offset == 1) { if (data & 0x03) - machine().device("dsp")->set_input_line(INPUT_LINE_IRQ2, ASSERT_LINE); + m_dsp[0]->set_input_line(INPUT_LINE_IRQ2, ASSERT_LINE); } break; } diff --git a/src/mame/machine/konppc.h b/src/mame/machine/konppc.h index 66907ad8f1f..5b10bd1604f 100644 --- a/src/mame/machine/konppc.h +++ b/src/mame/machine/konppc.h @@ -5,6 +5,8 @@ #pragma once +#include "cpu/sharc/sharc.h" +#include "machine/k033906.h" #include "video/voodoo.h" #define MCFG_KONPPC_CGBOARD_NUMBER(_num) \ @@ -74,7 +76,9 @@ protected: void nwk_fifo_w(int board, uint32_t data); private: // device finders - required_device_array m_voodoo; + optional_device_array m_dsp; + optional_device_array m_k033906; + optional_device_array m_voodoo; // internal state uint32_t dsp_comm_ppc[MAX_CG_BOARDS][2];