static int image_checkhash(mess_image *image) { const game_driver *drv; const struct IODevice *dev; mame_file *file; char hash_string[HASH_BUF_SIZE]; int rc; /* this call should not be made when the image is not loaded */ assert(image->status & (IMAGE_STATUS_ISLOADING | IMAGE_STATUS_ISLOADED)); /* only calculate CRC if it hasn't been calculated, and the open_mode is read only */ if (!image->hash && !image->writeable && !image->created) { /* initialize key variables */ file = image_fp(image); dev = image_device(image); /* do not cause a linear read of 600 megs please */ /* TODO: use SHA/MD5 in the CHD header as the hash */ if (dev->type == IO_CDROM) return FALSE; if (!run_hash(file, dev->partialhash, hash_string, HASH_CRC | HASH_MD5 | HASH_SHA1)) return FALSE; image->hash = image_strdup(image, hash_string); if (!image->hash) return FALSE; /* now read the hash file */ drv = Machine->gamedrv; do { rc = read_hash_config(drv->name, image); drv = mess_next_compatible_driver(drv); } while(rc && drv); } return TRUE; }
void device_image_interface::image_checkhash() { device_image_partialhash_func partialhash; /* only calculate CRC if it hasn't been calculated, and the open_mode is read only */ if (m_hash.first() == NULL && m_readonly && !m_created) { /* do not cause a linear read of 600 megs please */ /* TODO: use SHA1 in the CHD header as the hash */ if (image_type() == IO_CDROM) return; /* Skip calculating the hash when we have an image mounted through a software list */ if ( m_software_info_ptr ) return; /* retrieve the partial hash func */ partialhash = get_partial_hash(); run_hash(partialhash, m_hash, hash_collection::HASH_TYPES_ALL); } return; }
void device_image_interface::image_checkhash() { device_image_partialhash_func partialhash; // only calculate CRC if it hasn't been calculated, and the open_mode is read only UINT32 crcval; if (!m_hash.crc(crcval) && is_readonly() && !m_created) { // do not cause a linear read of 600 megs please // TODO: use SHA1 in the CHD header as the hash if (image_type() == IO_CDROM) return; // Skip calculating the hash when we have an image mounted through a software list if ( m_software_info_ptr ) return; // retrieve the partial hash func partialhash = get_partial_hash(); run_hash(partialhash, m_hash, util::hash_collection::HASH_TYPES_ALL); } return; }
static PyObject *hashtext_new(PyObject *self, PyObject *args) { return run_hash(args, hash_new_hashtext); }
static PyObject *hashtext_old(PyObject *self, PyObject *args) { return run_hash(args, hash_old_hashtext); }