src/emu/info.c
| r14593 | r14594 | |
| 179 | 179 | "\t\t\t<!ATTLIST slot name CDATA #REQUIRED>\n" |
| 180 | 180 | "\t\t\t<!ELEMENT slotoption EMPTY>\n" |
| 181 | 181 | "\t\t\t\t<!ATTLIST slotoption name CDATA #REQUIRED>\n" |
| 182 | | "\t\t\t\t<!ATTLIST slotoption shortname CDATA #REQUIRED>\n" |
| 182 | "\t\t\t\t<!ATTLIST slotoption devname CDATA #REQUIRED>\n" |
| 183 | 183 | "\t\t\t\t<!ATTLIST slotoption default (yes|no) \"no\">\n" |
| 184 | 184 | "\t\t<!ELEMENT softwarelist EMPTY>\n" |
| 185 | 185 | "\t\t\t<!ATTLIST softwarelist name CDATA #REQUIRED>\n" |
| r14593 | r14594 | |
| 340 | 340 | // a single device |
| 341 | 341 | //------------------------------------------------- |
| 342 | 342 | |
| 343 | | void info_xml_creator::output_one_device(device_t &device, const char *innertag, const char *outertag) |
| 343 | void info_xml_creator::output_one_device(device_t &device, const char *devtag) |
| 344 | 344 | { |
| 345 | 345 | bool has_speaker = FALSE, has_input = FALSE; |
| 346 | 346 | // check if the device adds speakers to the system |
| r14593 | r14594 | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | // start to output info |
| 366 | | fprintf(m_output, "\t<%s", outertag); |
| 367 | | // TODO: merge handling for devices with roms and other devices |
| 368 | | if (outertag == emulator_info::get_xml_top()) |
| 369 | | { |
| 370 | | // it's a device with roms necessary for this configuration |
| 371 | | fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); |
| 372 | | fprintf(m_output, " isdevice=\"yes\""); |
| 373 | | fprintf(m_output, " runnable=\"no\""); |
| 374 | | } |
| 375 | | else |
| 376 | | { |
| 377 | | // it's a generic device |
| 378 | | astring shrtnm(device.shortname()); |
| 379 | | if (shrtnm.cmp("")) |
| 380 | | fprintf(m_output, " shortname=\"%s\"", shrtnm.cstr()); |
| 381 | | } |
| 366 | fprintf(m_output, "\t<%s", emulator_info::get_xml_top()); |
| 367 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); |
| 368 | fprintf(m_output, " isdevice=\"yes\""); |
| 369 | fprintf(m_output, " runnable=\"no\""); |
| 382 | 370 | fprintf(m_output, ">\n"); |
| 383 | 371 | fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(device.name())); |
| 384 | 372 | |
| 385 | 373 | output_rom(device); |
| 386 | | output_chips(device, innertag); |
| 374 | output_chips(device, devtag); |
| 387 | 375 | output_display(device); |
| 388 | 376 | if (has_speaker) |
| 389 | 377 | output_sound(device); |
| 390 | 378 | if (has_input) |
| 391 | 379 | output_input(portlist); |
| 392 | | output_switches(portlist, innertag, IPT_DIPSWITCH, "dipswitch", "dipvalue"); |
| 393 | | output_switches(portlist, innertag, IPT_CONFIG, "configuration", "confsetting"); |
| 380 | output_switches(portlist, devtag, IPT_DIPSWITCH, "dipswitch", "dipvalue"); |
| 381 | output_switches(portlist, devtag, IPT_CONFIG, "configuration", "confsetting"); |
| 394 | 382 | output_adjusters(portlist); |
| 395 | | output_images(device, innertag); |
| 396 | | output_slots(device, innertag); |
| 397 | | fprintf(m_output, "\t</%s>\n", outertag); |
| 383 | output_images(device, devtag); |
| 384 | output_slots(device, devtag); |
| 385 | fprintf(m_output, "\t</%s>\n", emulator_info::get_xml_top()); |
| 398 | 386 | } |
| 399 | 387 | |
| 400 | 388 | |
| r14593 | r14594 | |
| 409 | 397 | void info_xml_creator::output_devices() |
| 410 | 398 | { |
| 411 | 399 | m_drivlist.reset(); |
| 412 | | slot_map desc; |
| 400 | slot_map shortnames; |
| 413 | 401 | |
| 414 | | // first, run through slot devices |
| 415 | 402 | while (m_drivlist.next()) |
| 416 | 403 | { |
| 404 | // first, run through devices with roms which belongs to the default configuration |
| 417 | 405 | device_iterator deviter(m_drivlist.config().root_device()); |
| 418 | 406 | deviter.first(); |
| 419 | | for (device_t *device = deviter.next(); device != NULL; device = deviter.next()) { |
| 407 | for (device_t *device = deviter.next(); device != NULL; device = deviter.next()) |
| 408 | { |
| 420 | 409 | if (device->rom_region() != NULL && device->shortname()!= NULL) |
| 421 | 410 | { |
| 422 | | if (desc.add(device->name(), 0, FALSE) != TMERR_DUPLICATE) |
| 423 | | output_one_device(*device, device->tag(), emulator_info::get_xml_top()); |
| 411 | if (shortnames.add(device->shortname(), 0, FALSE) != TMERR_DUPLICATE) |
| 412 | output_one_device(*device, device->tag()); |
| 424 | 413 | } |
| 425 | 414 | } |
| 415 | |
| 416 | // then, run through slot devices |
| 426 | 417 | slot_interface_iterator iter(m_drivlist.config().root_device()); |
| 427 | 418 | for (const device_slot_interface *slot = iter.first(); slot != NULL; slot = iter.next()) |
| 428 | 419 | { |
| r14593 | r14594 | |
| 439 | 430 | if (!device->configured()) |
| 440 | 431 | device->config_complete(); |
| 441 | 432 | |
| 442 | | if (desc.add(dev->name(), 0, FALSE) != TMERR_DUPLICATE) |
| 443 | | output_one_device(*dev, temptag.cstr(), emulator_info::get_xml_top()); |
| 433 | if (shortnames.add(dev->shortname(), 0, FALSE) != TMERR_DUPLICATE) |
| 434 | output_one_device(*dev, temptag.cstr()); |
| 444 | 435 | |
| 445 | 436 | const_cast<machine_config &>(m_drivlist.config()).device_remove(&m_drivlist.config().root_device(), temptag.cstr()); |
| 446 | 437 | global_free(dev); |
| r14593 | r14594 | |
| 1286 | 1277 | |
| 1287 | 1278 | fprintf(m_output, "\t\t\t<slotoption"); |
| 1288 | 1279 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(intf[i].name)); |
| 1289 | | fprintf(m_output, " shortname=\"%s\"", xml_normalize_string(dev->shortname())); |
| 1280 | fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname())); |
| 1290 | 1281 | if (slot->get_default_card(m_drivlist.config(), m_drivlist.options())) |
| 1291 | 1282 | { |
| 1292 | 1283 | if (slot->get_default_card(m_drivlist.config(), m_drivlist.options()) == intf[i].name) |