diff --git a/src/emu/info.c b/src/emu/info.c index 39a3fc33097..4a707805ba1 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -62,6 +62,7 @@ const char info_xml_creator::s_dtd_string[] = "\t\t\n" "\t\t\n" "\t\t\n" +"\t\t\n" "\t\t\n" "\t\t\n" "\t\t\n" @@ -94,6 +95,8 @@ const char info_xml_creator::s_dtd_string[] = "\t\t\t\n" "\t\t\t\n" "\t\t\t\n" +"\t\t\n" +"\t\t\t\n" "\t\t\n" "\t\t\t\n" "\t\t\n" @@ -187,6 +190,8 @@ const char info_xml_creator::s_dtd_string[] = "]>"; +extern const device_type *s_devices_sorted[]; +extern int m_device_count; //************************************************************************** // INFO XML CREATOR @@ -228,12 +233,17 @@ void info_xml_creator::output(FILE *out) CONFIG_VERSION ); + m_device_used = global_alloc_array_clear(UINT8, m_device_count); + // iterate through the drivers, outputting one at a time while (m_drivlist.next()) output_one(); // iterate through the devices, and output their roms output_devices(); + + global_free(m_device_used); + // close the top level tag fprintf(m_output, "\n"); } @@ -246,33 +256,35 @@ void info_xml_creator::output(FILE *out) void info_xml_creator::output_devices() { - extern const device_type *s_devices_sorted[]; - extern int m_device_count; - m_drivlist.reset(); m_drivlist.next(); machine_config &config = m_drivlist.config(); device_t *owner = config.devicelist().first(); - for(int i=0;iconfig_complete(); + // check if all are listed, note that empty one is included + bool display_all = driver_list::total() == (m_drivlist.count()+1); + for(int i=0;iconfig_complete(); - // print the header and the game name - fprintf(m_output, "\t<" XML_TOP); - fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname())); - fprintf(m_output, " runnable=\"no\""); - fprintf(m_output, ">\n"); - - // output device description - if (dev->name() != NULL) - fprintf(m_output, "\t\t%s\n", xml_normalize_string(dev->name())); + // print the header and the game name + fprintf(m_output, "\t<" XML_TOP); + fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname())); + fprintf(m_output, " isdevice=\"yes\""); + fprintf(m_output, " runnable=\"no\""); + fprintf(m_output, ">\n"); + + // output device description + if (dev->name() != NULL) + fprintf(m_output, "\t\t%s\n", xml_normalize_string(dev->name())); - output_rom(dev); - - // close the topmost tag - fprintf(m_output, "\t\n"); - global_free(dev); + output_rom(dev); + + // close the topmost tag + fprintf(m_output, "\t\n"); + global_free(dev); + } } } @@ -341,6 +353,7 @@ void info_xml_creator::output_one() // now print various additional information output_bios(); output_rom(rom_first_source(m_drivlist.config())); + output_device_roms(); output_sample(); output_chips(); output_display(); @@ -360,6 +373,25 @@ void info_xml_creator::output_one() fprintf(m_output, "\t\n"); } +//------------------------------------------------ +// output_device_roms - print the device +// with roms, if appropriate +//------------------------------------------------- + +void info_xml_creator::output_device_roms() +{ + int cnt=0; + for (const rom_source *source = rom_first_source(m_drivlist.config()); source != NULL; source = rom_next_source(*source)) + { + if (cnt!=0) { + fprintf(m_output, "\t\t\n", xml_normalize_string(source->shortname())); + for(int i=0;itype() == *s_devices_sorted[i]) m_device_used[i] = 1; + } + } + cnt++; + } +} //------------------------------------------------ // output_sampleof - print the 'sampleof' diff --git a/src/emu/info.h b/src/emu/info.h index a667e7d306d..87c918817c2 100644 --- a/src/emu/info.h +++ b/src/emu/info.h @@ -63,6 +63,7 @@ private: void output_sampleof(); void output_bios(); void output_rom(const rom_source *source); + void output_device_roms(); void output_sample(); void output_chips(); void output_display(); @@ -84,6 +85,7 @@ private: // internal state FILE * m_output; driver_enumerator & m_drivlist; + UINT8 * m_device_used; static const char s_dtd_string[]; };