diff options
Diffstat (limited to 'src/emu/validity.cpp')
-rw-r--r-- | src/emu/validity.cpp | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 4cb6202b4d9..92b141f269e 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -22,6 +22,7 @@ #include "unicode.h" #include <cctype> +#include <sstream> #include <type_traits> #include <typeinfo> @@ -174,13 +175,6 @@ void validate_integer_semantics() if (a32 >> 1 != -2) osd_printf_error("s32 right shift must be arithmetic\n"); if (a64 >> 1 != -2) osd_printf_error("s64 right shift must be arithmetic\n"); - // check pointer size -#ifdef PTR64 - static_assert(sizeof(void *) == 8, "PTR64 flag enabled, but was compiled for 32-bit target\n"); -#else - static_assert(sizeof(void *) == 4, "PTR64 flag not enabled, but was compiled for 64-bit target\n"); -#endif - // TODO: check if this is actually working // check endianness definition u16 lsbtest = 0; @@ -2150,6 +2144,49 @@ void validity_checker::validate_driver(device_t &root) osd_printf_error("Driver cannot have features that are both unemulated and imperfect (0x%08X)\n", util::underlying_value(unemulated & imperfect)); if ((m_current_driver->flags & machine_flags::NO_SOUND_HW) && ((unemulated | imperfect) & device_t::feature::SOUND)) osd_printf_error("Machine without sound hardware cannot have unemulated/imperfect sound\n"); + + // catch systems marked as supporting save states that contain devices that don't support save states + if (!(m_current_driver->type.emulation_flags() & device_t::flags::SAVE_UNSUPPORTED)) + { + std::set<std::add_pointer_t<device_type> > nosave; + device_enumerator iter(root); + std::string_view cardtag; + for (auto &device : iter) + { + // ignore any children of a slot card + if (!cardtag.empty()) + { + std::string_view tag(device.tag()); + if ((tag.length() > cardtag.length()) && (tag.substr(0, cardtag.length()) == cardtag) && tag[cardtag.length()] == ':') + continue; + else + cardtag = std::string_view(); + } + + // check to see if this is a slot card + device_t *const parent(device.owner()); + if (parent) + { + device_slot_interface *slot; + parent->interface(slot); + if (slot && (slot->get_card_device() == &device)) + { + cardtag = device.tag(); + continue; + } + } + + if (device.type().emulation_flags() & device_t::flags::SAVE_UNSUPPORTED) + nosave.emplace(&device.type()); + } + if (!nosave.empty()) + { + std::ostringstream buf; + for (auto const &devtype : nosave) + util::stream_format(buf, "%s(%s) %s\n", core_filename_extract_base(devtype->source()), devtype->shortname(), devtype->fullname()); + osd_printf_error("Machine is marked as supporting save states but uses devices that lack save state support:\n%s", std::move(buf).str()); + } + } } @@ -2495,12 +2532,13 @@ void validity_checker::validate_inputs(device_t &root) // allocate the input ports ioport_list portlist; - std::string errorbuf; - portlist.append(device, errorbuf); - - // report any errors during construction - if (!errorbuf.empty()) - osd_printf_error("I/O port error during construction:\n%s\n", errorbuf); + { + // report any errors during construction + std::ostringstream errorbuf; + portlist.append(device, errorbuf); + if (errorbuf.tellp()) + osd_printf_error("I/O port error during construction:\n%s\n", std::move(errorbuf).str()); + } // do a first pass over ports to add their names and find duplicates for (auto &port : portlist) |