本文整理汇总了C++中rom_next_region函数的典型用法代码示例。如果您正苦于以下问题:C++ rom_next_region函数的具体用法?C++ rom_next_region怎么用?C++ rom_next_region使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rom_next_region函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_cartridge
static int process_cartridge(device_image_interface *image, process_mode mode)
{
const rom_source *source;
const rom_entry *romrgn, *roment;
int result = 0;
for (source = rom_first_source(image->device().machine().config()); source != NULL; source = rom_next_source(*source))
{
for (romrgn = rom_first_region(*source); romrgn != NULL; romrgn = rom_next_region(romrgn))
{
roment = romrgn + 1;
while(!ROMENTRY_ISREGIONEND(roment))
{
if (ROMENTRY_GETTYPE(roment) == ROMENTRYTYPE_CARTRIDGE)
{
astring regiontag;
image->device().siblingtag(regiontag, roment->_hashdata);
if (strcmp(regiontag.cstr(),image->device().tag())==0)
{
result |= load_cartridge(image, romrgn, roment, mode);
/* if loading failed in any cart region, stop loading */
if (result)
return result;
}
}
roment++;
}
}
}
return IMAGE_INIT_PASS;
}
示例2: 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 );
}
示例3: process_cartridge
static int process_cartridge(mess_image *image, mame_file *file)
{
const rom_entry *romrgn, *roment;
int position, result;
romrgn = rom_first_region(Machine->gamedrv);
while(romrgn)
{
roment = romrgn + 1;
while(!ROMENTRY_ISREGIONEND(roment))
{
if (is_cart_roment(roment))
{
parse_rom_name(roment, &position, NULL);
if (position == image_index_in_device(image))
{
result = load_cartridge(romrgn, roment, file);
if (!result)
return result;
}
}
roment++;
}
romrgn = rom_next_region(romrgn);
}
return INIT_PASS;
}
示例4: 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] != 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: DriverIsHarddisk
BOOL DriverIsHarddisk(int driver_index)
{
const struct RomModule *region;
const struct GameDriver *gamedrv = drivers[driver_index];
for (region = rom_first_region(gamedrv); region; region = rom_next_region(region))
if (ROMREGION_ISDISKDATA(region))
return TRUE;
return FALSE;
}
示例8: 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;
}
示例9: 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 != NULL; 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 = NULL;
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 != NULL && (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());
}
示例10: 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");
}
}
}
示例11: 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);
}
}
示例12: 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 = 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 ((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 != 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 ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name))
highest_device = scandevice;
}
}
}
return highest_device;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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);
}
}