コード例 #1
0
ファイル: filemngr.c プロジェクト: curtiszimmerman/mame
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;
}
コード例 #2
0
ファイル: filemngr.cpp プロジェクト: Robbbert/store1
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;
}