diff options
author | 2012-01-24 20:18:55 +0000 | |
---|---|---|
committer | 2012-01-24 20:18:55 +0000 | |
commit | ed0207f1267c34dd195a9807d47b74e9fab155e0 (patch) | |
tree | d162988b04326e6b945e0aa5c8a228acdb90f92a /src/emu/network.c | |
parent | f2ed9c39edc94438907152a05459483d930ab5ef (diff) |
Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]
NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.
As before, the driver device is the root device and all
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.
A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.
All device name lookups are now done relative to another
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy.
The existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").
A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.
The new pathing system is built on top of the
device_t::subtag() method, so anyone using that will
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.
Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).
Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.
Simplified the device callback system since the new
pathing can describe all of the special-case devices that
were previously handled manually.
Changed the core output function callbacks to be delegates.
Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers
should no longer explicitly output this information, just
the error, assuming that the context is provided.
Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.
Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
Diffstat (limited to 'src/emu/network.c')
-rw-r--r-- | src/emu/network.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emu/network.c b/src/emu/network.c index cd44270c556..3da575835af 100644 --- a/src/emu/network.c +++ b/src/emu/network.c @@ -23,7 +23,6 @@ static void network_load(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; - device_network_interface *network = NULL; if ((config_type == CONFIG_TYPE_GAME) && (parentnode != NULL)) { for (node = xml_get_sibling(parentnode->child, "device"); node; node = xml_get_sibling(node->next, "device")) @@ -32,7 +31,8 @@ static void network_load(running_machine &machine, int config_type, xml_data_nod if ((tag != NULL) && (tag[0] != '\0')) { - for (bool gotone = machine.devicelist().first(network); gotone; gotone = network->next(network)) + network_interface_iterator iter(machine.root_device()); + for (device_network_interface *network = iter.first(); network != NULL; network = iter.next()) { if (!strcmp(tag, network->device().tag())) { int interface = xml_get_attribute_int(node, "interface", 0); @@ -56,12 +56,12 @@ static void network_load(running_machine &machine, int config_type, xml_data_nod static void network_save(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; - device_network_interface *network = NULL; /* only care about game-specific data */ if (config_type == CONFIG_TYPE_GAME) { - for (bool gotone = machine.devicelist().first(network); gotone; gotone = network->next(network)) + network_interface_iterator iter(machine.root_device()); + for (device_network_interface *network = iter.first(); network != NULL; network = iter.next()) { node = xml_add_child(parentnode, "device", NULL); if (node != NULL) |