FrontendCommon: Add auto cheat loading option

This commit is contained in:
Connor McLaughlin
2020-09-09 23:44:02 +10:00
parent bf6b4514a0
commit 03f052e12e
8 changed files with 190 additions and 18 deletions

View File

@ -324,6 +324,44 @@ bool CheatList::SaveToPCSXRFile(const char* filename)
return (std::ferror(fp.get()) == 0);
}
u32 CheatList::GetEnabledCodeCount() const
{
u32 count = 0;
for (const CheatCode& cc : m_codes)
{
if (cc.enabled)
count++;
}
return count;
}
void CheatList::SetCodeEnabled(u32 index, bool state)
{
if (index >= m_codes.size())
return;
m_codes[index].enabled = state;
}
void CheatList::EnableCode(u32 index)
{
SetCodeEnabled(index, true);
}
void CheatList::DisableCode(u32 index)
{
SetCodeEnabled(index, false);
}
void CheatList::ApplyCode(u32 index)
{
if (index >= m_codes.size())
return;
m_codes[index].Apply();
}
void CheatCode::Apply() const
{
const u32 count = static_cast<u32>(instructions.size());