Add option to disable all cheats by pressing X in the cheat panel

This commit is contained in:
Gericom
2026-03-07 14:51:58 +01:00
parent 4d9318b0b9
commit 12ebd482d4
3 changed files with 35 additions and 1 deletions

View File

@@ -86,3 +86,29 @@ void CheatsViewModel::Close()
_romBrowserController->HideGameInfo();
}
void CheatsViewModel::DisableAllCheats()
{
DisableAllCheats(_cheats.get());
}
void CheatsViewModel::DisableAllCheats(const ICheatCategory* cheatCategory)
{
u32 numberOfCategories = 0;
auto categories = cheatCategory->GetCategories(numberOfCategories);
for (u32 i = 0; i < numberOfCategories; i++)
{
DisableAllCheats(&categories[i]);
}
u32 numberOfCheats = 0;
auto cheats = cheatCategory->GetCheats(numberOfCheats);
for (u32 i = 0; i < numberOfCheats; i++)
{
if (cheats[i].GetIsCheatActive())
{
cheats[i].SetIsCheatActive(false);
_changed = true;
}
}
}