void cheat_manager::reload() { // if the cheat engine is disabled, we're done if (!machine().options().cheat()) return; // free everything m_cheatlist.reset(); // reset state m_framecount = 0; m_numlines = 0; m_lastline = 0; m_disabled = false; // load the cheat file, if it's a system that has a software list then try softlist_name/shortname.xml first, // if it fails to load then try to load via crc32 - basename/crc32.xml ( eg. 01234567.xml ) image_interface_iterator iter(machine().root_device()); for (device_image_interface *image = iter.first(); image != nullptr; image = iter.next()) if (image->exists()) { // if we are loading through a software list, try to load softlist_name/shortname.xml // this allows the coexistence of arcade cheats with cheats for home conversions which // have the same shortname if (image->software_entry() != nullptr) { std::string filename; strprintf(filename, "%s%s%s", image->software_list_name(), PATH_SEPARATOR, image->basename()); load_cheats(filename.c_str()); break; } // else we are loading outside the software list, try to load machine_basename/crc32.xml else { UINT32 crc = image->crc(); if (crc != 0) { std::string filename; strprintf(filename, "%s%s%08X", machine().basename(), PATH_SEPARATOR, crc); load_cheats(filename.c_str()); break; } } } // if we haven't found the cheats yet, load by basename if (m_cheatlist.count() == 0) load_cheats(machine().basename()); // temporary: save the file back out as output.xml for comparison if (m_cheatlist.count() != 0) save_all("output"); }
void cheat_manager::reload() { // if the cheat engine is disabled, we're done if (!machine().options().cheat()) return; // free everything m_cheatlist.reset(); // reset state m_framecount = 0; m_numlines = 0; m_lastline = 0; m_disabled = false; // load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml ) // and MAME will load gamename.xml image_interface_iterator iter(machine().root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) if (image->exists()) { // if we are loading through software lists, try to load shortname.xml if (image->software_entry() != NULL) { load_cheats(image->basename()); break; } else { UINT32 crc = image->crc(); if (crc != 0) { astring filename; filename.printf("%08X", crc); load_cheats(filename); break; } } } // if we haven't found the cheats yet, load by basename if (m_cheatlist.count() == 0) load_cheats(machine().basename()); // temporary: save the file back out as output.xml for comparison if (m_cheatlist.count() != 0) save_all("output"); }