summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/input.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-07-15 04:09:18 +1000
committer Vas Crabb <cuavas@users.noreply.github.com>2021-07-15 13:54:40 +1000
commit37157461313b13a691722b83c87df8d2315457da (patch)
tree8034c6f33776f5a8bfc8f6c69af879975061bd0a /src/emu/input.cpp
parent66554d3b84f5fec60dcf5d896283a1a04487c0e0 (diff)
API cleanups and miscellaneous fixes.
emu/ioport.cpp: Allow controller files to override input sequences for inputs that don't use defaults, and to override the toggle setting for digital inputs. emu/config.cpp: Expose configuration level (mostly matters for controller files), improved verbose diagnostic messages, and moved a few things out of the global and preprocessor namespaces. docs: Added documentation for some controller configuration file features. The device mapping feature documentation will be merged in at some point. util/unicode.cpp, emu/input.cpp: API cleanups.
Diffstat (limited to 'src/emu/input.cpp')
-rw-r--r--src/emu/input.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/emu/input.cpp b/src/emu/input.cpp
index 25ecd238d05..1221bf79f66 100644
--- a/src/emu/input.cpp
+++ b/src/emu/input.cpp
@@ -1313,15 +1313,12 @@ void input_manager::seq_from_tokens(input_seq &seq, std::string_view string)
// controller based on device map table
//-------------------------------------------------
-bool input_manager::map_device_to_controller(const devicemap_table_type *devicemap_table)
+bool input_manager::map_device_to_controller(const devicemap_table_type &devicemap_table)
{
- if (nullptr == devicemap_table)
- return true;
-
- for (devicemap_table_type::const_iterator it = devicemap_table->begin(); it != devicemap_table->end(); it++)
+ for (const auto &it : devicemap_table)
{
- std::string_view deviceid = it->first;
- std::string_view controllername = it->second;
+ std::string_view deviceid = it.first;
+ std::string_view controllername = it.second;
// tokenize the controller name into device class and index (i.e. controller name should be of the form "GUNCODE_1")
std::string token[2];
@@ -1360,7 +1357,7 @@ bool input_manager::map_device_to_controller(const devicemap_table_type *devicem
for (int devnum = 0; devnum <= input_devclass->maxindex(); devnum++)
{
input_device *device = input_devclass->device(devnum);
- if (device != nullptr && device->match_device_id(deviceid))
+ if (device && device->match_device_id(deviceid))
{
// remap devindex
input_devclass->remap_device_index(device->devindex(), devindex);