Previous 199869 Revisions Next

r21898 Saturday 16th March, 2013 at 22:19:16 UTC by Oliver Stöneberg
optimized -listxml a bit more (nw)
[src/emu]info.c

trunk/src/emu/info.c
r21897r21898
553553                  }
554554            }
555555
556            astring output;
557
556558            // opening tag
557559            if (!is_disk)
558               fprintf(m_output, "\t\t<rom");
560               output.cat("\t\t<rom");
559561            else
560               fprintf(m_output, "\t\t<disk");
562               output.cat("\t\t<disk");
561563
562564            // add name, merge, bios, and size tags */
563565            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));
565567            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));
567569            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));
569571            if (!is_disk)
570               fprintf(m_output, " size=\"%d\"", rom_file_size(rom));
572               output.catprintf(" size=\"%d\"", rom_file_size(rom));
571573
572574            // dump checksum information only if there is a known dump
573575            if (!hashes.flag(hash_collection::FLAG_NO_DUMP))
574576            {
575577               // iterate over hash function types and print m_output their values
576578               astring tempstr;
577               fprintf(m_output, " %s", hashes.attribute_string(tempstr));
579               output.catprintf(" %s", hashes.attribute_string(tempstr));
578580            }
579581            else
580               fprintf(m_output, " status=\"nodump\"");
582               output.cat(" status=\"nodump\"");
581583
582584            // append a region name
583            fprintf(m_output, " region=\"%s\"", ROMREGION_GETTAG(region));
585            output.catprintf(" region=\"%s\"", ROMREGION_GETTAG(region));
584586
585587            // for non-disk entries, print offset
586588            if (!is_disk)
587               fprintf(m_output, " offset=\"%x\"", offset);
589               output.catprintf(" offset=\"%x\"", offset);
588590
589591            // for disk entries, add the disk index
590592            else
591593            {
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");
594596            }
595597
596598            // add optional flag
597599            if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom)))
598               fprintf(m_output, " optional=\"yes\"");
600               output.cat(" optional=\"yes\"");
599601
600            fprintf(m_output, "/>\n");
602            output.cat("/>\n");
603
604            fprintf(m_output, "%s", output.cstr());
601605         }
602606      }
603607}
r21897r21898
10921096      for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
10931097         if (field->type() == type)
10941098         {
1099            astring output;
1100
10951101            astring newtag(port->tag()), oldtag(":");
10961102            newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len());
10971103
10981104            // 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());
11001106
11011107            // loop over settings
11021108            for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next())
11031109            {
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\"" : "");
11051111            }
11061112
11071113            // 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());
11091117         }
11101118}
11111119

Previous 199869 Revisions Next


© 1997-2024 The MAME Team