Sync core fixes from MESS done by OG (nw)

This commit is contained in:
Miodrag Milanovic 2012-02-11 16:15:39 +00:00
parent 5cb480e748
commit 5596c512fc
4 changed files with 33 additions and 3 deletions

View File

@ -10,6 +10,9 @@
device_slot_interface::device_slot_interface(const machine_config &mconfig, device_t &device)
: device_interface(device)
{
m_default_card = 0;
m_input_defaults = 0;
m_slot_interfaces = 0;
}
device_slot_interface::~device_slot_interface()

View File

@ -141,6 +141,33 @@ screen_device *machine_config::first_screen() const
device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, UINT32 clock)
{
const char *orig_tag = tag;
// if the device path is absolute, start from the root
if (tag[0] == ':')
{
tag++;
owner = m_root_device;
}
// go down the path until we're done with it
while (strchr(tag, ':'))
{
const char *next = strchr(tag, ':');
assert(next != tag);
astring part(tag, next-tag);
device_t *curdevice;
for (curdevice = owner->m_subdevice_list.first(); curdevice != NULL; curdevice = curdevice->next())
if (part == curdevice->m_basetag)
break;
if (!curdevice)
throw emu_fatalerror("Could not find %s when looking up path for device %s\n",
part.cstr(), orig_tag);
owner = curdevice;
tag = next+1;
}
assert(tag[0]);
// if there's an owner, let the owner do the work
if (owner != NULL)
return owner->add_subdevice(type, tag, clock);

View File

@ -51,8 +51,8 @@
// CONSTANTS
//**************************************************************************
// by convention, tags should all lowercase and between 2-15 characters
#define MIN_TAG_LENGTH 2
// by convention, tags should all lowercase and between 1-15 characters
#define MIN_TAG_LENGTH 1
#define MAX_TAG_LENGTH 15

View File

@ -1139,7 +1139,7 @@ void validity_checker::validate_slots()
{
// iterate over interfaces
const slot_interface *intf = slot->get_slot_interfaces();
for (int j = 0; intf[j].name != NULL; j++)
for (int j = 0; intf && intf[j].name != NULL; j++)
{
// instantiate the device
device_t *dev = (*intf[j].devtype)(*m_current_config, "dummy", &m_current_config->root_device(), 0);