summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/devfind.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-04-30 23:32:41 +1000
committer Vas Crabb <vas@vastheman.com>2018-04-30 23:32:41 +1000
commitb60c852f119db04564731fa86d73e0a986771258 (patch)
treef3f48148a13484a407b7054c78239258708c5a18 /src/emu/devfind.cpp
parent89b356a0f5d874f2cabe2e0a96ccfb611b735109 (diff)
Set finder tag relative to current device being configured rather than
the finder's owner. This meand you no longer need to care about the your relationship to the object being configured and a lot of ^ and : can disappear. There's a bit reduction in string pasting in macros from this. Yes, I have to make this apply to devcb etc. as well, but that's a job for another day. There's probably at least one thing broken by this where optional objects are involved. Most things can be solved by just getting rid of the now-problematic ^ and : prefixes.
Diffstat (limited to 'src/emu/devfind.cpp')
-rw-r--r--src/emu/devfind.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp
index 81071fa891c..ba2d024a7ca 100644
--- a/src/emu/devfind.cpp
+++ b/src/emu/devfind.cpp
@@ -116,14 +116,25 @@ finder_base::~finder_base()
//-------------------------------------------------
+// set_tag - set tag
+//-------------------------------------------------
+
+void finder_base::set_tag(char const *tag)
+{
+ m_base = m_base.get().mconfig().current_device();
+ m_tag = tag;
+}
+
+
+//-------------------------------------------------
// find_memregion - find memory region
//-------------------------------------------------
void *finder_base::find_memregion(u8 width, size_t &length, bool required) const
{
// look up the region and return nullptr if not found
- memory_region *const region = m_base.memregion(m_tag);
- if (region == nullptr)
+ memory_region *const region(m_base.get().memregion(m_tag));
+ if (!region)
{
length = 0;
return nullptr;
@@ -162,10 +173,10 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const
{
// make sure we can resolve the full path to the region
size_t bytes_found = 0;
- std::string region_fulltag = m_base.subtag(m_tag);
+ std::string const region_fulltag(m_base.get().subtag(m_tag));
// look for the region
- for (device_t const &dev : device_iterator(m_base.mconfig().root_device()))
+ for (device_t const &dev : device_iterator(m_base.get().mconfig().root_device()))
{
for (romload::region const &region : romload::entries(dev.rom_region()).get_regions())
{
@@ -197,8 +208,8 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const
void *finder_base::find_memshare(u8 width, size_t &bytes, bool required) const
{
// look up the share and return nullptr if not found
- memory_share *share = m_base.memshare(m_tag);
- if (share == nullptr)
+ memory_share *const share(m_base.get().memshare(m_tag));
+ if (!share)
return nullptr;
// check the width and warn if not correct
@@ -233,7 +244,7 @@ bool finder_base::report_missing(bool found, const char *objname, bool required)
return true;
// otherwise, report
- std::string const region_fulltag = m_base.subtag(m_tag);
+ std::string const region_fulltag(m_base.get().subtag(m_tag));
if (required)
osd_printf_error("Required %s '%s' not found\n", objname, region_fulltag.c_str());
else