From 49f354d5449432d449dd22f8455776a8ca8f4842 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 21 May 2018 01:10:24 -0400 Subject: [PATCH] Kludge some absolute tag lookups in the core that can't really be helped (nw) --- src/emu/debug/debugcmd.cpp | 2 +- src/emu/debug/debugcpu.cpp | 4 ++-- src/emu/romload.cpp | 10 ++++------ src/emu/schedule.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 3b38f536ef4..c0ef82c8d36 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -441,7 +441,7 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t *&res } /* first look for a tag match */ - result = m_machine.device(param); + result = m_machine.root_device().subdevice(param); if (result) return true; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 047317cd14f..bbf1170b762 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -296,7 +296,7 @@ bool debugger_cpu::comment_load(bool is_inline) for (util::xml::data_node const *cpunode = systemnode->get_child("cpu"); cpunode; cpunode = cpunode->get_next_sibling("cpu")) { const char *cputag_name = cpunode->get_attribute_string("tag", ""); - device_t *device = m_machine.device(cputag_name); + device_t *device = m_machine.root_device().subdevice(cputag_name); if (device != nullptr) { if(is_inline == false) @@ -692,7 +692,7 @@ device_t* debugger_cpu::expression_get_device(const char *tag) // convert to lowercase then lookup the name (tags are enforced to be all lower case) std::string fullname(tag); strmakelower(fullname); - return m_machine.device(fullname.c_str()); + return m_machine.root_device().subdevice(fullname.c_str()); } diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 2812a39db9e..d9bd274577f 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -1241,9 +1241,9 @@ void rom_load_manager::process_disk_entries(const char *regiontag, const rom_ent void rom_load_manager::normalize_flags_for_device(running_machine &machine, const char *rgntag, u8 &width, endianness_t &endian) { - device_t *device = machine.device(rgntag); + device_t *device = machine.root_device().subdevice(rgntag); device_memory_interface *memory; - if (device->interface(memory)) + if (device != nullptr && device->interface(memory)) { const address_space_config *spaceconfig = memory->space_config(); if (spaceconfig != nullptr) @@ -1341,8 +1341,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list memory_region *memregion = machine().root_device().memregion(regiontag.c_str()); if (memregion != nullptr) { - if (machine().device(regiontag.c_str()) != nullptr) - normalize_flags_for_device(machine(), regiontag.c_str(), width, endianness); + normalize_flags_for_device(machine(), regiontag.c_str(), width, endianness); /* clear old region (todo: should be moved to an image unload function) */ machine().memory().region_free(memregion->name()); @@ -1418,8 +1417,7 @@ void rom_load_manager::process_region_list() /* if this is a device region, override with the device width and endianness */ u8 width = ROMREGION_GETWIDTH(region) / 8; endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; - if (machine().device(regiontag.c_str()) != nullptr) - normalize_flags_for_device(machine(), regiontag.c_str(), width, endianness); + normalize_flags_for_device(machine(), regiontag.c_str(), width, endianness); /* remember the base and length */ m_region = machine().memory().region_alloc(regiontag.c_str(), regionlength, width, endianness); diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index 42552f5f5de..d281446d6c6 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -762,7 +762,7 @@ void device_scheduler::rebuild_execute_list() // if the configuration specifies a device to make perfect, pick that as the minimum if (!machine().config().m_perfect_cpu_quantum.empty()) { - device_t *device = machine().device(machine().config().m_perfect_cpu_quantum.c_str()); + device_t *device = machine().root_device().subdevice(machine().config().m_perfect_cpu_quantum.c_str()); if (device == nullptr) fatalerror("Device '%s' specified for perfect interleave is not present!\n", machine().config().m_perfect_cpu_quantum.c_str());