int cli_info_listclones(core_options *options, const char *gamename) { int drvindex, count = 0; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) { const game_driver *clone_of = driver_get_clone(drivers[drvindex]); /* if we are a clone, and either our name matches the gamename, or the clone's name matches, display us */ if (clone_of != NULL && (clone_of->flags & GAME_IS_BIOS_ROOT) == 0) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0 || mame_strwildcmp(gamename, clone_of->name) == 0) { /* print the header on the first one */ if (count == 0) mame_printf_info("Name: Clone of:\n"); /* output the remaining information */ mame_printf_info("%-8s %-8s\n", drivers[drvindex]->name, clone_of->name); count++; } } /* return an error if none found */ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listcrc(core_options *options, const char *gamename) { int drvindex, count = 0; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { const rom_entry *region, *rom; /* iterate over regions, and then ROMs within the region */ for (region = rom_first_region(drivers[drvindex]); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { char hashbuf[HASH_BUF_SIZE]; /* if we have a CRC, display it */ if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), HASH_CRC, hashbuf)) mame_printf_info("%s %-12s %s\n", hashbuf, ROM_GETNAME(rom), drivers[drvindex]->description); } count++; } /* return an error if none found */ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listsamples(core_options *options, const char *gamename) { int count = 0; int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); const device_config_sound_interface *sound = NULL; /* find samples interfaces */ for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) if (sound->devconfig().type() == SOUND_SAMPLES) { const char *const *samplenames = ((const samples_interface *)sound->devconfig().static_config())->samplenames; int sampnum; /* if the list is legit, walk it and print the sample info */ if (samplenames != NULL) for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) mame_printf_info("%s\n", samplenames[sampnum]); } count++; global_free(config); } return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
static int info_listmedia(core_options *options, const char *gamename) { int count = 0, devcount; int drvindex; machine_config *config; const device_config_image_interface *dev = NULL; const char *src; const char *driver_name; const char *name; const char *shortname; char paren_shortname[16]; printf(" SYSTEM DEVICE NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED \n"); printf("---------- -------------------- ------------------------------------\n"); /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { /* allocate the machine config */ config = global_alloc(machine_config(drivers[drvindex]->machine_config)); driver_name = drivers[drvindex]->name; devcount = 0; for (bool gotone = config->m_devicelist.first(dev); gotone; gotone = dev->next(dev)) { src = downcast<const legacy_image_device_config_base *>(dev)->file_extensions(); name = downcast<const legacy_image_device_config_base *>(dev)->instance_name(); shortname = downcast<const legacy_image_device_config_base *>(dev)->brief_instance_name(); sprintf(paren_shortname, "(%s)", shortname); printf("%-13s%-12s%-8s ", driver_name, name, paren_shortname); driver_name = " "; astring extensions(src); char *ext = strtok((char*)extensions.cstr(),","); while (ext != NULL) { printf(".%-5s",ext); ext = strtok (NULL, ","); devcount++; } printf("\n"); } if (!devcount) printf("%-13s(none)\n",driver_name); count++; global_free(config); } if (!count) printf("There are no Computers or Consoles named %s\n", gamename); return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
bool driver_list::matches(const char *wildstring, const char *string) { // can only match internal drivers if the wildstring starts with an underscore if (string[0] == '_' && (wildstring == NULL || wildstring[0] != '_')) return false; // match everything else normally return (wildstring == NULL || mame_strwildcmp(wildstring, string) == 0); }
int cli_info_listbrothers(core_options *options, const char *gamename) { UINT8 *didit = global_alloc_array_clear(UINT8, driver_list_get_count(drivers)); int drvindex, count = 0; astring filename; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) if (!didit[drvindex] && mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { int matchindex; didit[drvindex] = TRUE; if (count > 0) mame_printf_info("\n"); mame_printf_info("%s ... other drivers in %s:\n", drivers[drvindex]->name, core_filename_extract_base(&filename, drivers[drvindex]->source_file, FALSE)->cstr()); /* now iterate again over drivers, finding those with the same source file */ for (matchindex = 0; drivers[matchindex]; matchindex++) if (matchindex != drvindex && strcmp(drivers[drvindex]->source_file, drivers[matchindex]->source_file) == 0) { const char *matchstring = (mame_strwildcmp(gamename, drivers[matchindex]->name) == 0) ? "-> " : " "; const game_driver *clone_of = driver_get_clone(drivers[matchindex]); if (clone_of != NULL && (clone_of->flags & GAME_IS_BIOS_ROOT) == 0) mame_printf_info("%s%-16s [%s]\n", matchstring, drivers[matchindex]->name, clone_of->name); else mame_printf_info("%s%s\n", matchstring, drivers[matchindex]->name); didit[matchindex] = TRUE; } count++; } /* return an error if none found */ global_free(didit); return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listsource(core_options *options, const char *gamename) { int drvindex, count = 0; astring filename; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { /* output the remaining information */ mame_printf_info("%-16s %s\n", drivers[drvindex]->name, core_filename_extract_base(&filename, drivers[drvindex]->source_file, FALSE)->cstr()); count++; } /* return an error if none found */ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listsource(core_options *options, const char *gamename) { astring *filename = astring_alloc(); int drvindex, count = 0; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { /* output the remaining information */ mame_printf_info("%-8s %s\n", drivers[drvindex]->name, astring_c(core_filename_extract_base(filename, drivers[drvindex]->source_file, FALSE))); count++; } /* return an error if none found */ astring_free(filename); return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listsamples(core_options *options, const char *gamename) { int count = 0; #if (HAS_SAMPLES) int drvindex; /* since we expand the machine driver, we need to set things up */ init_resource_tracking(); cpuintrf_init(NULL); sndintrf_init(NULL); /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { machine_config *config = machine_config_alloc(drivers[drvindex]->machine_config); int sndnum; /* find samples interfaces */ for (sndnum = 0; sndnum < MAX_SOUND && config->sound[sndnum].type != SOUND_DUMMY; sndnum++) if (config->sound[sndnum].type == SOUND_SAMPLES) { const char *const *samplenames = ((const struct Samplesinterface *)config->sound[sndnum].config)->samplenames; int sampnum; /* if the list is legit, walk it and print the sample info */ if (samplenames != NULL) for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) mame_printf_info("%s\n", samplenames[sampnum]); } count++; machine_config_free(config); } /* clean up our tracked resources */ exit_resource_tracking(); #else mame_printf_error("Samples not supported in this build\n"); #endif return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listfull(core_options *options, const char *gamename) { int drvindex, count = 0; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if ((drivers[drvindex]->flags & GAME_NO_STANDALONE) == 0 && mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { /* print the header on the first one */ if (count == 0) mame_printf_info("Name: Description:\n"); /* output the remaining information */ mame_printf_info("%-10s\"%s\"\n", drivers[drvindex]->name, drivers[drvindex]->description); count++; } /* return an error if none found */ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
int cli_info_listdevices(core_options *options, const char *gamename) { int count = 0; int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); const device_config *devconfig; if (count != 0) printf("\n"); printf("Driver %s (%s):\n", drivers[drvindex]->name, drivers[drvindex]->description); /* iterate through devices */ for (devconfig = config->m_devicelist.first(); devconfig != NULL; devconfig = devconfig->next()) { printf(" %s ('%s')", devconfig->name(), devconfig->tag()); UINT32 clock = devconfig->clock(); if (clock >= 1000000000) printf(" @ %d.%02d GHz\n", clock / 1000000000, (clock / 10000000) % 100); else if (clock >= 1000000) printf(" @ %d.%02d MHz\n", clock / 1000000, (clock / 10000) % 100); else if (clock >= 1000) printf(" @ %d.%02d kHz\n", clock / 1000, (clock / 10) % 100); else if (clock > 0) printf(" @ %d Hz\n", clock); else printf("\n"); } count++; global_free(config); } return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
static int info_verifysamples(core_options *options, const char *gamename) { int correct = 0; int incorrect = 0; int notfound = FALSE; int drvindex; /* now iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { audit_record *audit; int audit_records; int res; /* audit the samples in this set */ audit_records = audit_samples(options, drivers[drvindex], &audit); res = audit_summary(drivers[drvindex], audit_records, audit, TRUE); if (audit_records > 0) free(audit); else continue; /* if not found, print a message and set the flag */ if (res == NOTFOUND) { mame_printf_error("sampleset \"%s\" not found!\n", drivers[drvindex]->name); notfound = TRUE; } /* else display information about what we discovered */ else { mame_printf_info("sampleset %s ", drivers[drvindex]->name); /* switch off of the result */ switch (res) { case INCORRECT: mame_printf_info("is bad\n"); incorrect++; break; case CORRECT: mame_printf_info("is good\n"); correct++; break; case BEST_AVAILABLE: mame_printf_info("is best available\n"); correct++; break; } } } /* clear out any cached files */ zip_file_cache_clear(); /* if we didn't get anything at all because of an unsupported set, display message */ if (correct + incorrect == 0) { if (!notfound) mame_printf_error("sampleset \"%s\" not supported!\n", gamename); return MAMERR_NO_SUCH_GAME; } /* otherwise, print a summary */ else { mame_printf_info("%d samplesets found, %d were OK.\n", correct + incorrect, correct); return (incorrect > 0) ? MAMERR_MISSING_FILES : MAMERR_NONE; } }
static int info_verifyroms(core_options *options, const char *gamename) { int correct = 0; int incorrect = 0; int notfound = 0; int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { audit_record *audit; int audit_records; int res; /* audit the ROMs in this set */ audit_records = audit_images(options, drivers[drvindex], AUDIT_VALIDATE_FAST, &audit); res = audit_summary(drivers[drvindex], audit_records, audit, TRUE); if (audit_records > 0) free(audit); /* if not found, count that and leave it at that */ if (res == NOTFOUND) notfound++; /* else display information about what we discovered */ else { const game_driver *clone_of; /* output the name of the driver and its clone */ mame_printf_info("romset %s ", drivers[drvindex]->name); clone_of = driver_get_clone(drivers[drvindex]); if (clone_of != NULL) mame_printf_info("[%s] ", clone_of->name); /* switch off of the result */ switch (res) { case INCORRECT: mame_printf_info("is bad\n"); incorrect++; break; case CORRECT: mame_printf_info("is good\n"); correct++; break; case BEST_AVAILABLE: mame_printf_info("is best available\n"); correct++; break; } } } /* clear out any cached files */ zip_file_cache_clear(); /* if we didn't get anything at all, display a generic end message */ if (correct + incorrect == 0) { if (notfound > 0) mame_printf_info("romset \"%s\" not found!\n", gamename); else mame_printf_info("romset \"%s\" not supported!\n", gamename); return MAMERR_NO_SUCH_GAME; } /* otherwise, print a summary */ else { mame_printf_info("%d romsets found, %d were OK.\n", correct + incorrect, correct); return (incorrect > 0) ? MAMERR_MISSING_FILES : MAMERR_NONE; } }
int cli_info_listroms(core_options *options, const char *gamename) { int drvindex, count = 0; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex]; drvindex++) if (mame_strwildcmp(gamename, drivers[drvindex]->name) == 0) { const rom_entry *region, *rom, *chunk; /* print the header */ if (count > 0) mame_printf_info("\n"); mame_printf_info("This is the list of the ROMs required for driver \"%s\".\n" "Name Size Checksum\n", drivers[drvindex]->name); /* iterate over regions and then ROMs within the region */ for (region = drivers[drvindex]->rom; region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { const char *name = ROM_GETNAME(rom); const char* hash = ROM_GETHASHDATA(rom); char hashbuf[HASH_BUF_SIZE]; int length = -1; /* accumulate the total length of all chunks */ if (ROMREGION_ISROMDATA(region)) { length = 0; for (chunk = rom_first_chunk(rom); chunk; chunk = rom_next_chunk(chunk)) length += ROM_GETLENGTH(chunk); } /* start with the name */ mame_printf_info("%-12s ", name); /* output the length next */ if (length >= 0) mame_printf_info("%7d", length); else mame_printf_info(" "); /* output the hash data */ if (!hash_data_has_info(hash, HASH_INFO_NO_DUMP)) { if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP)) mame_printf_info(" BAD"); hash_data_print(hash, 0, hashbuf); mame_printf_info(" %s", hashbuf); } else mame_printf_info(" NO GOOD DUMP KNOWN"); /* end with a CR */ mame_printf_info("\n"); } count++; } return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
void print_mame_xml(FILE *out, const game_driver *const games[], const char *gamename) { int drvnum; fprintf(out, "<?xml version=\"1.0\"?>\n" "<!DOCTYPE " XML_ROOT " [\n" "<!ELEMENT " XML_ROOT " (" XML_TOP "+)>\n" "\t<!ATTLIST " XML_ROOT " build CDATA #IMPLIED>\n" "\t<!ATTLIST " XML_ROOT " debug (yes|no) \"no\">\n" #ifdef MESS "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer, biosset*, rom*, disk*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, category*, adjuster*, driver?, device*, ramoption*)>\n" #else "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer, biosset*, rom*, disk*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, adjuster*, driver?)>\n" #endif "\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n" "\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n" "\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n" "\t\t<!ATTLIST " XML_TOP " runnable (yes|no) \"yes\">\n" "\t\t<!ATTLIST " XML_TOP " cloneof CDATA #IMPLIED>\n" "\t\t<!ATTLIST " XML_TOP " romof CDATA #IMPLIED>\n" "\t\t<!ATTLIST " XML_TOP " sampleof CDATA #IMPLIED>\n" "\t\t<!ELEMENT description (#PCDATA)>\n" "\t\t<!ELEMENT year (#PCDATA)>\n" "\t\t<!ELEMENT manufacturer (#PCDATA)>\n" "\t\t<!ELEMENT biosset EMPTY>\n" "\t\t\t<!ATTLIST biosset name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST biosset description CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST biosset default (yes|no) \"no\">\n" "\t\t<!ELEMENT rom EMPTY>\n" "\t\t\t<!ATTLIST rom name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST rom bios CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom size CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST rom crc CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom md5 CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom sha1 CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom merge CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom region CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom offset CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST rom status (baddump|nodump|good) \"good\">\n" "\t\t\t<!ATTLIST rom optional (yes|no) \"no\">\n" "\t\t<!ELEMENT disk EMPTY>\n" "\t\t\t<!ATTLIST disk name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST disk md5 CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST disk sha1 CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST disk merge CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST disk region CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST disk index CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST disk status (baddump|nodump|good) \"good\">\n" "\t\t\t<!ATTLIST disk optional (yes|no) \"no\">\n" "\t\t<!ELEMENT sample EMPTY>\n" "\t\t\t<!ATTLIST sample name CDATA #REQUIRED>\n" "\t\t<!ELEMENT chip EMPTY>\n" "\t\t\t<!ATTLIST chip name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST chip tag CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST chip type (cpu|audio) #REQUIRED>\n" "\t\t\t<!ATTLIST chip clock CDATA #IMPLIED>\n" "\t\t<!ELEMENT display EMPTY>\n" "\t\t\t<!ATTLIST display type (raster|vector|lcd|unknown) #REQUIRED>\n" "\t\t\t<!ATTLIST display rotate (0|90|180|270) #REQUIRED>\n" "\t\t\t<!ATTLIST display flipx (yes|no) \"no\">\n" "\t\t\t<!ATTLIST display width CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display height CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display refresh CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST display pixclock CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display htotal CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display hbend CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display hbstart CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display vtotal CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display vbend CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST display vbstart CDATA #IMPLIED>\n" "\t\t<!ELEMENT sound EMPTY>\n" "\t\t\t<!ATTLIST sound channels CDATA #REQUIRED>\n" "\t\t<!ELEMENT input (control*)>\n" "\t\t\t<!ATTLIST input service (yes|no) \"no\">\n" "\t\t\t<!ATTLIST input tilt (yes|no) \"no\">\n" "\t\t\t<!ATTLIST input players CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST input buttons CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST input coins CDATA #IMPLIED>\n" "\t\t\t<!ELEMENT control EMPTY>\n" "\t\t\t\t<!ATTLIST control type CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST control minimum CDATA #IMPLIED>\n" "\t\t\t\t<!ATTLIST control maximum CDATA #IMPLIED>\n" "\t\t\t\t<!ATTLIST control sensitivity CDATA #IMPLIED>\n" "\t\t\t\t<!ATTLIST control keydelta CDATA #IMPLIED>\n" "\t\t\t\t<!ATTLIST control reverse (yes|no) \"no\">\n" "\t\t<!ELEMENT dipswitch (dipvalue*)>\n" "\t\t\t<!ATTLIST dipswitch name CDATA #REQUIRED>\n" "\t\t\t<!ELEMENT dipvalue EMPTY>\n" "\t\t\t\t<!ATTLIST dipvalue name CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST dipvalue default (yes|no) \"no\">\n" "\t\t<!ELEMENT configuration (confsetting*)>\n" "\t\t\t<!ATTLIST configuration name CDATA #REQUIRED>\n" "\t\t\t<!ELEMENT confsetting EMPTY>\n" "\t\t\t\t<!ATTLIST confsetting name CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST confsetting default (yes|no) \"no\">\n" #ifdef MESS "\t\t<!ELEMENT category (item*)>\n" "\t\t\t<!ATTLIST category name CDATA #REQUIRED>\n" "\t\t\t<!ELEMENT item EMPTY>\n" "\t\t\t\t<!ATTLIST item name CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST item default (yes|no) \"no\">\n" #endif "\t\t<!ELEMENT adjuster EMPTY>\n" "\t\t\t<!ATTLIST adjuster name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST adjuster default CDATA #REQUIRED>\n" "\t\t<!ELEMENT driver EMPTY>\n" "\t\t\t<!ATTLIST driver status (good|imperfect|preliminary) #REQUIRED>\n" "\t\t\t<!ATTLIST driver emulation (good|imperfect|preliminary) #REQUIRED>\n" "\t\t\t<!ATTLIST driver color (good|imperfect|preliminary) #REQUIRED>\n" "\t\t\t<!ATTLIST driver sound (good|imperfect|preliminary) #REQUIRED>\n" "\t\t\t<!ATTLIST driver graphic (good|imperfect|preliminary) #REQUIRED>\n" "\t\t\t<!ATTLIST driver cocktail (good|imperfect|preliminary) #IMPLIED>\n" "\t\t\t<!ATTLIST driver protection (good|imperfect|preliminary) #IMPLIED>\n" "\t\t\t<!ATTLIST driver savestate (supported|unsupported) #REQUIRED>\n" "\t\t\t<!ATTLIST driver palettesize CDATA #REQUIRED>\n" #ifdef MESS "\t\t<!ELEMENT device (instance*, extension*)>\n" "\t\t\t<!ATTLIST device type CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST device tag CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST device mandatory CDATA #IMPLIED>\n" "\t\t\t<!ELEMENT instance EMPTY>\n" "\t\t\t\t<!ATTLIST instance name CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST instance briefname CDATA #REQUIRED>\n" "\t\t\t<!ELEMENT extension EMPTY>\n" "\t\t\t\t<!ATTLIST extension name CDATA #REQUIRED>\n" "\t\t<!ELEMENT ramoption (#PCDATA)>\n" "\t\t\t<!ATTLIST ramoption default CDATA #IMPLIED>\n" #endif "]>\n\n" "<" XML_ROOT " build=\"%s\" debug=\"" #ifdef MAME_DEBUG "yes" #else "no" #endif "\">\n", xml_normalize_string(build_version) ); for (drvnum = 0; games[drvnum] != NULL; drvnum++) if (mame_strwildcmp(gamename, games[drvnum]->name) == 0) print_game_info(out, games[drvnum]); fprintf(out, "</" XML_ROOT ">\n"); }
static int info_listsoftware(core_options *options, const char *gamename) { FILE *out = stdout; int nr_lists = 0; char ** lists = NULL; int list_idx = 0; /* First determine the maximum number of lists we might encounter */ for ( int drvindex = 0; drivers[drvindex] != NULL; drvindex++ ) { if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 ) { /* allocate the machine config */ machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); for (const device_config *dev = config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) nr_lists++; } } /* free the machine config */ global_free(config); } } lists = global_alloc_array( char *, nr_lists ); fprintf( out, "<?xml version=\"1.0\"?>\n" "<!DOCTYPE softwarelist [\n" "<!ELEMENT softwarelists (softwarelist*)>\n" "\t<!ELEMENT softwarelist (software+)>\n" "\t\t<!ATTLIST softwarelist name CDATA #REQUIRED>\n" "\t\t<!ATTLIST softwarelist description CDATA #IMPLIED>\n" "\t\t<!ELEMENT software (description, year?, publisher, part*)>\n" "\t\t\t<!ATTLIST software name CDATA #REQUIRED>\n" "\t\t\t<!ATTLIST software cloneof CDATA #IMPLIED>\n" "\t\t\t<!ATTLIST software supported (yes|partial|no) \"yes\">\n" "\t\t\t<!ELEMENT description (#PCDATA)>\n" "\t\t\t<!ELEMENT year (#PCDATA)>\n" "\t\t\t<!ELEMENT publisher (#PCDATA)>\n" "\t\t\t<!ELEMENT part (dataarea*)>\n" "\t\t\t\t<!ATTLIST part name CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST part interface CDATA #REQUIRED>\n" "\t\t\t\t<!ATTLIST part feature CDATA #IMPLIED>\n" "\t\t\t\t<!ELEMENT dataarea (rom*)>\n" "\t\t\t\t\t<!ATTLIST dataarea name CDATA #REQUIRED>\n" "\t\t\t\t\t<!ATTLIST dataarea size CDATA #REQUIRED>\n" "\t\t\t\t\t<!ATTLIST dataarea databits (8|16|32|64) \"8\">\n" "\t\t\t\t\t<!ATTLIST dataarea endian (big|little) \"little\">\n" "\t\t\t\t\t<!ELEMENT rom EMPTY>\n" "\t\t\t\t\t\t<!ATTLIST rom name CDATA #IMPLIED>\n" "\t\t\t\t\t\t<!ATTLIST rom size CDATA #REQUIRED>\n" "\t\t\t\t\t\t<!ATTLIST rom crc CDATA #IMPLIED>\n" "\t\t\t\t\t\t<!ATTLIST rom md5 CDATA #IMPLIED>\n" "\t\t\t\t\t\t<!ATTLIST rom sha1 CDATA #IMPLIED>\n" "\t\t\t\t\t\t<!ATTLIST rom offset CDATA #IMPLIED>\n" "\t\t\t\t\t\t<!ATTLIST rom status (baddump|nodump|good) \"good\">\n" "\t\t\t\t\t\t<!ATTLIST rom loadflag (load16_byte|load16_word|load16_word_swap|load32_byte|load32_word|load32_word_swap|load32_dword|load64_word|load64_word_swap|reload) #IMPLIED>\n" "]>\n\n" "<softwarelists>\n" ); for ( int drvindex = 0; drivers[drvindex] != NULL; drvindex++ ) { if ( mame_strwildcmp( gamename, drivers[drvindex]->name ) == 0 ) { /* allocate the machine config */ machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); for (const device_config *dev = config->m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext()) { software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config(); for ( int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++ ) { if ( swlist->list_name[i] && *swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM)) { software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); if ( list ) { /* Verify if we have encountered this list before */ bool seen_before = false; for ( int l = 0; l < list_idx && !seen_before; l++ ) { if ( ! strcmp( swlist->list_name[i], lists[l] ) ) { seen_before = true; } } if ( ! seen_before ) { lists[list_idx] = core_strdup( swlist->list_name[i] ); list_idx++; fprintf(out, "\t<softwarelist name=\"%s\">\n", swlist->list_name[i] ); for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) ) { fprintf( out, "\t\t<software name=\"%s\"", swinfo->shortname ); if ( swinfo->parentname != NULL ) fprintf( out, " cloneof=\"%s\"", swinfo->parentname ); if ( swinfo->supported == SOFTWARE_SUPPORTED_PARTIAL ) fprintf( out, " supported=\"partial\"" ); if ( swinfo->supported == SOFTWARE_SUPPORTED_NO ) fprintf( out, " supported=\"no\"" ); fprintf( out, ">\n" ); fprintf( out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo->longname) ); fprintf( out, "\t\t\t<year>%s</year>\n", xml_normalize_string( swinfo->year ) ); fprintf( out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string( swinfo->publisher ) ); for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) ) { fprintf( out, "\t\t\t<part name=\"%s\"", part->name ); if ( part->interface_ ) fprintf( out, " interface=\"%s\"", part->interface_ ); // if ( part->feature ) // fprintf( out, " features=\"%s\"", part->feature ); fprintf( out, ">\n"); /* TODO: display rom region information */ for ( const rom_entry *region = part->romdata; region; region = rom_next_region( region ) ) { fprintf( out, "\t\t\t\t<dataarea name=\"%s\" size=\"%x\">\n", ROMREGION_GETTAG(region), ROMREGION_GETLENGTH(region) ); for ( const rom_entry *rom = rom_first_file( region ); rom && !ROMENTRY_ISREGIONEND(rom); rom++ ) { if ( ROMENTRY_ISFILE(rom) ) { fprintf( out, "\t\t\t\t\t<rom name=\"%s\" size=\"%d\"", xml_normalize_string(ROM_GETNAME(rom)), rom_file_size(rom) ); /* dump checksum information only if there is a known dump */ if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) { char checksum[HASH_BUF_SIZE]; int hashtype; /* iterate over hash function types and print out their values */ for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); } fprintf( out, " offset=\"%x\"", ROM_GETOFFSET(rom) ); if ( hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP) ) fprintf( out, " status=\"baddump\"" ); if ( hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP) ) fprintf( out, " status=\"nodump\"" ); fprintf( out, "/>\n" ); } else if ( ROMENTRY_ISRELOAD(rom) ) { fprintf( out, "\t\t\t\t\t<rom size=\"%d\" offset=\"%x\" loadflag=\"reload\" />\n", ROM_GETLENGTH(rom), ROM_GETOFFSET(rom) ); } } fprintf( out, "\t\t\t\t</dataarea>\n" ); } fprintf( out, "\t\t\t</part>\n" ); } fprintf( out, "\t\t</software>\n" ); } fprintf(out, "\t</softwarelist>\n" ); } software_list_close( list ); } } } } global_free(config); } } fprintf( out, "</softwarelists>\n" ); global_free( lists ); return MAMERR_NONE; }