diff options
author | 2021-07-15 04:09:18 +1000 | |
---|---|---|
committer | 2021-07-15 13:54:40 +1000 | |
commit | 37157461313b13a691722b83c87df8d2315457da (patch) | |
tree | 8034c6f33776f5a8bfc8f6c69af879975061bd0a /src/emu/validity.cpp | |
parent | 66554d3b84f5fec60dcf5d896283a1a04487c0e0 (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/validity.cpp')
-rw-r--r-- | src/emu/validity.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index de5321f5347..9bd9edb1ff0 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -1706,7 +1706,7 @@ void validity_checker::validate_roms(device_t &root) // analog input field //------------------------------------------------- -void validity_checker::validate_analog_input_field(ioport_field &field) +void validity_checker::validate_analog_input_field(const ioport_field &field) { // analog ports must have a valid sensitivity if (field.sensitivity() == 0) @@ -1787,7 +1787,7 @@ void validity_checker::validate_analog_input_field(ioport_field &field) // setting //------------------------------------------------- -void validity_checker::validate_dip_settings(ioport_field &field) +void validity_checker::validate_dip_settings(const ioport_field &field) { const char *demo_sounds = ioport_string_from_index(INPUT_STRING_Demo_Sounds); const char *flipscreen = ioport_string_from_index(INPUT_STRING_Flip_Screen); @@ -1795,30 +1795,31 @@ void validity_checker::validate_dip_settings(ioport_field &field) bool coin_error = false; // iterate through the settings - for (ioport_setting &setting : field.settings()) + for (auto setting = field.settings().begin(); field.settings().end() != setting; ++setting) { // note any coinage strings - int strindex = get_defstr_index(setting.name()); + int strindex = get_defstr_index(setting->name()); if (strindex >= __input_string_coinage_start && strindex <= __input_string_coinage_end) coin_list[strindex - __input_string_coinage_start] = 1; // make sure demo sounds default to on - if (field.name() == demo_sounds && strindex == INPUT_STRING_On && field.defvalue() != setting.value()) + if (field.name() == demo_sounds && strindex == INPUT_STRING_On && field.defvalue() != setting->value()) osd_printf_error("Demo Sounds must default to On\n"); // check for bad demo sounds options if (field.name() == demo_sounds && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No)) - osd_printf_error("Demo Sounds option must be Off/On, not %s\n", setting.name()); + osd_printf_error("Demo Sounds option must be Off/On, not %s\n", setting->name()); // check for bad flip screen options if (field.name() == flipscreen && (strindex == INPUT_STRING_Yes || strindex == INPUT_STRING_No)) - osd_printf_error("Flip Screen option must be Off/On, not %s\n", setting.name()); + osd_printf_error("Flip Screen option must be Off/On, not %s\n", setting->name()); // if we have a neighbor, compare ourselves to him - if (setting.next() != nullptr) + auto const nextsetting = std::next(setting); + if (field.settings().end() != nextsetting) { // check for inverted off/on dispswitch order - int next_strindex = get_defstr_index(setting.next()->name(), true); + int next_strindex = get_defstr_index(nextsetting->name(), true); if (strindex == INPUT_STRING_On && next_strindex == INPUT_STRING_Off) osd_printf_error("%s option must have Off/On options in the order: Off, On\n", field.name()); @@ -1832,9 +1833,9 @@ void validity_checker::validate_dip_settings(ioport_field &field) // check for proper coin ordering else if (strindex >= __input_string_coinage_start && strindex <= __input_string_coinage_end && next_strindex >= __input_string_coinage_start && next_strindex <= __input_string_coinage_end && - strindex >= next_strindex && setting.condition() == setting.next()->condition()) + strindex >= next_strindex && setting->condition() == nextsetting->condition()) { - osd_printf_error("%s option has unsorted coinage %s > %s\n", field.name(), setting.name(), setting.next()->name()); + osd_printf_error("%s option has unsorted coinage %s > %s\n", field.name(), setting->name(), nextsetting->name()); coin_error = true; } } @@ -1856,7 +1857,7 @@ void validity_checker::validate_dip_settings(ioport_field &field) // stored within an ioport field or setting //------------------------------------------------- -void validity_checker::validate_condition(ioport_condition &condition, device_t &device) +void validity_checker::validate_condition(const ioport_condition &condition, device_t &device) { // resolve the tag, then find a matching port if (m_ioport_set.find(device.subtag(condition.tag())) == m_ioport_set.end()) @@ -1916,7 +1917,7 @@ void validity_checker::validate_inputs(device_t &root) } // iterate through the fields on this port - for (ioport_field &field : port.second->fields()) + for (ioport_field const &field : port.second->fields()) { // verify analog inputs if (field.is_analog()) @@ -1973,7 +1974,7 @@ void validity_checker::validate_inputs(device_t &root) validate_condition(field.condition(), device); // verify conditions on the settings - for (ioport_setting &setting : field.settings()) + for (ioport_setting const &setting : field.settings()) if (!setting.condition().none()) validate_condition(setting.condition(), device); |