Previous 15994 Revisions Next

r12489 Friday 5th August, 2011 at 11:22:34 UTC by Miodrag Milanović
Listxml changes (no whatsnew)

- In listxml now only devices related to retrieved drivers are listed.

- Those not connected are now in output only in case of full listxml

- Added device_ref in machine output so links to devices are present in list

- Also added isdevice="yes" to listxml output for devices, so they can be distinguished by tools
[src/emu]info.c info.h

src/emu/info.c
r12488r12489
6262"\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n"
6363"\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n"
6464"\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n"
65"\t\t<!ATTLIST " XML_TOP " isdevice (yes|no) \"no\">\n"
6566"\t\t<!ATTLIST " XML_TOP " ismechanical (yes|no) \"no\">\n"
6667"\t\t<!ATTLIST " XML_TOP " runnable (yes|no) \"yes\">\n"
6768"\t\t<!ATTLIST " XML_TOP " cloneof CDATA #IMPLIED>\n"
r12488r12489
9495"\t\t\t<!ATTLIST disk writable (yes|no) \"no\">\n"
9596"\t\t\t<!ATTLIST disk status (baddump|nodump|good) \"good\">\n"
9697"\t\t\t<!ATTLIST disk optional (yes|no) \"no\">\n"
98"\t\t<!ELEMENT device_ref EMPTY>\n"
99"\t\t\t<!ATTLIST rom name CDATA #REQUIRED>\n"
97100"\t\t<!ELEMENT sample EMPTY>\n"
98101"\t\t\t<!ATTLIST sample name CDATA #REQUIRED>\n"
99102"\t\t<!ELEMENT chip EMPTY>\n"
r12488r12489
187190"]>";
188191
189192
193extern const device_type *s_devices_sorted[];
194extern int m_device_count;
190195
191196//**************************************************************************
192197//  INFO XML CREATOR
r12488r12489
228233      CONFIG_VERSION
229234   );
230235
236   m_device_used = global_alloc_array_clear(UINT8, m_device_count);
237
231238   // iterate through the drivers, outputting one at a time
232239   while (m_drivlist.next())
233240      output_one();
234241
235242   // iterate through the devices, and output their roms
236243   output_devices();
244   
245   global_free(m_device_used);
246   
237247   // close the top level tag
238248   fprintf(m_output, "</" XML_ROOT ">\n");
239249}
r12488r12489
246256
247257void info_xml_creator::output_devices()
248258{
249   extern const device_type *s_devices_sorted[];
250   extern int m_device_count;
251
252259   m_drivlist.reset();
253260   m_drivlist.next();
254261   machine_config &config = m_drivlist.config();
255262   device_t *owner = config.devicelist().first();
256   for(int i=0;i<m_device_count;i++) {
257      device_type type = *s_devices_sorted[i];
258      device_t *dev = (*type)(config, "dummy", owner, 0);
259      dev->config_complete();
263   // check if all are listed, note that empty one is included
264   bool display_all = driver_list::total() == (m_drivlist.count()+1);
265   for(int i=0;i<m_device_count;i++) {   
266      if (display_all || (m_device_used[i]!=0)) {
267         device_type type = *s_devices_sorted[i];
268         device_t *dev = (*type)(config, "dummy", owner, 0);
269         dev->config_complete();
260270
261      // print the header and the game name
262      fprintf(m_output, "\t<" XML_TOP);
263      fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname()));
264      fprintf(m_output, " runnable=\"no\"");
265      fprintf(m_output, ">\n");
266     
267      // output device description
268      if (dev->name() != NULL)
269         fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(dev->name()));
271         // print the header and the game name
272         fprintf(m_output, "\t<" XML_TOP);
273         fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname()));
274         fprintf(m_output, " isdevice=\"yes\"");
275         fprintf(m_output, " runnable=\"no\"");
276         fprintf(m_output, ">\n");
277         
278         // output device description
279         if (dev->name() != NULL)
280            fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(dev->name()));
270281
271      output_rom(dev);
272     
273      // close the topmost tag
274      fprintf(m_output, "\t</" XML_TOP ">\n");
275      global_free(dev);
282         output_rom(dev);
283         
284         // close the topmost tag
285         fprintf(m_output, "\t</" XML_TOP ">\n");
286         global_free(dev);
287      }
276288   }
277289}
278290
r12488r12489
341353   // now print various additional information
342354   output_bios();
343355   output_rom(rom_first_source(m_drivlist.config()));
356   output_device_roms();
344357   output_sample();
345358   output_chips();
346359   output_display();
r12488r12489
360373   fprintf(m_output, "\t</" XML_TOP ">\n");
361374}
362375
376//------------------------------------------------
377//  output_device_roms - print the device
378//  with roms, if appropriate
379//-------------------------------------------------
363380
381void info_xml_creator::output_device_roms()
382{
383   int cnt=0;   
384   for (const rom_source *source = rom_first_source(m_drivlist.config()); source != NULL; source = rom_next_source(*source))
385   {
386      if (cnt!=0) {
387         fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", xml_normalize_string(source->shortname()));
388         for(int i=0;i<m_device_count;i++) {
389            if (source->type() == *s_devices_sorted[i]) m_device_used[i] = 1;
390         }
391      }
392      cnt++;
393   }
394}
395
364396//------------------------------------------------
365397//  output_sampleof - print the 'sampleof'
366398//  attribute, if appropriate
src/emu/info.h
r12488r12489
6363   void output_sampleof();
6464   void output_bios();
6565   void output_rom(const rom_source *source);
66   void output_device_roms();
6667   void output_sample();
6768   void output_chips();
6869   void output_display();
r12488r12489
8485   // internal state
8586   FILE *               m_output;
8687   driver_enumerator &      m_drivlist;
88   UINT8 *             m_device_used;
8789
8890   static const char s_dtd_string[];
8991};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team