Cheats: Support parsing built-in database

This commit is contained in:
Connor McLaughlin
2020-11-29 16:42:49 +10:00
parent d1399fe6a3
commit eaafd0a00c
6 changed files with 165 additions and 13 deletions

View File

@ -2436,6 +2436,20 @@ bool CommonHostInterface::LoadCheatListFromGameTitle()
return LoadCheatList(filename.c_str());
}
bool CommonHostInterface::LoadCheatListFromDatabase()
{
if (System::GetRunningCode().empty())
return false;
std::unique_ptr<CheatList> cl = std::make_unique<CheatList>();
if (!cl->LoadFromPackage(System::GetRunningCode()))
return false;
AddFormattedOSDMessage(10.0f, TranslateString("OSDMessage", "Loaded %u cheats from database."), cl->GetCodeCount());
System::SetCheatList(std::move(cl));
return true;
}
bool CommonHostInterface::SaveCheatList()
{
if (!System::IsValid() || !System::HasCheatList())

View File

@ -160,6 +160,9 @@ public:
/// Loads the cheat list for the current game title from the user directory.
bool LoadCheatListFromGameTitle();
/// Loads the cheat list for the current game code from the built-in code database.
bool LoadCheatListFromDatabase();
/// Saves the current cheat list to the game title's file.
bool SaveCheatList();