本文整理汇总了C++中ROM_GETHASHDATA函数的典型用法代码示例。如果您正苦于以下问题:C++ ROM_GETHASHDATA函数的具体用法?C++ ROM_GETHASHDATA怎么用?C++ ROM_GETHASHDATA使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROM_GETHASHDATA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hashes
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());
}
示例2: 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;
}
示例3: 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)++;
}
}
}
}
示例4: 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");
}
}
}
示例5: 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;
}
示例6: rom_used_by_parent
static int rom_used_by_parent(const game_driver *gamedrv, const rom_entry *romentry, const game_driver **parent)
{
const char *hash = ROM_GETHASHDATA(romentry);
const game_driver *drv;
/* iterate up the parent chain */
for (drv = driver_get_clone(gamedrv); drv != NULL; drv = driver_get_clone(drv))
{
const rom_entry *region;
const rom_entry *rom;
/* see if the parent has the same ROM or not */
for (region = rom_first_region(drv, NULL); region; region = rom_next_region(region))
for (rom = rom_first_file(region); rom; rom = rom_next_file(rom))
if (hash_data_is_equal(ROM_GETHASHDATA(rom), hash, 0))
{
if (parent != NULL)
*parent = drv;
return TRUE;
}
}
return FALSE;
}
示例7: 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)++;
}
}
}
示例8: fill_rom_data
static void fill_rom_data(romload_private *romdata, const rom_entry *romp)
{
UINT32 numbytes = ROM_GETLENGTH(romp);
UINT8 *base = romdata->region->base() + ROM_GETOFFSET(romp);
/* make sure we fill within the region space */
if (ROM_GETOFFSET(romp) + numbytes > romdata->region->bytes())
fatalerror("Error in RomModule definition: FILL out of memory region space\n");
/* make sure the length was valid */
if (numbytes == 0)
fatalerror("Error in RomModule definition: FILL has an invalid length\n");
/* fill the data (filling value is stored in place of the hashdata) */
memset(base, (FPTR)ROM_GETHASHDATA(romp) & 0xff, numbytes);
}
示例9: hashes
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;
}
示例10: lstrcpy
STDMETHODIMP CRom::Audit(VARIANT_BOOL fStrict)
{
int err;
char szHash[256];
lstrcpy(szHash, fStrict?"":ROM_GETHASHDATA(m_rom));
/* obtain CRC-32 and length of ROM file */
const struct GameDriver *drv = m_gamedrv;
do
{
err = mame_fchecksum(drv->name, m_pszName, (unsigned int*) &m_dwLength, szHash);
drv = drv->clone_of;
} while (err && drv);
if (err)
{
if (!m_dwChecksum)
/* not found but it's not good anyway */
m_dwState = AUD_NOT_AVAILABLE;
else
/* not found */
m_dwState = AUD_ROM_NOT_FOUND;
}
else {
m_dwChecksum = GetChecksumFromHash(szHash);
/* all cases below assume the ROM was at least found */
if (m_dwExpLength != m_dwLength)
m_dwState = AUD_LENGTH_MISMATCH;
else if (m_dwExpChecksum != m_dwChecksum)
{
if (!m_dwExpChecksum)
m_dwState = AUD_ROM_NEED_DUMP; /* new case - found but not known to be dumped */
else if (m_dwChecksum == BADCRC(m_dwExpChecksum))
m_dwState = AUD_ROM_NEED_REDUMP;
else
m_dwState = AUD_BAD_CHECKSUM;
}
else
m_dwState = AUD_ROM_GOOD;
}
return S_OK;
}
示例11: open_rom_file
static int open_rom_file(struct rom_load_data *romdata, const struct RomModule *romp)
{
const struct GameDriver *drv;
++romdata->romsloaded;
/* update status display */
if (osd_display_loading_rom_message(ROM_GETNAME(romp), romdata))
return 0;
/* Attempt reading up the chain through the parents. It automatically also
attempts any kind of load by checksum supported by the archives. */
romdata->file = NULL;
for (drv = Machine->gamedrv; !romdata->file && drv; drv = drv->clone_of)
if (drv->name && *drv->name)
romdata->file = mame_fopen_rom(drv->name, ROM_GETNAME(romp), ROM_GETHASHDATA(romp));
/* return the result */
return (romdata->file != NULL);
}
示例12: copy_rom_data
static int copy_rom_data(struct rom_load_data *romdata, const struct RomModule *romp)
{
UINT8 *base = romdata->regionbase + ROM_GETOFFSET(romp);
int srcregion = ROM_GETFLAGS(romp) >> 24;
UINT32 numbytes = ROM_GETLENGTH(romp);
UINT32 srcoffs = (UINT32)ROM_GETHASHDATA(romp); /* srcoffset in place of hashdata */
UINT8 *srcbase;
/* make sure we copy within the region space */
if (ROM_GETOFFSET(romp) + numbytes > romdata->regionlength)
{
printf("Error in RomModule definition: COPY out of target memory region space\n");
return 0;
}
/* make sure the length was valid */
if (numbytes == 0)
{
printf("Error in RomModule definition: COPY has an invalid length\n");
return 0;
}
/* make sure the source was valid */
srcbase = memory_region(srcregion);
if (!srcbase)
{
printf("Error in RomModule definition: COPY from an invalid region\n");
return 0;
}
/* make sure we find within the region space */
if (srcoffs + numbytes > memory_region_length(srcregion))
{
printf("Error in RomModule definition: COPY out of source memory region space\n");
return 0;
}
/* fill the data */
memcpy(base, srcbase + srcoffs, numbytes);
return 1;
}
示例13: while
/*-------------------------------------------------
load_software - software image loading
-------------------------------------------------*/
bool legacy_image_device_base::load_software(char *swlist, char *swname, rom_entry *start)
{
const rom_entry *region;
astring regiontag;
bool retVal = FALSE;
for (region = start; region != NULL; region = rom_next_region(region))
{
/* loop until we hit the end of this region */
const rom_entry *romp = region + 1;
while (!ROMENTRY_ISREGIONEND(romp))
{
/* handle files */
if (ROMENTRY_ISFILE(romp))
{
UINT32 crc = 0;
UINT8 crcbytes[4];
file_error filerr;
bool has_crc = hash_data_extract_binary_checksum(ROM_GETHASHDATA(romp), HASH_CRC, crcbytes);
if (has_crc)
crc = (crcbytes[0] << 24) | (crcbytes[1] << 16) | (crcbytes[2] << 8) | crcbytes[3];
astring fname(swlist, PATH_SEPARATOR, swname, PATH_SEPARATOR, ROM_GETNAME(romp));
if (has_crc)
filerr = mame_fopen_crc(libretro_content_directory, fname, crc, OPEN_FLAG_READ, &m_mame_file);
else
filerr = mame_fopen(libretro_content_directory, fname, OPEN_FLAG_READ, &m_mame_file);
if (filerr == FILERR_NONE)
{
m_file = mame_core_file(m_mame_file);
retVal = TRUE;
}
break; // load first item for start
}
romp++; /* something else; skip */
}
}
return retVal;
}
示例14: deviter
void ui_menu_bios_selection::populate()
{
/* cycle through all devices for this system */
device_iterator deviter(machine().root_device());
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
{
if (device->rom_region()) {
const char *val = "default";
for (const rom_entry *rom = device->rom_region(); !ROMENTRY_ISEND(rom); rom++)
{
if (ROMENTRY_ISSYSTEM_BIOS(rom) && ROM_GETBIOSFLAGS(rom)==device->system_bios())
{
val = ROM_GETHASHDATA(rom);
}
}
item_append(strcmp(device->tag(),":")==0 ? "driver" : device->tag()+1, val, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)device);
}
}
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
item_append(_("Reset"), nullptr, 0, (void *)1);
}
示例15: name
void rom_load_manager::handle_missing_file(const rom_entry *romp, std::string tried_file_names, chd_error chderr)
{
if(tried_file_names.length() != 0)
tried_file_names = " (tried in " + tried_file_names + ")";
std::string name(ROM_GETNAME(romp));
bool is_chd = (chderr != CHDERR_NONE);
if (is_chd)
name += ".chd";
bool is_chd_error = (is_chd && chderr != CHDERR_FILE_NOT_FOUND);
if (is_chd_error)
strcatprintf(m_errorstring, "%s CHD ERROR: %s\n", name.c_str(), chd_file::error_string(chderr));
/* optional files are okay */
if (ROM_ISOPTIONAL(romp))
{
if (!is_chd_error)
strcatprintf(m_errorstring, "OPTIONAL %s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str());
m_warnings++;
}
/* no good dumps are okay */
else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP))
{
if (!is_chd_error)
strcatprintf(m_errorstring, "%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.c_str(), tried_file_names.c_str());
m_knownbad++;
}
/* anything else is bad */
else
{
if (!is_chd_error)
strcatprintf(m_errorstring, "%s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str());
m_errors++;
}
}