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; }
software_config *software_config_alloc(int driver_index) //, hashfile_error_func error_proc) { const game_driver *driver; software_config *config; // allocate the software_config config = (software_config *)malloc(sizeof(software_config)); memset(config,0,sizeof(software_config)); // allocate the machine config windows_options pCurrentOpts; load_options(pCurrentOpts, OPTIONS_GLOBAL, driver_index); config->mconfig = global_alloc(machine_config(*drivers[driver_index],pCurrentOpts)); // allocate the hash file driver = drivers[driver_index]; while (driver) //&& (!config->hashfile)) { //config->hashfile = hashfile_open(*opts, driver->name, TRUE, error_proc); driver = driver_get_compatible(driver); } // other stuff config->driver_index = driver_index; config->gamedrv = drivers[driver_index]; return config; }
int cli_info_listcrc(core_options *options, const char *gamename) { int drvindex, count = 0; /* 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 rom_entry *region, *rom; const rom_source *source; /* iterate over sources, regions, and then ROMs within the region */ for (source = rom_first_source(drivers[drvindex], config); source != NULL; source = rom_next_source(drivers[drvindex], config, source)) for (region = rom_first_region(drivers[drvindex], source); 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++; global_free(config); } /* return an error if none found */ return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
static void match_roms(core_options *options, const char *hash, int length, int *found) { int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) { machine_config *config = global_alloc(machine_config(drivers[drvindex]->machine_config)); const rom_entry *region, *rom; const rom_source *source; /* iterate over sources, regions and files within the region */ for (source = rom_first_source(drivers[drvindex], config); source != NULL; source = rom_next_source(drivers[drvindex], config, source)) for (region = rom_first_region(drivers[drvindex], source); region; region = rom_next_region(region)) for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) if (hash_data_is_equal(hash, ROM_GETHASHDATA(rom), 0)) { int baddump = hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP); /* output information about the match */ if (*found != 0) mame_printf_info(" "); mame_printf_info("= %s%-20s %-10s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), drivers[drvindex]->name, drivers[drvindex]->description); (*found)++; } global_free(config); } softlist_match_roms( options, hash, length, found ); }
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; }
/*------------------------------------------------- softlist_match_roms - scan for a matching software ROM by hash -------------------------------------------------*/ static void softlist_match_roms(core_options *options, const char *hash, int length, int *found) { int drvindex; /* iterate over drivers */ for (drvindex = 0; drivers[drvindex] != NULL; drvindex++) { 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] ) { software_list *list = software_list_open( options, swlist->list_name[i], FALSE, NULL ); for ( software_info *swinfo = software_list_find( list, "*", NULL ); swinfo != NULL; swinfo = software_list_find( list, "*", swinfo ) ) { for ( software_part *part = software_find_part( swinfo, NULL, NULL ); part != NULL; part = software_part_next( part ) ) { for ( const rom_entry *region = part->romdata; region != NULL; region = rom_next_region(region) ) { for ( const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom) ) { if ( hash_data_is_equal(hash, ROM_GETHASHDATA(rom), 0) ) { int baddump = hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP); /* output information about the match */ if (*found != 0) mame_printf_info(" "); mame_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlist->list_name[i], swinfo->shortname, swinfo->longname); (*found)++; } } } } } software_list_close( list ); } } } global_free(config); } }
void image_add_device_options(core_options *opts, const game_driver *driver) { int index = 0; machine_config *config; const device_config_image_interface *image = NULL; /* create the configuration */ config = global_alloc(machine_config(driver->machine_config)); /* enumerate our callback for every device */ /* loop on each device instance */ for (bool gotone = config->m_devicelist.first(image); gotone; gotone = image->next(image)) { options_entry entry[2]; astring dev_full_name; /* first device? add the header as to be pretty */ if (index == 0) { memset(entry, 0, sizeof(entry)); entry[0].description = "IMAGE DEVICES"; entry[0].flags = OPTION_HEADER; options_add_entries(opts, entry); } /* retrieve info about the device instance */ dev_full_name.printf("%s;%s", image->instance_name(), image->brief_instance_name()); /* add the option */ memset(entry, 0, sizeof(entry)); entry[0].name = dev_full_name; options_add_entries(opts, entry); index++; } /* record that we've added device options */ options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE); /* free the configuration */ global_free(config); }
machine_config &driver_enumerator::config(int index, emu_options &options) const { assert(index >= 0 && index < s_driver_count); // if we don't have it cached, add it if (m_config[index] == NULL) { // if our cache is full, release the head entry if (m_config_cache.count() == CONFIG_CACHE_COUNT) { config_entry *first = m_config_cache.first(); m_config[first->index()] = NULL; m_config_cache.remove(*first); } // allocate the config and add it to the end of the list machine_config *config = m_config[index] = global_alloc(machine_config(*s_drivers_sorted[index], options)); m_config_cache.append(*global_alloc(config_entry(*config, index))); } return *m_config[index]; }
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; }
int audit_images(core_options *options, const game_driver *gamedrv, UINT32 validation, audit_record **audit) { machine_config *config = global_alloc(machine_config(gamedrv->machine_config)); const rom_entry *region, *rom; const rom_source *source; audit_record *record; int anyfound = FALSE; int anyrequired = FALSE; int allshared = TRUE; int records; /* determine the number of records we will generate */ records = 0; for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { int source_is_gamedrv = rom_source_is_gamedrv(gamedrv, source); for (region = rom_first_region(gamedrv, source); region != NULL; region = rom_next_region(region)) for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) if (ROMREGION_ISROMDATA(region) || ROMREGION_ISDISKDATA(region)) { if (source_is_gamedrv && !ROM_ISOPTIONAL(rom) && !ROM_NOGOODDUMP(rom)) { anyrequired = TRUE; if (allshared && !rom_used_by_parent(gamedrv, rom, NULL)) allshared = FALSE; } records++; } } if (records > 0) { /* allocate memory for the records */ *audit = global_alloc_array_clear(audit_record, records); record = *audit; /* iterate over ROM sources and regions */ for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { int source_is_gamedrv = rom_source_is_gamedrv(gamedrv, source); for (region = rom_first_region(gamedrv, source); region != NULL; region = rom_next_region(region)) { const char *regiontag = ROMREGION_ISLOADBYNAME(region) ? ROM_GETNAME(region) : NULL; for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { /* audit a file */ if (ROMREGION_ISROMDATA(region)) { audit_one_rom(options, rom, regiontag, gamedrv, validation, record); } /* audit a disk */ else if (ROMREGION_ISDISKDATA(region)) { audit_one_disk(options, rom, gamedrv, validation, record); } else { continue; } if (source_is_gamedrv && record->status != AUDIT_STATUS_NOT_FOUND && (allshared || !rom_used_by_parent(gamedrv, rom, NULL))) anyfound = TRUE; record++; } } } } /* if we found nothing, we don't have the set at all */ if (!anyfound && anyrequired) { global_free(*audit); *audit = NULL; records = 0; } global_free(config); return records; }
int audit_samples(core_options *options, const game_driver *gamedrv, audit_record **audit) { machine_config *config = global_alloc(machine_config(gamedrv->machine_config)); audit_record *record; int records = 0; int sampnum; /* count the number of sample records attached to this driver */ const device_config_sound_interface *sound = NULL; for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) if (sound->devconfig().type() == SOUND_SAMPLES) { const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); if (intf->samplenames != NULL) { /* iterate over samples in this entry */ for (sampnum = 0; intf->samplenames[sampnum] != NULL; sampnum++) if (intf->samplenames[sampnum][0] != '*') records++; } } /* if no records, just quit now */ if (records == 0) goto skip; /* allocate memory for the records */ *audit = global_alloc_array_clear(audit_record, records); record = *audit; /* now iterate over sample entries */ for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) if (sound->devconfig().type() == SOUND_SAMPLES) { const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); const char *sharedname = NULL; if (intf->samplenames != NULL) { /* iterate over samples in this entry */ for (sampnum = 0; intf->samplenames[sampnum] != NULL; sampnum++) if (intf->samplenames[sampnum][0] == '*') sharedname = &intf->samplenames[sampnum][1]; else { file_error filerr; mame_file *file; /* attempt to access the file from the game driver name */ astring fname(gamedrv->name, PATH_SEPARATOR, intf->samplenames[sampnum]); filerr = mame_fopen_options(options, samplepath, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); /* attempt to access the file from the shared driver name */ if (filerr != FILERR_NONE && sharedname != NULL) { fname.cpy(sharedname).cat(PATH_SEPARATOR).cat(intf->samplenames[sampnum]); filerr = mame_fopen_options(options, samplepath, fname, OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD, &file); } /* fill in the record */ record->type = AUDIT_FILE_SAMPLE; record->name = intf->samplenames[sampnum]; if (filerr == FILERR_NONE) { set_status(record++, AUDIT_STATUS_GOOD, SUBSTATUS_GOOD); mame_fclose(file); } else set_status(record++, AUDIT_STATUS_NOT_FOUND, SUBSTATUS_NOT_FOUND); } } } skip: global_free(config); return records; }
static struct DriversInfo* GetDriversInfo(int driver_index) { if (drivers_info == NULL) { int ndriver; drivers_info = (DriversInfo*)malloc(sizeof(struct DriversInfo) * GetNumGames()); for (ndriver = 0; ndriver < GetNumGames(); ndriver++) { const game_driver *gamedrv = drivers[ndriver]; struct DriversInfo *gameinfo = &drivers_info[ndriver]; const rom_entry *region, *rom; machine_config *config; const rom_source *source; int num_speakers; /* Allocate machine config */ config = global_alloc(machine_config(gamedrv->machine_config)); gameinfo->isClone = (GetParentRomSetIndex(gamedrv) != -1); gameinfo->isBroken = ((gamedrv->flags & GAME_NOT_WORKING) != 0); gameinfo->supportsSaveState = ((gamedrv->flags & GAME_SUPPORTS_SAVE) != 0); gameinfo->isHarddisk = FALSE; gameinfo->isVertical = (gamedrv->flags & ORIENTATION_SWAP_XY) ? TRUE : FALSE; for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region)) { if (ROMREGION_ISDISKDATA(region)) gameinfo->isHarddisk = TRUE; } } gameinfo->hasOptionalBIOS = FALSE; if (gamedrv->rom != NULL) { for (rom = gamedrv->rom; !ROMENTRY_ISEND(rom); rom++) { if (ROMENTRY_ISSYSTEM_BIOS(rom)) { gameinfo->hasOptionalBIOS = TRUE; break; } } } num_speakers = numberOfSpeakers(config); gameinfo->isStereo = (num_speakers > 1); gameinfo->screenCount = numberOfScreens(config); gameinfo->isVector = isDriverVector(config); // ((drv.video_attributes & VIDEO_TYPE_VECTOR) != 0); gameinfo->usesRoms = FALSE; for (source = rom_first_source(gamedrv, config); source != NULL; source = rom_next_source(gamedrv, config, source)) { for (region = rom_first_region(gamedrv, source); region; region = rom_next_region(region)) { for (rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { gameinfo->usesRoms = TRUE; break; } } } gameinfo->usesSamples = FALSE; { const device_config_sound_interface *sound; const char * const * samplenames = NULL; for (bool gotone = config->m_devicelist.first(sound); gotone; gotone = sound->next(sound)) { if (sound->devconfig().type() == SOUND_SAMPLES) { const samples_interface *intf = (const samples_interface *)sound->devconfig().static_config(); samplenames = intf->samplenames; if (samplenames != 0 && samplenames[0] != 0) { gameinfo->usesSamples = TRUE; break; } } } } gameinfo->numPlayers = 0; gameinfo->numButtons = 0; memset(gameinfo->usesController, 0, sizeof gameinfo->usesController); gameinfo->parentIndex = -1; if (gameinfo->isClone) { int i; for (i = 0; i < GetNumGames(); i++) { if (GetParentRomSetIndex(gamedrv) == i) { gameinfo->parentIndex = i; break; } } } gameinfo->biosIndex = -1; if (DriverIsBios(ndriver)) gameinfo->biosIndex = ndriver; else if (gameinfo->hasOptionalBIOS) { int parentIndex; if (gameinfo->isClone) parentIndex = gameinfo->parentIndex; else parentIndex = ndriver; while (1) { parentIndex = GetGameNameIndex(drivers[parentIndex]->parent); if (parentIndex == -1) { dprintf("bios for %s is not found", drivers[ndriver]->name); break; } if (DriverIsBios(parentIndex)) { gameinfo->biosIndex = parentIndex; break; } } } /* Free the structure */ global_free(config); gameinfo->usesTrackball = FALSE; gameinfo->usesLightGun = FALSE; if (gamedrv->ipt != NULL) { const input_port_config *port; ioport_list portlist; input_port_list_init(portlist, gamedrv->ipt, NULL, 0, FALSE); for (port = portlist.first(); port != NULL; port = port->next()) { const input_field_config *field; for (field = port->fieldlist; field != NULL; field = field->next) { UINT32 type; type = field->type; if (type == IPT_END) break; if (type == IPT_DIAL || type == IPT_PADDLE || type == IPT_TRACKBALL_X || type == IPT_TRACKBALL_Y || type == IPT_AD_STICK_X || type == IPT_AD_STICK_Y) gameinfo->usesTrackball = TRUE; if (type == IPT_LIGHTGUN_X || type == IPT_LIGHTGUN_Y) gameinfo->usesLightGun = TRUE; if (type == IPT_MOUSE_X || type == IPT_MOUSE_Y) gameinfo->usesMouse = TRUE; } } } } UpdateController(); } return &drivers_info[driver_index]; }
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; }
int cli_info_listroms(core_options *options, const char *gamename) { int drvindex, count = 0; /* 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 rom_entry *region, *rom; const rom_source *source; /* 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 sources, regions and then ROMs within the region */ for (source = rom_first_source(drivers[drvindex], config); source != NULL; source = rom_next_source(drivers[drvindex], config, source)) for (region = rom_first_region(drivers[drvindex], source); region != NULL; region = rom_next_region(region)) for (rom = rom_first_file(region); rom != NULL; 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 = rom_file_size(rom); /* 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++; global_free(config); } return (count > 0) ? MAMERR_NONE : MAMERR_NO_SUCH_GAME; }
} hw; struct { Bitu rate; Bit8u buf[TDAC_DMA_BUFSIZE]; Bit8u last_sample; DmaChannel * chan; bool transfer_done; } dma; Bit8u mode,control; Bit16u frequency; Bit8u amplitude; bool irq_activated; } dac; } tandy; static sn76496_device device_sn76496(machine_config(), 0, 0, SOUND_CLOCK ); static ncr8496_device device_ncr8496(machine_config(), 0, 0, SOUND_CLOCK); static sn76496_base_device* activeDevice = &device_ncr8496; #define device (*activeDevice) static void SN76496Write(Bitu /*port*/,Bitu data,Bitu /*iolen*/) { tandy.last_write=PIC_Ticks; if (!tandy.enabled) { tandy.chan->Enable(true); tandy.enabled=true; } device.write(data); // LOG_MSG("3voice write %X at time %7.3f",data,PIC_FullIndex()); }