DB: Only use unverified entries for headerless roms
This commit is contained in:
parent
6d1ca4503e
commit
0917f3f8f8
5 changed files with 15 additions and 9 deletions
|
@ -406,7 +406,7 @@ bool GameDatabase::GetiNesHeader(uint32_t romCrc, NESHeader &nesHeader)
|
|||
return false;
|
||||
}
|
||||
|
||||
void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRomData)
|
||||
void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRomData, bool forHeaderlessRom)
|
||||
{
|
||||
GameInfo info = {};
|
||||
|
||||
|
@ -415,8 +415,14 @@ void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRom
|
|||
auto result = _gameDatabase.find(romCrc);
|
||||
|
||||
if(result != _gameDatabase.end()) {
|
||||
MessageManager::Log("[DB] Game found in database");
|
||||
info = result->second;
|
||||
if(!forHeaderlessRom && info.Board == "UNK") {
|
||||
//Boards marked as UNK should only be used for headerless roms (since their data is unverified)
|
||||
romData.DatabaseInfo = {};
|
||||
return;
|
||||
}
|
||||
|
||||
MessageManager::Log("[DB] Game found in database");
|
||||
|
||||
if(info.MapperID < UnifBoards::UnknownBoard) {
|
||||
MessageManager::Log("[DB] Mapper: " + std::to_string(info.MapperID) + " Sub: " + std::to_string(GetSubMapper(info)));
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
static void InitializeInputDevices(string inputType, GameSystem system, bool silent = false);
|
||||
static void InitializeInputDevices(uint32_t romCrc);
|
||||
static void SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRomData);
|
||||
static void SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRomData, bool forHeaderlessRom);
|
||||
static bool GetiNesHeader(uint32_t romCrc, NESHeader &nesHeader);
|
||||
static bool GetDbRomSize(uint32_t romCrc, uint32_t &prgSize, uint32_t &chrSize);
|
||||
};
|
|
@ -207,7 +207,7 @@ public:
|
|||
Log("[UNIF] Battery: " + string(romData.HasBattery ? "Yes" : "No"));
|
||||
|
||||
if(!_checkOnly) {
|
||||
GameDatabase::SetGameInfo(romData.PrgChrCrc32, romData, !EmulationSettings::CheckFlag(EmulationFlags::DisableGameDatabase));
|
||||
GameDatabase::SetGameInfo(romData.PrgChrCrc32, romData, !EmulationSettings::CheckFlag(EmulationFlags::DisableGameDatabase), false);
|
||||
}
|
||||
|
||||
if(romData.MapperID == UnifBoards::UnknownBoard) {
|
||||
|
|
|
@ -77,7 +77,7 @@ RomData iNesLoader::LoadRom(vector<uint8_t>& romFile, NESHeader *preloadedHeader
|
|||
|
||||
romData.PrgCrc32 = CRC32::GetCRC(romData.PrgRom.data(), romData.PrgRom.size());
|
||||
|
||||
Log("PRG+CHR CRC32: 0x" + HexUtilities::ToHex(romData.PrgChrCrc32));
|
||||
Log("PRG+CHR CRC32: 0x" + HexUtilities::ToHex(romData.PrgChrCrc32, true));
|
||||
|
||||
if(romData.IsNes20Header) {
|
||||
Log("[iNes] NES 2.0 file: Yes");
|
||||
|
@ -104,7 +104,7 @@ RomData iNesLoader::LoadRom(vector<uint8_t>& romFile, NESHeader *preloadedHeader
|
|||
}
|
||||
|
||||
if(!_checkOnly) {
|
||||
GameDatabase::SetGameInfo(romData.PrgChrCrc32, romData, !EmulationSettings::CheckFlag(EmulationFlags::DisableGameDatabase) && header.GetRomHeaderVersion() != RomHeaderVersion::Nes2_0);
|
||||
GameDatabase::SetGameInfo(romData.PrgChrCrc32, romData, !EmulationSettings::CheckFlag(EmulationFlags::DisableGameDatabase) && header.GetRomHeaderVersion() != RomHeaderVersion::Nes2_0, preloadedHeader != nullptr);
|
||||
}
|
||||
|
||||
return romData;
|
||||
|
|
|
@ -7,9 +7,9 @@ private:
|
|||
const static vector<string> _hexCache;
|
||||
|
||||
public:
|
||||
static string ToHex(uint8_t addr);
|
||||
static string ToHex(uint16_t addr);
|
||||
static string ToHex(uint32_t addr, bool fullSize = false);
|
||||
static string ToHex(uint8_t value);
|
||||
static string ToHex(uint16_t value);
|
||||
static string ToHex(uint32_t value, bool fullSize = false);
|
||||
static string ToHex(vector<uint8_t> &data);
|
||||
|
||||
static int FromHex(string hex);
|
||||
|
|
Loading…
Add table
Reference in a new issue