summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/source/advanced/devicemap.rst13
-rw-r--r--src/emu/input.cpp9
-rw-r--r--src/emu/ioport.cpp27
3 files changed, 24 insertions, 25 deletions
diff --git a/docs/source/advanced/devicemap.rst b/docs/source/advanced/devicemap.rst
index be49b7d0091..d834f57aebf 100644
--- a/docs/source/advanced/devicemap.rst
+++ b/docs/source/advanced/devicemap.rst
@@ -11,7 +11,8 @@ That's where the "mapdevice" configuration setting comes into the picture. This
Usage of mapdevice
------------------
-The "mapdevice" xml element is specified under the input xml element in the configuration. It requires two attributes, "device" and "controller".
+The "mapdevice" xml element is specified under the input xml element in the controller configuration file. It requires two attributes, "device" and "controller".
+NOTE: This setting only take effect when added to the **ctrlr** config file.
The "device" attribute specifies the name of the device to match. It may also be a substring of the name. To see the list of available devices, enable verbose output and available devices will then be listed to the console at startup (more on this below).
@@ -47,15 +48,7 @@ Listing Available Devices
-------------------------
How did we obtain the device names in the above example? Easy!
-We simply set verbose to 1 in mame.ini:
-
-| #
-| # CORE DEBUGGING OPTIONS
-| #
-| **verbose 1**
-|
-
-Then, when MAME is started, it will list available devices to the console. For example:
+Run MAME with -v parameter to enable verbose output. It will then list available devices to the console. For example:
| Input: Adding Gun #0:
| Input: Adding Gun #1:
diff --git a/src/emu/input.cpp b/src/emu/input.cpp
index cb63a33e05a..2a65ff4c688 100644
--- a/src/emu/input.cpp
+++ b/src/emu/input.cpp
@@ -1048,8 +1048,11 @@ void input_class::remap_device_index(int oldindex, int newindex)
m_device[oldindex].swap(m_device[newindex]);
// update device indexes
- m_device[oldindex]->set_devindex(oldindex);
- m_device[newindex]->set_devindex(newindex);
+ if (nullptr != m_device[oldindex].get())
+ m_device[oldindex]->set_devindex(oldindex);
+
+ if (nullptr != m_device[newindex].get())
+ m_device[newindex]->set_devindex(newindex);
// update the maximum index found, since newindex may
// exceed current m_maxindex
@@ -2152,7 +2155,7 @@ bool input_manager::map_device_to_controller(const devicemap_table_type *devicem
{
// remap devindex
input_devclass->remap_device_index(device->devindex(), devindex);
- osd_printf_info("Input: Remapped %s #%d: %s\n", (*devclass_string_table)[input_devclass->devclass()], devindex, device->name());
+ osd_printf_verbose("Input: Remapped %s #%d: %s\n", (*devclass_string_table)[input_devclass->devclass()], devindex, device->name());
break;
}
}
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index 00dbedb8de8..bf6a4cd52c4 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -2904,22 +2904,25 @@ 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"))
+ // load device map table for controller configs only
+ if (cfg_type == config_type::CONFIG_TYPE_CONTROLLER)
{
- 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)
+ 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"))
{
- devicemap_table->insert(std::make_pair(std::string(devicename), std::string(controllername)));
+ 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());
+ // 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