src/emu/info.c
| r12488 | r12489 | |
| 62 | 62 | "\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n" |
| 63 | 63 | "\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n" |
| 64 | 64 | "\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n" |
| 65 | "\t\t<!ATTLIST " XML_TOP " isdevice (yes|no) \"no\">\n" |
| 65 | 66 | "\t\t<!ATTLIST " XML_TOP " ismechanical (yes|no) \"no\">\n" |
| 66 | 67 | "\t\t<!ATTLIST " XML_TOP " runnable (yes|no) \"yes\">\n" |
| 67 | 68 | "\t\t<!ATTLIST " XML_TOP " cloneof CDATA #IMPLIED>\n" |
| r12488 | r12489 | |
| 94 | 95 | "\t\t\t<!ATTLIST disk writable (yes|no) \"no\">\n" |
| 95 | 96 | "\t\t\t<!ATTLIST disk status (baddump|nodump|good) \"good\">\n" |
| 96 | 97 | "\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" |
| 97 | 100 | "\t\t<!ELEMENT sample EMPTY>\n" |
| 98 | 101 | "\t\t\t<!ATTLIST sample name CDATA #REQUIRED>\n" |
| 99 | 102 | "\t\t<!ELEMENT chip EMPTY>\n" |
| r12488 | r12489 | |
| 187 | 190 | "]>"; |
| 188 | 191 | |
| 189 | 192 | |
| 193 | extern const device_type *s_devices_sorted[]; |
| 194 | extern int m_device_count; |
| 190 | 195 | |
| 191 | 196 | //************************************************************************** |
| 192 | 197 | // INFO XML CREATOR |
| r12488 | r12489 | |
| 228 | 233 | CONFIG_VERSION |
| 229 | 234 | ); |
| 230 | 235 | |
| 236 | m_device_used = global_alloc_array_clear(UINT8, m_device_count); |
| 237 | |
| 231 | 238 | // iterate through the drivers, outputting one at a time |
| 232 | 239 | while (m_drivlist.next()) |
| 233 | 240 | output_one(); |
| 234 | 241 | |
| 235 | 242 | // iterate through the devices, and output their roms |
| 236 | 243 | output_devices(); |
| 244 | |
| 245 | global_free(m_device_used); |
| 246 | |
| 237 | 247 | // close the top level tag |
| 238 | 248 | fprintf(m_output, "</" XML_ROOT ">\n"); |
| 239 | 249 | } |
| r12488 | r12489 | |
| 246 | 256 | |
| 247 | 257 | void info_xml_creator::output_devices() |
| 248 | 258 | { |
| 249 | | extern const device_type *s_devices_sorted[]; |
| 250 | | extern int m_device_count; |
| 251 | | |
| 252 | 259 | m_drivlist.reset(); |
| 253 | 260 | m_drivlist.next(); |
| 254 | 261 | machine_config &config = m_drivlist.config(); |
| 255 | 262 | 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(); |
| 260 | 270 | |
| 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())); |
| 270 | 281 | |
| 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 | } |
| 276 | 288 | } |
| 277 | 289 | } |
| 278 | 290 | |
| r12488 | r12489 | |
| 341 | 353 | // now print various additional information |
| 342 | 354 | output_bios(); |
| 343 | 355 | output_rom(rom_first_source(m_drivlist.config())); |
| 356 | output_device_roms(); |
| 344 | 357 | output_sample(); |
| 345 | 358 | output_chips(); |
| 346 | 359 | output_display(); |
| r12488 | r12489 | |
| 360 | 373 | fprintf(m_output, "\t</" XML_TOP ">\n"); |
| 361 | 374 | } |
| 362 | 375 | |
| 376 | //------------------------------------------------ |
| 377 | // output_device_roms - print the device |
| 378 | // with roms, if appropriate |
| 379 | //------------------------------------------------- |
| 363 | 380 | |
| 381 | void 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 | |
| 364 | 396 | //------------------------------------------------ |
| 365 | 397 | // output_sampleof - print the 'sampleof' |
| 366 | 398 | // attribute, if appropriate |