From c3c45bb12fea299b43e0883cf9e7c2ab5d04a95c Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Tue, 31 Mar 2020 14:33:28 +0200 Subject: Fix some deprecations (nw) --- src/mame/drivers/konamim2.cpp | 4 ++-- src/mame/machine/3dom2.cpp | 18 +++--------------- src/mame/machine/3dom2.h | 13 ++++++++----- src/osd/modules/debugger/qt/debuggerview.cpp | 4 ++-- src/osd/modules/debugger/qt/memorywindow.cpp | 2 +- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/mame/drivers/konamim2.cpp b/src/mame/drivers/konamim2.cpp index 1c3d8ac46fb..400814a14bf 100644 --- a/src/mame/drivers/konamim2.cpp +++ b/src/mame/drivers/konamim2.cpp @@ -1124,7 +1124,7 @@ void konamim2_state::konamim2(machine_config &config) m_ppc2->set_addrmap(AS_PROGRAM, &konamim2_state::m2_map); // M2 hardware - M2_BDA(config, m_bda, M2_CLOCK, m_ppc1, m_ppc2); + M2_BDA(config, m_bda, M2_CLOCK, m_ppc1, m_ppc2, m_cde); m_bda->set_ram_size(m2_bda_device::RAM_8MB, m2_bda_device::RAM_8MB); m_bda->subdevice("powerbus")->int_handler().set(FUNC(konamim2_state::ppc1_int)); m_bda->subdevice("memctl")->gpio_out_handler<3>().set(FUNC(konamim2_state::ppc2_int)).invert(); @@ -1133,7 +1133,7 @@ void konamim2_state::konamim2(machine_config &config) m_bda->ldac_handler().set(FUNC(konamim2_state::ldac_out)); m_bda->rdac_handler().set(FUNC(konamim2_state::rdac_out)); - M2_CDE(config, m_cde, M2_CLOCK, m_ppc1); + M2_CDE(config, m_cde, M2_CLOCK, m_ppc1, m_bda); m_cde->int_handler().set(":bda:powerbus", FUNC(m2_powerbus_device::int_line)); m_cde->set_syscfg(SYSCONFIG_ARCADE); m_cde->sdbg_out().set(FUNC(konamim2_state::cde_sdbg_out)); diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp index b6bc96e2f7b..34082c729c4 100644 --- a/src/mame/machine/3dom2.cpp +++ b/src/mame/machine/3dom2.cpp @@ -213,6 +213,7 @@ m2_bda_device::m2_bda_device(const machine_config &mconfig, const char *tag, dev device_t(mconfig, M2_BDA, tag, owner, clock), m_cpu1(*this, finder_base::DUMMY_TAG), m_cpu2(*this, finder_base::DUMMY_TAG), + m_cde(*this, finder_base::DUMMY_TAG), m_videores_in(*this), m_memctl(*this, "memctl"), m_powerbus(*this, "powerbus"), @@ -478,14 +479,7 @@ void m2_bda_device::configure_ppc_address_map(address_space &space) space.install_readwrite_handler(CPUID_BASE, CPUID_BASE + DEVICE_MASK, read32_delegate(*this, FUNC(m2_bda_device::cpu_id_r)), write32_delegate(*this, FUNC(m2_bda_device::cpu_id_w)), 0xffffffffffffffffULL); - - // Find and install the CDE - m2_cde_device *cde = downcast(machine().device("cde")); - - if (!cde) - throw emu_fatalerror("BDA: Could not find the CDE device!"); - - space.install_readwrite_handler(SLOT4_BASE, SLOT4_BASE + SLOT_MASK, read32_delegate(*cde, FUNC(m2_cde_device::read)), write32_delegate(*cde, FUNC(m2_cde_device::write)), 0xffffffffffffffffULL); + space.install_readwrite_handler(SLOT4_BASE, SLOT4_BASE + SLOT_MASK, read32_delegate(*m_cde, FUNC(m2_cde_device::read)), write32_delegate(*m_cde, FUNC(m2_cde_device::write)), 0xffffffffffffffffULL); } @@ -1497,6 +1491,7 @@ WRITE32_MEMBER( m2_ctrlport_device::write ) m2_cde_device::m2_cde_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, M2_CDE, tag, owner, clock), m_cpu1(*this, finder_base::DUMMY_TAG), + m_bda(*this, finder_base::DUMMY_TAG), m_int_handler(*this), m_sdbg_out_handler(*this) { @@ -1509,13 +1504,6 @@ m2_cde_device::m2_cde_device(const machine_config &mconfig, const char *tag, dev void m2_cde_device::device_start() { - // Find our friend the BDA - m_bda = downcast(machine().device("bda")); - assert(m_bda != nullptr); - - if (m_bda == nullptr) - throw device_missing_dependencies(); - // Resolve callbacks m_int_handler.resolve_safe(); m_sdbg_out_handler.resolve_safe(); diff --git a/src/mame/machine/3dom2.h b/src/mame/machine/3dom2.h index 4e59f116ec4..137f9dce6cf 100644 --- a/src/mame/machine/3dom2.h +++ b/src/mame/machine/3dom2.h @@ -119,12 +119,13 @@ public: RAM_16MB = 16 }; - template - m2_bda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu1_tag, U &&cpu2_tag) + template + m2_bda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu1_tag, U &&cpu2_tag, V &&cde_tag) : m2_bda_device(mconfig, tag, owner, clock) { m_cpu1.set_tag(std::forward(cpu1_tag)); m_cpu2.set_tag(std::forward(cpu2_tag)); + m_cde.set_tag(std::forward(cde_tag)); } m2_bda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -211,6 +212,7 @@ private: public: // TODO: THIS SHOULD NOT BE PUBLIC required_device m_cpu1; required_device m_cpu2; + required_device m_cde; devcb_read_line m_videores_in; // Sub-devices @@ -505,11 +507,12 @@ private: class m2_cde_device : public device_t { public: - template - m2_cde_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu1_tag) + template + m2_cde_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu1_tag, U &&bda_tag) : m2_cde_device(mconfig, tag, owner, clock) { m_cpu1.set_tag(std::forward(cpu1_tag)); + m_bda.set_tag(std::forward(bda_tag)); } m2_cde_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -701,7 +704,7 @@ private: } required_device m_cpu1; - m2_bda_device *m_bda; // todo + required_device m_bda; devcb_write_line m_int_handler; devcb_write32 m_sdbg_out_handler; diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp index 7dc16c0a3de..67389efc0af 100644 --- a/src/osd/modules/debugger/qt/debuggerview.cpp +++ b/src/osd/modules/debugger/qt/debuggerview.cpp @@ -49,7 +49,7 @@ void DebuggerView::paintEvent(QPaintEvent* event) { // Tell the MAME debug view how much real estate is available QFontMetrics actualFont = fontMetrics(); - const double fontWidth = actualFont.width(QString(100, '_')) / 100.; + const double fontWidth = actualFont.horizontalAdvance(QString(100, '_')) / 100.; const int fontHeight = std::max(1, actualFont.lineSpacing()); m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight)); @@ -240,7 +240,7 @@ void DebuggerView::mousePressEvent(QMouseEvent* event) if (event->button() == Qt::LeftButton) { QFontMetrics actualFont = fontMetrics(); - const double fontWidth = actualFont.width(QString(100, '_')) / 100.; + const double fontWidth = actualFont.horizontalAdvance(QString(100, '_')) / 100.; const int fontHeight = std::max(1, actualFont.lineSpacing()); debug_view_xy topLeft = m_view->visible_position(); diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 6c95e04df80..e9fc36b7a8f 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -334,7 +334,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event) if (leftClick || rightClick) { QFontMetrics actualFont = fontMetrics(); - const double fontWidth = actualFont.width(QString(100, '_')) / 100.; + const double fontWidth = actualFont.horizontalAdvance(QString(100, '_')) / 100.; const int fontHeight = std::max(1, actualFont.lineSpacing()); debug_view_xy topLeft = view()->visible_position(); -- cgit v1.2.3