Qt: Add new cheat manager

This commit is contained in:
Connor McLaughlin
2020-10-20 01:14:49 +10:00
parent 9f0f24a5e5
commit b694577c38
21 changed files with 2356 additions and 19 deletions

View File

@ -2366,6 +2366,23 @@ bool CommonHostInterface::LoadCheatListFromGameTitle()
return LoadCheatList(filename.c_str());
}
bool CommonHostInterface::SaveCheatList()
{
if (!System::IsValid() || !System::HasCheatList())
return false;
const std::string filename(GetCheatFileName());
if (filename.empty())
return false;
if (!System::GetCheatList()->SaveToPCSXRFile(filename.c_str()))
{
AddFormattedOSDMessage(15.0f, TranslateString("OSDMessage", "Failed to save cheat list to '%s'"), filename.c_str());
}
return true;
}
bool CommonHostInterface::SaveCheatList(const char* filename)
{
if (!System::IsValid() || !System::HasCheatList())
@ -2404,17 +2421,7 @@ void CommonHostInterface::SetCheatCodeState(u32 index, bool enabled, bool save_t
}
if (save_to_file)
{
const std::string filename(GetCheatFileName());
if (!filename.empty())
{
if (!cl->SaveToPCSXRFile(filename.c_str()))
{
AddFormattedOSDMessage(15.0f, TranslateString("OSDMessage", "Failed to save cheat list to '%s'"),
filename.c_str());
}
}
}
SaveCheatList();
}
void CommonHostInterface::ApplyCheatCode(u32 index)

View File

@ -159,6 +159,9 @@ public:
/// Loads the cheat list for the current game title from the user directory.
bool LoadCheatListFromGameTitle();
/// Saves the current cheat list to the game title's file.
bool SaveCheatList();
/// Saves the current cheat list to the specified file.
bool SaveCheatList(const char* filename);