summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-08-28 13:11:27 +1000
committer Vas Crabb <vas@vastheman.com>2020-08-28 13:11:27 +1000
commit9f02fa058b7680ae66e4c270d998605d54e507f2 (patch)
tree96b86a25c7315bd94513f798847a5a66e5109e2f
parent3cc6415c081ecd1cd0b8d49bfaf0f0f9e3afbdc7 (diff)
validity.cpp, devfind.cpp: Catch missing required I/O ports in systems (excluding slot cards)
-rw-r--r--src/emu/devfind.cpp112
-rw-r--r--src/emu/devfind.h115
-rw-r--r--src/emu/device.cpp8
-rw-r--r--src/emu/device.h2
-rw-r--r--src/emu/softlist_dev.cpp9
-rw-r--r--src/emu/validity.cpp50
-rw-r--r--src/emu/validity.h30
-rw-r--r--src/frontend/mame/clifront.cpp3
-rw-r--r--src/frontend/mame/mame.cpp2
9 files changed, 199 insertions, 132 deletions
diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp
index 380b246a666..20c6e684da0 100644
--- a/src/emu/devfind.cpp
+++ b/src/emu/devfind.cpp
@@ -10,6 +10,7 @@
#include "emu.h"
#include "romload.h"
+#include "validity.h"
//**************************************************************************
@@ -162,7 +163,7 @@ void *finder_base::find_memregion(u8 width, size_t &length, bool required) const
if (length != 0 && length != length_found)
{
if (required)
- osd_printf_warning("Region '%s' found but has %d bytes, not %ld as requested\n", m_tag, region->bytes(), long(length*width));
+ osd_printf_warning("Region '%s' found but has %d bytes, not %d as requested\n", m_tag, region->bytes(), length * width);
length = 0;
return nullptr;
}
@@ -201,7 +202,7 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const
// check the length and warn if other than specified
if ((bytes_found != 0) && (bytes != 0) && (bytes != bytes_found))
{
- osd_printf_warning("Region '%s' found but has %ld bytes, not %ld as requested\n", m_tag, long(bytes_found), long(bytes));
+ osd_printf_warning("Region '%s' found but has %d bytes, not %d as requested\n", m_tag, bytes_found, bytes);
bytes_found = 0;
}
@@ -337,14 +338,103 @@ bool finder_base::report_missing(bool found, const char *objname, bool required)
}
-void finder_base::printf_warning(const char *format, ...)
+
+//**************************************************************************
+// MEMORY REGION FINDER
+//**************************************************************************
+
+template <bool Required>
+memory_region_finder<Required>::memory_region_finder(device_t &base, char const *tag)
+ : object_finder_base<memory_region, Required>(base, tag)
{
- va_list argptr;
- char buffer[1024];
-
- // do the output
- va_start(argptr, format);
- vsnprintf(buffer, 1024, format, argptr);
- osd_printf_warning("%s", buffer);
- va_end(argptr);
+}
+
+
+template <bool Required>
+bool memory_region_finder<Required>::findit(validity_checker *valid)
+{
+ if (valid)
+ return this->validate_memregion(0, Required);
+
+ assert(!this->m_resolved);
+ this->m_resolved = true;
+ this->m_target = this->m_base.get().memregion(this->m_tag);
+ return this->report_missing("memory region");
+}
+
+
+
+//**************************************************************************
+// MEMORY BANK FINDER
+//**************************************************************************
+
+template <bool Required>
+memory_bank_finder<Required>::memory_bank_finder(device_t &base, char const *tag)
+ : object_finder_base<memory_bank, Required>(base, tag)
+{
+}
+
+
+template <bool Required>
+bool memory_bank_finder<Required>::findit(validity_checker *valid)
+{
+ if (valid)
+ return true;
+
+ assert(!this->m_resolved);
+ this->m_resolved = true;
+ this->m_target = this->m_base.get().membank(this->m_tag);
+ return this->report_missing("memory bank");
+}
+
+
+
+//**************************************************************************
+// I/O PORT FINDER
+//**************************************************************************
+
+template <bool Required>
+ioport_finder<Required>::ioport_finder(device_t &base, char const *tag)
+ : object_finder_base<ioport_port, Required>(base, tag)
+{
+}
+
+
+template <bool Required>
+bool ioport_finder<Required>::findit(validity_checker *valid)
+{
+ if (valid)
+ return finder_base::report_missing(!valid->ioport_missing(this->m_base.get().subtag(this->m_tag).c_str()), "I/O port", Required);
+
+ assert(!this->m_resolved);
+ this->m_resolved = true;
+ this->m_target = this->m_base.get().ioport(this->m_tag);
+ return this->report_missing("I/O port");
+}
+
+
+
+//**************************************************************************
+// ADDRESS SPACE FINDER
+//**************************************************************************
+
+template <bool Required>
+address_space_finder<Required>::address_space_finder(device_t &base, char const *tag, int spacenum, u8 width)
+ : object_finder_base<address_space, Required>(base, tag)
+ , m_spacenum(spacenum)
+ , m_data_width(width)
+{
+}
+
+
+template <bool Required>
+bool address_space_finder<Required>::findit(validity_checker *valid)
+{
+ if (valid)
+ return this->validate_addrspace(this->m_spacenum, this->m_data_width, Required);
+
+ assert(!this->m_resolved);
+ this->m_resolved = true;
+ this->m_target = this->find_addrspace(this->m_spacenum, this->m_data_width, Required);
+ return this->report_missing("address space");
}
diff --git a/src/emu/devfind.h b/src/emu/devfind.h
index 3922624e272..668defe4523 100644
--- a/src/emu/devfind.h
+++ b/src/emu/devfind.h
@@ -20,6 +20,7 @@
#include <type_traits>
#include <utility>
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -236,11 +237,12 @@ public:
/// Should return false if the object is required but not found, or
/// true otherwise (the report_missing member function can assist
/// in implementing this behaviour).
- /// \param [in] isvalidation Pass true if this is a dry run (i.e. no
- /// intention to actually start the device), or false otherwise.
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return False if the object is required but not found, or true
/// otherwise.
- virtual bool findit(bool isvalidation = false) = 0;
+ virtual bool findit(validity_checker *valid) = 0;
/// \brief Clear temporary binding from configuration
///
@@ -417,14 +419,6 @@ protected:
/// \return True if found or not required, false otherwise.
bool report_missing(bool found, char const *objname, bool required) const;
- /// \brief Print a message at warning level
- ///
- /// Prints a message if logging is enabled at warning level or more
- /// detailed. Uses printf semantics of the C runtime library.
- /// \param [in] format Format string as used by printf function in
- /// runtime library
- void printf_warning(char const *format, ...) ATTR_PRINTF(2,3);
-
/// \brief Pointer to next registered discovery helper
///
@@ -598,13 +592,14 @@ private:
/// with the requested tag is found but the type is incorrect, a
/// warning message will be printed. This method is called by the
/// base device at resolution time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the device is optional or if a matching device
/// is found, false otherwise.
- virtual bool findit(bool isvalidation) override
+ virtual bool findit(validity_checker *valid) override
{
- if (!isvalidation)
+ if (!valid)
{
assert(!this->m_resolved);
this->m_resolved = true;
@@ -613,7 +608,7 @@ private:
device_t *const device = this->m_base.get().subdevice(this->m_tag);
this->m_target = dynamic_cast<DeviceClass *>(device);
if (device && !this->m_target)
- this->printf_warning("Device '%s' found but is of incorrect type (actual type is %s)\n", this->m_tag, device->name());
+ osd_printf_warning("Device '%s' found but is of incorrect type (actual type is %s)\n", this->m_tag, device->name());
return this->report_missing("device");
}
@@ -661,7 +656,7 @@ public:
/// \param [in] tag Memory region tag to search for. This is not
/// copied, it is the caller's responsibility to ensure this
/// pointer remains valid until resolution time.
- memory_region_finder(device_t &base, char const *tag) : object_finder_base<memory_region, Required>(base, tag) { }
+ memory_region_finder(device_t &base, char const *tag);
private:
/// \brief Find memory region
@@ -669,20 +664,12 @@ private:
/// Find memory region with requested tag. For a dry run, the
/// target object pointer will not be set. This method is called by
/// the base device at resolution time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the memory region is optional or if a matching
/// memory region is found, false otherwise.
- virtual bool findit(bool isvalidation) override
- {
- if (isvalidation)
- return this->validate_memregion(0, Required);
-
- assert(!this->m_resolved);
- this->m_resolved = true;
- this->m_target = this->m_base.get().memregion(this->m_tag);
- return this->report_missing("memory region");
- }
+ virtual bool findit(validity_checker *valid) override;
};
/// \brief Optional memory region finder
@@ -726,27 +713,19 @@ public:
/// \param [in] tag Memory bank tag to search for. This is not
/// copied, it is the caller's responsibility to ensure this
/// pointer remains valid until resolution time.
- memory_bank_finder(device_t &base, char const *tag) : object_finder_base<memory_bank, Required>(base, tag) { }
+ memory_bank_finder(device_t &base, char const *tag);
/// \brief Find memory bank
///
/// Find memory bank with requested tag. Just returns true for a
/// dry run. This method is called by the base device at resolution
/// time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the memory bank is optional, a matching memory
/// bank is found or this is a dry run, false otherwise.
- virtual bool findit(bool isvalidation) override
- {
- if (isvalidation)
- return true;
-
- assert(!this->m_resolved);
- this->m_resolved = true;
- this->m_target = this->m_base.get().membank(this->m_tag);
- return this->report_missing("memory bank");
- }
+ virtual bool findit(validity_checker *valid) override;
};
/// \brief Optional memory bank finder
@@ -790,7 +769,7 @@ public:
/// \param [in] tag I/O port tag to search for. This is not copied,
/// it is the caller's responsibility to ensure this pointer
/// remains valid until resolution time.
- ioport_finder(device_t &base, char const *tag) : object_finder_base<ioport_port, Required>(base, tag) { }
+ ioport_finder(device_t &base, char const *tag);
/// \brief Read I/O port if found or return default value
///
@@ -808,20 +787,12 @@ private:
/// Find I/O port with requested tag. Just returns true for a dry
/// run. This method is called by the base device at resolution
/// time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the I/O port is optional, a matching I/O port is
/// is found or this is a dry run, false otherwise.
- virtual bool findit(bool isvalidation) override
- {
- if (isvalidation)
- return true;
-
- assert(!this->m_resolved);
- this->m_resolved = true;
- this->m_target = this->m_base.get().ioport(this->m_tag);
- return this->report_missing("I/O port");
- }
+ virtual bool findit(validity_checker *valid) override;
};
/// \brief Optional I/O port finder
@@ -864,7 +835,7 @@ public:
/// remains valid until resolution time.
/// \param [in] spacenum Address space number.
/// \param [in] width Specific data width (optional).
- address_space_finder(device_t &base, char const *tag, int spacenum, u8 width = 0) : object_finder_base<address_space, Required>(base, tag), m_spacenum(spacenum), m_data_width(width) { }
+ address_space_finder(device_t &base, char const *tag, int spacenum, u8 width = 0);
/// \brief Set search tag and space number
///
@@ -919,20 +890,12 @@ private:
/// Find address space with requested tag. For a dry run, the
/// target object pointer will not be set. This method is called by
/// the base device at resolution time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the address space is optional, a matching address space is
/// is found or this is a dry run, false otherwise.
- virtual bool findit(bool isvalidation) override
- {
- if (isvalidation)
- return this->validate_addrspace(this->m_spacenum, this->m_data_width, Required);
-
- assert(!this->m_resolved);
- this->m_resolved = true;
- this->m_target = this->find_addrspace(this->m_spacenum, this->m_data_width, Required);
- return this->report_missing("address space");
- }
+ virtual bool findit(validity_checker *valid) override;
int m_spacenum;
u8 m_data_width;
@@ -1018,13 +981,14 @@ private:
/// checked - the width is not checked and the target pointer is not
/// set. This method is called by the base device at resolution
/// time.
- /// \param [in] isvalidation True if this is a dry run (not
- /// intending to run the machine, just checking for errors).
+ /// \param [in] valid Pass a pointer to the validity checker if this
+ /// is a dry run (i.e. no intention to actually start the device),
+ /// or nullptr otherwise.
/// \return True if the memory region is optional or a matching
/// memory region is found, or false otherwise.
- virtual bool findit(bool isvalidation) override
+ virtual bool findit(validity_checker *valid) override
{
- if (isvalidation)
+ if (valid)
return this->validate_memregion(sizeof(PointerType) * m_desired_length, Required);
assert(!this->m_resolved);
@@ -1108,9 +1072,9 @@ public:
private:
// finder
- virtual bool findit(bool isvalidation) override
+ virtual bool findit(validity_checker *valid) override
{
- if (isvalidation)
+ if (valid)
return true;
assert(!this->m_resolved);
@@ -1171,6 +1135,9 @@ extern template class memory_bank_finder<true>;
extern template class ioport_finder<false>;
extern template class ioport_finder<true>;
+extern template class address_space_finder<false>;
+extern template class address_space_finder<true>;
+
extern template class region_ptr_finder<u8, false>;
extern template class region_ptr_finder<u8, true>;
extern template class region_ptr_finder<u16, false>;
diff --git a/src/emu/device.cpp b/src/emu/device.cpp
index fe028719f2f..7196b75e18f 100644
--- a/src/emu/device.cpp
+++ b/src/emu/device.cpp
@@ -495,12 +495,12 @@ void device_t::set_machine(running_machine &machine)
// list and return status
//-------------------------------------------------
-bool device_t::findit(bool isvalidation) const
+bool device_t::findit(validity_checker *valid) const
{
bool allfound = true;
for (finder_base *autodev = m_auto_finder_list; autodev != nullptr; autodev = autodev->next())
{
- if (isvalidation)
+ if (valid)
{
// sanity checking
char const *const tag = autodev->finder_tag();
@@ -517,7 +517,7 @@ bool device_t::findit(bool isvalidation) const
continue;
}
}
- allfound &= autodev->findit(isvalidation);
+ allfound &= autodev->findit(valid);
}
return allfound;
}
@@ -541,7 +541,7 @@ void device_t::resolve_pre_map()
void device_t::resolve_post_map()
{
// find all the registered post-map objects
- if (!findit(false))
+ if (!findit(nullptr))
throw emu_fatalerror("Missing some required objects, unable to proceed");
// allow implementation to do additional setup
diff --git a/src/emu/device.h b/src/emu/device.h
index 941be58f798..55c3641f678 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -638,7 +638,7 @@ public:
device_debug *debug() const { return m_debug.get(); }
void set_system_bios(u8 bios) { m_system_bios = bios; }
- bool findit(bool isvalidation) const;
+ bool findit(validity_checker *valid) const;
// misc
template <typename Format, typename... Params> void popmessage(Format &&fmt, Params &&... args) const;
diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp
index 0a8f996525a..e2842b315b4 100644
--- a/src/emu/softlist_dev.cpp
+++ b/src/emu/softlist_dev.cpp
@@ -405,12 +405,9 @@ void software_list_device::device_validity_check(validity_checker &valid) const
if (valid.already_checked(std::string("softlist/").append(m_list_name).c_str()))
return;
- // do device validation only in case of validate command
- if (!valid.validate_all())
- return;
-
- // actually do the validate
- const_cast<software_list_device *>(this)->internal_validity_check(valid);
+ // skip in case of quick validation
+ if (!valid.quick())
+ const_cast<software_list_device *>(this)->internal_validity_check(valid);
}
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp
index d9d90c3729e..c8b5b52892c 100644
--- a/src/emu/validity.cpp
+++ b/src/emu/validity.cpp
@@ -128,7 +128,7 @@ void validity_checker::validate_tag(const char *tag)
// validity_checker - constructor
//-------------------------------------------------
-validity_checker::validity_checker(emu_options &options)
+validity_checker::validity_checker(emu_options &options, bool quick)
: m_drivlist(options)
, m_errors(0)
, m_warnings(0)
@@ -136,7 +136,8 @@ validity_checker::validity_checker(emu_options &options)
, m_current_driver(nullptr)
, m_current_device(nullptr)
, m_current_ioport(nullptr)
- , m_validate_all(false)
+ , m_checking_card(false)
+ , m_quick(quick)
{
// pre-populate the defstr map with all the default strings
for (int strnum = 1; strnum < INPUT_STRING_COUNT; strnum++)
@@ -260,6 +261,7 @@ void validity_checker::validate_begin()
m_roms_map.clear();
m_defstr_map.clear();
m_region_map.clear();
+ m_ioport_set.clear();
// reset internal state
m_errors = 0;
@@ -295,6 +297,8 @@ void validity_checker::validate_one(const game_driver &driver)
m_current_device = nullptr;
m_current_ioport = nullptr;
m_region_map.clear();
+ m_ioport_set.clear();
+ m_checking_card = false;
// reset error/warning state
int start_errors = m_errors;
@@ -303,7 +307,7 @@ void validity_checker::validate_one(const game_driver &driver)
m_warning_text.clear();
m_verbose_text.clear();
- // wrap in try/except to catch fatalerrors
+ // wrap in try/catch to catch fatalerrors
try
{
machine_config config(driver, m_blank_options);
@@ -312,7 +316,7 @@ void validity_checker::validate_one(const game_driver &driver)
validate_inputs(config.root_device());
validate_devices(config);
}
- catch (emu_fatalerror &err)
+ catch (emu_fatalerror const &err)
{
osd_printf_error("Fatal error %s", err.what());
}
@@ -336,6 +340,9 @@ void validity_checker::validate_one(const game_driver &driver)
m_current_driver = nullptr;
m_current_device = nullptr;
m_current_ioport = nullptr;
+ m_region_map.clear();
+ m_ioport_set.clear();
+ m_checking_card = false;
}
@@ -1847,11 +1854,10 @@ 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, std::unordered_set<std::string> &port_map)
+void validity_checker::validate_condition(ioport_condition &condition, device_t &device)
{
- // resolve the tag
- // then find a matching port
- if (port_map.find(device.subtag(condition.tag())) == port_map.end())
+ // resolve the tag, then find a matching port
+ if (m_ioport_set.find(device.subtag(condition.tag())) == m_ioport_set.end())
osd_printf_error("Condition referencing non-existent ioport tag '%s'\n", condition.tag());
}
@@ -1862,8 +1868,6 @@ void validity_checker::validate_condition(ioport_condition &condition, device_t
void validity_checker::validate_inputs(device_t &root)
{
- std::unordered_set<std::string> port_map;
-
// iterate over devices
for (device_t &device : device_iterator(root))
{
@@ -1885,7 +1889,7 @@ void validity_checker::validate_inputs(device_t &root)
// do a first pass over ports to add their names and find duplicates
for (auto &port : portlist)
- if (!port_map.insert(port.second->tag()).second)
+ if (!m_ioport_set.insert(port.second->tag()).second)
osd_printf_error("Multiple I/O ports with the same tag '%s' defined\n", port.second->tag());
// iterate over ports
@@ -1964,12 +1968,12 @@ void validity_checker::validate_inputs(device_t &root)
// verify conditions on the field
if (!field.condition().none())
- validate_condition(field.condition(), device, port_map);
+ validate_condition(field.condition(), device);
// verify conditions on the settings
for (ioport_setting &setting : field.settings())
if (!setting.condition().none())
- validate_condition(setting.condition(), device, port_map);
+ validate_condition(setting.condition(), device);
// verify natural keyboard codes
for (int which = 0; which < 1 << (UCHAR_SHIFT_END - UCHAR_SHIFT_BEGIN + 1); which++)
@@ -1980,9 +1984,9 @@ void validity_checker::validate_inputs(device_t &root)
if (!uchar_isvalid(code))
{
osd_printf_error("Field '%s' has non-character U+%04X in PORT_CHAR(%d)\n",
- name,
- (unsigned)code,
- (int)code);
+ name,
+ (unsigned)code,
+ (int)code);
}
}
}
@@ -2013,7 +2017,7 @@ void validity_checker::validate_devices(machine_config &config)
m_current_device = &device;
// validate auto-finders
- device.findit(true);
+ device.findit(this);
// validate the device tag
validate_tag(device.basetag());
@@ -2039,6 +2043,7 @@ void validity_checker::validate_devices(machine_config &config)
if (slot->default_option() != nullptr && option.first == slot->default_option())
continue;
+ m_checking_card = true;
device_t *card;
{
machine_config::token const tok(config.begin_configuration(slot->device()));
@@ -2079,13 +2084,14 @@ void validity_checker::validate_devices(machine_config &config)
for (device_t &card_dev : device_iterator(*card))
{
m_current_device = &card_dev;
- card_dev.findit(true);
+ card_dev.findit(this);
card_dev.validity_check(*this);
m_current_device = nullptr;
}
machine_config::token const tok(config.begin_configuration(slot->device()));
config.device_remove(option.second->name());
+ m_checking_card = false;
}
}
}
@@ -2199,10 +2205,16 @@ void validity_checker::validate_device_types()
if (unemulated & imperfect)
osd_printf_error("Device cannot have features that are both unemulated and imperfect (0x%08lX)\n", static_cast<unsigned long>(unemulated & imperfect));
- // give devices some of the same scrutiny that drivers get, necessary for cards not default for any slots
+ // give devices some of the same scrutiny that drivers get - necessary for cards not default for any slots
validate_roms(*dev);
validate_inputs(*dev);
+ // reset the device
+ m_current_device = nullptr;
+ m_current_ioport = nullptr;
+ m_region_map.clear();
+ m_ioport_set.clear();
+
// remove the device in preparation for re-using the machine configuration
config.device_remove(type.shortname());
}
diff --git a/src/emu/validity.h b/src/emu/validity.h
index 03a652d2856..594e55a6e9f 100644
--- a/src/emu/validity.h
+++ b/src/emu/validity.h
@@ -25,17 +25,16 @@
class validity_checker : public osd_output
{
public:
- validity_checker(emu_options &options);
+ validity_checker(emu_options &options, bool quick);
~validity_checker();
// getters
int errors() const { return m_errors; }
int warnings() const { return m_warnings; }
- bool validate_all() const { return m_validate_all; }
+ bool quick() const { return m_quick; }
// setter
void set_verbose(bool verbose) { m_print_verbose = verbose; }
- void set_validate_all(bool all) { m_validate_all = all; }
// operations
void check_driver(const game_driver &driver);
@@ -44,20 +43,21 @@ public:
// helpers for devices
void validate_tag(const char *tag);
- int region_length(const char *tag) { auto i = m_region_map.find(tag); return i == m_region_map.end() ? 0 : i->second; }
+ int region_length(const char *tag) { auto const i = m_region_map.find(tag); return (i == m_region_map.end()) ? 0 : i->second; }
+ bool ioport_missing(const char *tag) { return !m_checking_card && (m_ioport_set.find(tag) == m_ioport_set.end()); }
// generic registry of already-checked stuff
bool already_checked(const char *string) { return !m_already_checked.insert(string).second; }
- // osd_output interface
-
protected:
+ // osd_output interface
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<std::ostream> &args) override;
private:
// internal map types
- typedef std::unordered_map<std::string,const game_driver *> game_driver_map;
- typedef std::unordered_map<std::string,uintptr_t> int_map;
+ using game_driver_map = std::unordered_map<std::string, game_driver const *>;
+ using int_map = std::unordered_map<std::string, uintptr_t>;
+ using string_set = std::unordered_set<std::string>;
// internal helpers
const char *ioport_string_from_index(u32 index);
@@ -76,7 +76,7 @@ private:
void validate_roms(device_t &root);
void validate_analog_input_field(ioport_field &field);
void validate_dip_settings(ioport_field &field);
- void validate_condition(ioport_condition &condition, device_t &device, std::unordered_set<std::string> &port_map);
+ void validate_condition(ioport_condition &condition, device_t &device);
void validate_inputs(device_t &root);
void validate_devices(machine_config &config);
void validate_device_types();
@@ -113,12 +113,14 @@ private:
int_map m_defstr_map;
// current state
- const game_driver * m_current_driver;
- const device_t * m_current_device;
- const char * m_current_ioport;
+ game_driver const * m_current_driver;
+ device_t const * m_current_device;
+ char const * m_current_ioport;
int_map m_region_map;
- std::unordered_set<std::string> m_already_checked;
- bool m_validate_all;
+ string_set m_ioport_set;
+ string_set m_already_checked;
+ bool m_checking_card;
+ bool const m_quick;
};
#endif // MAME_EMU_VALIDITY_H
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index de22e2e9113..4785b718d68 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -1632,8 +1632,7 @@ void cli_frontend::execute_commands(const char *exename)
osd_printf_error("Auxiliary verb -validate takes at most 1 argument\n");
return;
}
- validity_checker valid(m_options);
- valid.set_validate_all(true);
+ validity_checker valid(m_options, false);
const char *sysname = m_options.command_arguments().empty() ? nullptr : m_options.command_arguments()[0].c_str();
bool result = valid.check_all_matching(sysname);
if (!result)
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index 88ccc4e1b80..908da0e2bf6 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -244,7 +244,7 @@ int mame_machine_manager::execute()
bool is_empty = (system == &GAME_NAME(___empty));
if (!is_empty)
{
- validity_checker valid(m_options);
+ validity_checker valid(m_options, true);
valid.set_verbose(false);
valid.check_shared_source(*system);
}