void ui_menu_file_manager::populate() { std::string buffer, tmp_inst, tmp_name; bool first_entry = true; std::string prev_owner; if (!m_warnings.empty()) { item_append(m_warnings.c_str(), NULL, MENU_FLAG_DISABLE, NULL); item_append("", NULL, MENU_FLAG_DISABLE, NULL); } // cycle through all devices for this system device_iterator iter(machine().root_device()); tagmap_t<UINT8> devtags; for (device_t *dev = iter.first(); dev != NULL; dev = iter.next()) { bool tag_appended = false; if (devtags.add(dev->tag(), 1, FALSE) == TMERR_DUPLICATE) continue; // check whether it owns an image interface image_interface_iterator subiter(*dev); if (subiter.count() > 0) { // if so, cycle through all its image interfaces image_interface_iterator subiter(*dev); for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next()) { // if it is a children device, and not something further down the device tree, we want it in the menu! if (strcmp(scan->device().owner()->tag(), dev->tag()) == 0) if (devtags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE) { // check whether we already had some devices with the same owner: if not, output the owner tag! if (!tag_appended) { if (first_entry) first_entry = false; else item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); strprintf(buffer, "[root%s]", dev->tag()); item_append(buffer.c_str(), NULL, 0, NULL); tag_appended = true; } // finally, append the image interface to the menu fill_image_line(scan, tmp_inst, tmp_name); item_append(tmp_inst.c_str(), tmp_name.c_str(), 0, (void *)scan); } } } } item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Reset", NULL, 0, (void *)1); custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
void menu_file_manager::populate(float &customtop, float &custombottom) { std::string tmp_inst, tmp_name; bool first_entry = true; if (!m_warnings.empty()) { item_append(m_warnings, "", FLAG_DISABLE, nullptr); item_append("", "", FLAG_DISABLE, nullptr); } // cycle through all devices for this system std::unordered_set<std::string> devtags; for (device_t &dev : device_iterator(machine().root_device())) { bool tag_appended = false; if (!devtags.insert(dev.tag()).second) continue; // check whether it owns an image interface image_interface_iterator subiter(dev); if (subiter.first() != nullptr) { // if so, cycle through all its image interfaces for (device_image_interface &scan : subiter) { if (!scan.user_loadable()) continue; // if it is a children device, and not something further down the device tree, we want it in the menu! if (strcmp(scan.device().owner()->tag(), dev.tag()) == 0) if (devtags.insert(scan.device().tag()).second) { // check whether we already had some devices with the same owner: if not, output the owner tag! if (!tag_appended) { if (first_entry) first_entry = false; else item_append(menu_item_type::SEPARATOR); item_append(string_format("[root%s]", dev.tag()), "", 0, nullptr); tag_appended = true; } // finally, append the image interface to the menu fill_image_line(&scan, tmp_inst, tmp_name); item_append(tmp_inst, tmp_name, 0, (void *)&scan); } } } } item_append(menu_item_type::SEPARATOR); item_append("Reset", "", 0, (void *)1); custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; }
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()); } } } }
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); } } } }
void c64_bn1541_device::device_start() { device_iterator iter(machine().root_device()); for (device_t *device = iter.first(); device != NULL; device = iter.next()) { device_iterator subiter(*device); for (device_t *subdevice = subiter.first(); subdevice != NULL; subdevice = iter.next()) { if (subdevice->interface(m_other) && subdevice != this) { if (LOG) logerror("Parallel device %s\n", subdevice->tag()); // grab the first 1541/1571 and run to the hills m_other->m_other = this; return; } } } }