mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
clifront.c: Slightly optimized -romident so that each software list is
parsed only once instead of as many times as the number of drivers it is attached to. Also, removed the implication that files with (size != power of 2) are to be skipped, since we now want to identify also tapes and floppies and not only ROM binaries. [Fabio Priuli]
This commit is contained in:
parent
e674358476
commit
e978f44775
@ -1863,18 +1863,7 @@ void media_identifier::identify_data(const char *name, const UINT8 *data, int le
|
|||||||
|
|
||||||
// if we didn't find it, try to guess what it might be
|
// if we didn't find it, try to guess what it might be
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
{
|
osd_printf_info("NO MATCH\n");
|
||||||
// if not a power of 2, assume it is a non-ROM file
|
|
||||||
if ((length & (length - 1)) != 0)
|
|
||||||
{
|
|
||||||
osd_printf_info("NOT A ROM\n");
|
|
||||||
m_nonroms++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise, it's just not a match
|
|
||||||
else
|
|
||||||
osd_printf_info("NO MATCH\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we did find it, count it as a match
|
// if we did find it, count it as a match
|
||||||
else
|
else
|
||||||
@ -1887,9 +1876,12 @@ void media_identifier::identify_data(const char *name, const UINT8 *data, int le
|
|||||||
// of drivers by hash
|
// of drivers by hash
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
typedef tagmap_t<FPTR> slname_map;
|
||||||
|
|
||||||
int media_identifier::find_by_hash(const hash_collection &hashes, int length)
|
int media_identifier::find_by_hash(const hash_collection &hashes, int length)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
slname_map listnames;
|
||||||
|
|
||||||
// iterate over drivers
|
// iterate over drivers
|
||||||
m_drivlist.reset();
|
m_drivlist.reset();
|
||||||
@ -1918,23 +1910,26 @@ int media_identifier::find_by_hash(const hash_collection &hashes, int length)
|
|||||||
software_list_device_iterator iter(m_drivlist.config().root_device());
|
software_list_device_iterator iter(m_drivlist.config().root_device());
|
||||||
for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
|
for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
|
||||||
{
|
{
|
||||||
for (software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
|
if (listnames.add(swlistdev->list_name(), 0, FALSE) != TMERR_DUPLICATE)
|
||||||
for (software_part *part = swinfo->first_part(); part != NULL; part = part->next())
|
{
|
||||||
for (const rom_entry *region = part->romdata(); region != NULL; region = rom_next_region(region))
|
for (software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
|
||||||
for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
|
for (software_part *part = swinfo->first_part(); part != NULL; part = part->next())
|
||||||
{
|
for (const rom_entry *region = part->romdata(); region != NULL; region = rom_next_region(region))
|
||||||
hash_collection romhashes(ROM_GETHASHDATA(rom));
|
for (const rom_entry *rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom))
|
||||||
if (hashes == romhashes)
|
|
||||||
{
|
{
|
||||||
bool baddump = romhashes.flag(hash_collection::FLAG_BAD_DUMP);
|
hash_collection romhashes(ROM_GETHASHDATA(rom));
|
||||||
|
if (hashes == romhashes)
|
||||||
// output information about the match
|
{
|
||||||
if (found)
|
bool baddump = romhashes.flag(hash_collection::FLAG_BAD_DUMP);
|
||||||
osd_printf_info(" ");
|
|
||||||
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev->list_name(), swinfo->shortname(), swinfo->longname());
|
// output information about the match
|
||||||
found++;
|
if (found)
|
||||||
|
osd_printf_info(" ");
|
||||||
|
osd_printf_info("= %s%-20s %s:%s %s\n", baddump ? "(BAD) " : "", ROM_GETNAME(rom), swlistdev->list_name(), swinfo->shortname(), swinfo->longname());
|
||||||
|
found++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user