本文整理汇总了C++中rom_next_file函数的典型用法代码示例。如果您正苦于以下问题:C++ rom_next_file函数的具体用法?C++ rom_next_file怎么用?C++ rom_next_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rom_next_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: audit_images
int audit_images(int game, UINT32 validation, audit_record **audit)
{
const game_driver *gamedrv = drivers[game];
const rom_entry *region, *rom;
audit_record *record;
int foundany = FALSE;
int allshared = TRUE;
int records;
/* determine the number of records we will generate */
records = 0;
for (region = rom_first_region(gamedrv); 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 (allshared && !rom_used_by_parent(gamedrv, rom, NULL))
allshared = FALSE;
records++;
}
if (records > 0)
{
/* allocate memory for the records */
*audit = malloc_or_die(sizeof(**audit) * records);
memset(*audit, 0, sizeof(**audit) * records);
record = *audit;
/* iterate over regions and ROMs */
for (region = rom_first_region(drivers[game]); region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
int shared = rom_used_by_parent(gamedrv, rom, NULL);
/* audit a file */
if (ROMREGION_ISROMDATA(region))
{
if (audit_one_rom(rom, gamedrv, validation, record++) && (!shared || allshared))
foundany = TRUE;
}
/* audit a disk */
else if (ROMREGION_ISDISKDATA(region))
{
if (audit_one_disk(rom, gamedrv, validation, record++) && (!shared || allshared))
foundany = TRUE;
}
}
/* if we found nothing, we don't have the set at all */
if (!foundany)
{
free(*audit);
*audit = NULL;
records = 0;
}
}
return records;
}
示例2: cli_info_listcrc
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;
}
示例3: match_roms
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 );
}
示例4: DriverUsesRoms
BOOL DriverUsesRoms(int driver_index)
{
const struct GameDriver *gamedrv = drivers[driver_index];
const struct RomModule *region, *rom;
for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
return TRUE;
return FALSE;
}
示例5: audit_is_rom_used
/* returns 1 if rom is defined in this set */
int audit_is_rom_used (const game_driver *gamedrv, const char* hash)
{
const rom_entry *region, *rom;
for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
/* Compare all the available checksums */
if (hash_data_is_equal(ROM_GETHASHDATA(rom), hash, 0))
return 1;
return 0;
}
示例6: RomInSet
/* returns 1 if rom is defined in this set */
int RomInSet (const struct GameDriver *gamedrv, const char* hash)
{
const struct RomModule *region, *rom;
for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
/* Compare all the available checksums */
if (hash_data_is_equal(ROM_GETHASHDATA(rom), hash, 0))
return 1;
return 0;
}
示例7: hashes
device_t *media_auditor::find_shared_device(device_t &device, const hash_collection &romhashes, UINT64 romlength)
{
// doesn't apply to NO_DUMP items
if (romhashes.flag(hash_collection::FLAG_NO_DUMP))
return NULL;
// special case for non-root devices
device_t *highest_device = NULL;
if (device.owner() != NULL)
{
for (const rom_entry *region = rom_first_region(device); region != NULL; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if (hashes == romhashes)
highest_device = &device;
}
}
else
{
// iterate up the parent chain
for (int drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex != -1; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent))
{
device_iterator deviter(m_enumerator.config(drvindex).root_device());
for (device_t *scandevice = deviter.first(); scandevice != NULL; scandevice = deviter.next())
for (const rom_entry *region = rom_first_region(*scandevice); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if (hashes == romhashes)
highest_device = scandevice;
}
}
}
return highest_device;
}
示例8: audit_device
media_auditor::summary media_auditor::audit_device(device_t *device, const char *validation)
{
// start fresh
m_record_list.reset();
// store validation for later
m_validation = validation;
m_searchpath = device->shortname();
int found = 0;
int required = 0;
// now iterate over regions and ROMs within
for (const rom_entry *region = rom_first_region(*device); region != nullptr; region = rom_next_region(region))
{
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
hash_collection hashes(ROM_GETHASHDATA(rom));
// count the number of files with hashes
if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom))
{
required++;
}
// audit a file
audit_record *record = nullptr;
if (ROMREGION_ISROMDATA(region))
record = audit_one_rom(rom);
// audit a disk
else if (ROMREGION_ISDISKDATA(region))
record = audit_one_disk(rom);
// count the number of files that are found.
if (record != nullptr && (record->status() == audit_record::STATUS_GOOD || record->status() == audit_record::STATUS_FOUND_INVALID))
{
found++;
}
}
}
if (found == 0 && required > 0)
{
m_record_list.reset();
return NOTFOUND;
}
// return a summary
return summarize(device->shortname());
}
示例9: printromlist
void printromlist(const struct RomModule *romp,const char *basename)
{
const struct RomModule *region, *rom, *chunk;
char buf[512];
if (!romp) return;
#ifdef MESS
if (!strcmp(basename,"nes")) return;
#endif
printf("This is the list of the ROMs required for driver \"%s\".\n"
"Name Size Checksum\n",basename);
for (region = romp; 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);
int length = -1; /* default is for disks! */
if (ROMREGION_ISROMDATA(region))
{
length = 0;
for (chunk = rom_first_chunk(rom); chunk; chunk = rom_next_chunk(chunk))
length += ROM_GETLENGTH(chunk);
}
printf("%-12s ", name);
if (length >= 0)
printf("%7d",length);
else
printf(" ");
if (!hash_data_has_info(hash, HASH_INFO_NO_DUMP))
{
if (hash_data_has_info(hash, HASH_INFO_BAD_DUMP))
printf(" BAD");
hash_data_print(hash, 0, buf);
printf(" %s", buf);
}
else
printf(" NO GOOD DUMP KNOWN");
printf("\n");
}
}
}
示例10: softlist_match_roms
/*-------------------------------------------------
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);
}
}
示例11: hashes
device_t *media_auditor::find_shared_device(device_t &device, const char *name, const hash_collection &romhashes, UINT64 romlength)
{
bool dumped = !romhashes.flag(hash_collection::FLAG_NO_DUMP);
// special case for non-root devices
device_t *highest_device = nullptr;
if (device.owner() != nullptr)
{
for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom != nullptr; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
highest_device = &device;
}
}
else
{
// iterate up the parent chain
for (int drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex != -1; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent))
{
device_iterator deviter(m_enumerator.config(drvindex).root_device());
for (device_t *scandevice = deviter.first(); scandevice != nullptr; scandevice = deviter.next())
for (const rom_entry *region = rom_first_region(*scandevice); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (ROM_GETLENGTH(rom) == romlength)
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
highest_device = scandevice;
}
}
}
return highest_device;
}
示例12: count_roms
static int count_roms(const struct RomModule *romp)
{
const struct RomModule *region, *rom;
int count = 0;
/* determine the correct biosset to load based on options.bios string */
int this_bios = determine_bios_rom(Machine->gamedrv->bios);
/* loop over regions, then over files */
for (region = romp; region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (!ROM_GETBIOSFLAGS(romp) || (ROM_GETBIOSFLAGS(romp) == (this_bios+1))) /* alternate bios sets */
count++;
/* return the total count */
return count;
}
示例13: also_used_by_parent
int media_auditor::also_used_by_parent(const hash_collection &romhashes)
{
// iterate up the parent chain
for (int drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex != -1; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent))
// see if the parent has the same ROM or not
for (const rom_source *source = rom_first_source(m_enumerator.config(drvindex)); source != NULL; source = rom_next_source(*source))
for (const rom_entry *region = rom_first_region(*source); region; region = rom_next_region(region))
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{
hash_collection hashes(ROM_GETHASHDATA(rom));
if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && hashes == romhashes)
return drvindex;
}
// nope, return -1
return -1;
}
示例14: count_roms
static void count_roms(romload_private *romdata)
{
const rom_entry *region, *rom;
/* start with 0 */
romdata->romstotal = 0;
romdata->romstotalsize = 0;
/* loop over regions, then over files */
device_iterator deviter(romdata->machine().config().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
if (ROM_GETBIOSFLAGS(rom) == 0 || ROM_GETBIOSFLAGS(rom) == device->system_bios())
{
romdata->romstotal++;
romdata->romstotalsize += rom_file_size(rom);
}
}
示例15: phashes
const char *info_xml_creator::get_merge_name(const hash_collection &romhashes)
{
const char *merge_name = NULL;
// walk the parent chain
for (int clone_of = m_drivlist.find(m_drivlist.driver().parent); clone_of != -1; clone_of = m_drivlist.find(m_drivlist.driver(clone_of).parent))
// look in the parent's ROMs
for (const rom_source *psource = rom_first_source(m_drivlist.config(clone_of,m_lookup_options)); psource != NULL; psource = rom_next_source(*psource))
for (const rom_entry *pregion = rom_first_region(*psource); pregion != NULL; pregion = rom_next_region(pregion))
for (const rom_entry *prom = rom_first_file(pregion); prom != NULL; prom = rom_next_file(prom))
{
hash_collection phashes(ROM_GETHASHDATA(prom));
if (!phashes.flag(hash_collection::FLAG_NO_DUMP) && romhashes == phashes)
{
// stop when we find a match
merge_name = ROM_GETNAME(prom);
break;
}
}
return merge_name;
}