trunk/src/emu/info.c
| r21897 | r21898 | |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | astring output; |
| 557 | |
| 556 | 558 | // opening tag |
| 557 | 559 | if (!is_disk) |
| 558 | | fprintf(m_output, "\t\t<rom"); |
| 560 | output.cat("\t\t<rom"); |
| 559 | 561 | else |
| 560 | | fprintf(m_output, "\t\t<disk"); |
| 562 | output.cat("\t\t<disk"); |
| 561 | 563 | |
| 562 | 564 | // add name, merge, bios, and size tags */ |
| 563 | 565 | if (name != NULL && name[0] != 0) |
| 564 | | fprintf(m_output, " name=\"%s\"", xml_normalize_string(name)); |
| 566 | output.catprintf(" name=\"%s\"", xml_normalize_string(name)); |
| 565 | 567 | if (merge_name != NULL) |
| 566 | | fprintf(m_output, " merge=\"%s\"", xml_normalize_string(merge_name)); |
| 568 | output.catprintf(" merge=\"%s\"", xml_normalize_string(merge_name)); |
| 567 | 569 | if (bios_name[0] != 0) |
| 568 | | fprintf(m_output, " bios=\"%s\"", xml_normalize_string(bios_name)); |
| 570 | output.catprintf(" bios=\"%s\"", xml_normalize_string(bios_name)); |
| 569 | 571 | if (!is_disk) |
| 570 | | fprintf(m_output, " size=\"%d\"", rom_file_size(rom)); |
| 572 | output.catprintf(" size=\"%d\"", rom_file_size(rom)); |
| 571 | 573 | |
| 572 | 574 | // dump checksum information only if there is a known dump |
| 573 | 575 | if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) |
| 574 | 576 | { |
| 575 | 577 | // iterate over hash function types and print m_output their values |
| 576 | 578 | astring tempstr; |
| 577 | | fprintf(m_output, " %s", hashes.attribute_string(tempstr)); |
| 579 | output.catprintf(" %s", hashes.attribute_string(tempstr)); |
| 578 | 580 | } |
| 579 | 581 | else |
| 580 | | fprintf(m_output, " status=\"nodump\""); |
| 582 | output.cat(" status=\"nodump\""); |
| 581 | 583 | |
| 582 | 584 | // append a region name |
| 583 | | fprintf(m_output, " region=\"%s\"", ROMREGION_GETTAG(region)); |
| 585 | output.catprintf(" region=\"%s\"", ROMREGION_GETTAG(region)); |
| 584 | 586 | |
| 585 | 587 | // for non-disk entries, print offset |
| 586 | 588 | if (!is_disk) |
| 587 | | fprintf(m_output, " offset=\"%x\"", offset); |
| 589 | output.catprintf(" offset=\"%x\"", offset); |
| 588 | 590 | |
| 589 | 591 | // for disk entries, add the disk index |
| 590 | 592 | else |
| 591 | 593 | { |
| 592 | | fprintf(m_output, " index=\"%x\"", DISK_GETINDEX(rom)); |
| 593 | | fprintf(m_output, " writable=\"%s\"", DISK_ISREADONLY(rom) ? "no" : "yes"); |
| 594 | output.catprintf(" index=\"%x\"", DISK_GETINDEX(rom)); |
| 595 | output.catprintf(" writable=\"%s\"", DISK_ISREADONLY(rom) ? "no" : "yes"); |
| 594 | 596 | } |
| 595 | 597 | |
| 596 | 598 | // add optional flag |
| 597 | 599 | if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom))) |
| 598 | | fprintf(m_output, " optional=\"yes\""); |
| 600 | output.cat(" optional=\"yes\""); |
| 599 | 601 | |
| 600 | | fprintf(m_output, "/>\n"); |
| 602 | output.cat("/>\n"); |
| 603 | |
| 604 | fprintf(m_output, "%s", output.cstr()); |
| 601 | 605 | } |
| 602 | 606 | } |
| 603 | 607 | } |
| r21897 | r21898 | |
| 1092 | 1096 | for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) |
| 1093 | 1097 | if (field->type() == type) |
| 1094 | 1098 | { |
| 1099 | astring output; |
| 1100 | |
| 1095 | 1101 | astring newtag(port->tag()), oldtag(":"); |
| 1096 | 1102 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); |
| 1097 | 1103 | |
| 1098 | 1104 | // output the switch name information |
| 1099 | | fprintf(m_output, "\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, xml_normalize_string(field->name()), xml_normalize_string(newtag), field->mask()); |
| 1105 | output.catprintf("\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, xml_normalize_string(field->name()), xml_normalize_string(newtag), field->mask()); |
| 1100 | 1106 | |
| 1101 | 1107 | // loop over settings |
| 1102 | 1108 | for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) |
| 1103 | 1109 | { |
| 1104 | | fprintf(m_output, "\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting->name()), setting->value(), setting->value() == field->defvalue() ? " default=\"yes\"" : ""); |
| 1110 | output.catprintf("\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting->name()), setting->value(), setting->value() == field->defvalue() ? " default=\"yes\"" : ""); |
| 1105 | 1111 | } |
| 1106 | 1112 | |
| 1107 | 1113 | // terminate the switch entry |
| 1108 | | fprintf(m_output, "\t\t</%s>\n", outertag); |
| 1114 | output.catprintf("\t\t</%s>\n", outertag); |
| 1115 | |
| 1116 | fprintf(m_output, "%s", output.cstr()); |
| 1109 | 1117 | } |
| 1110 | 1118 | } |
| 1111 | 1119 | |