diff options
| author | 2016-09-12 18:35:36 -0700 | |
|---|---|---|
| committer | 2016-09-12 18:35:36 -0700 | |
| commit | 2bd18d5fea66bedcde02da1b2c17d83c4640a782 (patch) | |
| tree | 21a026c276f83cd6a3619d49ca85cba088485e5b /src/emu/ioport.cpp | |
| parent | 597626d0593e84868d5d9887c1f44b96222bdd49 (diff) | |
Support for configuring device to conrtoller id
This change adds support for configuring device to conrtoller id. This
allows for stable controller ids even if USB devices are plugged /
unplugged, system is rebooted, etc.
See documentation for additional context.
Diffstat (limited to 'src/emu/ioport.cpp')
| -rw-r--r-- | src/emu/ioport.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 44e758b5752..00dbedb8de8 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -2904,6 +2904,24 @@ void ioport_manager::load_config(config_type cfg_type, xml_data_node *parentnode if (cfg_type == config_type::CONFIG_TYPE_CONTROLLER) load_remap_table(parentnode); + // load device map table, if any + std::unique_ptr<devicemap_table_type> devicemap_table = std::make_unique<devicemap_table_type>(); + for (xml_data_node *mapdevice_node = xml_get_sibling(parentnode->child, "mapdevice"); mapdevice_node != nullptr; mapdevice_node = xml_get_sibling(mapdevice_node->next, "mapdevice")) + { + const char *devicename = xml_get_attribute_string(mapdevice_node, "device", nullptr); + const char *controllername = xml_get_attribute_string(mapdevice_node, "controller", nullptr); + if (devicename != nullptr && controllername != nullptr) + { + devicemap_table->insert(std::make_pair(std::string(devicename), std::string(controllername))); + } + } + + // map device to controller if we have a device map + if (!devicemap_table->empty()) + { + machine().input().map_device_to_controller(devicemap_table.get()); + } + // iterate over all the port nodes for (xml_data_node *portnode = xml_get_sibling(parentnode->child, "port"); portnode; portnode = xml_get_sibling(portnode->next, "port")) { |
