本文整理汇总了C++中rom_first_region函数的典型用法代码示例。如果您正苦于以下问题:C++ rom_first_region函数的具体用法?C++ rom_first_region怎么用?C++ rom_first_region使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rom_first_region函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:shangma,项目名称:mame0112,代码行数:58,代码来源:audit.c
示例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));
}
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:58,代码来源:romload.c
示例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;
}
开发者ID:cdenix,项目名称:ps3-mame-0125,代码行数:27,代码来源:clifront.c
示例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;
}
开发者ID:CrouchingLlama,项目名称:openlase-mame,代码行数:27,代码来源:cartslot.c
示例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 );
}
开发者ID:DarrenBranford,项目名称:MAME4iOS,代码行数:31,代码来源:clifront.c
示例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;
}
开发者ID:cdenix,项目名称:psmame,代码行数:31,代码来源:cartslot.c
示例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;
}
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:32,代码来源:cartslot.c
示例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;
}
开发者ID:Sunoo,项目名称:nonamemame,代码行数:10,代码来源:m32util.c
示例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;
}
开发者ID:Sunoo,项目名称:nonamemame,代码行数:13,代码来源:audit.c
示例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;
}
开发者ID:BirchJD,项目名称:advancemame-0.106.1-RPi,代码行数:13,代码来源:audit.c
示例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;
}
开发者ID:Sunoo,项目名称:nonamemame,代码行数:12,代码来源:m32util.c
示例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;
}
开发者ID:risico,项目名称:jsmess,代码行数:39,代码来源:audit.c
示例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());
}
开发者ID:RJRetro,项目名称:mame,代码行数:51,代码来源:audit.cpp
示例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;
}
开发者ID:RJRetro,项目名称:mame,代码行数:37,代码来源:audit.cpp
示例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;
}
开发者ID:lidibupa,项目名称:ClientServerMAME,代码行数:18,代码来源:audit.c
示例16: 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);
}
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:19,代码来源:romload.c
示例17: 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;
}
开发者ID:LibXenonProject,项目名称:mame-lx,代码行数:22,代码来源:info.c
示例18: open_disk_image
chd_error open_disk_image(const game_driver *gamedrv, const rom_entry *romp, chd_file **image)
{
const game_driver *drv;
const rom_entry *region, *rom;
const char *fname;
chd_error err;
/* attempt to open the properly named file */
fname = assemble_2_strings(ROM_GETNAME(romp), ".chd");
err = chd_open(fname, CHD_OPEN_READ, NULL, image);
free((void *)fname);
/* if that worked, we're done */
if (err == CHDERR_NONE)
return err;
/* otherwise, look at our parents for a CHD with an identical checksum */
/* and try to open that */
for (drv = gamedrv; drv != NULL; drv = driver_get_clone(drv))
for (region = rom_first_region(drv); region != NULL; region = rom_next_region(region))
if (ROMREGION_ISDISKDATA(region))
for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
/* look for a differing name but with the same hash data */
if (strcmp(ROM_GETNAME(romp), ROM_GETNAME(rom)) != 0 &&
hash_data_is_equal(ROM_GETHASHDATA(romp), ROM_GETHASHDATA(rom), 0))
{
fname = assemble_2_strings(ROM_GETNAME(rom), ".chd");
err = chd_open(fname, CHD_OPEN_READ, NULL, image);
free((void *)fname);
/* if that worked, we're done */
if (err == CHDERR_NONE)
return err;
}
return err;
}
开发者ID:broftkd,项目名称:historic-mess,代码行数:38,代码来源:romload.c
示例19: match_roms
/* Identifies a rom from from this checksum */
static void match_roms(const struct GameDriver *driver,const char* hash,int *found)
{
const struct RomModule *region, *rom;
for (region = rom_first_region(driver); 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))
{
char baddump = hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP);
if (!silentident)
{
if (*found != 0)
fprintf(stdout_file, " ");
fprintf(stdout_file, "= %s%-12s %s\n",baddump ? "(BAD) " : "",ROM_GETNAME(rom),driver->description);
}
(*found)++;
}
}
}
}
开发者ID:CarnyPriest,项目名称:SAMbuild,代码行数:24,代码来源:ident.c
示例20: match_roms
static void match_roms(const char *hash, int length, int *found)
{
int drvindex;
/* iterate over drivers */
for (drvindex = 0; drivers[drvindex]; drvindex++)
{
const rom_entry *region, *rom;
/* iterate over regions and files 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))
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\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), drivers[drvindex]->description);
(*found)++;
}
}
}
开发者ID:cdenix,项目名称:ps3-mame-0125,代码行数:24,代码来源:clifront.c
注:本文中的rom_first_region函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论