summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-11-25 19:18:26 +1100
committer Vas Crabb <vas@vastheman.com>2020-11-25 19:18:26 +1100
commitec8042864703f9ce6cc9b0cf528e6a8528104b89 (patch)
tree427556c7d86c7cab5f136aff7f0675adc443144b /src/emu
parent8ea35743e40bd6dc01e50a0a21524db7b0ad203e (diff)
Fairly significant overhaul of Lua engine and some cleanup.
The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/addrmap.cpp2
-rw-r--r--src/emu/crsshair.cpp6
-rw-r--r--src/emu/debug/debugcmd.cpp66
-rw-r--r--src/emu/debug/debugcon.cpp4
-rw-r--r--src/emu/debug/debugcpu.cpp12
-rw-r--r--src/emu/debug/dvbpoints.cpp2
-rw-r--r--src/emu/debug/dvdisasm.cpp2
-rw-r--r--src/emu/debug/dvmemory.cpp2
-rw-r--r--src/emu/debug/dvstate.cpp12
-rw-r--r--src/emu/debug/dvwpoints.cpp2
-rw-r--r--src/emu/devfind.cpp2
-rw-r--r--src/emu/device.h100
-rw-r--r--src/emu/didisasm.h2
-rw-r--r--src/emu/diexec.cpp4
-rw-r--r--src/emu/diexec.h2
-rw-r--r--src/emu/digfx.h2
-rw-r--r--src/emu/diimage.cpp4
-rw-r--r--src/emu/diimage.h2
-rw-r--r--src/emu/dimemory.h5
-rw-r--r--src/emu/dinetwork.h2
-rw-r--r--src/emu/dinvram.h2
-rw-r--r--src/emu/dipalette.h2
-rw-r--r--src/emu/dipty.h2
-rw-r--r--src/emu/dirtc.h2
-rw-r--r--src/emu/dislot.h2
-rw-r--r--src/emu/disound.cpp6
-rw-r--r--src/emu/disound.h4
-rw-r--r--src/emu/distate.h2
-rw-r--r--src/emu/divideo.cpp4
-rw-r--r--src/emu/divideo.h2
-rw-r--r--src/emu/drivenum.cpp2
-rw-r--r--src/emu/driver.cpp2
-rw-r--r--src/emu/emufwd.h1
-rw-r--r--src/emu/emumem.cpp3
-rw-r--r--src/emu/emumem.h2
-rw-r--r--src/emu/emuopts.cpp8
-rw-r--r--src/emu/image.cpp12
-rw-r--r--src/emu/ioport.cpp2
-rw-r--r--src/emu/machine.cpp24
-rw-r--r--src/emu/main.h2
-rw-r--r--src/emu/mconfig.cpp6
-rw-r--r--src/emu/network.cpp4
-rw-r--r--src/emu/profiler.cpp2
-rw-r--r--src/emu/render.cpp26
-rw-r--r--src/emu/render.h66
-rw-r--r--src/emu/rendlay.cpp292
-rw-r--r--src/emu/romload.cpp6
-rw-r--r--src/emu/schedule.cpp2
-rw-r--r--src/emu/screen.cpp2
-rw-r--r--src/emu/screen.h2
-rw-r--r--src/emu/softlist_dev.cpp6
-rw-r--r--src/emu/softlist_dev.h2
-rw-r--r--src/emu/sound.cpp14
-rw-r--r--src/emu/speaker.h2
-rw-r--r--src/emu/validity.cpp14
-rw-r--r--src/emu/video.cpp20
56 files changed, 481 insertions, 306 deletions
diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp
index d38d518aa55..7aeefd7baca 100644
--- a/src/emu/addrmap.cpp
+++ b/src/emu/addrmap.cpp
@@ -1175,7 +1175,7 @@ void address_map::map_validity_check(validity_checker &valid, int spacenum) cons
std::string entry_region = entry.m_devbase.subtag(entry.m_region);
// look for the region
- for (device_t &dev : device_iterator(m_device->mconfig().root_device()))
+ for (device_t &dev : device_enumerator(m_device->mconfig().root_device()))
{
for (romload::region const &region : romload::entries(dev.rom_region()).get_regions())
{
diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp
index 027d8828e32..0e570bb9eaf 100644
--- a/src/emu/crsshair.cpp
+++ b/src/emu/crsshair.cpp
@@ -123,7 +123,7 @@ render_crosshair::render_crosshair(running_machine &machine, int player)
, m_time(0)
{
// for now, use the main screen
- m_screen = screen_device_iterator(machine.root_device()).first();
+ m_screen = screen_device_enumerator(machine.root_device()).first();
}
@@ -377,8 +377,8 @@ crosshair_manager::crosshair_manager(running_machine &machine)
machine.configuration().config_register("crosshairs", config_load_delegate(&crosshair_manager::config_load, this), config_save_delegate(&crosshair_manager::config_save, this));
/* register the animation callback */
- screen_device *first_screen = screen_device_iterator(machine.root_device()).first();
- if (first_screen != nullptr)
+ screen_device *first_screen = screen_device_enumerator(machine.root_device()).first();
+ if (first_screen)
first_screen->register_vblank_callback(vblank_state_delegate(&crosshair_manager::animate, this));
}
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 949f1194061..3aa7544f3ff 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -422,7 +422,7 @@ u64 debugger_commands::execute_s32(int params, const u64 *param)
u64 debugger_commands::get_cpunum()
{
- execute_interface_iterator iter(m_machine.root_device());
+ execute_interface_enumerator iter(m_machine.root_device());
return iter.indexof(m_console.get_visible_cpu()->execute());
}
@@ -558,7 +558,7 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t *&res
// attempt to find by numerical index
int index = 0;
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
{
// real CPUs should have pcbase
const device_state_interface *state;
@@ -1074,7 +1074,7 @@ void debugger_commands::execute_focus(int ref, const std::vector<std::string> &p
cpu->debug()->ignore(false);
/* then loop over CPUs and set the ignore flags on all other CPUs */
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
if (&exec.device() != cpu)
exec.device().debug()->ignore(true);
m_console.printf("Now focused on CPU '%s'\n", cpu->tag());
@@ -1093,7 +1093,7 @@ void debugger_commands::execute_ignore(int ref, const std::vector<std::string> &
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
/* build up a comma-separated list */
if (!exec.device().debug()->observing())
@@ -1125,7 +1125,7 @@ void debugger_commands::execute_ignore(int ref, const std::vector<std::string> &
{
/* make sure this isn't the last live CPU */
bool gotone = false;
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
if (&exec.device() != devicelist[paramnum] && exec.device().debug()->observing())
{
gotone = true;
@@ -1156,7 +1156,7 @@ void debugger_commands::execute_observe(int ref, const std::vector<std::string>
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
/* build up a comma-separated list */
if (exec.device().debug()->observing())
@@ -1204,7 +1204,7 @@ void debugger_commands::execute_suspend(int ref, const std::vector<std::string>
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
/* build up a comma-separated list */
if (exec.device().debug()->suspended())
@@ -1233,7 +1233,7 @@ void debugger_commands::execute_suspend(int ref, const std::vector<std::string>
{
/* make sure this isn't the last live CPU */
bool gotone = false;
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
if (&exec.device() != devicelist[paramnum] && !exec.device().debug()->suspended())
{
gotone = true;
@@ -1263,7 +1263,7 @@ void debugger_commands::execute_resume(int ref, const std::vector<std::string> &
std::string buffer;
/* loop over all executable devices */
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
/* build up a comma-separated list */
if (exec.device().debug()->suspended())
@@ -1303,7 +1303,7 @@ void debugger_commands::execute_resume(int ref, const std::vector<std::string> &
void debugger_commands::execute_cpulist(int ref, const std::vector<std::string> &params)
{
int index = 0;
- for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(m_machine.root_device()))
{
device_state_interface *state;
if (exec.device().interface(state) && state->state_find_entry(STATE_GENPCBASE) != nullptr)
@@ -1462,7 +1462,7 @@ void debugger_commands::execute_bpclear(int ref, const std::vector<std::string>
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->breakpoint_clear_all();
m_console.printf("Cleared all breakpoints\n");
}
@@ -1473,7 +1473,7 @@ void debugger_commands::execute_bpclear(int ref, const std::vector<std::string>
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->breakpoint_clear(bpindex))
found = true;
if (found)
@@ -1496,7 +1496,7 @@ void debugger_commands::execute_bpdisenable(int ref, const std::vector<std::stri
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->breakpoint_enable_all(ref);
if (ref == 0)
m_console.printf("Disabled all breakpoints\n");
@@ -1510,7 +1510,7 @@ void debugger_commands::execute_bpdisenable(int ref, const std::vector<std::stri
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->breakpoint_enable(bpindex, ref))
found = true;
if (found)
@@ -1532,7 +1532,7 @@ void debugger_commands::execute_bplist(int ref, const std::vector<std::string> &
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (!device.debug()->breakpoint_list().empty())
{
m_console.printf("Device '%s' breakpoints:\n", device.tag());
@@ -1621,7 +1621,7 @@ void debugger_commands::execute_wpclear(int ref, const std::vector<std::string>
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->watchpoint_clear_all();
m_console.printf("Cleared all watchpoints\n");
}
@@ -1632,7 +1632,7 @@ void debugger_commands::execute_wpclear(int ref, const std::vector<std::string>
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->watchpoint_clear(wpindex))
found = true;
if (found)
@@ -1655,7 +1655,7 @@ void debugger_commands::execute_wpdisenable(int ref, const std::vector<std::stri
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->watchpoint_enable_all(ref);
if (ref == 0)
m_console.printf("Disabled all watchpoints\n");
@@ -1669,7 +1669,7 @@ void debugger_commands::execute_wpdisenable(int ref, const std::vector<std::stri
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->watchpoint_enable(wpindex, ref))
found = true;
if (found)
@@ -1691,7 +1691,7 @@ void debugger_commands::execute_wplist(int ref, const std::vector<std::string> &
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
for (int spacenum = 0; spacenum < device.debug()->watchpoint_space_count(); ++spacenum)
if (!device.debug()->watchpoint_vector(spacenum).empty())
{
@@ -1763,7 +1763,7 @@ void debugger_commands::execute_rpclear(int ref, const std::vector<std::string>
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->registerpoint_clear_all();
m_console.printf("Cleared all registerpoints\n");
}
@@ -1774,7 +1774,7 @@ void debugger_commands::execute_rpclear(int ref, const std::vector<std::string>
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->registerpoint_clear(rpindex))
found = true;
if (found)
@@ -1797,7 +1797,7 @@ void debugger_commands::execute_rpdisenable(int ref, const std::vector<std::stri
/* if 0 parameters, clear all */
if (params.empty())
{
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->registerpoint_enable_all(ref);
if (ref == 0)
m_console.printf("Disabled all registerpoints\n");
@@ -1811,7 +1811,7 @@ void debugger_commands::execute_rpdisenable(int ref, const std::vector<std::stri
else
{
bool found = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->registerpoint_enable(rpindex, ref))
found = true;
if (found)
@@ -1833,7 +1833,7 @@ void debugger_commands::execute_rplist(int ref, const std::vector<std::string> &
std::string buffer;
/* loop over all CPUs */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (!device.debug()->registerpoint_list().empty())
{
m_console.printf("Device '%s' registerpoints:\n", device.tag());
@@ -1867,7 +1867,7 @@ void debugger_commands::execute_hotspot(int ref, const std::vector<std::string>
bool cleared = false;
/* loop over CPUs and find live spots */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug()->hotspot_tracking_enabled())
{
device.debug()->hotspot_track(0, 0);
@@ -1919,7 +1919,7 @@ void debugger_commands::execute_stateload(int ref, const std::vector<std::string
m_machine.immediate_load(filename.c_str());
// clear all PC & memory tracks
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
{
device.debug()->track_pc_data_clear();
device.debug()->track_mem_data_clear();
@@ -1937,7 +1937,7 @@ void debugger_commands::execute_rewind(int ref, const std::vector<std::string> &
bool success = m_machine.rewind_step();
if (success)
// clear all PC & memory tracks
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
{
device.debug()->track_pc_data_clear();
device.debug()->track_mem_data_clear();
@@ -3657,7 +3657,7 @@ void debugger_commands::execute_snap(int ref, const std::vector<std::string> &pa
const char *filename = params[0].c_str();
int scrnum = (params.size() > 1) ? atoi(params[1].c_str()) : 0;
- screen_device_iterator iter(m_machine.root_device());
+ screen_device_enumerator iter(m_machine.root_device());
screen_device *screen = iter.byindex(scrnum);
if ((screen == nullptr) || !m_machine.render().is_live(*screen))
@@ -3750,7 +3750,7 @@ void debugger_commands::execute_memdump(int ref, const std::vector<std::string>
file = fopen(filename, "w");
if (file)
{
- memory_interface_iterator iter(m_machine.root_device());
+ memory_interface_enumerator iter(m_machine.root_device());
for (device_memory_interface &memory : iter) {
for (int space = 0; space != memory.max_space_count(); space++)
if (memory.has_space(space))
@@ -3871,7 +3871,7 @@ void debugger_commands::execute_hardreset(int ref, const std::vector<std::string
void debugger_commands::execute_images(int ref, const std::vector<std::string> &params)
{
- image_interface_iterator iter(m_machine.root_device());
+ image_interface_enumerator iter(m_machine.root_device());
for (device_image_interface &img : iter)
m_console.printf("%s: %s\n", img.brief_instance_name(), img.exists() ? img.filename() : "[empty slot]");
if (iter.first() == nullptr)
@@ -3885,7 +3885,7 @@ void debugger_commands::execute_images(int ref, const std::vector<std::string> &
void debugger_commands::execute_mount(int ref, const std::vector<std::string> &params)
{
bool done = false;
- for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
+ for (device_image_interface &img : image_interface_enumerator(m_machine.root_device()))
{
if (img.brief_instance_name() == params[0])
{
@@ -3908,7 +3908,7 @@ void debugger_commands::execute_mount(int ref, const std::vector<std::string> &p
void debugger_commands::execute_unmount(int ref, const std::vector<std::string> &params)
{
bool done = false;
- for (device_image_interface &img : image_interface_iterator(m_machine.root_device()))
+ for (device_image_interface &img : image_interface_enumerator(m_machine.root_device()))
{
if (img.brief_instance_name() == params[0])
{
diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp
index 500310bd459..8bce3a26668 100644
--- a/src/emu/debug/debugcon.cpp
+++ b/src/emu/debug/debugcon.cpp
@@ -68,10 +68,10 @@ debugger_console::debugger_console(running_machine &machine)
register_command("condump", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_console::execute_condump, this, _1, _2));
/* first CPU is visible by default */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
{
auto *cpu = dynamic_cast<cpu_device *>(&device);
- if (cpu != nullptr)
+ if (cpu)
{
m_visiblecpu = cpu;
break;
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index c3dd9a0c3a6..3c325d3a841 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -60,9 +60,9 @@ debugger_cpu::debugger_cpu(running_machine &machine)
m_symtable->add("wpaddr", symbol_table::READ_ONLY, &m_wpaddr);
m_symtable->add("wpdata", symbol_table::READ_ONLY, &m_wpdata);
- screen_device_iterator screen_iterator = screen_device_iterator(m_machine.root_device());
- screen_device_iterator::auto_iterator iter = screen_iterator.begin();
- const uint32_t count = (uint32_t)screen_iterator.count();
+ screen_device_enumerator screen_enumerator = screen_device_enumerator(m_machine.root_device());
+ screen_device_enumerator::iterator iter = screen_enumerator.begin();
+ const uint32_t count = (uint32_t)screen_enumerator.count();
if (count == 1)
{
@@ -104,7 +104,7 @@ void debugger_cpu::flush_traces()
{
/* this can be called on exit even when no debugging is enabled, so
make sure the devdebug is valid before proceeding */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug() != nullptr)
device.debug()->trace_flush();
}
@@ -146,7 +146,7 @@ bool debugger_cpu::comment_save()
// for each device
bool found_comments = false;
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
if (device.debug() && device.debug()->comment_count() > 0)
{
// create a node for this device
@@ -272,7 +272,7 @@ void debugger_cpu::on_vblank(screen_device &device, bool vblank_state)
void debugger_cpu::reset_transient_flags()
{
/* loop over CPUs and reset the transient flags */
- for (device_t &device : device_iterator(m_machine.root_device()))
+ for (device_t &device : device_enumerator(m_machine.root_device()))
device.debug()->reset_transient_flag();
m_stop_when_not_device = nullptr;
}
diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp
index 5a2cb7b0455..ba99c147a72 100644
--- a/src/emu/debug/dvbpoints.cpp
+++ b/src/emu/debug/dvbpoints.cpp
@@ -122,7 +122,7 @@ void debug_view_breakpoints::enumerate_sources()
m_source_list.clear();
// iterate over devices with disassembly interfaces
- for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
+ for (device_disasm_interface &dasm : disasm_interface_enumerator(machine().root_device()))
{
m_source_list.emplace_back(
std::make_unique<debug_view_source>(
diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp
index 956b0bdc29b..a08d500e92f 100644
--- a/src/emu/debug/dvdisasm.cpp
+++ b/src/emu/debug/dvdisasm.cpp
@@ -86,7 +86,7 @@ void debug_view_disasm::enumerate_sources()
m_source_list.clear();
// iterate over devices with disassembly interfaces
- for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
+ for (device_disasm_interface &dasm : disasm_interface_enumerator(machine().root_device()))
{
if (dasm.device().memory().space_config(AS_PROGRAM))
{
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index 4e9b8506a62..3ae8008f0a2 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -145,7 +145,7 @@ void debug_view_memory::enumerate_sources()
m_source_list.reserve(machine().save().registration_count());
// first add all the devices' address spaces
- for (device_memory_interface &memintf : memory_interface_iterator(machine().root_device()))
+ for (device_memory_interface &memintf : memory_interface_enumerator(machine().root_device()))
{
for (int spacenum = 0; spacenum < memintf.max_space_count(); ++spacenum)
{
diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp
index e24550bf34f..50e8c1610c4 100644
--- a/src/emu/debug/dvstate.cpp
+++ b/src/emu/debug/dvstate.cpp
@@ -74,7 +74,7 @@ void debug_view_state::enumerate_sources()
m_source_list.clear();
// iterate over devices that have state interfaces
- for (device_state_interface &state : state_interface_iterator(machine().root_device()))
+ for (device_state_interface &state : state_interface_enumerator(machine().root_device()))
{
m_source_list.emplace_back(
std::make_unique<debug_view_state_source>(
@@ -114,8 +114,8 @@ void debug_view_state::recompute()
// add a cycles entry: cycles:99999999
m_state_list.emplace_back(REG_CYCLES, "cycles", 8);
- screen_device_iterator screen_iterator = screen_device_iterator(machine().root_device());
- screen_device_iterator::auto_iterator iter = screen_iterator.begin();
+ screen_device_enumerator screen_iterator(machine().root_device());
+ screen_device_enumerator::iterator iter = screen_iterator.begin();
const int screen_count = screen_iterator.count();
if (screen_count == 1)
@@ -236,19 +236,19 @@ void debug_view_state::view_update()
case REG_BEAMX_S0: case REG_BEAMX_S1: case REG_BEAMX_S2: case REG_BEAMX_S3:
case REG_BEAMX_S4: case REG_BEAMX_S5: case REG_BEAMX_S6: case REG_BEAMX_S7:
- curitem.update(screen_device_iterator(machine().root_device()).byindex(-(curitem.index() - REG_BEAMX_S0))->hpos(), cycles_changed);
+ curitem.update(screen_device_enumerator(machine().root_device()).byindex(-(curitem.index() - REG_BEAMX_S0))->hpos(), cycles_changed);
valstr = string_format("%4d", curitem.value());
break;
case REG_BEAMY_S0: case REG_BEAMY_S1: case REG_BEAMY_S2: case REG_BEAMY_S3:
case REG_BEAMY_S4: case REG_BEAMY_S5: case REG_BEAMY_S6: case REG_BEAMY_S7:
- curitem.update(screen_device_iterator(machine().root_device()).byindex(-(curitem.index() - REG_BEAMY_S0))->vpos(), cycles_changed);
+ curitem.update(screen_device_enumerator(machine().root_device()).byindex(-(curitem.index() - REG_BEAMY_S0))->vpos(), cycles_changed);
valstr = string_format("%4d", curitem.value());
break;
case REG_FRAME_S0: case REG_FRAME_S1: case REG_FRAME_S2: case REG_FRAME_S3:
case REG_FRAME_S4: case REG_FRAME_S5: case REG_FRAME_S6: case REG_FRAME_S7:
- curitem.update(screen_device_iterator(machine().root_device()).byindex(-(curitem.index() - REG_FRAME_S0))->frame_number(), cycles_changed);
+ curitem.update(screen_device_enumerator(machine().root_device()).byindex(-(curitem.index() - REG_FRAME_S0))->frame_number(), cycles_changed);
valstr = string_format("%-6d", curitem.value());
break;
diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp
index f177cdf6a5c..605dcf8fe42 100644
--- a/src/emu/debug/dvwpoints.cpp
+++ b/src/emu/debug/dvwpoints.cpp
@@ -139,7 +139,7 @@ void debug_view_watchpoints::enumerate_sources()
m_source_list.clear();
// iterate over devices with disassembly interfaces
- for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
+ for (device_disasm_interface &dasm : disasm_interface_enumerator(machine().root_device()))
{
m_source_list.emplace_back(
std::make_unique<debug_view_source>(
diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp
index bbf3d35c1fb..d6bc984703e 100644
--- a/src/emu/devfind.cpp
+++ b/src/emu/devfind.cpp
@@ -95,7 +95,7 @@ bool finder_base::validate_memregion(bool required) const
std::string const region_fulltag(m_base.get().subtag(m_tag));
// look for the region
- for (device_t const &dev : device_iterator(m_base.get().mconfig().root_device()))
+ for (device_t const &dev : device_enumerator(m_base.get().mconfig().root_device()))
{
for (romload::region const &region : romload::entries(dev.rom_region()).get_regions())
{
diff --git a/src/emu/device.h b/src/emu/device.h
index fa973c56556..f6785a2741b 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -1008,13 +1008,13 @@ private:
};
-// ======================> device_iterator
+// ======================> device_enumerator
// helper class to iterate over the hierarchy of devices depth-first
-class device_iterator
+class device_enumerator
{
public:
- class auto_iterator
+ class iterator
{
public:
typedef std::ptrdiff_t difference_type;
@@ -1024,7 +1024,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
// construction
- auto_iterator(device_t *devptr, int curdepth, int maxdepth)
+ iterator(device_t *devptr, int curdepth, int maxdepth)
: m_curdevice(devptr)
, m_curdepth(curdepth)
, m_maxdepth(maxdepth)
@@ -1036,12 +1036,12 @@ public:
int depth() const { return m_curdepth; }
// required operator overrides
- bool operator==(auto_iterator const &iter) const { return m_curdevice == iter.m_curdevice; }
- bool operator!=(auto_iterator const &iter) const { return m_curdevice != iter.m_curdevice; }
+ bool operator==(iterator const &iter) const { return m_curdevice == iter.m_curdevice; }
+ bool operator!=(iterator const &iter) const { return m_curdevice != iter.m_curdevice; }
device_t &operator*() const { assert(m_curdevice); return *m_curdevice; }
device_t *operator->() const { return m_curdevice; }
- auto_iterator &operator++() { advance(); return *this; }
- auto_iterator operator++(int) { auto_iterator const result(*this); ++*this; return result; }
+ iterator &operator++() { advance(); return *this; }
+ iterator operator++(int) { iterator const result(*this); ++*this; return result; }
protected:
// search depth-first for the next device
@@ -1082,18 +1082,17 @@ public:
}
// protected state
- device_t * m_curdevice;
- int m_curdepth;
- const int m_maxdepth;
+ device_t * m_curdevice;
+ int m_curdepth;
+ int m_maxdepth;
};
// construction
- device_iterator(device_t &root, int maxdepth = 255)
- : m_root(root), m_maxdepth(maxdepth) { }
+ device_enumerator(device_t &root, int maxdepth = 255) : m_root(root), m_maxdepth(maxdepth) { }
// standard iterators
- auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
- auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
+ iterator begin() const { return iterator(&m_root, 0, m_maxdepth); }
+ iterator end() const { return iterator(nullptr, 0, m_maxdepth); }
// return first item
device_t *first() const { return begin().current(); }
@@ -1135,32 +1134,31 @@ public:
private:
// internal state
- device_t & m_root;
- int m_maxdepth;
+ device_t & m_root;
+ int m_maxdepth;
};
-// ======================> device_type_iterator
+// ======================> device_type_enumerator
// helper class to find devices of a given type in the device hierarchy
template <class DeviceType, class DeviceClass = DeviceType>
-class device_type_iterator
+class device_type_enumerator
{
public:
- class auto_iterator : protected device_iterator::auto_iterator
+ class iterator : protected device_enumerator::iterator
{
public:
- using device_iterator::auto_iterator::difference_type;
- using device_iterator::auto_iterator::iterator_category;
- using device_iterator::auto_iterator::depth;
+ using device_enumerator::iterator::difference_type;
+ using device_enumerator::iterator::iterator_category;
+ using device_enumerator::iterator::depth;
typedef DeviceClass value_type;
typedef DeviceClass *pointer;
typedef DeviceClass &reference;
// construction
- auto_iterator(device_t *devptr, int curdepth, int maxdepth)
- : device_iterator::auto_iterator(devptr, curdepth, maxdepth)
+ iterator(device_t *devptr, int curdepth, int maxdepth) : device_enumerator::iterator(devptr, curdepth, maxdepth)
{
// make sure the first device is of the specified type
while (m_curdevice && (m_curdevice->type().type() != typeid(DeviceType)))
@@ -1168,8 +1166,8 @@ public:
}
// required operator overrides
- bool operator==(auto_iterator const &iter) const { return m_curdevice == iter.m_curdevice; }
- bool operator!=(auto_iterator const &iter) const { return m_curdevice != iter.m_curdevice; }
+ bool operator==(iterator const &iter) const { return m_curdevice == iter.m_curdevice; }
+ bool operator!=(iterator const &iter) const { return m_curdevice != iter.m_curdevice; }
// getters returning specified device type
DeviceClass *current() const { return downcast<DeviceClass *>(m_curdevice); }
@@ -1177,25 +1175,23 @@ public:
DeviceClass *operator->() const { return downcast<DeviceClass *>(m_curdevice); }
// search for devices of the specified type
- auto_iterator &operator++()
+ iterator &operator++()
{
- advance();
- while (m_curdevice && (m_curdevice->type().type() != typeid(DeviceType)))
- advance();
+ do { advance(); } while (m_curdevice && (m_curdevice->type().type() != typeid(DeviceType)));
return *this;
}
- auto_iterator operator++(int) { auto_iterator const result(*this); ++*this; return result; }
+ iterator operator++(int) { iterator const result(*this); ++*this; return result; }
};
// construction
- device_type_iterator(device_t &root, int maxdepth = 255) : m_root(root), m_maxdepth(maxdepth) { }
+ device_type_enumerator(device_t &root, int maxdepth = 255) : m_root(root), m_maxdepth(maxdepth) { }
// standard iterators
- auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
- auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
- auto_iterator cbegin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
- auto_iterator cend() const { return auto_iterator(nullptr, 0, m_maxdepth); }
+ iterator begin() const { return iterator(&m_root, 0, m_maxdepth); }
+ iterator end() const { return iterator(nullptr, 0, m_maxdepth); }
+ iterator cbegin() const { return iterator(&m_root, 0, m_maxdepth); }
+ iterator cend() const { return iterator(nullptr, 0, m_maxdepth); }
// return first item
DeviceClass *first() const { return begin().current(); }
@@ -1233,20 +1229,19 @@ private:
};
-// ======================> device_interface_iterator
+// ======================> device_interface_enumerator
// helper class to find devices with a given interface in the device hierarchy
// also works for finding devices derived from a given subclass
-template<class InterfaceClass>
-class device_interface_iterator
+template <class InterfaceClass>
+class device_interface_enumerator
{
public:
- class auto_iterator : public device_iterator::auto_iterator
+ class iterator : public device_enumerator::iterator
{
-public:
+ public:
// construction
- auto_iterator(device_t *devptr, int curdepth, int maxdepth)
- : device_iterator::auto_iterator(devptr, curdepth, maxdepth)
+ iterator(device_t *devptr, int curdepth, int maxdepth) : device_enumerator::iterator(devptr, curdepth, maxdepth)
{
// set the iterator for the first device with the interface
find_interface();
@@ -1257,14 +1252,15 @@ public:
InterfaceClass &operator*() const { assert(m_interface != nullptr); return *m_interface; }
// search for devices with the specified interface
- const auto_iterator &operator++() { advance(); find_interface(); return *this; }
+ const iterator &operator++() { advance(); find_interface(); return *this; }
+ iterator operator++(int) { iterator const result(*this); ++*this; return result; }
-private:
+ private:
// private helper
void find_interface()
{
// advance until finding a device with the interface
- for ( ; m_curdevice != nullptr; advance())
+ for ( ; m_curdevice; advance())
if (m_curdevice->interface(m_interface))
return;
@@ -1276,14 +1272,12 @@ private:
InterfaceClass *m_interface;
};
-public:
// construction
- device_interface_iterator(device_t &root, int maxdepth = 255)
- : m_root(root), m_maxdepth(maxdepth) { }
+ device_interface_enumerator(device_t &root, int maxdepth = 255) : m_root(root), m_maxdepth(maxdepth) { }
// standard iterators
- auto_iterator begin() const { return auto_iterator(&m_root, 0, m_maxdepth); }
- auto_iterator end() const { return auto_iterator(nullptr, 0, m_maxdepth); }
+ iterator begin() const { return iterator(&m_root, 0, m_maxdepth); }
+ iterator end() const { return iterator(nullptr, 0, m_maxdepth); }
// return first item
InterfaceClass *first() const { return begin().current(); }
@@ -1390,4 +1384,4 @@ inline device_t::interface_list::auto_iterator device_t::interface_list::auto_it
}
-#endif /* MAME_EMU_DEVICE_H */
+#endif // MAME_EMU_DEVICE_H
diff --git a/src/emu/didisasm.h b/src/emu/didisasm.h
index 0813520a8c7..fef59c3372e 100644
--- a/src/emu/didisasm.h
+++ b/src/emu/didisasm.h
@@ -55,6 +55,6 @@ private:
};
// iterator
-typedef device_interface_iterator<device_disasm_interface> disasm_interface_iterator;
+typedef device_interface_enumerator<device_disasm_interface> disasm_interface_enumerator;
#endif // MAME_EMU_DIDISASM_H
diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp
index c142fd960e1..55613cf90f2 100644
--- a/src/emu/diexec.cpp
+++ b/src/emu/diexec.cpp
@@ -350,7 +350,7 @@ void device_execute_interface::interface_validity_check(validity_checker &valid)
// validate the interrupts
if (!m_vblank_interrupt.isnull())
{
- screen_device_iterator iter(device().mconfig().root_device());
+ screen_device_enumerator iter(device().mconfig().root_device());
if (iter.first() == nullptr)
osd_printf_error("VBLANK interrupt specified, but the driver is screenless\n");
else if (m_vblank_interrupt_screen != nullptr && device().siblingdevice(m_vblank_interrupt_screen) == nullptr)
@@ -379,7 +379,7 @@ void device_execute_interface::interface_pre_start()
m_driver_irq.resolve();
// fill in the initial states
- int const index = device_iterator(device().machine().root_device()).indexof(*this);
+ int const index = device_enumerator(device().machine().root_device()).indexof(*this);
m_suspend = SUSPEND_REASON_RESET;
m_profiler = profile_type(index + PROFILER_DEVICE_FIRST);
m_inttrigger = index + TRIGGER_INT;
diff --git a/src/emu/diexec.h b/src/emu/diexec.h
index c661544ba73..065248a9046 100644
--- a/src/emu/diexec.h
+++ b/src/emu/diexec.h
@@ -340,6 +340,6 @@ public:
};
// iterator
-typedef device_interface_iterator<device_execute_interface> execute_interface_iterator;
+typedef device_interface_enumerator<device_execute_interface> execute_interface_enumerator;
#endif // MAME_EMU_DIEXEC_H
diff --git a/src/emu/digfx.h b/src/emu/digfx.h
index 3829cd2882e..6ba323baafc 100644
--- a/src/emu/digfx.h
+++ b/src/emu/digfx.h
@@ -199,7 +199,7 @@ private:
};
// iterator
-typedef device_interface_iterator<device_gfx_interface> gfx_interface_iterator;
+typedef device_interface_enumerator<device_gfx_interface> gfx_interface_enumerator;
#endif /* MAME_EMU_DIGFX_H */
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index db890ad3d8c..0b78816c8e5 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -1260,7 +1260,7 @@ void device_image_interface::update_names()
// count instances of the general image type, or device type if custom
int count = 0;
int index = -1;
- for (const device_image_interface &image : image_interface_iterator(device().mconfig().root_device()))
+ for (const device_image_interface &image : image_interface_enumerator(device().mconfig().root_device()))
{
if (this == &image)
index = count;
@@ -1302,7 +1302,7 @@ const software_part *device_image_interface::find_software_item(const std::strin
: nullptr;
// find the software list if explicitly specified
- for (software_list_device &swlistdev : software_list_device_iterator(device().mconfig().root_device()))
+ for (software_list_device &swlistdev : software_list_device_enumerator(device().mconfig().root_device()))
{
if (list_name.empty() || (list_name == swlistdev.list_name()))
{
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index 9f67530383f..9ec748c3bed 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -331,6 +331,6 @@ private:
};
// iterator
-typedef device_interface_iterator<device_image_interface> image_interface_iterator;
+typedef device_interface_enumerator<device_image_interface> image_interface_enumerator;
#endif /* MAME_EMU_DIIMAGE_H */
diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h
index 1c0d14ebe45..f15a04166f4 100644
--- a/src/emu/dimemory.h
+++ b/src/emu/dimemory.h
@@ -126,8 +126,7 @@ private:
};
// iterator
-typedef device_interface_iterator<device_memory_interface> memory_interface_iterator;
+typedef device_interface_enumerator<device_memory_interface> memory_interface_enumerator;
-
-#endif /* MAME_EMU_DIMEMORY_H */
+#endif // MAME_EMU_DIMEMORY_H
diff --git a/src/emu/dinetwork.h b/src/emu/dinetwork.h
index d844be951ab..d165d752852 100644
--- a/src/emu/dinetwork.h
+++ b/src/emu/dinetwork.h
@@ -50,6 +50,6 @@ protected:
// iterator
-typedef device_interface_iterator<device_network_interface> network_interface_iterator;
+typedef device_interface_enumerator<device_network_interface> network_interface_enumerator;
#endif // MAME_EMU_DINETWORK_H
diff --git a/src/emu/dinvram.h b/src/emu/dinvram.h
index 65fd25d2578..fb02a9c6e14 100644
--- a/src/emu/dinvram.h
+++ b/src/emu/dinvram.h
@@ -48,7 +48,7 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_nvram_interface> nvram_interface_iterator;
+typedef device_interface_enumerator<device_nvram_interface> nvram_interface_enumerator;
#endif /* MAME_EMU_DINVRAM */
diff --git a/src/emu/dipalette.h b/src/emu/dipalette.h
index 7e41f968cea..1e84b2848e8 100644
--- a/src/emu/dipalette.h
+++ b/src/emu/dipalette.h
@@ -140,7 +140,7 @@ private:
};
// interface type iterator
-typedef device_interface_iterator<device_palette_interface> palette_interface_iterator;
+typedef device_interface_enumerator<device_palette_interface> palette_interface_enumerator;
#endif // MAME_EMU_DIPALETTE_H
diff --git a/src/emu/dipty.h b/src/emu/dipty.h
index e3297da9967..790d4ec39b0 100644
--- a/src/emu/dipty.h
+++ b/src/emu/dipty.h
@@ -37,6 +37,6 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_pty_interface> pty_interface_iterator;
+typedef device_interface_enumerator<device_pty_interface> pty_interface_enumerator;
#endif // MAME_EMU_DIPTY_H
diff --git a/src/emu/dirtc.h b/src/emu/dirtc.h
index 76658b12a9f..89a08deb830 100644
--- a/src/emu/dirtc.h
+++ b/src/emu/dirtc.h
@@ -75,7 +75,7 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_rtc_interface> rtc_interface_iterator;
+typedef device_interface_enumerator<device_rtc_interface> rtc_interface_enumerator;
#endif // MAME_EMU_DIRTC_H
diff --git a/src/emu/dislot.h b/src/emu/dislot.h
index a88102f84e5..ae9d8ec4575 100644
--- a/src/emu/dislot.h
+++ b/src/emu/dislot.h
@@ -227,6 +227,6 @@ protected:
}
};
-typedef device_interface_iterator<device_slot_interface> slot_interface_iterator;
+typedef device_interface_enumerator<device_slot_interface> slot_interface_enumerator;
#endif // MAME_EMU_DISLOT_H
diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp
index 7cbfe36bbff..abd5e4f4e12 100644
--- a/src/emu/disound.cpp
+++ b/src/emu/disound.cpp
@@ -287,7 +287,7 @@ void device_sound_interface::interface_validity_check(validity_checker &valid) c
void device_sound_interface::interface_pre_start()
{
// scan all the sound devices
- sound_interface_iterator iter(device().machine().root_device());
+ sound_interface_enumerator iter(device().machine().root_device());
for (device_sound_interface const &sound : iter)
{
// scan each route on the device
@@ -332,7 +332,7 @@ void device_sound_interface::interface_pre_start()
void device_sound_interface::interface_post_start()
{
// iterate over all the sound devices
- for (device_sound_interface &sound : sound_interface_iterator(device().machine().root_device()))
+ for (device_sound_interface &sound : sound_interface_enumerator(device().machine().root_device()))
{
// scan each route on the device
for (sound_route const &route : sound.routes())
@@ -440,7 +440,7 @@ void device_mixer_interface::interface_pre_start()
m_outputmap.resize(m_auto_allocated_inputs);
// iterate through all routes that point to us and note their mixer output
- for (device_sound_interface const &sound : sound_interface_iterator(device().machine().root_device()))
+ for (device_sound_interface const &sound : sound_interface_enumerator(device().machine().root_device()))
{
for (sound_route const &route : sound.routes())
{
diff --git a/src/emu/disound.h b/src/emu/disound.h
index 1d24150bfb2..e48ba290bc6 100644
--- a/src/emu/disound.h
+++ b/src/emu/disound.h
@@ -113,7 +113,7 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_sound_interface> sound_interface_iterator;
+typedef device_interface_enumerator<device_sound_interface> sound_interface_enumerator;
@@ -142,7 +142,7 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_mixer_interface> mixer_interface_iterator;
+typedef device_interface_enumerator<device_mixer_interface> mixer_interface_enumerator;
#endif // MAME_EMU_DISOUND_H
diff --git a/src/emu/distate.h b/src/emu/distate.h
index 5888313440e..0155d2afb11 100644
--- a/src/emu/distate.h
+++ b/src/emu/distate.h
@@ -373,7 +373,7 @@ protected:
};
// iterator
-typedef device_interface_iterator<device_state_interface> state_interface_iterator;
+typedef device_interface_enumerator<device_state_interface> state_interface_enumerator;
diff --git a/src/emu/divideo.cpp b/src/emu/divideo.cpp
index b894f11fb5d..9ce8d53ac10 100644
--- a/src/emu/divideo.cpp
+++ b/src/emu/divideo.cpp
@@ -88,7 +88,7 @@ void device_video_interface::interface_validity_check(validity_checker &valid) c
else
{
// otherwise, look for a single match
- screen_device_iterator iter(device().mconfig().root_device());
+ screen_device_enumerator iter(device().mconfig().root_device());
screen = iter.first();
if (iter.count() > 1)
osd_printf_error("No screen specified for device '%s', but multiple screens found\n", device().tag());
@@ -121,7 +121,7 @@ void device_video_interface::interface_pre_start()
else
{
// otherwise, look for a single match
- screen_device_iterator iter(device().machine().root_device());
+ screen_device_enumerator iter(device().machine().root_device());
m_screen = iter.first();
if (iter.count() > 1)
throw emu_fatalerror("No screen specified for device '%s', but multiple screens found", device().tag());
diff --git a/src/emu/divideo.h b/src/emu/divideo.h
index 626d5bc66b4..096f4fd9958 100644
--- a/src/emu/divideo.h
+++ b/src/emu/divideo.h
@@ -68,7 +68,7 @@ private:
};
// iterator
-typedef device_interface_iterator<device_video_interface> video_interface_iterator;
+typedef device_interface_enumerator<device_video_interface> video_interface_enumerator;
#endif /* MAME_EMU_DIVIDEO_H */
diff --git a/src/emu/drivenum.cpp b/src/emu/drivenum.cpp
index 5a29dcabd9a..574205379cd 100644
--- a/src/emu/drivenum.cpp
+++ b/src/emu/drivenum.cpp
@@ -340,7 +340,7 @@ void driver_enumerator::release_current() const
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()))
+ for (software_list_device &swlistdev : software_list_device_enumerator(cached->second->root_device()))
swlistdev.release();
}
}
diff --git a/src/emu/driver.cpp b/src/emu/driver.cpp
index eb128669f5c..04c6489aae3 100644
--- a/src/emu/driver.cpp
+++ b/src/emu/driver.cpp
@@ -211,7 +211,7 @@ ioport_constructor driver_device::device_input_ports() const
void driver_device::device_start()
{
// reschedule ourselves to be last
- for (device_t &test : device_iterator(*this))
+ for (device_t &test : device_enumerator(*this))
if (&test != this && !test.started())
throw device_missing_dependencies();
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index 1b6b48af522..aa8b72b8d9c 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -197,6 +197,7 @@ class output_manager;
// declared in render.h
class layout_element;
class layout_view;
+class layout_file;
class render_container;
class render_manager;
class render_target;
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index c930fd31469..f7eb15a208f 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -302,9 +302,8 @@ memory_manager::~memory_manager()
void memory_manager::initialize()
{
// loop over devices and spaces within each device
- memory_interface_iterator iter(machine().root_device());
std::vector<device_memory_interface *> memories;
- for (device_memory_interface &memory : iter)
+ for (device_memory_interface &memory : memory_interface_enumerator(machine().root_device()))
{
memories.push_back(&memory);
allocate(memory);
diff --git a/src/emu/emumem.h b/src/emu/emumem.h
index be26838b91e..5e419241162 100644
--- a/src/emu/emumem.h
+++ b/src/emu/emumem.h
@@ -1658,7 +1658,7 @@ public:
handler_entry *unmap_w() const { return m_unmap_w; }
handler_entry *nop_r() const { return m_nop_r; }
handler_entry *nop_w() const { return m_nop_w; }
-
+
protected:
// internal helpers
virtual std::pair<void *, void *> get_cache_info() = 0;
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index d28d1bede37..ceda32dbbcc 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -567,7 +567,7 @@ bool emu_options::add_and_remove_slot_options()
// create the configuration
machine_config config(*m_system, *this);
- for (const device_slot_interface &slot : slot_interface_iterator(config.root_device()))
+ for (const device_slot_interface &slot : slot_interface_enumerator(config.root_device()))
{
// come up with the canonical name of the slot
const char *slot_option_name = slot.slot_name();
@@ -664,7 +664,7 @@ bool emu_options::add_and_remove_image_options()
machine_config config(*m_system, *this);
// iterate through all image devices
- for (device_image_interface &image : image_interface_iterator(config.root_device()))
+ for (device_image_interface &image : image_interface_enumerator(config.root_device()))
{
const std::string &canonical_name(image.canonical_instance_name());
@@ -745,7 +745,7 @@ void emu_options::reevaluate_default_card_software()
found = false;
// iterate through all slot devices
- for (device_slot_interface &slot : slot_interface_iterator(config.root_device()))
+ for (device_slot_interface &slot : slot_interface_enumerator(config.root_device()))
{
// retrieve info about the device instance
auto &slot_opt(slot_option(slot.slot_name()));
@@ -883,7 +883,7 @@ emu_options::software_options emu_options::evaluate_initial_softlist_options(con
// and set up a configuration
machine_config config(*m_system, *this);
- software_list_device_iterator iter(config.root_device());
+ software_list_device_enumerator iter(config.root_device());
if (iter.count() == 0)
throw emu_fatalerror(EMU_ERR_FATALERROR, "Error: unknown option: %s\n", software_identifier.c_str());
diff --git a/src/emu/image.cpp b/src/emu/image.cpp
index 4613d411c91..5da34b1abc5 100644
--- a/src/emu/image.cpp
+++ b/src/emu/image.cpp
@@ -30,7 +30,7 @@ image_manager::image_manager(running_machine &machine)
: m_machine(machine)
{
// make sure that any required devices have been allocated
- for (device_image_interface &image : image_interface_iterator(machine.root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine.root_device()))
{
// ignore things not user loadable
if (!image.user_loadable())
@@ -93,7 +93,7 @@ void image_manager::unload_all()
// extract the options
options_extract();
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
// unload this image
image.unload();
@@ -110,7 +110,7 @@ void image_manager::config_load(config_type cfg_type, util::xml::data_node const
if ((dev_instance != nullptr) && (dev_instance[0] != '\0'))
{
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
if (!strcmp(dev_instance, image.instance_name().c_str()))
{
@@ -134,7 +134,7 @@ void image_manager::config_save(config_type cfg_type, util::xml::data_node *pare
/* only care about game-specific data */
if (cfg_type == config_type::GAME)
{
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
const char *const dev_instance = image.instance_name().c_str();
@@ -182,7 +182,7 @@ int image_manager::write_config(emu_options &options, const char *filename, cons
void image_manager::options_extract()
{
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
// There are two scenarios where we want to extract the option:
//
@@ -230,7 +230,7 @@ void image_manager::options_extract()
void image_manager::postdevice_init()
{
/* make sure that any required devices have been allocated */
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
image_init_result result = image.finish_load();
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index e9fd8d7b6d7..e3b2aa9b473 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -1675,7 +1675,7 @@ time_t ioport_manager::initialize()
init_port_types();
// if we have a token list, proceed
- device_iterator iter(machine().root_device());
+ device_enumerator iter(machine().root_device());
for (device_t &device : iter)
{
std::string errors;
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 246cca0dd3e..f25d236083a 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -140,7 +140,7 @@ running_machine::running_machine(const machine_config &_config, machine_manager
m_dummy_space.config_complete();
// set the machine on all devices
- device_iterator iter(root_device());
+ device_enumerator iter(root_device());
for (device_t &device : iter)
device.set_machine(*this);
@@ -222,7 +222,7 @@ void running_machine::start()
m_sound = std::make_unique<sound_manager>(*this);
// resolve objects that can be used by memory maps
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
device.resolve_pre_map();
// configure the address spaces, load ROMs (which needs
@@ -252,7 +252,7 @@ void running_machine::start()
manager().create_custom(*this);
// resolve objects that are created by memory maps
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
device.resolve_post_map();
// register callbacks for the devices, then start them
@@ -551,7 +551,7 @@ std::string running_machine::get_statename(const char *option) const
//printf("check template: %s\n", devname_str.c_str());
// verify that there is such a device for this system
- for (device_image_interface &image : image_interface_iterator(root_device()))
+ for (device_image_interface &image : image_interface_enumerator(root_device()))
{
// get the device name
std::string tempdevname(image.brief_instance_name());
@@ -878,7 +878,7 @@ void running_machine::current_datetime(system_time &systime)
void running_machine::set_rtc_datetime(const system_time &systime)
{
- for (device_rtc_interface &rtc : rtc_interface_iterator(root_device()))
+ for (device_rtc_interface &rtc : rtc_interface_enumerator(root_device()))
if (rtc.has_battery())
rtc.set_current_time(systime);
}
@@ -1047,7 +1047,7 @@ void running_machine::start_all_devices()
{
// iterate over all devices
int failed_starts = 0;
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
if (!device.started())
{
// attempt to start the device, catching any expected exceptions
@@ -1104,7 +1104,7 @@ void running_machine::stop_all_devices()
debugger().cpu().comment_save();
// iterate over devices and stop them
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
device.stop();
}
@@ -1116,7 +1116,7 @@ void running_machine::stop_all_devices()
void running_machine::presave_all_devices()
{
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
device.pre_save();
}
@@ -1128,7 +1128,7 @@ void running_machine::presave_all_devices()
void running_machine::postload_all_devices()
{
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
device.post_load();
}
@@ -1181,7 +1181,7 @@ std::string running_machine::nvram_filename(device_t &device) const
void running_machine::nvram_load()
{
- for (device_nvram_interface &nvram : nvram_interface_iterator(root_device()))
+ for (device_nvram_interface &nvram : nvram_interface_enumerator(root_device()))
{
emu_file file(options().nvram_directory(), OPEN_FLAG_READ);
if (file.open(nvram_filename(nvram.device())) == osd_file::error::NONE)
@@ -1201,7 +1201,7 @@ void running_machine::nvram_load()
void running_machine::nvram_save()
{
- for (device_nvram_interface &nvram : nvram_interface_iterator(root_device()))
+ for (device_nvram_interface &nvram : nvram_interface_enumerator(root_device()))
{
if (nvram.nvram_can_save())
{
@@ -1269,7 +1269,7 @@ void running_machine::export_http_api()
writer.Key("devices");
writer.StartArray();
- device_iterator iter(this->root_device());
+ device_enumerator iter(this->root_device());
for (device_t &device : iter)
writer.String(device.tag());
diff --git a/src/emu/main.h b/src/emu/main.h
index 609985a48bf..3c75205de14 100644
--- a/src/emu/main.h
+++ b/src/emu/main.h
@@ -59,7 +59,7 @@ public:
static void periodic_check();
static bool frame_hook();
static void sound_hook();
- static void layout_file_cb(util::xml::data_node const &layout);
+ static void layout_script_cb(layout_file &file, const char *script);
static bool standalone();
};
diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp
index cf162ae4f06..32b82468c3a 100644
--- a/src/emu/mconfig.cpp
+++ b/src/emu/mconfig.cpp
@@ -51,7 +51,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
device_add("root", gamedrv.type, 0);
// intialize slot devices - make sure that any required devices have been allocated
- for (device_slot_interface &slot : slot_interface_iterator(root_device()))
+ for (device_slot_interface &slot : slot_interface_enumerator(root_device()))
{
device_t &owner = slot.device();
const char *slot_option_name = owner.tag() + 1;
@@ -104,7 +104,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
}
// then notify all devices that their configuration is complete
- for (device_t &device : device_iterator(root_device()))
+ for (device_t &device : device_enumerator(root_device()))
if (!device.configured())
device.config_complete();
}
@@ -380,7 +380,7 @@ void machine_config::remove_references(device_t &device)
}
// iterate over all devices and remove any references
- for (device_t &scan : device_iterator(root_device()))
+ for (device_t &scan : device_enumerator(root_device()))
scan.subdevices().m_tagmap.clear();
}
diff --git a/src/emu/network.cpp b/src/emu/network.cpp
index 1456013a74f..92ac826e9d8 100644
--- a/src/emu/network.cpp
+++ b/src/emu/network.cpp
@@ -44,7 +44,7 @@ void network_manager::config_load(config_type cfg_type, util::xml::data_node con
if ((tag != nullptr) && (tag[0] != '\0'))
{
- for (device_network_interface &network : network_interface_iterator(machine().root_device()))
+ for (device_network_interface &network : network_interface_enumerator(machine().root_device()))
{
if (!strcmp(tag, network.device().tag())) {
int interface = node->get_attribute_int("interface", 0);
@@ -74,7 +74,7 @@ void network_manager::config_save(config_type cfg_type, util::xml::data_node *pa
/* only care about game-specific data */
if (cfg_type == config_type::GAME)
{
- for (device_network_interface &network : network_interface_iterator(machine().root_device()))
+ for (device_network_interface &network : network_interface_enumerator(machine().root_device()))
{
util::xml::data_node *const node = parentnode->add_child("device", nullptr);
if (node != nullptr)
diff --git a/src/emu/profiler.cpp b/src/emu/profiler.cpp
index 173e2f4d767..765373e34e7 100644
--- a/src/emu/profiler.cpp
+++ b/src/emu/profiler.cpp
@@ -193,7 +193,7 @@ void real_profiler_state::update_text(running_machine &machine)
}
// loop over all types and generate the string
- device_iterator iter(machine.root_device());
+ device_enumerator iter(machine.root_device());
std::ostringstream stream;
for (curtype = PROFILER_DEVICE_FIRST; curtype < PROFILER_TOTAL; ++curtype)
{
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 41563bdb873..c81db6c78d8 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -1073,7 +1073,7 @@ unsigned render_target::configured_view(const char *viewname, int targetindex, i
// if we don't have a match, default to the nth view
std::vector<std::reference_wrapper<screen_device> > screens;
- for (screen_device &screen : screen_device_iterator(m_manager.machine().root_device()))
+ for (screen_device &screen : screen_device_enumerator(m_manager.machine().root_device()))
screens.push_back(screen);
if (!view && !screens.empty())
{
@@ -1615,17 +1615,10 @@ void render_target::debug_append(render_container &container)
void render_target::resolve_tags()
{
for (layout_file &file : m_filelist)
- {
- for (layout_view &view : file.views())
- {
- view.resolve_tags();
- if (&current_view() == &view)
- {
- view.recompute(visibility_mask(), m_layerconfig.zoom_to_screen());
- view.preload();
- }
- }
- }
+ file.resolve_tags();
+
+ current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen());
+ current_view().preload();
}
@@ -1779,7 +1772,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have
bool m_rotated;
std::pair<unsigned, unsigned> m_physical, m_native;
};
- screen_device_iterator iter(m_manager.machine().root_device());
+ screen_device_enumerator iter(m_manager.machine().root_device());
std::vector<screen_info> const screens(std::begin(iter), std::end(iter));
// need this because views aren't fully set up yet
@@ -2208,13 +2201,12 @@ bool render_target::load_layout_file(device_t &device, util::xml::data_node cons
{
m_filelist.emplace_back(device, rootnode, searchpath, dirname);
}
- catch (emu_fatalerror &)
+ catch (emu_fatalerror &err)
{
+ osd_printf_warning("%s\n", err.what());
return false;
}
- emulator_info::layout_file_cb(rootnode);
-
return true;
}
@@ -3053,7 +3045,7 @@ render_manager::render_manager(running_machine &machine)
machine.configuration().config_register("video", config_load_delegate(&render_manager::config_load, this), config_save_delegate(&render_manager::config_save, this));
// create one container per screen
- for (screen_device &screen : screen_device_iterator(machine.root_device()))
+ for (screen_device &screen : screen_device_enumerator(machine.root_device()))
screen.set_container(*container_alloc(&screen));
}
diff --git a/src/emu/render.h b/src/emu/render.h
index 3dc7376957c..e24893033c6 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -176,7 +176,7 @@ namespace emu::render::detail {
struct bounds_step
{
- constexpr render_bounds get() const { return bounds; }
+ void get(render_bounds &result) const { result = bounds; }
int state;
render_bounds bounds;
@@ -186,7 +186,7 @@ using bounds_vector = std::vector<bounds_step>;
struct color_step
{
- constexpr render_color get() const { return color; }
+ void get(render_color &result) const { result = color; }
int state;
render_color color;
@@ -735,6 +735,10 @@ public:
friend class layout_view;
public:
+ using state_delegate = delegate<int ()>;
+ using bounds_delegate = delegate<void (render_bounds &)>;
+ using color_delegate = delegate<void (render_color &)>;
+
// construction/destruction
item(
view_environment &env,
@@ -746,12 +750,13 @@ public:
~item();
// getters
+ std::string const &id() const { return m_id; }
layout_element *element() const { return m_element; }
screen_device *screen() { return m_screen; }
bool bounds_animated() const { return m_bounds.size() > 1U; }
bool color_animated() const { return m_color.size() > 1U; }
- render_bounds bounds() const { return m_get_bounds(); }
- render_color color() const { return m_get_color(); }
+ render_bounds bounds() const { render_bounds result; m_get_bounds(result); return result; }
+ render_color color() const { render_color result; m_get_color(result); return result; }
int blend_mode() const { return m_blend_mode; }
u32 visibility_mask() const { return m_visibility_mask; }
int orientation() const { return m_orientation; }
@@ -766,24 +771,35 @@ public:
int element_state() const { return m_get_elem_state(); }
int animation_state() const { return m_get_anim_state(); }
+ // set state
+ void set_state(int state) { m_elem_state = state; }
+
+ // set handlers
+ void set_element_state_callback(state_delegate &&handler);
+ void set_animation_state_callback(state_delegate &&handler);
+ void set_bounds_callback(bounds_delegate &&handler);
+ void set_color_callback(color_delegate &&handler);
+
// resolve tags, if any
void resolve_tags();
private:
using bounds_vector = emu::render::detail::bounds_vector;
using color_vector = emu::render::detail::color_vector;
- using state_delegate = delegate<int ()>;
- using bounds_delegate = delegate<render_bounds ()>;
- using color_delegate = delegate<render_color ()>;
+ state_delegate default_get_elem_state();
+ state_delegate default_get_anim_state();
+ bounds_delegate default_get_bounds();
+ color_delegate default_get_color();
+ int get_state() const;
int get_output() const;
int get_input_raw() const;
int get_input_field_cached() const;
int get_input_field_conditional() const;
int get_anim_output() const;
int get_anim_input() const;
- render_bounds get_interpolated_bounds() const;
- render_color get_interpolated_color() const;
+ void get_interpolated_bounds(render_bounds &result) const;
+ void get_interpolated_color(render_color &result) const;
static layout_element *find_element(view_environment &env, util::xml::data_node const &itemnode, element_map &elemmap);
static bounds_vector make_bounds(view_environment &env, util::xml::data_node const &itemnode, layout_group::transform const &trans);
@@ -804,26 +820,28 @@ public:
output_finder<> m_output; // associated output
output_finder<> m_animoutput; // associated output for animation if different
ioport_port * m_animinput_port; // input port used for animation
+ int m_elem_state; // element state used in absence of bindings
ioport_value const m_animmask; // mask for animation state
u8 const m_animshift; // shift for animation state
ioport_port * m_input_port; // input port of this item
ioport_field const * m_input_field; // input port field of this item
ioport_value const m_input_mask; // input mask of this item
u8 const m_input_shift; // input mask rightshift for raw (trailing 0s)
- bool const m_input_raw; // get raw data from input port
bool m_clickthrough; // should click pass through to lower elements
screen_device * m_screen; // pointer to screen
- int m_orientation; // orientation of this item
+ int const m_orientation; // orientation of this item
bounds_vector m_bounds; // bounds of the item
color_vector const m_color; // color of the item
int m_blend_mode; // blending mode to use when drawing
u32 m_visibility_mask; // combined mask of parent visibility groups
// cold items
+ std::string const m_id; // optional unique item identifier
std::string const m_input_tag; // input tag of this item
std::string const m_animinput_tag; // tag of input port for animation state
bounds_vector const m_rawbounds; // raw (original) bounds of the item
bool const m_have_output; // whether we actually have an output
+ bool const m_input_raw; // get raw data from input port
bool const m_have_animoutput; // whether we actually have an output for animation
bool const m_has_clickthrough; // whether clickthrough was explicitly configured
};
@@ -893,9 +911,11 @@ public:
~layout_view();
// getters
+ item *get_item(std::string const &id);
item_list &items() { return m_items; }
bool has_screen(screen_device &screen);
const std::string &name() const { return m_name; }
+ const std::string &unqualified_name() const { return m_unqualified_name; }
size_t visible_screen_count() const { return m_screens.size(); }
float effective_aspect() const { return m_effaspect; }
const render_bounds &bounds() const { return m_bounds; }
@@ -920,6 +940,12 @@ public:
private:
struct layer_lists;
+ using item_id_map = std::unordered_map<
+ std::reference_wrapper<std::string const>,
+ item &,
+ std::hash<std::string>,
+ std::equal_to<std::string> >;
+
// add items, recursing for groups
void add_items(
layer_lists &layers,
@@ -937,7 +963,6 @@ private:
static std::string make_name(layout_environment &env, util::xml::data_node const &viewnode);
// internal state
- std::string m_name; // name of the layout
float m_effaspect; // X/Y of the layout in current configuration
render_bounds m_bounds; // computed bounds of the view in current configuration
item_list m_items; // list of layout items
@@ -949,6 +974,9 @@ private:
screen_ref_vector m_screens; // list screens visible in current configuration
// cold items
+ std::string m_name; // display name for the view
+ std::string m_unqualified_name; // the name exactly as specified in the layout file
+ item_id_map m_items_by_id; // items with non-empty ID indexed by ID
visibility_toggle_vector m_vistoggles; // collections of items that can be shown/hidden
render_bounds m_expbounds; // explicit bounds of the view
u32 m_defvismask; // default visibility mask
@@ -966,16 +994,24 @@ public:
using element_map = std::unordered_map<std::string, layout_element>;
using group_map = std::unordered_map<std::string, layout_group>;
using view_list = std::list<layout_view>;
+ using resolve_tags_delegate = delegate<void ()>;
// construction/destruction
layout_file(device_t &device, util::xml::data_node const &rootnode, char const *searchpath, char const *dirname);
~layout_file();
// getters
+ device_t &device() const { return m_device; }
element_map const &elements() const { return m_elemmap; }
view_list &views() { return m_viewlist; }
view_list const &views() const { return m_viewlist; }
+ // resolve tags, if any
+ void resolve_tags();
+
+ // set handlers
+ void set_resolve_tags_callback(resolve_tags_delegate &&handler);
+
private:
using environment = emu::render::detail::layout_environment;
@@ -988,8 +1024,10 @@ private:
bool init);
// internal state
- element_map m_elemmap; // list of shared layout elements
- view_list m_viewlist; // list of views
+ device_t & m_device; // device that caused file to be loaded
+ element_map m_elemmap; // list of shared layout elements
+ view_list m_viewlist; // list of views
+ resolve_tags_delegate m_resolve_tags; // additional actions after resolving tags
};
// ======================> render_target
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index 326089c3f10..46124cf73f6 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -89,11 +89,6 @@ constexpr layout_group::transform identity_transform{{ {{ 1.0F, 0.0F, 0.0F }}, {
// HELPERS
//**************************************************************************
-constexpr int get_state_dummy(layout_view::item &item)
-{
- return 0;
-}
-
inline void render_bounds_transform(render_bounds &bounds, layout_group::transform const &trans)
{
bounds = render_bounds{
@@ -420,7 +415,7 @@ private:
try_insert("deviceshortname", device().shortname());
util::ovectorstream tmp;
unsigned i(0U);
- for (screen_device const &screen : screen_device_iterator(machine().root_device()))
+ for (screen_device const &screen : screen_device_enumerator(machine().root_device()))
{
std::pair<u64, u64> const physaspect(screen.physical_aspect());
s64 const w(screen.visible_area().width()), h(screen.visible_area().height());
@@ -3955,9 +3950,9 @@ layout_view::layout_view(
util::xml::data_node const &viewnode,
element_map &elemmap,
group_map &groupmap)
- : m_name(make_name(env, viewnode))
- , m_effaspect(1.0f)
- , m_items()
+ : m_effaspect(1.0f)
+ , m_name(make_name(env, viewnode))
+ , m_unqualified_name(env.get_attribute_string(viewnode, "name", ""))
, m_defvismask(0U)
, m_has_art(false)
{
@@ -4044,6 +4039,16 @@ layout_view::layout_view(
m_items.splice(m_items.end(), layers.marquees);
}
+ // index items with keys supplied
+ for (item &curitem : m_items)
+ {
+ if (!curitem.id().empty())
+ {
+ if (!m_items_by_id.emplace(curitem.id(), curitem).second)
+ throw layout_syntax_error("view contains item with duplicate id attribute");
+ }
+ }
+
// calculate metrics
recompute(default_visibility_mask(), false);
for (group_map::value_type &group : groupmap)
@@ -4061,8 +4066,19 @@ layout_view::~layout_view()
//-------------------------------------------------
+// get_item - get item by ID
+//-------------------------------------------------
+
+layout_view::item *layout_view::get_item(std::string const &id)
+{
+ auto const found(m_items_by_id.find(id));
+ return (m_items_by_id.end() != found) ? &found->second : nullptr;
+}
+
+
+//-------------------------------------------------
// has_screen - return true if this view contains
-// the given screen
+// the specified screen
//-------------------------------------------------
bool layout_view::has_screen(screen_device &screen)
@@ -4395,8 +4411,8 @@ void layout_view::add_items(
std::string layout_view::make_name(layout_environment &env, util::xml::data_node const &viewnode)
{
char const *const name(env.get_attribute_string(viewnode, "name", nullptr));
- if (!name)
- throw layout_syntax_error("view must have name attribute");
+ if (!name || !*name)
+ throw layout_syntax_error("view must have non-empty name attribute");
if (env.is_root_device())
{
@@ -4432,30 +4448,32 @@ layout_view::item::item(
, m_output(env.device(), env.get_attribute_string(itemnode, "name", ""))
, m_animoutput(env.device(), make_animoutput_tag(env, itemnode))
, m_animinput_port(nullptr)
+ , m_elem_state(m_element ? m_element->default_state() : 0)
, m_animmask(make_animmask(env, itemnode))
, m_animshift(get_state_shift(m_animmask))
, m_input_port(nullptr)
, m_input_field(nullptr)
, m_input_mask(env.get_attribute_int(itemnode, "inputmask", 0))
, m_input_shift(get_state_shift(m_input_mask))
- , m_input_raw(env.get_attribute_bool(itemnode, "inputraw", 0))
, m_clickthrough(env.get_attribute_bool(itemnode, "clickthrough", "yes"))
, m_screen(nullptr)
, m_orientation(orientation_add(env.parse_orientation(itemnode.get_child("orientation")), orientation))
, m_color(make_color(env, itemnode, color))
, m_blend_mode(get_blend_mode(env, itemnode))
, m_visibility_mask(env.visibility_mask())
+ , m_id(env.get_attribute_string(itemnode, "id", ""))
, m_input_tag(make_input_tag(env, itemnode))
, m_animinput_tag(make_animinput_tag(env, itemnode))
, m_rawbounds(make_bounds(env, itemnode, trans))
, m_have_output(env.get_attribute_string(itemnode, "name", "")[0])
+ , m_input_raw(env.get_attribute_bool(itemnode, "inputraw", 0))
, m_have_animoutput(!make_animoutput_tag(env, itemnode).empty())
, m_has_clickthrough(env.get_attribute_string(itemnode, "clickthrough", "")[0])
{
// fetch common data
int index = env.get_attribute_int(itemnode, "index", -1);
if (index != -1)
- m_screen = screen_device_iterator(env.machine().root_device()).byindex(index);
+ m_screen = screen_device_enumerator(env.machine().root_device()).byindex(index);
// sanity checks
if (strcmp(itemnode.get_name(), "screen") == 0)
@@ -4492,9 +4510,65 @@ layout_view::item::~item()
}
-//---------------------------------------------
+//-------------------------------------------------
+// set_element_state_callback - set callback to
+// obtain element state value
+//-------------------------------------------------
+
+void layout_view::item::set_element_state_callback(state_delegate &&handler)
+{
+ if (!handler.isnull())
+ m_get_elem_state = std::move(handler);
+ else
+ m_get_elem_state = default_get_elem_state();
+}
+
+
+//-------------------------------------------------
+// set_animation_state_callback - set callback to
+// obtain animation state
+//-------------------------------------------------
+
+void layout_view::item::set_animation_state_callback(state_delegate &&handler)
+{
+ if (!handler.isnull())
+ m_get_anim_state = std::move(handler);
+ else
+ m_get_anim_state = default_get_anim_state();
+}
+
+
+//-------------------------------------------------
+// set_bounds_callback - set callback to obtain
+// bounds
+//-------------------------------------------------
+
+void layout_view::item::set_bounds_callback(bounds_delegate &&handler)
+{
+ if (!handler.isnull())
+ m_get_bounds = std::move(handler);
+ else
+ m_get_bounds = default_get_bounds();
+}
+
+
+//-------------------------------------------------
+// set_color_callback - set callback to obtain
+// color
+//-------------------------------------------------
+
+void layout_view::item::set_color_callback(color_delegate &&handler)
+{
+ if (!handler.isnull())
+ m_get_color = std::move(handler);
+ else
+ m_get_color = default_get_color();
+}
+
+
+//-------------------------------------------------
// resolve_tags - resolve tags, if any are set
-//---------------------------------------------
+//-------------------------------------------------
void layout_view::item::resolve_tags()
{
@@ -4537,39 +4611,87 @@ void layout_view::item::resolve_tags()
}
}
- // choose optimal element state function
+ // choose optimal handlers
+ m_get_elem_state = default_get_elem_state();
+ m_get_anim_state = default_get_anim_state();
+ m_get_bounds = default_get_bounds();
+ m_get_color = default_get_color();
+}
+
+
+//-------------------------------------------------
+// default_get_elem_state - get default element
+// state handler
+//-------------------------------------------------
+
+layout_view::item::state_delegate layout_view::item::default_get_elem_state()
+{
if (m_have_output)
- m_get_elem_state = state_delegate(&item::get_output, this);
+ return state_delegate(&item::get_output, this);
else if (!m_input_port)
- m_get_elem_state = state_delegate(&get_state_dummy, this);
+ return state_delegate(&item::get_state, this);
else if (m_input_raw)
- m_get_elem_state = state_delegate(&item::get_input_raw, this);
+ return state_delegate(&item::get_input_raw, this);
else if (m_input_field)
- m_get_elem_state = state_delegate(&item::get_input_field_cached, this);
+ return state_delegate(&item::get_input_field_cached, this);
else
- m_get_elem_state = state_delegate(&item::get_input_field_conditional, this);
+ return state_delegate(&item::get_input_field_conditional, this);
+}
- // choose optimal animation state function
+
+//-------------------------------------------------
+// default_get_anim_state - get default animation
+// state handler
+//-------------------------------------------------
+
+layout_view::item::state_delegate layout_view::item::default_get_anim_state()
+{
if (m_have_animoutput)
- m_get_anim_state = state_delegate(&item::get_anim_output, this);
+ return state_delegate(&item::get_anim_output, this);
else if (m_animinput_port)
- m_get_anim_state = state_delegate(&item::get_anim_input, this);
+ return state_delegate(&item::get_anim_input, this);
else
- m_get_anim_state = m_get_elem_state;
+ return default_get_elem_state();
+}
- // choose optional bounds and colour functions
- m_get_bounds = (m_bounds.size() == 1U)
+
+//-------------------------------------------------
+// default_get_bounds - get default bounds handler
+//-------------------------------------------------
+
+layout_view::item::bounds_delegate layout_view::item::default_get_bounds()
+{
+ return (m_bounds.size() == 1U)
? bounds_delegate(&emu::render::detail::bounds_step::get, &m_bounds.front())
: bounds_delegate(&item::get_interpolated_bounds, this);
- m_get_color = (m_color.size() == 1U)
+}
+
+
+//-------------------------------------------------
+// default_get_color - get default color handler
+//-------------------------------------------------
+
+layout_view::item::color_delegate layout_view::item::default_get_color()
+{
+ return (m_color.size() == 1U)
? color_delegate(&emu::render::detail::color_step::get, &const_cast<emu::render::detail::color_step &>(m_color.front()))
: color_delegate(&item::get_interpolated_color, this);
}
-//---------------------------------------------
+//-------------------------------------------------
+// get_state - get state when no bindings
+//-------------------------------------------------
+
+int layout_view::item::get_state() const
+{
+ return m_elem_state;
+}
+
+
+//-------------------------------------------------
// get_output - get element state output
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_output() const
{
@@ -4578,9 +4700,9 @@ int layout_view::item::get_output() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_input_raw - get element state input
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_input_raw() const
{
@@ -4589,9 +4711,9 @@ int layout_view::item::get_input_raw() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_input_field_cached - element state
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_input_field_cached() const
{
@@ -4601,9 +4723,9 @@ int layout_view::item::get_input_field_cached() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_input_field_conditional - element state
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_input_field_conditional() const
{
@@ -4614,9 +4736,9 @@ int layout_view::item::get_input_field_conditional() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_anim_output - get animation output
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_anim_output() const
{
@@ -4625,9 +4747,9 @@ int layout_view::item::get_anim_output() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_anim_input - get animation input
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_anim_input() const
{
@@ -4636,31 +4758,31 @@ int layout_view::item::get_anim_input() const
}
-//---------------------------------------------
+//-------------------------------------------------
// get_interpolated_bounds - animated bounds
-//---------------------------------------------
+//-------------------------------------------------
-render_bounds layout_view::item::get_interpolated_bounds() const
+void layout_view::item::get_interpolated_bounds(render_bounds &result) const
{
assert(m_bounds.size() > 1U);
- return interpolate_bounds(m_bounds, m_get_anim_state());
+ result = interpolate_bounds(m_bounds, m_get_anim_state());
}
-//---------------------------------------------
+//-------------------------------------------------
// get_interpolated_color - animated color
-//---------------------------------------------
+//-------------------------------------------------
-render_color layout_view::item::get_interpolated_color() const
+void layout_view::item::get_interpolated_color(render_color &result) const
{
assert(m_color.size() > 1U);
- return interpolate_color(m_color, m_get_anim_state());
+ result = interpolate_color(m_color, m_get_anim_state());
}
-//---------------------------------------------
+//-------------------------------------------------
// find_element - find element definition
-//---------------------------------------------
+//-------------------------------------------------
layout_element *layout_view::item::find_element(view_environment &env, util::xml::data_node const &itemnode, element_map &elemmap)
{
@@ -4677,9 +4799,9 @@ layout_element *layout_view::item::find_element(view_environment &env, util::xml
}
-//---------------------------------------------
+//-------------------------------------------------
// make_bounds - get transformed bounds
-//---------------------------------------------
+//-------------------------------------------------
layout_view::item::bounds_vector layout_view::item::make_bounds(
view_environment &env,
@@ -4710,9 +4832,9 @@ layout_view::item::bounds_vector layout_view::item::make_bounds(
}
-//---------------------------------------------
+//-------------------------------------------------
// make_color - get color inflection points
-//---------------------------------------------
+//-------------------------------------------------
layout_view::item::color_vector layout_view::item::make_color(
view_environment &env,
@@ -4744,10 +4866,9 @@ layout_view::item::color_vector layout_view::item::make_color(
}
-//---------------------------------------------
-// make_animoutput_tag - get animation output
-// tag
-//---------------------------------------------
+//-------------------------------------------------
+// make_animoutput_tag - get animation output tag
+//-------------------------------------------------
std::string layout_view::item::make_animoutput_tag(view_environment &env, util::xml::data_node const &itemnode)
{
@@ -4759,9 +4880,9 @@ std::string layout_view::item::make_animoutput_tag(view_environment &env, util::
}
-//---------------------------------------------
+//-------------------------------------------------
// make_animmask - get animation state mask
-//---------------------------------------------
+//-------------------------------------------------
ioport_value layout_view::item::make_animmask(view_environment &env, util::xml::data_node const &itemnode)
{
@@ -4770,10 +4891,10 @@ ioport_value layout_view::item::make_animmask(view_environment &env, util::xml::
}
-//---------------------------------------------
+//-------------------------------------------------
// make_animinput_tag - get absolute tag for
// animation input
-//---------------------------------------------
+//-------------------------------------------------
std::string layout_view::item::make_animinput_tag(view_environment &env, util::xml::data_node const &itemnode)
{
@@ -4783,9 +4904,9 @@ std::string layout_view::item::make_animinput_tag(view_environment &env, util::x
}
-//---------------------------------------------
+//-------------------------------------------------
// make_input_tag - get absolute input tag
-//---------------------------------------------
+//-------------------------------------------------
std::string layout_view::item::make_input_tag(view_environment &env, util::xml::data_node const &itemnode)
{
@@ -4794,9 +4915,9 @@ std::string layout_view::item::make_input_tag(view_environment &env, util::xml::
}
-//---------------------------------------------
+//-------------------------------------------------
// get_blend_mode - explicit or implicit blend
-//---------------------------------------------
+//-------------------------------------------------
int layout_view::item::get_blend_mode(view_environment &env, util::xml::data_node const &itemnode)
{
@@ -4826,9 +4947,9 @@ int layout_view::item::get_blend_mode(view_environment &env, util::xml::data_nod
}
-//---------------------------------------------
+//-------------------------------------------------
// get_state_shift - shift to right-align LSB
-//---------------------------------------------
+//-------------------------------------------------
unsigned layout_view::item::get_state_shift(ioport_value mask)
{
@@ -4873,7 +4994,8 @@ layout_file::layout_file(
util::xml::data_node const &rootnode,
char const *searchpath,
char const *dirname)
- : m_elemmap()
+ : m_device(device)
+ , m_elemmap()
, m_viewlist()
{
try
@@ -4910,6 +5032,11 @@ layout_file::layout_file(
osd_printf_warning("Error instantiating layout view %s: %s\n", env.get_attribute_string(*viewnode, "name", ""), err.what());
}
}
+
+ // load the content of the first script node
+ util::xml::data_node const *const scriptnode = mamelayoutnode->get_child("script");
+ if (scriptnode)
+ emulator_info::layout_script_cb(*this, scriptnode->get_value());
}
catch (layout_syntax_error const &err)
{
@@ -4928,6 +5055,31 @@ layout_file::~layout_file()
}
+//-------------------------------------------------
+// resolve_tags - resolve tags
+//-------------------------------------------------
+
+void layout_file::resolve_tags()
+{
+ for (layout_view &view : views())
+ view.resolve_tags();
+
+ if (!m_resolve_tags.isnull())
+ m_resolve_tags();
+}
+
+
+//-------------------------------------------------
+// set_resolve_tags_callback - set callback for
+// additional tasks after resolving tags
+//-------------------------------------------------
+
+void layout_file::set_resolve_tags_callback(resolve_tags_delegate &&handler)
+{
+ m_resolve_tags = std::move(handler);
+}
+
+
void layout_file::add_elements(
environment &env,
util::xml::data_node const &parentnode,
diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp
index 164f2c97fbc..f7b55c18229 100644
--- a/src/emu/romload.cpp
+++ b/src/emu/romload.cpp
@@ -411,7 +411,7 @@ void rom_load_manager::count_roms()
m_romstotalsize = 0;
/* loop over regions, then over files */
- for (device_t &device : device_iterator(machine().config().root_device()))
+ for (device_t &device : device_enumerator(machine().config().root_device()))
for (region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
for (rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device.system_bios())
@@ -1338,7 +1338,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list
void rom_load_manager::process_region_list()
{
// loop until we hit the end
- device_iterator deviter(machine().root_device());
+ device_enumerator deviter(machine().root_device());
std::vector<std::string> searchpath;
for (device_t &device : deviter)
{
@@ -1436,7 +1436,7 @@ rom_load_manager::rom_load_manager(running_machine &machine)
{
// figure out which BIOS we are using
std::map<std::string, std::string> card_bios;
- for (device_t &device : device_iterator(machine.config().root_device()))
+ for (device_t &device : device_enumerator(machine.config().root_device()))
{
device_slot_interface const *const slot(dynamic_cast<device_slot_interface *>(&device));
if (slot)
diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp
index 410ca6e9b7d..28b98cdb91a 100644
--- a/src/emu/schedule.cpp
+++ b/src/emu/schedule.cpp
@@ -787,7 +787,7 @@ void device_scheduler::rebuild_execute_list()
device_execute_interface **suspend_tailptr = &suspend_list;
// iterate over all devices
- for (device_execute_interface &exec : execute_interface_iterator(machine().root_device()))
+ for (device_execute_interface &exec : execute_interface_enumerator(machine().root_device()))
{
// append to the appropriate list
exec.m_nextexec = nullptr;
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index c265b14e31b..88e0dc00e8c 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -890,7 +890,7 @@ void screen_device::device_start()
if (m_oldstyle_vblank_supplied)
logerror("%s: Deprecated legacy Old Style screen configured (MCFG_SCREEN_VBLANK_TIME), please use MCFG_SCREEN_RAW_PARAMS instead.\n",this->tag());
- m_is_primary_screen = (this == screen_device_iterator(machine().root_device()).first());
+ m_is_primary_screen = (this == screen_device_enumerator(machine().root_device()).first());
}
diff --git a/src/emu/screen.h b/src/emu/screen.h
index cf7ea4b7ede..d3f4ce418b1 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -550,7 +550,7 @@ private:
DECLARE_DEVICE_TYPE(SCREEN, screen_device)
// iterator helper
-typedef device_type_iterator<screen_device> screen_device_iterator;
+typedef device_type_enumerator<screen_device> screen_device_enumerator;
/*!
@defgroup Screen device configuration functions
diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp
index e2842b315b4..a69f6ccab00 100644
--- a/src/emu/softlist_dev.cpp
+++ b/src/emu/softlist_dev.cpp
@@ -189,7 +189,7 @@ void software_list_device::release()
software_list_device *software_list_device::find_by_name(const machine_config &config, const std::string &name)
{
// iterate over each device in the system and find a match
- for (software_list_device &swlistdev : software_list_device_iterator(config.root_device()))
+ for (software_list_device &swlistdev : software_list_device_enumerator(config.root_device()))
if (swlistdev.list_name() == name)
return &swlistdev;
return nullptr;
@@ -205,7 +205,7 @@ software_list_device *software_list_device::find_by_name(const machine_config &c
void software_list_device::display_matches(const machine_config &config, const char *interface, const std::string &name)
{
// check if there is at least one software list
- software_list_device_iterator deviter(config.root_device());
+ software_list_device_enumerator deviter(config.root_device());
if (deviter.first() != nullptr)
osd_printf_error("\n\"%s\" approximately matches the following\n"
"supported software items (best match first):\n\n", name.c_str());
@@ -361,7 +361,7 @@ device_image_interface *software_list_device::find_mountable_image(const machine
if (mount != nullptr && strcmp(mount, "no") == 0)
return nullptr;
- for (device_image_interface &image : image_interface_iterator(mconfig.root_device()))
+ for (device_image_interface &image : image_interface_enumerator(mconfig.root_device()))
{
const char *interface = image.image_interface();
if (interface != nullptr && part.matches_interface(interface) && filter(image))
diff --git a/src/emu/softlist_dev.h b/src/emu/softlist_dev.h
index f3d222d65d5..d6f7f078553 100644
--- a/src/emu/softlist_dev.h
+++ b/src/emu/softlist_dev.h
@@ -163,7 +163,7 @@ private:
DECLARE_DEVICE_TYPE(SOFTWARE_LIST, software_list_device)
// device type iterator
-typedef device_type_iterator<software_list_device> software_list_device_iterator;
+typedef device_type_enumerator<software_list_device> software_list_device_enumerator;
#endif // MAME_EMU_SOFTLIST_DEV_H
diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp
index 139e6339089..95bc85bc4ae 100644
--- a/src/emu/sound.cpp
+++ b/src/emu/sound.cpp
@@ -1102,7 +1102,7 @@ sound_manager::sound_manager(running_machine &machine) :
// count the mixers
#if VERBOSE
- mixer_interface_iterator iter(machine.root_device());
+ mixer_interface_enumerator iter(machine.root_device());
VPRINTF(("total mixers = %d\n", iter.count()));
#endif
@@ -1199,7 +1199,7 @@ void sound_manager::set_attenuation(float attenuation)
bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const
{
// scan through the mixers until we find the indexed input
- for (device_mixer_interface &mixer : mixer_interface_iterator(machine().root_device()))
+ for (device_mixer_interface &mixer : mixer_interface_enumerator(machine().root_device()))
{
if (index < mixer.inputs())
{
@@ -1270,7 +1270,7 @@ void sound_manager::recursive_remove_stream_from_orphan_list(sound_stream *which
void sound_manager::apply_sample_rate_changes()
{
// update sample rates if they have changed
- for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
{
int stream_out;
sound_stream *stream = speaker.output_to_stream_output(0, stream_out);
@@ -1292,7 +1292,7 @@ void sound_manager::apply_sample_rate_changes()
void sound_manager::reset()
{
// reset all the sound chips
- for (device_sound_interface &sound : sound_interface_iterator(machine().root_device()))
+ for (device_sound_interface &sound : sound_interface_enumerator(machine().root_device()))
sound.device().reset();
// apply any sample rate changes now
@@ -1308,7 +1308,7 @@ void sound_manager::reset()
m_orphan_stream_list[stream.get()] = 0;
// then walk the graph like we do on update and remove any we touch
- for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
{
int dummy;
sound_stream *output = speaker.output_to_stream_output(0, dummy);
@@ -1318,7 +1318,7 @@ void sound_manager::reset()
#if (SOUND_DEBUG)
// dump the sound graph when we start up
- for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
{
int index;
sound_stream *output = speaker.output_to_stream_output(0, index);
@@ -1487,7 +1487,7 @@ void sound_manager::update(void *ptr, int param)
std::fill_n(&m_rightmix[0], m_samples_this_update, 0);
// force all the speaker streams to generate the proper number of samples
- for (speaker_device &speaker : speaker_device_iterator(machine().root_device()))
+ for (speaker_device &speaker : speaker_device_enumerator(machine().root_device()))
speaker.mix(&m_leftmix[0], &m_rightmix[0], m_last_update, endtime, m_samples_this_update, (m_muted & MUTE_REASON_SYSTEM));
// determine the maximum in this section
diff --git a/src/emu/speaker.h b/src/emu/speaker.h
index fd20c4b94b8..54aa00603c9 100644
--- a/src/emu/speaker.h
+++ b/src/emu/speaker.h
@@ -90,7 +90,7 @@ protected:
// speaker device iterator
-using speaker_device_iterator = device_type_iterator<speaker_device>;
+using speaker_device_enumerator = device_type_enumerator<speaker_device>;
#endif // MAME_EMU_SPEAKER_H
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp
index c8b5b52892c..c7363cf7b7a 100644
--- a/src/emu/validity.cpp
+++ b/src/emu/validity.cpp
@@ -1539,7 +1539,7 @@ void validity_checker::validate_driver(device_t &root)
device_t::feature_type const imperfect(m_current_driver->type.imperfect_features());
if (!(m_current_driver->flags & (machine_flags::IS_BIOS_ROOT | machine_flags::NO_SOUND_HW)) && !(unemulated & device_t::feature::SOUND))
{
- sound_interface_iterator iter(root);
+ sound_interface_enumerator iter(root);
if (!iter.first())
osd_printf_error("Driver is missing MACHINE_NO_SOUND or MACHINE_NO_SOUND_HW flag\n");
}
@@ -1563,7 +1563,7 @@ void validity_checker::validate_driver(device_t &root)
void validity_checker::validate_roms(device_t &root)
{
// iterate, starting with the driver's ROMs and continuing with device ROMs
- for (device_t &device : device_iterator(root))
+ for (device_t &device : device_enumerator(root))
{
// track the current device
m_current_device = &device;
@@ -1869,7 +1869,7 @@ void validity_checker::validate_condition(ioport_condition &condition, device_t
void validity_checker::validate_inputs(device_t &root)
{
// iterate over devices
- for (device_t &device : device_iterator(root))
+ for (device_t &device : device_enumerator(root))
{
// see if this device has ports; if not continue
if (device.input_ports() == nullptr)
@@ -2011,7 +2011,7 @@ void validity_checker::validate_devices(machine_config &config)
{
std::unordered_set<std::string> device_map;
- for (device_t &device : device_iterator(config.root_device()))
+ for (device_t &device : device_enumerator(config.root_device()))
{
// track the current device
m_current_device = &device;
@@ -2057,7 +2057,7 @@ void validity_checker::validate_devices(machine_config &config)
additions(card);
}
- for (device_slot_interface &subslot : slot_interface_iterator(*card))
+ for (device_slot_interface &subslot : slot_interface_enumerator(*card))
{
if (subslot.fixed())
{
@@ -2077,11 +2077,11 @@ void validity_checker::validate_devices(machine_config &config)
}
}
- for (device_t &card_dev : device_iterator(*card))
+ for (device_t &card_dev : device_enumerator(*card))
card_dev.config_complete();
validate_roms(*card);
- for (device_t &card_dev : device_iterator(*card))
+ for (device_t &card_dev : device_enumerator(*card))
{
m_current_device = &card_dev;
card_dev.findit(this);
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index 56d60ba1661..26b7fe1d2c2 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -115,7 +115,7 @@ video_manager::video_manager(running_machine &machine)
// extract initial execution state from global configuration settings
update_refresh_speed();
- const unsigned screen_count(screen_device_iterator(machine.root_device()).count());
+ const unsigned screen_count(screen_device_enumerator(machine.root_device()).count());
const bool no_screens(!screen_count);
// create a render target for snapshots
@@ -263,7 +263,7 @@ void video_manager::frame_update(bool from_debugger)
if (phase == machine_phase::RUNNING)
{
// reset partial updates if we're paused or if the debugger is active
- screen_device *const screen = screen_device_iterator(machine().root_device()).first();
+ screen_device *const screen = screen_device_enumerator(machine().root_device()).first();
bool const debugger_enabled = machine().debug_flags & DEBUG_FLAG_ENABLED;
bool const within_instruction_hook = debugger_enabled && machine().debugger().within_instruction_hook();
if (screen && ((machine().paused() && machine().options().update_in_pause()) || from_debugger || within_instruction_hook))
@@ -304,7 +304,7 @@ std::string video_manager::speed_text()
// display the number of partial updates as well
int partials = 0;
- for (screen_device &screen : screen_device_iterator(machine().root_device()))
+ for (screen_device &screen : screen_device_enumerator(machine().root_device()))
partials += screen.partial_updates();
if (partials > 1)
util::stream_format(str, "\n%d partial updates", partials);
@@ -353,7 +353,7 @@ void video_manager::save_active_screen_snapshots()
if (m_snap_native)
{
// write one snapshot per visible screen
- for (screen_device &screen : screen_device_iterator(machine().root_device()))
+ for (screen_device &screen : screen_device_enumerator(machine().root_device()))
if (machine().render().is_live(screen))
{
emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
@@ -455,8 +455,8 @@ void video_manager::begin_recording_screen(const std::string &filename, uint32_t
void video_manager::begin_recording(const char *name, movie_recording::format format)
{
// create a snapshot bitmap so we know what the target size is
- screen_device_iterator iterator = screen_device_iterator(machine().root_device());
- screen_device_iterator::auto_iterator iter = iterator.begin();
+ screen_device_enumerator iterator(machine().root_device());
+ screen_device_enumerator::iterator iter(iterator.begin());
uint32_t count = (uint32_t)iterator.count();
const bool no_screens(!count);
@@ -637,7 +637,7 @@ inline int video_manager::original_speed_setting() const
bool video_manager::finish_screen_updates()
{
// finish updating the screens
- screen_device_iterator iter(machine().root_device());
+ screen_device_enumerator iter(machine().root_device());
bool has_live_screen = false;
for (screen_device &screen : iter)
@@ -953,7 +953,7 @@ void video_manager::update_refresh_speed()
// find the screen with the shortest frame period (max refresh rate)
// note that we first check the token since this can get called before all screens are created
attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND;
- for (screen_device &screen : screen_device_iterator(machine().root_device()))
+ for (screen_device &screen : screen_device_enumerator(machine().root_device()))
{
attoseconds_t period = screen.frame_period().attoseconds();
if (period != 0)
@@ -1056,7 +1056,7 @@ void video_manager::create_snapshot_bitmap(screen_device *screen)
// select the appropriate view in our dummy target
if (m_snap_native && screen != nullptr)
{
- screen_device_iterator iter(machine().root_device());
+ screen_device_enumerator iter(machine().root_device());
int view_index = iter.indexof(*screen);
assert(view_index != -1);
m_snap_target->set_view(view_index);
@@ -1175,7 +1175,7 @@ osd_file::error video_manager::open_next(emu_file &file, const char *extension,
//printf("check template: %s\n", snapdevname.c_str());
// verify that there is such a device for this system
- for (device_image_interface &image : image_interface_iterator(machine().root_device()))
+ for (device_image_interface &image : image_interface_enumerator(machine().root_device()))
{
// get the device name
std::string tempdevname(image.brief_instance_name());