本文整理汇总了C++中rom_first_region函数的典型用法代码示例。如果您正苦于以下问题:C++ rom_first_region函数的具体用法?C++ rom_first_region怎么用?C++ rom_first_region使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rom_first_region函数的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: process_region_list
static void process_region_list(romload_private *romdata)
{
astring regiontag;
/* loop until we hit the end */
device_iterator deviter(romdata->machine().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
{
UINT32 regionlength = ROMREGION_GETLENGTH(region);
rom_region_name(regiontag, *device, region);
LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength));
/* the first entry must be a region */
assert(ROMENTRY_ISREGION(region));
if (ROMREGION_ISROMDATA(region))
{
/* if this is a device region, override with the device width and endianness */
UINT8 width = ROMREGION_GETWIDTH(region) / 8;
endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE;
if (romdata->machine().device(regiontag) != NULL)
normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
/* remember the base and length */
romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
/* clear the region if it's requested */
if (ROMREGION_ISERASE(region))
memset(romdata->region->base(), ROMREGION_GETERASEVAL(region), romdata->region->bytes());
/* or if it's sufficiently small (<= 4MB) */
else if (romdata->region->bytes() <= 0x400000)
memset(romdata->region->base(), 0, romdata->region->bytes());
#ifdef MAME_DEBUG
/* if we're debugging, fill region with random data to catch errors */
else
fill_random(romdata->machine(), romdata->region->base(), romdata->region->bytes());
#endif
/* now process the entries in the region */
process_rom_entries(romdata, device->shortname(), region, region + 1, device, FALSE);
}
else if (ROMREGION_ISDISKDATA(region))
process_disk_entries(romdata, regiontag, region, region + 1, NULL);
}
/* now go back and post-process all the regions */
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region))
{
rom_region_name(regiontag, *device, region);
region_post_process(romdata, regiontag, ROMREGION_ISINVERTED(region));
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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 );
}
示例6: 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)
{
if (strcmp(roment->_hashdata,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;
}
示例7: deviter
int cartslot_image_device::process_cartridge(bool load)
{
const rom_entry *romrgn, *roment;
int result = 0;
device_iterator deviter(device().mconfig().root_device());
for (device_t *device = deviter.first(); device != NULL; device = deviter.next())
for (romrgn = rom_first_region(*device); romrgn != NULL; romrgn = rom_next_region(romrgn))
{
roment = romrgn + 1;
while(!ROMENTRY_ISREGIONEND(roment))
{
if (ROMENTRY_GETTYPE(roment) == ROMENTRYTYPE_CARTRIDGE)
{
astring regiontag;
this->device().siblingtag(regiontag, roment->_hashdata);
if (strcmp(regiontag.cstr(),this->device().tag())==0)
{
result |= load_cartridge(romrgn, roment, load);
/* if loading failed in any cart region, stop loading */
if (result)
return result;
}
}
roment++;
}
}
return IMAGE_INIT_PASS;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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());
}
示例14: 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;
}
示例15: 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;
}