本文整理汇总了C++中deviter函数的典型用法代码示例。如果您正苦于以下问题:C++ deviter函数的具体用法?C++ deviter怎么用?C++ deviter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deviter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m_machine
rom_load_manager::rom_load_manager(running_machine &machine)
: m_machine(machine)
{
/* figure out which BIOS we are using */
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next()) {
if (device->rom_region()) {
std::string specbios;
if (device->owner() == nullptr) {
specbios.assign(machine.options().bios());
} else {
specbios = machine.options().sub_value(std::string(device->owner()->tag()).c_str()+1,"bios");
if (specbios.empty()) {
specbios = device->default_bios_tag();
}
}
determine_bios_rom(device, specbios.c_str());
}
}
/* count the total number of ROMs */
count_roms();
/* reset the disk list */
m_chd_list.clear();
/* process the ROM entries we were passed */
process_region_list();
/* display the results and exit */
display_rom_load_results(FALSE);
}
示例2: deviter
void software_list_device::display_matches(const machine_config &config, const char *interface, const char *name)
{
// check if there is at least one software list
software_list_device_iterator 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);
// iterate through lists
for (software_list_device &swlistdev : deviter)
{
// get the top 16 approximate matches for the selected device interface (i.e. only carts for cartslot, etc.)
const software_info *matches[16] = { nullptr };
swlistdev.find_approx_matches(name, ARRAY_LENGTH(matches), matches, interface);
// if we found some, print them
if (matches[0] != nullptr)
{
// different output depending on original system or compatible
if (swlistdev.list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
osd_printf_error("* Software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description());
else
osd_printf_error("* Compatible software list \"%s\" (%s) matches: \n", swlistdev.list_name().c_str(), swlistdev.description());
// print them out
for (auto &match : matches)
{
if (match != nullptr)
osd_printf_error("%-18s%s\n", match->shortname().c_str(), match->longname().c_str());
}
osd_printf_error("\n");
}
}
}
示例3: deviter
int cartslot_image_device::process_cartridge(bool load)
{
const rom_entry *romrgn, *roment;
int result = 0;
device_iterator deviter(device().mconfig().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (romrgn = rom_first_region(*device); romrgn != NULL; romrgn = rom_next_region(romrgn))
{
roment = romrgn + 1;
while(!ROMENTRY_ISREGIONEND(roment))
{
if (ROMENTRY_GETTYPE(roment) == ROMENTRYTYPE_CARTRIDGE)
{
astring regiontag;
this->device().siblingtag(regiontag, roment->_hashdata);
if (strcmp(regiontag.cstr(),this->device().tag())==0)
{
result |= load_cartridge(romrgn, roment, load);
/* if loading failed in any cart region, stop loading */
if (result)
return result;
}
}
roment++;
}
}
return IMAGE_INIT_PASS;
}
示例4: process_region_list
static void process_region_list(romload_private *romdata)
{
astring regiontag;
/* loop until we hit the end */
device_iterator deviter(romdata->machine().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
{
UINT32 regionlength = ROMREGION_GETLENGTH(region);
rom_region_name(regiontag, *device, region);
LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength));
/* the first entry must be a region */
assert(ROMENTRY_ISREGION(region));
if (ROMREGION_ISROMDATA(region))
{
/* if this is a device region, override with the device width and endianness */
UINT8 width = ROMREGION_GETWIDTH(region) / 8;
endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE;
if (romdata->machine().device(regiontag) != NULL)
normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
/* remember the base and length */
romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
/* clear the region if it's requested */
if (ROMREGION_ISERASE(region))
memset(romdata->region->base(), ROMREGION_GETERASEVAL(region), romdata->region->bytes());
/* or if it's sufficiently small (<= 4MB) */
else if (romdata->region->bytes() <= 0x400000)
memset(romdata->region->base(), 0, romdata->region->bytes());
#ifdef MAME_DEBUG
/* if we're debugging, fill region with random data to catch errors */
else
fill_random(romdata->machine(), romdata->region->base(), romdata->region->bytes());
#endif
/* now process the entries in the region */
process_rom_entries(romdata, device->shortname(), region, region + 1, device, FALSE);
}
else if (ROMREGION_ISDISKDATA(region))
process_disk_entries(romdata, regiontag, region, region + 1, NULL);
}
/* now go back and post-process all the regions */
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
{
rom_region_name(regiontag, *device, region);
region_post_process(romdata, regiontag, ROMREGION_ISINVERTED(region));
}
}
示例5: while
void info_xml_creator::output_devices()
{
m_drivlist.reset();
slot_map shortnames;
while (m_drivlist.next())
{
// first, run through devices with roms which belongs to the default configuration
device_iterator deviter(m_drivlist.config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
{
if (device->owner() != NULL && device->shortname()!= NULL && strlen(device->shortname())!=0)
{
if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE)
output_one_device(*device, device->tag());
}
}
// then, run through slot devices
slot_interface_iterator iter(m_drivlist.config().root_device());
for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
{
for (const device_slot_option *option = slot->first_option(); option != NULL; option = option->next())
{
std::string temptag("_");
temptag.append(option->name());
device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.c_str(), option->devtype(), 0);
// notify this device and all its subdevices that they are now configured
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != NULL; device = subiter.next())
if (!device->configured())
device->config_complete();
if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE)
output_one_device(*dev, temptag.c_str());
// also, check for subdevices with ROMs (a few devices are missed otherwise, e.g. MPU401)
device_iterator deviter2(*dev);
for (device_t *device = deviter2.first(); device != NULL; device = deviter2.next())
{
if (device->owner() == dev && device->shortname()!= NULL && strlen(device->shortname())!=0)
{
if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE)
output_one_device(*device, device->tag());
}
}
const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.c_str());
}
}
}
}
示例6: deviter
void driver_enumerator::release_current()
{
// skip if no current entry
if (m_current < 0 || m_current >= s_driver_count)
return;
// skip if we haven't cached a config
if (m_config[m_current] == NULL)
return;
// iterate over software lists in this entry and reset
software_list_device_iterator deviter(m_config[m_current]->root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != NULL; swlistdev = deviter.next())
swlistdev->release();
}
示例7: software_name_split
software_part *device_image_interface::find_software_item(const char *path, bool restrict_to_interface) const
{
// split full software name into software list name and short software name
std::string swlist_name, swinfo_name, swpart_name;
software_name_split(path, swlist_name, swinfo_name, swpart_name);
// determine interface
const char *interface = nullptr;
if (restrict_to_interface)
interface = image_interface();
// find the software list if explicitly specified
software_list_device_iterator deviter(device().mconfig().root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != nullptr; swlistdev = deviter.next())
{
if (swlist_name.compare(swlistdev->list_name())==0 || !(swlist_name.length() > 0))
{
software_info *info = swlistdev->find(swinfo_name.c_str());
if (info != nullptr)
{
software_part *part = info->find_part(swpart_name.c_str(), interface);
if (part != nullptr)
return part;
}
}
if (swinfo_name == swlistdev->list_name())
{
// ad hoc handling for the case path = swlist_name:swinfo_name (e.g.
// gameboy:sml) which is not handled properly by software_name_split
// since the function cannot distinguish between this and the case
// path = swinfo_name:swpart_name
software_info *info = swlistdev->find(swpart_name.c_str());
if (info != nullptr)
{
software_part *part = info->find_part(nullptr, interface);
if (part != nullptr)
return part;
}
}
}
// if explicitly specified and not found, just error here
return nullptr;
}
示例8: ui_menu
ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(machine, container)
{
astring tmp_tag;
tmp_tag.cpy(slot->device().tag()).cat(":").cat(option->name());
m_option = option;
m_owner = slot;
m_mounted = false;
device_iterator deviter(machine.config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
{
if (strcmp(device->tag(), tmp_tag.cstr()) == 0)
{
m_mounted = true;
break;
}
}
}
示例9: while
void info_xml_creator::output_devices()
{
m_drivlist.reset();
slot_map shortnames;
while (m_drivlist.next())
{
// first, run through devices with roms which belongs to the default configuration
device_iterator deviter(m_drivlist.config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
{
if (device->owner() != NULL && device->rom_region() != NULL && device->shortname()!= NULL)
{
if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE)
output_one_device(*device, device->tag());
}
}
// then, run through slot devices
slot_interface_iterator iter(m_drivlist.config().root_device());
for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next())
{
const slot_interface* intf = slot->get_slot_interfaces();
for (int i = 0; intf && intf[i].name != NULL; i++)
{
astring temptag("_");
temptag.cat(intf[i].name);
device_t *dev = const_cast<machine_config &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.cstr(), intf[i].devtype, 0);
// notify this device and all its subdevices that they are now configured
device_iterator subiter(*dev);
for (device_t *device = subiter.first(); device != NULL; device = subiter.next())
if (!device->configured())
device->config_complete();
if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE)
output_one_device(*dev, temptag.cstr());
const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.cstr());
global_free(dev);
}
}
}
}
示例10: deviter
void rom_load_manager::count_roms()
{
const rom_entry *region, *rom;
/* start with 0 */
m_romstotal = 0;
m_romstotalsize = 0;
/* loop over regions, then over files */
device_iterator deviter(machine().config().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
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())
{
m_romstotal++;
m_romstotalsize += rom_file_size(rom);
}
}
示例11: rom_init
void rom_init(running_machine &machine)
{
romload_private *romdata;
/* allocate private data */
machine.romload_data = romdata = auto_alloc_clear(machine, romload_private);
/* make sure we get called back on the way out */
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(rom_exit), &machine));
/* reset the romdata struct */
romdata->m_machine = &machine;
/* figure out which BIOS we are using */
device_iterator deviter(romdata->machine().config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) {
if (device->rom_region()) {
const char *specbios;
astring temp;
if (strcmp(device->tag(),":")==0) {
specbios = romdata->machine().options().bios();
} else {
specbios = romdata->machine().options().sub_value(temp,device->owner()->tag()+1,"bios");
if (strlen(specbios) == 0) {
specbios = device->default_bios_tag().cstr();
}
}
determine_bios_rom(romdata, device, specbios);
}
}
/* count the total number of ROMs */
count_roms(romdata);
/* reset the disk list */
romdata->chd_list.reset();
/* process the ROM entries we were passed */
process_region_list(romdata);
/* display the results and exit */
display_rom_load_results(romdata, FALSE);
}
示例12: count_roms
static void count_roms(romload_private *romdata)
{
const rom_entry *region, *rom;
/* start with 0 */
romdata->romstotal = 0;
romdata->romstotalsize = 0;
/* loop over regions, then over files */
device_iterator deviter(romdata->machine().config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios())
{
romdata->romstotal++;
romdata->romstotalsize += rom_file_size(rom);
}
}
示例13: hashes
device_t *media_auditor::find_shared_device(device_t &device, const hash_collection &romhashes, UINT64 romlength)
{
// doesn't apply to NO_DUMP items
if (romhashes.flag(hash_collection::FLAG_NO_DUMP))
return NULL;
// special case for non-root devices
device_t *highest_device = NULL;
if (device.owner() != NULL)
{
for (const rom_entry *region = rom_first_region(device); region != NULL; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if (hashes == romhashes)
highest_device = &device;
}
}
else
{
// iterate up the parent chain
for (int drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex != -1; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent))
{
device_iterator deviter(m_enumerator.config(drvindex).root_device());
for (device_t *scandevice = deviter.first(); scandevice != NULL; scandevice = deviter.next())
for (const rom_entry *region = rom_first_region(*scandevice); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if (hashes == romhashes)
highest_device = scandevice;
}
}
}
return highest_device;
}
示例14: deviter
void ui_menu_bios_selection::populate()
{
/* cycle through all devices for this system */
device_iterator deviter(machine().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
{
if (device->rom_region()) {
const char *val = "default";
for (const rom_entry *rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
{
if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom)==device->system_bios())
{
val = ROM_GETHASHDATA(rom);
}
}
item_append(strcmp(device->tag(),":")==0 ? "driver" : device->tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
}
}
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
item_append(_("Reset"), nullptr, 0, (void *)1);
}
示例15: software_name_split
software_part *device_image_interface::find_software_item(const char *path, bool restrict_to_interface)
{
//
// Note: old code would explicitly load swlist_name if it was specified, rather than
// searching the devices.
//
// Also if not found, old code would attempt to open <drivername>.xml and even
// <swinfo_name>.xml. Hopefully removing this won't break anything.
//
// split full software name into software list name and short software name
astring swlist_name, swinfo_name, swpart_name;
software_name_split(path, swlist_name, swinfo_name, swpart_name);
bool explicit_name = (swlist_name.len() > 0);
// determine interface
const char *interface = NULL;
if (restrict_to_interface)
interface = image_interface();
// find the software list if explicitly specified
software_list_device_iterator deviter(device().mconfig().root_device());
for (software_list_device *swlistdev = deviter.first(); swlistdev != NULL; swlistdev = deviter.next())
if (!explicit_name || swlist_name == swlistdev->list_name())
{
software_info *info = swlistdev->find(swinfo_name);
if (info != NULL)
{
software_part *part = info->find_part(swpart_name, interface);
if (part != NULL)
return part;
}
}
// if explicitly specified and not found, just error here
return NULL;
}