示例#1
0
static void counters_save(running_machine &machine, int config_type, xml_data_node *parentnode)
{
    generic_machine_private *state = machine.generic_machine_data;
    int i;

    /* only care about game-specific data */
    if (config_type != CONFIG_TYPE_GAME)
        return;

    /* iterate over coin counters */
    for (i = 0; i < COIN_COUNTERS; i++)
        if (state->coin_count[i] != 0)
        {
            xml_data_node *coinnode = xml_add_child(parentnode, "coins", NULL);
            if (coinnode != NULL)
            {
                xml_set_attribute_int(coinnode, "index", i);
                xml_set_attribute_int(coinnode, "number", state->coin_count[i]);
            }
        }

    /* output tickets */
    if (state->dispensed_tickets != 0)
    {
        xml_data_node *tickets = xml_add_child(parentnode, "tickets", NULL);
        if (tickets != NULL)
            xml_set_attribute_int(tickets, "number", state->dispensed_tickets);
    }
}
示例#2
0
文件: debugwin.c 项目: Ilgrim/MAMEHub
static void configuration_save(running_machine &machine, int config_type, xml_data_node *parentnode)
{
	/* we only care about game files */
	if (config_type != CONFIG_TYPE_GAME)
		return;

	// Loop over all the nodes
	for(win_i *p = win_list; p != NULL; p = p->next)
	{
		/* create a node */
		xml_data_node *debugger_node;
		debugger_node = xml_add_child(parentnode, "window", NULL);

		xml_set_attribute_int(debugger_node, "type", p->type);

		if (debugger_node != NULL)
		{
			int x, y;
			gtk_window_get_position(GTK_WINDOW(p->win), &x, &y);
			xml_set_attribute_int(debugger_node, "position_x", x);
			xml_set_attribute_int(debugger_node, "position_y", y);

			gtk_window_get_size(GTK_WINDOW(p->win), &x, &y);
			xml_set_attribute_int(debugger_node, "size_x", x);
			xml_set_attribute_int(debugger_node, "size_y", y);
		}
	}
}
示例#3
0
void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
{
	WindowQtConfig::addToXmlDataNode(node);
	xml_set_attribute_int(node, "memoryregion", m_memoryRegion);
	xml_set_attribute_int(node, "reverse", m_reverse);
	xml_set_attribute_int(node, "addressmode", m_addressMode);
	xml_set_attribute_int(node, "dataformat", m_dataFormat);
}
示例#4
0
void WindowQtConfig::addToXmlDataNode(xml_data_node* node) const
{
	xml_set_attribute_int(node, "type", m_type);
	xml_set_attribute_int(node, "position_x", m_position.x());
	xml_set_attribute_int(node, "position_y", m_position.y());
	xml_set_attribute_int(node, "size_x", m_size.x());
	xml_set_attribute_int(node, "size_y", m_size.y());
}
示例#5
0
void crosshair_manager::config_save(config_type cfg_type, xml_data_node *parentnode)
{
    /* Note: crosshair_save() is only registered if crosshairs are used */

    xml_data_node *crosshairnode;
    int player;

    /* we only care about game files */
    if (cfg_type != config_type::CONFIG_TYPE_GAME)
        return;

    for (player = 0; player < MAX_PLAYERS; player++)
    {
        const render_crosshair &crosshair = *m_crosshair[player];

        if (crosshair.is_used())
        {
            /* create a node */
            crosshairnode = xml_add_child(parentnode, "crosshair", nullptr);

            if (crosshairnode != nullptr)
            {
                bool changed = false;

                xml_set_attribute_int(crosshairnode, "player", player);

                if (crosshair.mode() != CROSSHAIR_VISIBILITY_DEFAULT)
                {
                    xml_set_attribute_int(crosshairnode, "mode", crosshair.mode());
                    changed = true;
                }

                // only save graphic name if not the default
                if (*crosshair.bitmap_name() != '\0')
                {
                    xml_set_attribute(crosshairnode, "pic", crosshair.bitmap_name());
                    changed = true;
                }

                /* if nothing changed, kill the node */
                if (!changed)
                    xml_delete_node(crosshairnode);
            }
        }
    }

    /* always store autotime so that it stays at the user value if it is needed */
    if (m_auto_time != CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
    {
        /* create a node */
        crosshairnode = xml_add_child(parentnode, "autotime", nullptr);

        if (crosshairnode != nullptr)
            xml_set_attribute_int(crosshairnode, "val", m_auto_time);
    }

}
示例#6
0
static void crosshair_save(running_machine &machine, int config_type, xml_data_node *parentnode)
{
	/* Note: crosshair_save() is only registered if crosshairs are used */

	xml_data_node *crosshairnode;
	int player;

	/* we only care about game files */
	if (config_type != CONFIG_TYPE_GAME)
		return;

	for (player = 0; player < MAX_PLAYERS; player++)
	{
		if (global.used[player])
		{
			/* create a node */
			crosshairnode = xml_add_child(parentnode, "crosshair", NULL);

			if (crosshairnode != NULL)
			{
				int changed = FALSE;

				xml_set_attribute_int(crosshairnode, "player", player);

				if (global.visible[player] != CROSSHAIR_VISIBILITY_DEFAULT)
				{
					xml_set_attribute_int(crosshairnode, "mode", global.mode[player]);
					changed = TRUE;
				}

				/* the default graphic name is "", so only save if not */
				if (*(global.name[player]) != 0)
				{
					xml_set_attribute(crosshairnode, "pic", global.name[player]);
					changed = TRUE;
				}

				/* if nothing changed, kill the node */
				if (!changed)
					xml_delete_node(crosshairnode);
			}
		}
	}

	/* always store autotime so that it stays at the user value if it is needed */
	if (global.auto_time != CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT)
	{
		/* create a node */
		crosshairnode = xml_add_child(parentnode, "autotime", NULL);

		if (crosshairnode != NULL)
			xml_set_attribute_int(crosshairnode, "val", global.auto_time);
	}

}
示例#7
0
static void sound_save(int config_type, xml_data_node *parentnode)
{
	int mixernum;

	/* we only care about game files */
	if (config_type != CONFIG_TYPE_GAME)
		return;

	/* iterate over mixer channels */
	if (parentnode != NULL)
		for (mixernum = 0; mixernum < MAX_MIXER_CHANNELS; mixernum++)
		{
			float defvol = sound_get_default_gain(mixernum);
			float newvol = sound_get_user_gain(mixernum);

			if (defvol != newvol)
			{
				xml_data_node *channelnode = xml_add_child(parentnode, "channel", NULL);
				if (channelnode != NULL)
				{
					xml_set_attribute_int(channelnode, "index", mixernum);
					xml_set_attribute_float(channelnode, "defvol", defvol);
					xml_set_attribute_float(channelnode, "newvol", newvol);
				}
			}
		}
}
示例#8
0
文件: config.c 项目: crazii/mameplus
static int config_save_xml(running_machine &machine, emu_file &file, int which_type)
{
	xml_data_node *root = xml_file_create();
	xml_data_node *confignode, *systemnode;
	config_type *type;

	/* if we don't have a root, bail */
	if (!root)
		return 0;

	/* create a config node */
	confignode = xml_add_child(root, "mameconfig", NULL);
	if (!confignode)
		goto error;
	xml_set_attribute_int(confignode, "version", CONFIG_VERSION);

	/* create a system node */
	systemnode = xml_add_child(confignode, "system", NULL);
	if (!systemnode)
		goto error;
	xml_set_attribute(systemnode, "name", (which_type == CONFIG_TYPE_DEFAULT) ? "default" : machine.system().name);

	/* create the input node and write it out */
	/* loop over all registrants and call their save function */
	for (type = typelist; type; type = type->next)
	{
		xml_data_node *curnode = xml_add_child(systemnode, type->name, NULL);
		if (!curnode)
			goto error;
		type->save(which_type, curnode);

		/* if nothing was added, just nuke the node */
		if (!curnode->value && !curnode->child)
			xml_delete_node(curnode);
	}

	/* flush the file */
	xml_file_write(root, file);

	/* free and get out of here */
	xml_file_free(root);
	return 1;

error:
	xml_file_free(root);
	return 0;
}
示例#9
0
void MainWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
{
	WindowQtConfig::addToXmlDataNode(node);
	xml_set_attribute_int(node, "rightbar", m_rightBar);
	xml_set_attribute(node, "qtwindowstate", m_windowState.toPercentEncoding().data());
}
示例#10
0
int debug_comment_save(void)
{
	int i, j;
	char crc_buf[20];
	xml_data_node *root = xml_file_create();
	xml_data_node *commentnode, *systemnode;
	int total_comments = 0;

	/* if we don't have a root, bail */
	if (!root)
		return 0;

	/* create a comment node */
	commentnode = xml_add_child(root, "mamecommentfile", NULL);
	if (!commentnode)
		goto error;
	xml_set_attribute_int(commentnode, "version", COMMENT_VERSION);

	/* create a system node */
	systemnode = xml_add_child(commentnode, "system", NULL);
	if (!systemnode)
		goto error;
	xml_set_attribute(systemnode, "name", Machine->gamedrv->name);

	/* for each cpu */
	for (i = 0; i < cpu_gettotalcpu(); i++)
	{
		xml_data_node *curnode = xml_add_child(systemnode, "cpu", NULL);
		if (!curnode)
			goto error;
		xml_set_attribute_int(curnode, "num", i);

		for (j = 0; j < debug_comments[i].comment_count; j++)
		{
			xml_data_node *datanode = xml_add_child(curnode, "comment", debug_comments[i].comment_info[j]->text);
			if (!datanode)
				goto error;
			xml_set_attribute_int(datanode, "address", debug_comments[i].comment_info[j]->address);
			xml_set_attribute_int(datanode, "color", debug_comments[i].comment_info[j]->color);
			sprintf(crc_buf, "%08X", debug_comments[i].comment_info[j]->crc);
			xml_set_attribute(datanode, "crc", crc_buf);
			total_comments++;
		}
	}

	/* flush the file */
	if (total_comments > 0)
	{
 		mame_file *fp = mame_fopen(Machine->gamedrv->name, 0, FILETYPE_COMMENT, 1);
 		xml_file_write(root, fp);
		mame_fclose(fp);
	}

	/* free and get out of here */
	xml_file_free(root);
	return 1;

error:
	xml_file_free(root);
	return 0;
}
示例#11
0
void BreakpointsWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
{
	WindowQtConfig::addToXmlDataNode(node);
	xml_set_attribute_int(node, "bwtype", m_bwType);
}
示例#12
0
void DasmWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
{
	WindowQtConfig::addToXmlDataNode(node);
	xml_set_attribute_int(node, "cpu", m_cpu);
	xml_set_attribute_int(node, "rightbar", m_rightBar);
}