Clean up code, adapt to existing coding style.

This commit is contained in:
Aaron Giles 2011-04-19 04:26:02 +00:00
parent 5e443744c5
commit 3628e7eaed

View File

@ -81,8 +81,8 @@ const char *driverpath = m_enumerator.config().m_devicelist.find("root")->search
// iterate over ROM sources and regions // iterate over ROM sources and regions
int found = 0; int found = 0;
int required = 0; int required = 0;
int sharedFound = 0; int shared_found = 0;
int sharedRequired = 0; int shared_required = 0;
for (const rom_source *source = rom_first_source(m_enumerator.config()); source != NULL; source = rom_next_source(*source)) for (const rom_source *source = rom_first_source(m_enumerator.config()); source != NULL; source = rom_next_source(*source))
{ {
// determine the search path for this source and iterate through the regions // determine the search path for this source and iterate through the regions
@ -95,27 +95,22 @@ const char *driverpath = m_enumerator.config().m_devicelist.find("root")->search
for (const rom_entry *region = rom_first_region(*source); region != NULL; region = rom_next_region(region)) for (const rom_entry *region = rom_first_region(*source); region != NULL; region = rom_next_region(region))
{ {
// temporary hack: add the driver path & region name // temporary hack: add the driver path & region name
astring combinedpath(m_searchpath, ";", driverpath); astring combinedpath(source->searchpath(), ";", driverpath);
if(ROMREGION_ISLOADBYNAME(region)) if (ROMREGION_ISLOADBYNAME(region))
{ combinedpath.cat(";").cat(ROMREGION_GETTAG(region));
combinedpath=combinedpath.cat(";");
combinedpath=combinedpath.cat(ROMREGION_GETTAG(region));
}
m_searchpath = combinedpath; m_searchpath = combinedpath;
for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
{ {
hash_collection hashes(ROM_GETHASHDATA(rom)); hash_collection hashes(ROM_GETHASHDATA(rom));
bool shared = also_used_by_parent(hashes) >= 0; bool shared = (also_used_by_parent(hashes) != -1);
// if a dump exists, then at least one entry is required // if a dump exists, then at least one entry is required
if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) if (!hashes.flag(hash_collection::FLAG_NO_DUMP))
{ {
required++; required++;
if (shared) if (shared)
{ shared_required++;
sharedRequired++;
}
} }
// audit a file // audit a file
@ -136,16 +131,14 @@ m_searchpath = combinedpath;
{ {
found++; found++;
if (shared) if (shared)
{ shared_found++;
sharedFound++;
}
} }
} }
} }
} }
// if we found nothing unique to this set & the set needs roms that aren't in the parent or the parent isn't found either, then we don't have the set at all // if we found nothing unique to this set & the set needs roms that aren't in the parent or the parent isn't found either, then we don't have the set at all
if (found == sharedFound && required > 0 && (required != sharedRequired || sharedFound == 0)) if (found == shared_found && required > 0 && (required != shared_required || shared_found == 0))
m_record_list.reset(); m_record_list.reset();
// return a summary // return a summary