Allow region tags starting with a : to mean "absolute" so devices can access the parent base driver's ROM regions [R. Belmont]

This commit is contained in:
R. Belmont 2011-09-17 18:47:02 +00:00
parent cc60a2d683
commit 1d64e14960
3 changed files with 32 additions and 8 deletions

View File

@ -318,10 +318,19 @@ bool device_memory_interface::interface_validity_check(emu_options &options, con
{
astring fulltag;
astring regiontag;
if (strchr(entry->m_region,':')) {
regiontag = entry->m_region;
} else {
device().siblingtag(regiontag, entry->m_region);
// a leading : on a region name indicates an absolute region, so fix up accordingly
if (entry->m_region[0] == ':')
{
regiontag = &entry->m_region[1];
}
else
{
if (strchr(entry->m_region,':')) {
regiontag = entry->m_region;
} else {
device().siblingtag(regiontag, entry->m_region);
}
}
rom_region_name(fulltag, &driver, source, romp);
if (fulltag.cmp(regiontag) == 0)

View File

@ -617,6 +617,12 @@ inline const input_port_config *running_machine::port(const char *tag)
inline const memory_region *running_machine::region(const char *tag)
{
// if tag begins with a :, it's absolute
if (tag[0] == ':')
{
return m_regionlist.find(&tag[1]);
}
return m_regionlist.find(tag);
}

View File

@ -2198,10 +2198,19 @@ void address_space::prepare_map()
if (entry->m_region != NULL && entry->m_share == NULL && entry->m_baseptr == NULL)
{
astring regiontag;
if (strchr(entry->m_region,':')) {
regiontag = entry->m_region;
} else {
m_device.siblingtag(regiontag, entry->m_region);
// a leading : on a region name indicates an absolute region, so fix up accordingly
if (entry->m_region[0] == ':')
{
regiontag = &entry->m_region[1];
}
else
{
if (strchr(entry->m_region,':')) {
regiontag = entry->m_region;
} else {
m_device.siblingtag(regiontag, entry->m_region);
}
}
const memory_region *region = machine().region(regiontag.cstr());
if (region == NULL)