本文整理汇总了C++中hash_collection类的典型用法代码示例。如果您正苦于以下问题:C++ hash_collection类的具体用法?C++ hash_collection怎么用?C++ hash_collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了hash_collection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: verify_length_and_hash
static int verify_length_and_hash(emu_file *file, const char *name, UINT32 explength, const hash_collection &hashes)
{
int retVal = 0;
if (file==NULL) return 0;
/* verify length */
UINT32 actlength = file->size();
if (explength != actlength)
{
mame_printf_error("%s WRONG LENGTH (expected: %d found: %d)\n", name, explength, actlength);
retVal++;
}
/* If there is no good dump known, write it */
astring tempstr;
hash_collection &acthashes = file->hashes(hashes.hash_types(tempstr));
if (hashes.flag(hash_collection::FLAG_NO_DUMP))
{
mame_printf_error("%s NO GOOD DUMP KNOWN\n", name);
}
/* verify checksums */
else if (hashes != acthashes)
{
/* otherwise, it's just bad */
mame_printf_error("%s WRONG CHECKSUMS:\n", name);
dump_wrong_and_correct_checksums(hashes, acthashes);
retVal++;
}
/* If it matches, but it is actually a bad dump, write it */
else if (hashes.flag(hash_collection::FLAG_BAD_DUMP))
{
mame_printf_error("%s NEEDS REDUMP\n",name);
}
return retVal;
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:35,代码来源:diimage.c
示例2: run_hash
void device_image_interface::run_hash(void (*partialhash)(hash_collection &, const unsigned char *, unsigned long, const char *),
hash_collection &hashes, const char *types)
{
UINT32 size;
UINT8 *buf = NULL;
hashes.reset();
size = (UINT32) length();
buf = (UINT8*)malloc(size);
memset(buf,0,size);
/* read the file */
fseek(0, SEEK_SET);
fread(buf, size);
if (partialhash)
partialhash(hashes, buf, size, types);
else
hashes.compute(buf, size, types);
/* cleanup */
free(buf);
fseek(0, SEEK_SET);
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:25,代码来源:diimage.c
示例3: pce_partialhash
INPUT_PORTS_END
static void pce_partialhash(hash_collection &dest, const unsigned char *data,
unsigned long length, const char *functions)
{
if ( ( length <= PCE_HEADER_SIZE ) || ( length & PCE_HEADER_SIZE ) ) {
dest.compute(&data[PCE_HEADER_SIZE], length - PCE_HEADER_SIZE, functions);
} else {
dest.compute(data, length, functions);
}
}
开发者ID:clobber,项目名称:UME,代码行数:12,代码来源:pce.c
示例4: Absolute
/* Header format
0 Header version - 1 byte
1..16 "ATARI7800 " - 16 bytes
17..48 Cart title - 32 bytes
49..52 data length - 4 bytes
53..54 cart type - 2 bytes
bit 0 0x01 - pokey cart
bit 1 0x02 - supercart bank switched
bit 2 0x04 - supercart RAM at $4000
bit 3 0x08 - additional state->m_ROM at $4000
bit 8-15 - Special
0 = Normal cart
1 = Absolute (F18 Hornet)
2 = Activision
55 controller 1 type - 1 byte
56 controller 2 type - 1 byte
0 = None
1 = Joystick
2 = Light Gun
57 0 = NTSC/1 = PAL
100..127 "ACTUAL CART DATA STARTS HERE" - 28 bytes
Versions:
Version 0: Initial release
Version 1: Added PAL/NTSC bit. Added Special cart byte.
Changed 53 bit 2, added bit 3
*/
void a7800_partialhash(hash_collection &dest, const unsigned char *data,
unsigned long length, const char *functions)
{
if (length <= 128)
return;
dest.compute(&data[128], length - 128, functions);
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:38,代码来源:a7800.c
示例5: copyfrom
void hash_collection::copyfrom(const hash_collection &src)
{
// copy flags directly
m_flags = src.m_flags;
// rebuild the hashlist by copying from the source
m_hashlist.reset();
for (hash_base *hash = src.first(); hash != NULL; hash = hash->next())
add_from_buffer(hash->id(), hash->buffer(), hash->length());
}
开发者ID:bdidier,项目名称:MAME-OS-X,代码行数:10,代码来源:hash.c
示例6: device_compute_hash
void device_image_interface::device_compute_hash(hash_collection &hashes, const void *data, size_t length, const char *types) const
{
/* retrieve the partial hash func */
device_image_partialhash_func partialhash = get_partial_hash();
/* compute the hash */
if (partialhash)
partialhash(hashes, (const unsigned char*)data, length, types);
else
hashes.compute(reinterpret_cast<const UINT8 *>(data), length, types);
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:11,代码来源:diimage.c
示例7: run_hash
void device_image_interface::run_hash(void (*partialhash)(hash_collection &, const unsigned char *, unsigned long, const char *),
hash_collection &hashes, const char *types)
{
UINT32 size;
dynamic_buffer buf;
hashes.reset();
size = (UINT32) length();
buf.resize_and_clear(size);
/* read the file */
fseek(0, SEEK_SET);
fread(buf, size);
if (partialhash)
partialhash(hashes, buf, size, types);
else
hashes.compute(buf, size, types);
/* cleanup */
fseek(0, SEEK_SET);
}
开发者ID:Eduardop,项目名称:mame,代码行数:23,代码来源:diimage.c
示例8: verify_length_and_hash
static void verify_length_and_hash(romload_private *romdata, const char *name, UINT32 explength, const hash_collection &hashes)
{
/* we've already complained if there is no file */
if (romdata->file == NULL)
return;
/* verify length */
UINT32 actlength = romdata->file->size();
if (explength != actlength)
{
romdata->errorstring.catprintf("%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength);
romdata->warnings++;
}
/* If there is no good dump known, write it */
astring tempstr;
hash_collection &acthashes = romdata->file->hashes(hashes.hash_types(tempstr));
if (hashes.flag(hash_collection::FLAG_NO_DUMP))
{
romdata->errorstring.catprintf("%s NO GOOD DUMP KNOWN\n", name);
romdata->knownbad++;
}
/* verify checksums */
else if (hashes != acthashes)
{
/* otherwise, it's just bad */
romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", name);
dump_wrong_and_correct_checksums(romdata, hashes, acthashes);
romdata->warnings++;
}
/* If it matches, but it is actually a bad dump, write it */
else if (hashes.flag(hash_collection::FLAG_BAD_DUMP))
{
romdata->errorstring.catprintf("%s ROM NEEDS REDUMP\n",name);
romdata->knownbad++;
}
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:37,代码来源:romload.c
示例9: strcatprintf
void rom_load_manager::verify_length_and_hash(const char *name, UINT32 explength, const hash_collection &hashes)
{
/* we've already complained if there is no file */
if (m_file == nullptr)
return;
/* verify length */
UINT32 actlength = m_file->size();
if (explength != actlength)
{
strcatprintf(m_errorstring, "%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength);
m_warnings++;
}
/* If there is no good dump known, write it */
hash_collection &acthashes = m_file->hashes(hashes.hash_types().c_str());
if (hashes.flag(hash_collection::FLAG_NO_DUMP))
{
strcatprintf(m_errorstring, "%s NO GOOD DUMP KNOWN\n", name);
m_knownbad++;
}
/* verify checksums */
else if (hashes != acthashes)
{
/* otherwise, it's just bad */
strcatprintf(m_errorstring, "%s WRONG CHECKSUMS:\n", name);
dump_wrong_and_correct_checksums(hashes, acthashes);
m_warnings++;
}
/* If it matches, but it is actually a bad dump, write it */
else if (hashes.flag(hash_collection::FLAG_BAD_DUMP))
{
strcatprintf(m_errorstring, "%s ROM NEEDS REDUMP\n",name);
m_knownbad++;
}
}
开发者ID:notaz,项目名称:mame,代码行数:36,代码来源:romload.cpp
示例10:
bool hash_collection::operator==(const hash_collection &rhs) const
{
// look for a mismatch in any hash; do not fail if one is missing
int matches = 0;
for (hash_base *hash = m_hashlist.first(); hash != NULL; hash = hash->next())
{
hash_base *rhs_hash = rhs.hash(hash->id());
if (rhs_hash != NULL)
{
if (*hash != *rhs_hash)
return false;
matches++;
}
}
// if all shared hashes match, return true
return (matches > 0);
}
开发者ID:bdidier,项目名称:MAME-OS-X,代码行数:18,代码来源:hash.c
示例11: dump_wrong_and_correct_checksums
static void dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes)
{
astring tempstr;
mame_printf_error(" EXPECTED: %s\n", hashes.macro_string(tempstr));
mame_printf_error(" FOUND: %s\n", acthashes.macro_string(tempstr));
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:6,代码来源:diimage.c
示例12: dump_wrong_and_correct_checksums
static void dump_wrong_and_correct_checksums(romload_private *romdata, const hash_collection &hashes, const hash_collection &acthashes)
{
astring tempstr;
romdata->errorstring.catprintf(" EXPECTED: %s\n", hashes.macro_string(tempstr));
romdata->errorstring.catprintf(" FOUND: %s\n", acthashes.macro_string(tempstr));
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:6,代码来源:romload.c
示例13: dump_wrong_and_correct_checksums
void rom_load_manager::dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes)
{
strcatprintf(m_errorstring, " EXPECTED: %s\n", hashes.macro_string().c_str());
strcatprintf(m_errorstring, " FOUND: %s\n", acthashes.macro_string().c_str());
}
开发者ID:notaz,项目名称:mame,代码行数:5,代码来源:romload.cpp
示例14: dump_wrong_and_correct_checksums
static void dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes)
{
osd_printf_error(" EXPECTED: %s\n", hashes.macro_string().c_str());
osd_printf_error(" FOUND: %s\n", acthashes.macro_string().c_str());
}
开发者ID:YarlinWare,项目名称:mame,代码行数:5,代码来源:diimage.cpp
示例15: dump_wrong_and_correct_checksums
void rom_load_manager::dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes)
{
m_errorstring.append(string_format(" EXPECTED: %s\n", hashes.macro_string().c_str()));
m_errorstring.append(string_format(" FOUND: %s\n", acthashes.macro_string().c_str()));
}
开发者ID:WinCoder,项目名称:mame,代码行数:5,代码来源:romload.cpp
注:本文中的hash_collection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论