diff options
-rw-r--r-- | scripts/build/makelist.py | 2 | ||||
-rw-r--r-- | scripts/src/cpu.lua | 7 | ||||
-rw-r--r-- | scripts/src/sound.lua | 3 | ||||
-rw-r--r-- | scripts/target/mame/arcade.lua | 12 | ||||
-rw-r--r-- | src/devices/cpu/sh2/sh7604_wdt.cpp | 6 | ||||
-rw-r--r-- | src/emu/drivenum.cpp | 201 | ||||
-rw-r--r-- | src/emu/drivenum.h | 75 | ||||
-rw-r--r-- | src/emu/gamedrv.h | 190 | ||||
-rw-r--r-- | src/frontend/mame/audit.cpp | 8 | ||||
-rw-r--r-- | src/frontend/mame/clifront.cpp | 34 | ||||
-rw-r--r-- | src/frontend/mame/info.cpp | 42 | ||||
-rw-r--r-- | src/frontend/mame/luaengine.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/media_ident.cpp | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/selgame.cpp | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/selsoft.cpp | 4 | ||||
-rw-r--r-- | src/lib/util/coretmpl.h | 3 |
16 files changed, 274 insertions, 323 deletions
diff --git a/scripts/build/makelist.py b/scripts/build/makelist.py index a9b450474e2..1a27a515e04 100644 --- a/scripts/build/makelist.py +++ b/scripts/build/makelist.py @@ -164,4 +164,4 @@ print("};") print("") # also output a global count -print("int driver_list::s_driver_count = %d;\n" % len(drivlist)) +print("std::size_t const driver_list::s_driver_count = %d;\n" % len(drivlist)) diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index 12f877f4f10..8b2fc31abed 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -27,7 +27,6 @@ if (CPUS["SH2"]~=null or CPUS["MIPS"]~=null or CPUS["POWERPC"]~=null or CPUS["RS MAME_DIR .. "src/devices/cpu/drcuml.h", MAME_DIR .. "src/devices/cpu/uml.cpp", MAME_DIR .. "src/devices/cpu/uml.h", - MAME_DIR .. "src/devices/cpu/i386/i386dasm.cpp", MAME_DIR .. "src/devices/cpu/x86log.cpp", MAME_DIR .. "src/devices/cpu/x86log.h", MAME_DIR .. "src/devices/cpu/drcbex86.cpp", @@ -931,7 +930,7 @@ if (CPUS["I86"]~=null) then } end -if (CPUS["I86"]~=null or _OPTIONS["with-tools"]) then +if (CPUS["SH2"]~=null or CPUS["MIPS"]~=null or CPUS["POWERPC"]~=null or CPUS["RSP"]~=null or CPUS["ARM7"]~=null or CPUS["ADSP21062"]~=null or CPUS["MB86235"]~=null or CPUS["I86"]~=null or _OPTIONS["with-tools"]) then table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/i386/i386dasm.cpp") end @@ -951,10 +950,6 @@ if (CPUS["I386"]~=null) then } end -if (CPUS["I386"]~=null or _OPTIONS["with-tools"]) then - table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/i386/i386dasm.cpp") -end - -------------------------------------------------- -- Intel i860 --@src/devices/cpu/i860/i860.h,CPUS["I860"] = true diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua index 171ad3f30cc..fd1dc2f33a3 100644 --- a/scripts/src/sound.lua +++ b/scripts/src/sound.lua @@ -755,9 +755,6 @@ if (SOUNDS["QSOUND"]~=null) then files { MAME_DIR .. "src/devices/sound/qsound.cpp", MAME_DIR .. "src/devices/sound/qsound.h", - MAME_DIR .. "src/devices/cpu/dsp16/dsp16.cpp", - MAME_DIR .. "src/devices/cpu/dsp16/dsp16.h", - MAME_DIR .. "src/devices/cpu/dsp16/dsp16dis.cpp", } end diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 7d75617c22c..c06831fb7dc 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -848,6 +848,8 @@ function createProjects_mame_arcade(_target, _subtarget) createMAMEProjects(_target, _subtarget, "shared") files { + MAME_DIR .. "src/mame/machine/meters.cpp", + MAME_DIR .. "src/mame/machine/meters.h", MAME_DIR .. "src/mame/machine/nmk112.cpp", MAME_DIR .. "src/mame/machine/nmk112.h", MAME_DIR .. "src/mame/machine/pcshare.cpp", @@ -858,6 +860,8 @@ files { MAME_DIR .. "src/mame/machine/ticket.h", MAME_DIR .. "src/mame/video/avgdvg.cpp", MAME_DIR .. "src/mame/video/avgdvg.h", + MAME_DIR .. "src/mame/video/awpvid.cpp", + MAME_DIR .. "src/mame/video/awpvid.h", MAME_DIR .. "src/mame/audio/dcs.cpp", MAME_DIR .. "src/mame/audio/dcs.h", MAME_DIR .. "src/mame/audio/decobsmt.cpp", @@ -1266,10 +1270,6 @@ files { MAME_DIR .. "src/mame/drivers/mpu4misc.hxx", MAME_DIR .. "src/mame/drivers/mpu5.cpp", MAME_DIR .. "src/mame/drivers/mpu5.hxx", - MAME_DIR .. "src/mame/video/awpvid.cpp", - MAME_DIR .. "src/mame/video/awpvid.h", - MAME_DIR .. "src/mame/machine/meters.cpp", - MAME_DIR .. "src/mame/machine/meters.h", } createMAMEProjects(_target, _subtarget, "bfm") @@ -2088,10 +2088,6 @@ files { MAME_DIR .. "src/mame/drivers/jpmimpctsw.cpp", MAME_DIR .. "src/mame/drivers/pluto5.cpp", MAME_DIR .. "src/mame/drivers/jpmsys7.cpp", - MAME_DIR .. "src/mame/video/awpvid.cpp", - MAME_DIR .. "src/mame/video/awpvid.h", - MAME_DIR .. "src/mame/machine/meters.cpp", - MAME_DIR .. "src/mame/machine/meters.h", } createMAMEProjects(_target, _subtarget, "kaneko") diff --git a/src/devices/cpu/sh2/sh7604_wdt.cpp b/src/devices/cpu/sh2/sh7604_wdt.cpp index ea6e42d6325..e128b692fa0 100644 --- a/src/devices/cpu/sh2/sh7604_wdt.cpp +++ b/src/devices/cpu/sh2/sh7604_wdt.cpp @@ -47,6 +47,12 @@ sh7604_wdt_device::sh7604_wdt_device(const machine_config &mconfig, const char * } +const address_space_config *sh7604_wdt_device::memory_space_config(address_spacenum spacenum) const +{ + return &m_space_config; +} + + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/emu/drivenum.cpp b/src/emu/drivenum.cpp index a23db4c54bc..41439f5dac4 100644 --- a/src/emu/drivenum.cpp +++ b/src/emu/drivenum.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "drivenum.h" #include "softlist_dev.h" + #include <ctype.h> @@ -35,17 +36,15 @@ driver_list::driver_list() int driver_list::find(const char *name) { // if no name, bail - if (name == nullptr) + if (!name) return -1; - // create a dummy item for comparison purposes - game_driver driver; - driver.name = name; - game_driver *driverptr = &driver; - // binary search to find it - const game_driver **result = reinterpret_cast<const game_driver **>(bsearch(&driverptr, s_drivers_sorted, s_driver_count, sizeof(*s_drivers_sorted), driver_sort_callback)); - return (result == nullptr) ? -1 : result - s_drivers_sorted; + game_driver const *const *const begin = s_drivers_sorted; + game_driver const *const *const end = begin + s_driver_count; + auto const cmp = [] (game_driver const *driver, char const *name) { return core_stricmp(driver->name, name) < 0; }; + game_driver const *const *const result = std::lower_bound(begin, end, name, cmp); + return ((result == end) || core_stricmp((*result)->name, name)) ? -1 : std::distance(begin, result); } @@ -66,19 +65,6 @@ bool driver_list::matches(const char *wildstring, const char *string) //------------------------------------------------- -// driver_sort_callback - compare two items in -// an array of game_driver pointers -//------------------------------------------------- - -int driver_list::driver_sort_callback(const void *elem1, const void *elem2) -{ - const game_driver * const *item1 = reinterpret_cast<const game_driver * const *>(elem1); - const game_driver * const *item2 = reinterpret_cast<const game_driver * const *>(elem2); - return core_stricmp((*item1)->name, (*item2)->name); -} - - -//------------------------------------------------- // penalty_compare - compare two strings for // closeness and assign a score. //------------------------------------------------- @@ -129,33 +115,25 @@ int driver_list::penalty_compare(const char *source, const char *target) //------------------------------------------------- driver_enumerator::driver_enumerator(emu_options &options) - : m_current(-1), - m_filtered_count(0), - m_options(options), - m_included(s_driver_count), - m_config(s_driver_count) + : m_current(-1) + , m_filtered_count(0) + , m_options(options) + , m_included(s_driver_count) + , m_config(CONFIG_CACHE_COUNT) { include_all(); } driver_enumerator::driver_enumerator(emu_options &options, const char *string) - : m_current(-1), - m_filtered_count(0), - m_options(options), - m_included(s_driver_count), - m_config(s_driver_count) + : driver_enumerator(options) { filter(string); } driver_enumerator::driver_enumerator(emu_options &options, const game_driver &driver) - : m_current(-1), - m_filtered_count(0), - m_options(options), - m_included(s_driver_count), - m_config(s_driver_count) + : driver_enumerator(options) { filter(driver); } @@ -176,24 +154,16 @@ driver_enumerator::~driver_enumerator() // driver, allocating on demand if needed //------------------------------------------------- -machine_config &driver_enumerator::config(int index, emu_options &options) const +std::shared_ptr<machine_config> const &driver_enumerator::config(std::size_t index, emu_options &options) const { - assert(index >= 0 && index < s_driver_count); + assert(index < s_driver_count); // if we don't have it cached, add it - if (m_config[index] == nullptr) - { - // if our cache is full, release the head entry - if (m_config_cache.size() == CONFIG_CACHE_COUNT) - { - int first = m_config_cache.front(); - m_config[first] = nullptr; - m_config_cache.erase(m_config_cache.begin()); - } - m_config[index] = std::make_unique<machine_config>(*s_drivers_sorted[index], options); - m_config_cache.push_back(index); - } - return *m_config[index]; + std::shared_ptr<machine_config> &config = m_config[index]; + if (!config) + config = std::make_shared<machine_config>(*s_drivers_sorted[index], options); + + return config; } @@ -202,13 +172,13 @@ machine_config &driver_enumerator::config(int index, emu_options &options) const // given string //------------------------------------------------- -int driver_enumerator::filter(const char *filterstring) +std::size_t driver_enumerator::filter(const char *filterstring) { // reset the count exclude_all(); // match name against each driver in the list - for (int index = 0; index < s_driver_count; index++) + for (std::size_t index = 0; index < s_driver_count; index++) if (matches(filterstring, s_drivers_sorted[index]->name)) include(index); @@ -221,13 +191,13 @@ int driver_enumerator::filter(const char *filterstring) // given driver //------------------------------------------------- -int driver_enumerator::filter(const game_driver &driver) +std::size_t driver_enumerator::filter(const game_driver &driver) { // reset the count exclude_all(); // match name against each driver in the list - for (int index = 0; index < s_driver_count; index++) + for (std::size_t index = 0; index < s_driver_count; index++) if (s_drivers_sorted[index] == &driver) include(index); @@ -242,12 +212,10 @@ int driver_enumerator::filter(const game_driver &driver) void driver_enumerator::include_all() { std::fill(m_included.begin(), m_included.end(), true); - m_filtered_count = s_driver_count; + m_filtered_count = m_included.size(); // always exclude the empty driver - int empty = find("___empty"); - assert(empty != -1); - m_included[empty] = 0; + exclude(find("___empty")); } @@ -258,20 +226,14 @@ void driver_enumerator::include_all() bool driver_enumerator::next() { - // always advance one release_current(); - m_current++; + // always advance one // if we have a filter, scan forward to the next match - while (m_current < s_driver_count) - { - if (m_included[m_current]) - break; - m_current++; - } + for (m_current++; (m_current < s_driver_count) && !m_included[m_current]; m_current++) { } // return true if we end up in range - return (m_current >= 0 && m_current < s_driver_count); + return (m_current >= 0) && (m_current < s_driver_count); } @@ -282,20 +244,14 @@ bool driver_enumerator::next() bool driver_enumerator::next_excluded() { - // always advance one release_current(); - m_current++; + // always advance one // if we have a filter, scan forward to the next match - while (m_current < s_driver_count) - { - if (!m_included[m_current]) - break; - m_current++; - } + for (m_current++; (m_current < s_driver_count) && m_included[m_current]; m_current++) { } // return true if we end up in range - return (m_current >= 0 && m_current < s_driver_count); + return (m_current >= 0) && (m_current < s_driver_count); } @@ -304,12 +260,12 @@ bool driver_enumerator::next_excluded() // an array of game_driver pointers //------------------------------------------------- -void driver_enumerator::find_approximate_matches(const char *string, int count, int *results) +void driver_enumerator::find_approximate_matches(const char *string, std::size_t count, int *results) { #undef rand // if no name, pick random entries - if (string == nullptr || string[0] == 0) + if (!string || !string[0]) { // seed the RNG first srand(osd_ticks()); @@ -323,7 +279,7 @@ void driver_enumerator::find_approximate_matches(const char *string, int count, assert(arrayindex == m_filtered_count); // shuffle - for (int shufnum = 0; shufnum < 4 * s_driver_count; shufnum++) + for (int shufnum = 0; shufnum < (4 * s_driver_count); shufnum++) { int item1 = rand() % m_filtered_count; int item2 = rand() % m_filtered_count; @@ -335,49 +291,49 @@ void driver_enumerator::find_approximate_matches(const char *string, int count, // copy out the first few entries for (int matchnum = 0; matchnum < count; matchnum++) results[matchnum] = templist[matchnum % m_filtered_count]; - return; } - - // allocate memory to track the penalty value - std::vector<int> penalty(count); - - // initialize everyone's states - for (int matchnum = 0; matchnum < count; matchnum++) + else { - penalty[matchnum] = 9999; - results[matchnum] = -1; - } + // allocate memory to track the penalty value + std::vector<int> penalty(count); - // scan the entire drivers array - for (int index = 0; index < s_driver_count; index++) - if (m_included[index]) + // initialize everyone's states + for (int matchnum = 0; matchnum < count; matchnum++) { - // skip things that can't run - if ((s_drivers_sorted[index]->flags & MACHINE_NO_STANDALONE) != 0) - continue; - - // pick the best match between driver name and description - int curpenalty = penalty_compare(string, s_drivers_sorted[index]->description); - int tmp = penalty_compare(string, s_drivers_sorted[index]->name); - curpenalty = std::min(curpenalty, tmp); + penalty[matchnum] = 9999; + results[matchnum] = -1; + } - // insert into the sorted table of matches - for (int matchnum = count - 1; matchnum >= 0; matchnum--) + // scan the entire drivers array + for (int index = 0; index < s_driver_count; index++) + { + // skip things that can't run + if (m_included[index] && !(s_drivers_sorted[index]->flags & MACHINE_NO_STANDALONE)) { - // stop if we're worse than the current entry - if (curpenalty >= penalty[matchnum]) - break; + // pick the best match between driver name and description + int curpenalty = penalty_compare(string, s_drivers_sorted[index]->description); + int tmp = penalty_compare(string, s_drivers_sorted[index]->name); + curpenalty = (std::min)(curpenalty, tmp); - // as long as this isn't the last entry, bump this one down - if (matchnum < count - 1) + // insert into the sorted table of matches + for (int matchnum = count - 1; matchnum >= 0; matchnum--) { - penalty[matchnum + 1] = penalty[matchnum]; - results[matchnum + 1] = results[matchnum]; + // stop if we're worse than the current entry + if (curpenalty >= penalty[matchnum]) + break; + + // as long as this isn't the last entry, bump this one down + if (matchnum < count - 1) + { + penalty[matchnum + 1] = penalty[matchnum]; + results[matchnum + 1] = results[matchnum]; + } + results[matchnum] = index; + penalty[matchnum] = curpenalty; } - results[matchnum] = index; - penalty[matchnum] = curpenalty; } } + } } @@ -390,14 +346,15 @@ void driver_enumerator::find_approximate_matches(const char *string, int count, void driver_enumerator::release_current() const { // skip if no current entry - if (m_current < 0 || m_current >= s_driver_count) - return; - - // skip if we haven't cached a config - if (m_config[m_current] == nullptr) - return; - - // iterate over software lists in this entry and reset - for (software_list_device &swlistdev : software_list_device_iterator(m_config[m_current]->root_device())) - swlistdev.release(); + if ((m_current >= 0) && (m_current < s_driver_count)) + { + // skip if we haven't cached a config + auto const cached = m_config.find(m_current); + if (cached != m_config.end()) + { + // iterate over software lists in this entry and reset + for (software_list_device &swlistdev : software_list_device_iterator(cached->second->root_device())) + swlistdev.release(); + } + } } diff --git a/src/emu/drivenum.h b/src/emu/drivenum.h index 3732915b46a..8db4fa9766c 100644 --- a/src/emu/drivenum.h +++ b/src/emu/drivenum.h @@ -8,10 +8,14 @@ ***************************************************************************/ +#ifndef MAME_EMU_DRIVENUM_H +#define MAME_EMU_DRIVENUM_H + #pragma once -#ifndef __DRIVENUM_H__ -#define __DRIVENUM_H__ +#include <algorithm> +#include <cassert> +#include <memory> //************************************************************************** @@ -38,18 +42,18 @@ protected: public: // getters - static int total() { return s_driver_count; } + static std::size_t total() { return s_driver_count; } // any item by index - static const game_driver &driver(int index) { assert(index >= 0 && index < s_driver_count); return *s_drivers_sorted[index]; } - static int clone(int index) { return find(driver(index).parent); } - static int non_bios_clone(int index) { int result = find(driver(index).parent); return (result != -1 && (driver(result).flags & MACHINE_IS_BIOS_ROOT) == 0) ? result : -1; } - static int compatible_with(int index) { return find(driver(index).compatible_with); } + static const game_driver &driver(std::size_t index) { assert(index < total()); return *s_drivers_sorted[index]; } + static int clone(std::size_t index) { return find(driver(index).parent); } + static int non_bios_clone(std::size_t index) { int const result = find(driver(index).parent); return ((result >= 0) && !(driver(result).flags & MACHINE_IS_BIOS_ROOT)) ? result : -1; } + static int compatible_with(std::size_t index) { return find(driver(index).compatible_with); } // any item by driver - static int clone(const game_driver &driver) { int index = find(driver); assert(index != -1); return clone(index); } - static int non_bios_clone(const game_driver &driver) { int index = find(driver); assert(index != -1); return non_bios_clone(index); } - static int compatible_with(const game_driver &driver) { int index = find(driver); assert(index != -1); return compatible_with(index); } + static int clone(const game_driver &driver) { int const index = find(driver); assert(index >= 0); return clone(index); } + static int non_bios_clone(const game_driver &driver) { int const index = find(driver); assert(index >= 0); return non_bios_clone(index); } + static int compatible_with(const game_driver &driver) { int const index = find(driver); assert(index >= 0); return compatible_with(index); } // general helpers static int find(const char *name); @@ -60,12 +64,8 @@ public: static int penalty_compare(const char *source, const char *target); protected: - // internal helpers - static int driver_sort_callback(const void *elem1, const void *elem2); - - // internal state - static int s_driver_count; - static const game_driver * const s_drivers_sorted[]; + static std::size_t const s_driver_count; + static game_driver const * const s_drivers_sorted[]; }; @@ -84,13 +84,13 @@ public: ~driver_enumerator(); // getters - int count() const { return m_filtered_count; } + std::size_t count() const { return m_filtered_count; } int current() const { return m_current; } emu_options &options() const { return m_options; } // current item const game_driver &driver() const { return driver_list::driver(m_current); } - machine_config &config() const { return config(m_current, m_options); } + std::shared_ptr<machine_config> const &config() const { return config(m_current, m_options); } int clone() const { return driver_list::clone(m_current); } int non_bios_clone() const { return driver_list::non_bios_clone(m_current); } int compatible_with() const { return driver_list::compatible_with(m_current); } @@ -98,20 +98,20 @@ public: void exclude() { exclude(m_current); } // any item by index - bool included(int index) const { assert(index >= 0 && index < s_driver_count); return m_included[index]; } - bool excluded(int index) const { assert(index >= 0 && index < s_driver_count); return !m_included[index]; } - machine_config &config(int index) const { return config(index,m_options); } - machine_config &config(int index, emu_options &options) const; - void include(int index) { assert(index >= 0 && index < s_driver_count); if (!m_included[index]) { m_included[index] = true; m_filtered_count++; } } - void exclude(int index) { assert(index >= 0 && index < s_driver_count); if (m_included[index]) { m_included[index] = false; m_filtered_count--; } } + bool included(std::size_t index) const { assert(index < m_included.size()); return m_included[index]; } + bool excluded(std::size_t index) const { assert(index < m_included.size()); return !m_included[index]; } + std::shared_ptr<machine_config> const &config(std::size_t index) const { return config(index, m_options); } + std::shared_ptr<machine_config> const &config(std::size_t index, emu_options &options) const; + void include(std::size_t index) { assert(index < m_included.size()); if (!m_included[index]) { m_included[index] = true; m_filtered_count++; } } + void exclude(std::size_t index) { assert(index < m_included.size()); if (m_included[index]) { m_included[index] = false; m_filtered_count--; } } using driver_list::driver; using driver_list::clone; using driver_list::non_bios_clone; using driver_list::compatible_with; // filtering/iterating - int filter(const char *string = nullptr); - int filter(const game_driver &driver); + std::size_t filter(const char *string = nullptr); + std::size_t filter(const game_driver &driver); void include_all(); void exclude_all() { std::fill(m_included.begin(), m_included.end(), false); m_filtered_count = 0; } void reset() { m_current = -1; } @@ -119,22 +119,23 @@ public: bool next_excluded(); // general helpers - void set_current(int index) { assert(index >= -1 && index <= s_driver_count); m_current = index; } - void find_approximate_matches(const char *string, int count, int *results); + void set_current(std::size_t index) { assert(index < s_driver_count); m_current = index; } + void find_approximate_matches(const char *string, std::size_t count, int *results); private: + static constexpr std::size_t CONFIG_CACHE_COUNT = 100; + + typedef util::lru_cache_map<std::size_t, std::shared_ptr<machine_config> > machine_config_cache; + // internal helpers void release_current() const; - static const int CONFIG_CACHE_COUNT = 100; - // internal state - int m_current; - int m_filtered_count; - emu_options & m_options; - std::vector<bool> m_included; - mutable std::vector<std::unique_ptr<machine_config>> m_config; - mutable std::vector<int> m_config_cache; + int m_current; + std::size_t m_filtered_count; + emu_options & m_options; + std::vector<bool> m_included; + mutable machine_config_cache m_config; }; -#endif +#endif // MAME_EMU_DRIVENUM_H diff --git a/src/emu/gamedrv.h b/src/emu/gamedrv.h index 03b7f06f632..4c0779bb733 100644 --- a/src/emu/gamedrv.h +++ b/src/emu/gamedrv.h @@ -68,130 +68,130 @@ typedef void (*driver_init_func)(running_machine &machine); // static POD structure describing each game driver entry struct game_driver { - const char * source_file; // set this to __FILE__ - const char * parent; // if this is a clone, the name of the parent - const char * name; // short (8-character) name of the game - const char * description; // full name of the game - const char * year; // year the game was released - const char * manufacturer; // manufacturer of the game - machine_config_constructor machine_config; // machine driver tokens - ioport_constructor ipt; // pointer to constructor for input ports - void (*driver_init)(running_machine &machine); // DRIVER_INIT callback - const tiny_rom_entry * rom; // pointer to list of ROMs for the game - const char * compatible_with; - u32 flags; // orientation and other flags; see defines below - const internal_layout * default_layout; // default internally defined layout + const char * source_file; // set this to __FILE__ + const char * parent; // if this is a clone, the name of the parent + const char * description; // full name of the game + const char * year; // year the game was released + const char * manufacturer; // manufacturer of the game + machine_config_constructor machine_config; // machine driver tokens + ioport_constructor ipt; // pointer to constructor for input ports + driver_init_func driver_init; // DRIVER_INIT callback + const tiny_rom_entry * rom; // pointer to list of ROMs for the game + const char * compatible_with; + const internal_layout * default_layout; // default internally defined layout + u32 flags; // orientation and other flags; see defines above + char name[MAX_DRIVER_NAME_CHARS + 1]; // short name of the game }; - //************************************************************************** // MACROS //************************************************************************** // wrappers for the DRIVER_INIT callback -#define DRIVER_INIT_NAME(name) init_##name -#define DECLARE_DRIVER_INIT(name) void DRIVER_INIT_NAME(name)() ATTR_COLD -#define DRIVER_INIT_MEMBER(cls,name) void cls::DRIVER_INIT_NAME(name)() -#define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)() +#define DRIVER_INIT_NAME(name) init_##name +#define DECLARE_DRIVER_INIT(name) void DRIVER_INIT_NAME(name)() ATTR_COLD +#define DRIVER_INIT_MEMBER(cls, name) void cls::DRIVER_INIT_NAME(name)() +#define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)() // wrappers for declaring and defining game drivers -#define GAME_NAME(name) driver_##name -#define GAME_EXTERN(name) extern const game_driver GAME_NAME(name) +#define GAME_NAME(name) driver_##name +#define GAME_EXTERN(name) extern game_driver const GAME_NAME(name) // standard GAME() macro -#define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ -extern const game_driver GAME_NAME(NAME) = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - MACHINE_CONFIG_NAME(MACHINE), \ - INPUT_PORTS_NAME(INPUT), \ +#define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ +extern game_driver const GAME_NAME(NAME) \ +{ \ + __FILE__, \ + #PARENT, \ + FULLNAME, \ + #YEAR, \ + COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ &driver_device::driver_init_wrapper<CLASS, &CLASS::init_##INIT>, \ - ROM_NAME(NAME), \ - nullptr, \ - (MONITOR)|(FLAGS)|MACHINE_TYPE_ARCADE, \ - nullptr \ + ROM_NAME(NAME), \ + nullptr, \ + nullptr, \ + (MONITOR) | (FLAGS) | MACHINE_TYPE_ARCADE, \ + #NAME \ }; // standard macro with additional layout -#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ -extern const game_driver GAME_NAME(NAME) = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - MACHINE_CONFIG_NAME(MACHINE), \ - INPUT_PORTS_NAME(INPUT), \ +#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,CLASS,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ +extern game_driver const GAME_NAME(NAME) \ +{ \ + __FILE__, \ + #PARENT, \ + FULLNAME, \ + #YEAR, \ + COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ &driver_device::driver_init_wrapper<CLASS, &CLASS::init_##INIT>, \ - ROM_NAME(NAME), \ - nullptr, \ - (MONITOR)|(FLAGS)|MACHINE_TYPE_ARCADE, \ - &LAYOUT \ + ROM_NAME(NAME), \ + nullptr, \ + &LAYOUT, \ + (MONITOR) | (FLAGS) | MACHINE_TYPE_ARCADE, \ + #NAME \ }; + // standard console definition macro -#define CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -extern const game_driver GAME_NAME(NAME) = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - MACHINE_CONFIG_NAME(MACHINE), \ - INPUT_PORTS_NAME(INPUT), \ +#define CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ +extern game_driver const GAME_NAME(NAME) \ +{ \ + __FILE__, \ + #PARENT, \ + FULLNAME, \ + #YEAR, \ + COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ &driver_device::driver_init_wrapper<CLASS, &CLASS::init_##INIT>, \ - ROM_NAME(NAME), \ - #COMPAT, \ - ROT0|(FLAGS)|MACHINE_TYPE_CONSOLE, \ - nullptr \ + ROM_NAME(NAME), \ + #COMPAT, \ + nullptr, \ + ROT0 | (FLAGS) | MACHINE_TYPE_CONSOLE, \ + #NAME \ }; // standard computer definition macro -#define COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -extern const game_driver GAME_NAME(NAME) = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - MACHINE_CONFIG_NAME(MACHINE), \ - INPUT_PORTS_NAME(INPUT), \ +#define COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ +extern game_driver const GAME_NAME(NAME) \ +{ \ + __FILE__, \ + #PARENT, \ + FULLNAME, \ + #YEAR, \ + COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ &driver_device::driver_init_wrapper<CLASS, &CLASS::init_##INIT>, \ - ROM_NAME(NAME), \ - #COMPAT, \ - ROT0|(FLAGS)|MACHINE_TYPE_COMPUTER, \ - nullptr \ + ROM_NAME(NAME), \ + #COMPAT, \ + nullptr, \ + ROT0 | (FLAGS) | MACHINE_TYPE_COMPUTER, \ + #NAME \ }; // standard system definition macro -#define SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ -extern const game_driver GAME_NAME(NAME) = \ -{ \ - __FILE__, \ - #PARENT, \ - #NAME, \ - FULLNAME, \ - #YEAR, \ - COMPANY, \ - MACHINE_CONFIG_NAME(MACHINE), \ - INPUT_PORTS_NAME(INPUT), \ +#define SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,CLASS,INIT,COMPANY,FULLNAME,FLAGS) \ +extern game_driver const GAME_NAME(NAME) \ +{ \ + __FILE__, \ + #PARENT, \ + FULLNAME, \ + #YEAR, \ + COMPANY, \ + MACHINE_CONFIG_NAME(MACHINE), \ + INPUT_PORTS_NAME(INPUT), \ &driver_device::driver_init_wrapper<CLASS, &CLASS::init_##INIT>, \ - ROM_NAME(NAME), \ - #COMPAT, \ - ROT0|(FLAGS)|MACHINE_TYPE_OTHER, \ - nullptr \ + ROM_NAME(NAME), \ + #COMPAT, \ + nullptr, \ + ROT0 | (FLAGS) | MACHINE_TYPE_OTHER, \ + #NAME \ }; diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp index b47339cfe67..97bad77b76b 100644 --- a/src/frontend/mame/audit.cpp +++ b/src/frontend/mame/audit.cpp @@ -48,7 +48,7 @@ media_auditor::summary media_auditor::audit_media(const char *validation) // temporary hack until romload is update: get the driver path and support it for // all searches -const char *driverpath = m_enumerator.config().root_device().searchpath(); +const char *driverpath = m_enumerator.config()->root_device().searchpath(); std::size_t found = 0; std::size_t required = 0; @@ -56,7 +56,7 @@ const char *driverpath = m_enumerator.config().root_device().searchpath(); std::size_t shared_required = 0; // iterate over devices and regions - for (device_t &device : device_iterator(m_enumerator.config().root_device())) + for (device_t &device : device_iterator(m_enumerator.config()->root_device())) { // determine the search path for this source and iterate through the regions m_searchpath = device.searchpath(); @@ -199,7 +199,7 @@ media_auditor::summary media_auditor::audit_samples() std::size_t found = 0; // iterate over sample entries - for (samples_device &device : samples_device_iterator(m_enumerator.config().root_device())) + for (samples_device &device : samples_device_iterator(m_enumerator.config()->root_device())) { // by default we just search using the driver name std::string searchpath(m_enumerator.driver().name); @@ -507,7 +507,7 @@ device_t *media_auditor::find_shared_device(device_t &device, const char *name, // iterate up the parent chain for (auto drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex >= 0; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent)) { - for (device_t &scandevice : device_iterator(m_enumerator.config(drvindex).root_device())) + for (device_t &scandevice : device_iterator(m_enumerator.config(drvindex)->root_device())) { for (const rom_entry *region = rom_first_region(scandevice); region; region = rom_next_region(region)) { diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 9dfe7a3670c..4fac3b489f1 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -457,7 +457,7 @@ void cli_frontend::listclones(const char *gamename) if (original_count == 0) throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); else - osd_printf_info("Found %d matches for '%s' but none were clones\n", drivlist.count(), gamename); + osd_printf_info("Found %lu matches for '%s' but none were clones\n", (unsigned long)drivlist.count(), gamename); return; } @@ -534,7 +534,7 @@ void cli_frontend::listcrc(const char *gamename) // iterate through matches, and then through ROMs while (drivlist.next()) { - for (device_t &device : device_iterator(drivlist.config().root_device())) + for (device_t &device : device_iterator(drivlist.config()->root_device())) for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region)) for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { @@ -571,7 +571,7 @@ void cli_frontend::listroms(const char *gamename) "%-32s %10s %s\n",drivlist.driver().name, "Name", "Size", "Checksum"); // iterate through roms - for (device_t &device : device_iterator(drivlist.config().root_device())) + for (device_t &device : device_iterator(drivlist.config()->root_device())) for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region)) for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { @@ -625,7 +625,7 @@ void cli_frontend::listsamples(const char *gamename) while (drivlist.next()) { // see if we have samples - samples_device_iterator iter(drivlist.config().root_device()); + samples_device_iterator iter(drivlist.config()->root_device()); if (iter.count() == 0) continue; @@ -670,7 +670,7 @@ void cli_frontend::listdevices(const char *gamename) // build a list of devices std::vector<device_t *> device_list; - for (device_t &device : device_iterator(drivlist.config().root_device())) + for (device_t &device : device_iterator(drivlist.config()->root_device())) device_list.push_back(&device); // sort them by tag @@ -742,7 +742,7 @@ void cli_frontend::listslots(const char *gamename) { // iterate bool first = true; - for (const device_slot_interface &slot : slot_interface_iterator(drivlist.config().root_device())) + for (const device_slot_interface &slot : slot_interface_iterator(drivlist.config()->root_device())) { if (slot.fixed()) continue; // output the line, up to the list of extensions @@ -755,7 +755,7 @@ void cli_frontend::listslots(const char *gamename) { if (option.second->selectable()) { - device_t *dev = (*option.second->devtype())(drivlist.config(), "dummy", &drivlist.config().root_device(), 0); + device_t *dev = (*option.second->devtype())(*drivlist.config(), "dummy", &drivlist.config()->root_device(), 0); dev->config_complete(); if (first_option) { printf("%-16s %s\n", option.second->name(),dev->name()); @@ -802,7 +802,7 @@ void cli_frontend::listmedia(const char *gamename) { // iterate bool first = true; - for (const device_image_interface &imagedev : image_interface_iterator(drivlist.config().root_device())) + for (const device_image_interface &imagedev : image_interface_iterator(drivlist.config()->root_device())) { if (!imagedev.user_loadable()) continue; @@ -872,8 +872,8 @@ void cli_frontend::verifyroms(const char *gamename) std::unordered_set<std::string> device_map; while (dummy_drivlist.next()) { - machine_config &config = dummy_drivlist.config(); - for (device_t &dev : device_iterator(config.root_device())) + std::shared_ptr<machine_config> const &config = dummy_drivlist.config(); + for (device_t &dev : device_iterator(config->root_device())) { if (dev.owner() != nullptr && (*(dev.shortname()) != 0) && dev.rom_region() != nullptr && (device_map.insert(dev.shortname()).second)) { if (core_strwildcmp(gamename, dev.shortname()) == 0) @@ -892,13 +892,13 @@ void cli_frontend::verifyroms(const char *gamename) } } - for (const device_slot_interface &slot : slot_interface_iterator(config.root_device())) + for (const device_slot_interface &slot : slot_interface_iterator(config->root_device())) { for (auto &option : slot.option_list()) { std::string temptag("_"); temptag.append(option.second->name()); - device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.c_str(), option.second->devtype(), 0); + device_t *dev = config->device_add(&config->root_device(), temptag.c_str(), option.second->devtype(), 0); // notify this device and all its subdevices that they are now configured for (device_t &device : device_iterator(*dev)) @@ -952,7 +952,7 @@ void cli_frontend::verifyroms(const char *gamename) } } - const_cast<machine_config &>(config).device_remove(&config.root_device(), temptag.c_str()); + config->device_remove(&config->root_device(), temptag.c_str()); } } } @@ -1236,7 +1236,7 @@ void cli_frontend::listsoftware(const char *gamename) while (drivlist.next()) { - for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config()->root_device())) if (list_map.insert(swlistdev.list_name()).second) if (!swlistdev.get_info().empty()) { @@ -1279,7 +1279,7 @@ void cli_frontend::verifysoftware(const char *gamename) { matched++; - for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config()->root_device())) { if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) { @@ -1339,7 +1339,7 @@ void cli_frontend::getsoftlist(const char *gamename) driver_enumerator drivlist(m_options); while (drivlist.next()) { - for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config()->root_device())) if (core_strwildcmp(gamename, swlistdev.list_name().c_str()) == 0 && list_map.insert(swlistdev.list_name()).second) if (!swlistdev.get_info().empty()) { @@ -1372,7 +1372,7 @@ void cli_frontend::verifysoftlist(const char *gamename) while (drivlist.next()) { - for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(drivlist.config()->root_device())) { if (core_strwildcmp(gamename, swlistdev.list_name().c_str()) == 0 && list_map.insert(swlistdev.list_name()).second) { diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp index 1479978ceb9..7c964de669c 100644 --- a/src/frontend/mame/info.cpp +++ b/src/frontend/mame/info.cpp @@ -246,10 +246,10 @@ void info_xml_creator::output_one() return; // allocate input ports - machine_config &config = m_drivlist.config(); + std::shared_ptr<machine_config> config = m_drivlist.config(); ioport_list portlist; std::string errors; - device_iterator iter(config.root_device()); + device_iterator iter(config->root_device()); for (device_t &device : iter) portlist.append(device, errors); @@ -326,20 +326,20 @@ void info_xml_creator::output_one() // now print various additional information output_bios(); - output_rom(m_drivlist.config().root_device()); + output_rom(config->root_device()); output_device_roms(); - output_sample(m_drivlist.config().root_device()); - output_chips(m_drivlist.config().root_device(), ""); - output_display(m_drivlist.config().root_device(), ""); - output_sound(m_drivlist.config().root_device()); + output_sample(config->root_device()); + output_chips(config->root_device(), ""); + output_display(config->root_device(), ""); + output_sound(config->root_device()); output_input(portlist); output_switches(portlist, "", IPT_DIPSWITCH, "dipswitch", "dipvalue"); output_switches(portlist, "", IPT_CONFIG, "configuration", "confsetting"); output_ports(portlist); output_adjusters(portlist); output_driver(); - output_images(m_drivlist.config().root_device(), ""); - output_slots(m_drivlist.config().root_device(), ""); + output_images(config->root_device(), ""); + output_slots(config->root_device(), ""); output_software_list(); output_ramoptions(); @@ -426,7 +426,7 @@ void info_xml_creator::output_devices() while (m_drivlist.next()) { // first, run through devices with roms which belongs to the default configuration - for (device_t &device : device_iterator(m_drivlist.config().root_device())) + for (device_t &device : device_iterator(m_drivlist.config()->root_device())) { if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0]!='\0') { @@ -436,13 +436,13 @@ void info_xml_creator::output_devices() } // then, run through slot devices - for (const device_slot_interface &slot : slot_interface_iterator(m_drivlist.config().root_device())) + for (const device_slot_interface &slot : slot_interface_iterator(m_drivlist.config()->root_device())) { for (auto &option : slot.option_list()) { std::string temptag("_"); temptag.append(option.second->name()); - device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.c_str(), option.second->devtype(), 0); + device_t *dev = m_drivlist.config()->device_add(&m_drivlist.config()->root_device(), temptag.c_str(), option.second->devtype(), 0); // notify this device and all its subdevices that they are now configured for (device_t &device : device_iterator(*dev)) @@ -462,7 +462,7 @@ void info_xml_creator::output_devices() } } - const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.c_str()); + m_drivlist.config()->device_remove(&m_drivlist.config()->root_device(), temptag.c_str()); } } } @@ -476,7 +476,7 @@ void info_xml_creator::output_devices() void info_xml_creator::output_device_roms() { - for (device_t &device : device_iterator(m_drivlist.config().root_device())) + for (device_t &device : device_iterator(m_drivlist.config()->root_device())) if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0] != '\0') fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", util::xml::normalize_string(device.shortname())); } @@ -490,7 +490,7 @@ void info_xml_creator::output_device_roms() void info_xml_creator::output_sampleof() { // iterate over sample devices - for (samples_device &device : samples_device_iterator(m_drivlist.config().root_device())) + for (samples_device &device : samples_device_iterator(m_drivlist.config()->root_device())) { samples_iterator sampiter(device); if (sampiter.altbasename() != nullptr) @@ -572,7 +572,7 @@ void info_xml_creator::output_rom(device_t &device) util::hash_collection hashes(ROM_GETHASHDATA(rom)); if (!hashes.flag(util::hash_collection::FLAG_NO_DUMP)) merge_name = get_merge_name(hashes); - if (&device != &m_drivlist.config().root_device()) + if (&device != &m_drivlist.config()->root_device()) merge_name = nullptr; // scan for a BIOS name bios_name[0] = 0; @@ -1534,7 +1534,7 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) { if (option.second->selectable()) { - device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), "dummy", option.second->devtype(), 0); + device_t *dev = m_drivlist.config()->device_add(&m_drivlist.config()->root_device(), "dummy", option.second->devtype(), 0); if (!dev->configured()) dev->config_complete(); @@ -1544,7 +1544,7 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) if (slot.default_option() != nullptr && strcmp(slot.default_option(), option.second->name())==0) fprintf(m_output, " default=\"yes\""); fprintf(m_output, "/>\n"); - const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), "dummy"); + m_drivlist.config()->device_remove(&m_drivlist.config()->root_device(), "dummy"); } } @@ -1561,7 +1561,7 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) void info_xml_creator::output_software_list() { - for (const software_list_device &swlist : software_list_device_iterator(m_drivlist.config().root_device())) + for (const software_list_device &swlist : software_list_device_iterator(m_drivlist.config()->root_device())) { fprintf(m_output, "\t\t<softwarelist name=\"%s\" ", swlist.list_name().c_str()); fprintf(m_output, "status=\"%s\" ", (swlist.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM) ? "original" : "compatible"); @@ -1580,7 +1580,7 @@ void info_xml_creator::output_software_list() void info_xml_creator::output_ramoptions() { - for (const ram_device &ram : ram_device_iterator(m_drivlist.config().root_device())) + for (const ram_device &ram : ram_device_iterator(m_drivlist.config()->root_device())) { fprintf(m_output, "\t\t<ramoption default=\"1\">%u</ramoption>\n", ram.default_size()); @@ -1612,7 +1612,7 @@ const char *info_xml_creator::get_merge_name(const util::hash_collection &romhas for (int clone_of = m_drivlist.find(m_drivlist.driver().parent); clone_of != -1; clone_of = m_drivlist.find(m_drivlist.driver(clone_of).parent)) { // look in the parent's ROMs - device_t *device = &m_drivlist.config(clone_of, m_lookup_options).root_device(); + device_t *device = &m_drivlist.config(clone_of, m_lookup_options)->root_device(); for (const rom_entry *pregion = rom_first_region(*device); pregion != nullptr; pregion = rom_next_region(pregion)) for (const rom_entry *prom = rom_first_file(pregion); prom != nullptr; prom = rom_next_file(prom)) { diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index a1ecf792d8e..79e65d4e9c9 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1075,7 +1075,7 @@ void lua_engine::initialize() sol().registry().new_usertype<game_driver>("game_driver", "new", sol::no_constructor, "source_file", sol::readonly(&game_driver::source_file), "parent", sol::readonly(&game_driver::parent), - "name", sol::readonly(&game_driver::name), + "name", sol::property([] (game_driver const &driver) { return &driver.name[0]; }), "description", sol::readonly(&game_driver::description), "year", sol::readonly(&game_driver::year), "manufacturer", sol::readonly(&game_driver::manufacturer), diff --git a/src/frontend/mame/media_ident.cpp b/src/frontend/mame/media_ident.cpp index 3c1fdf19c47..b2e1ba218ed 100644 --- a/src/frontend/mame/media_ident.cpp +++ b/src/frontend/mame/media_ident.cpp @@ -220,7 +220,7 @@ int media_identifier::find_by_hash(const util::hash_collection &hashes, int leng while (m_drivlist.next()) { // iterate over devices, regions and files within the region - for (device_t &device : device_iterator(m_drivlist.config().root_device())) + for (device_t &device : device_iterator(m_drivlist.config()->root_device())) { if (shortnames.insert(device.shortname()).second) { @@ -245,7 +245,7 @@ int media_identifier::find_by_hash(const util::hash_collection &hashes, int leng } // next iterate over softlists - for (software_list_device &swlistdev : software_list_device_iterator(m_drivlist.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(m_drivlist.config()->root_device())) { if (listnames.insert(swlistdev.list_name()).second) { diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 440985aaccf..e2628f63a9b 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -803,7 +803,7 @@ void menu_select_game::inkey_select(const event *menu_event) { if ((driver->flags & MACHINE_TYPE_ARCADE) == 0) { - for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config().root_device())) + for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) if (!swlistdev.get_info().empty()) { menu::stack_push<menu_select_software>(ui(), container(), driver); @@ -900,7 +900,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) driver_enumerator drv(machine().options(), *ui_swinfo->driver); media_auditor auditor(drv); drv.next(); - software_list_device *swlist = software_list_device::find_by_name(drv.config(), ui_swinfo->listname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drv.config(), ui_swinfo->listname.c_str()); const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 7e267c98987..17e7abc1a7e 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -688,7 +688,7 @@ void menu_select_software::inkey_select(const event *menu_event) driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); media_auditor auditor(drivlist); drivlist.next(); - software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname.c_str()); const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); @@ -1413,7 +1413,7 @@ void bios_selection::handle() machine().options().set_value(OPTION_BIOS, elem.second, OPTION_PRIORITY_CMDLINE, error); driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); drivlist.next(); - software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); + software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname.c_str()); const software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); if (!ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 0633a10c06e..011fb28264b 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -634,9 +634,8 @@ public: return std::pair<iterator, bool>(inserted, true); } template <typename P> - std::pair<iterator, bool> insert(P &&value) + std::enable_if_t<std::is_constructible<value_type, P>::value, std::pair<iterator, bool> > insert(P &&value) { - // FIXME: should only participate in overload resolution if std::is_constructible<value_type, P&&>::value return emplace(std::forward<P>(value)); } template <typename InputIt> |