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); } }
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); } }
void image_manager::config_save(config_type cfg_type, xml_data_node *parentnode) { xml_data_node *node; const char *dev_instance; /* only care about game-specific data */ if (cfg_type == config_type::CONFIG_TYPE_GAME) { for (device_image_interface &image : image_interface_iterator(machine().root_device())) { dev_instance = image.instance_name(); node = xml_add_child(parentnode, "device", nullptr); if (node != nullptr) { xml_set_attribute(node, "instance", dev_instance); xml_set_attribute(node, "directory", image.working_directory()); } } } }
static void image_dirs_save(running_machine &machine, int config_type, xml_data_node *parentnode) { xml_data_node *node; const char *dev_instance; device_image_interface *image = NULL; /* only care about game-specific data */ if (config_type == CONFIG_TYPE_GAME) { for (bool gotone = machine.devicelist().first(image); gotone; gotone = image->next(image)) { dev_instance = image->instance_name(); node = xml_add_child(parentnode, "device", NULL); if (node != NULL) { xml_set_attribute(node, "instance", dev_instance); xml_set_attribute(node, "directory", image->working_directory()); } } } }
xml_element *Floor::xml(xml_document *document) { // new on 011102 xml_element *floor_element = create_xml_element(xml_tag(),document); if (previous_mouse != NULL && tt_dumping_background != NULL) { // new on 131202 previous_mouse->add_xml(floor_element,L"PreviousMouse",document); }; // folllowing new on 070103 - checked through all state variables if (body_cubby != NULL) { body_cubby->add_xml(floor_element,L"MainBox",document); if (room != NULL) { // only needed if in thought bubble xml_append_child(room->xml_path(document),floor_element); }; }; if (alternative_body_cubbies != NULL) { // new on 151204 xml_element *alternative_body_cubbies_element = create_xml_element(L"AlternativesForMyBox",document); alternative_body_cubbies->add_xml(alternative_body_cubbies_element,document); xml_append_child(alternative_body_cubbies_element,floor_element); // new on 161204 }; if (initial_robot != NULL) { initial_robot->add_xml(floor_element,L"InitialRobot",document); }; if (toolbox_status != TOOLBOX_CACHE_STATUS_UNINITIALIZED) { xml_set_attribute(floor_element,L"ToolBoxStatusCode",(int) toolbox_status); }; if (items != NULL) { // moved here so these don't generate include files if the above refers to them (or their parts) xml_element *on_floor_element = create_xml_element(L"OnFloor",document); xml_set_attribute(on_floor_element,L"Z",current_priority); // only need this if there are some items on the floor #if TT_DEBUG_ON if (tt_debug_mode == 160703) { tt_error_file() << "About to dump floor items." << endl; }; #endif items->add_xml(on_floor_element,document,NULL,TRUE); xml_append_child(on_floor_element,floor_element); // moved here on 190804 #if TT_DEBUG_ON if (tt_debug_mode == 160703) { tt_error_file() << "Done dumping floor items." << endl; }; #endif // following not needed as of 160703 so restored above // new on 120703 so that mice who might cause others to not dump as an include file are processed first // what about running robots?? -- ok since tt_running_robots is processed first - right? // items->add_xml(on_floor_element,document,NULL,TRUE,FALSE,first_to_be_dumped); //items->add_xml(on_floor_element,document,NULL,TRUE,FALSE,not_first_to_be_dumped); }; xml_set_attribute(floor_element,L"FloorID",floor_id); if (at_left_wall) { xml_set_attribute(floor_element,L"AtLeftWall",1); }; if (at_right_wall) { xml_set_attribute(floor_element,L"AtRightWall",1); }; if (at_front_wall) { xml_set_attribute(floor_element,L"AtFrontWall",1); }; // add_xml(floor_element,document); // new on 090404 -- this wasn't needed since all this containment stuff is now computed from sit_llx etc on load return(floor_element); };
void laserdisc_device::config_save(config_type cfg_type, xml_data_node *parentnode) { // we only care about game files if (cfg_type != config_type::CONFIG_TYPE_GAME) return; // create a node xml_data_node *ldnode = xml_add_child(parentnode, "device", nullptr); if (ldnode != nullptr) { // output the basics xml_set_attribute(ldnode, "tag", tag().c_str()); // add an overlay node xml_data_node *overnode = xml_add_child(ldnode, "overlay", nullptr); bool changed = false; if (overnode != nullptr) { // output the positioning controls if (m_overposx != m_orig_config.m_overposx) { xml_set_attribute_float(overnode, "hoffset", m_overposx); changed = true; } if (m_overscalex != m_orig_config.m_overscalex) { xml_set_attribute_float(overnode, "hstretch", m_overscalex); changed = true; } if (m_overposy != m_orig_config.m_overposy) { xml_set_attribute_float(overnode, "voffset", m_overposy); changed = true; } if (m_overscaley != m_orig_config.m_overscaley) { xml_set_attribute_float(overnode, "vstretch", m_overscaley); changed = true; } } // if nothing changed, kill the node if (!changed) xml_delete_node(ldnode); } }
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; }
xml_element *Room::xml(xml_document *document) { // new on 011102 xml_element *room_element = create_xml_element(L"Room",document); if (wall_decoration != NULL) { xml_element *decoration_element = create_xml_element(L"OnWall",document); wall_decoration->xml_create_and_append_element(decoration_element,document)->Release(); xml_append_child(decoration_element,room_element); // moved here on 190804 // don't need to restore this since it'll be dumped here but not as an item below wall_decoration->set_ok_to_dump(FALSE); // so not dumped as an item as well // i.e. not when items are dumped below - note this really means don't dump if part of a list - will still be dumped as decoration from here }; if (items != NULL && !(items->rest() == NULL && !items->first()->ok_to_dump())) { xml_element *inside_element = create_xml_element(L"Inside",document); items->add_xml(inside_element,document,NULL,TRUE); xml_append_child(inside_element,room_element); // moved here on 190804 }; if (explosion_time != 0) { // new on 030204 xml_set_attribute(room_element,L"ExplosionTime",explosion_time); }; return(room_element); };
xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) { char buffer[100]; sprintf(buffer, "%f", value); return xml_set_attribute(node, name, buffer); }
/* * Get the mime header (soap) container */ MIME *ebxml_getsoap (XML *xml, QUEUEROW *r) { XML *soap; MIME *msg; char *ch, *pid, *partyid, *cpa, *organization, path[MAX_PATH], buf[MAX_PATH]; int route; debug ("getting soap container...\n"); organization = cfg_org (xml); pid = queue_field_get (r, "MESSAGEID"); if (pid != NULL) pid = strchr (pid, '-'); if (pid++ == NULL) { error ("Can't get PID from MESSAGEID\n"); return (NULL); } if ((route = cfg_route_index (xml, queue_field_get (r, "ROUTEINFO"))) < 0) return (NULL); debug ("getting soap template for pid=%s org=%s...\n", pid, organization); if ((soap = ebxml_template (xml, XSOAP)) == NULL) { error ("Can't get SOAP template\n"); return (NULL); } xml_set_text (soap, SOAPFROMPARTY, cfg_party (xml)); partyid = "Someone_else"; xml_set_text (soap, SOAPTOPARTY, partyid); cpa = cfg_route (xml, route, "Cpa"); xml_set_text (soap, SOAPCPAID, cpa); xml_set_text (soap, SOAPCONVERSEID, pid); xml_set_text (soap, SOAPSERVICE, queue_field_get (r, "SERVICE")); xml_set_text (soap, SOAPACTION, queue_field_get (r, "ACTION")); sprintf (buf, "%ld@%s", pid, organization); xml_set_text (soap, SOAPMESSAGEID, buf); queue_field_set (r, "MESSAGECREATIONTIME", ptime (NULL, buf)); xml_set_text (soap, SOAPDATATIME, buf); if (!strcmp (queue_field_get (r, "ACTION"), "Ping")) { xml_delete (soap, SOAPBODY); } else { sprintf (buf, "cid:%s@%s", queue_field_get (r, "PAYLOADFILE"), organization); debug ("set %s xlink:href=\"%s\"\n", SOAPMREF, buf); xml_set_attribute (soap, SOAPMREF, "xlink:href", buf); sprintf (buf, "%s.%s", r->queue->name, queue_field_get (r, "RECORDID")); xml_set_text (soap, SOAPDBRECID, buf); xml_set_text (soap, SOAPDBMESSID, queue_field_get (r, "MESSAGEID")); xml_set_text (soap, SOAPDBARGS, queue_field_get (r, "ARGUMENTS")); xml_set_text (soap, SOAPDBRECP, queue_field_get (r, "MESSAGERECIPIENT")); } debug ("building soap mime container...\n"); msg = mime_alloc (); mime_setHeader (msg, MIME_CONTENT, MIME_XML, 99); sprintf (buf, "<%s%s>", "ebxml-envelope@", organization); mime_setHeader (msg, MIME_CONTENTID, buf, 0); debug ("formatting soap xml...\n"); ch = xml_format (soap); debug ("soap envelope:\n%s\n", ch); xml_free (soap); mime_setBody (msg, ch, strlen (ch)); free (ch); debug ("returning soap message...\n"); return (msg); }
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()); }
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; }
void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const { WindowQtConfig::addToXmlDataNode(node); xml_set_attribute(node, "device-tag", m_device_tag); }