mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Add option to disable all cheats by pressing X in the cheat panel
This commit is contained in:
@@ -86,3 +86,29 @@ void CheatsViewModel::Close()
|
|||||||
|
|
||||||
_romBrowserController->HideGameInfo();
|
_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
void ItemActivated();
|
void ItemActivated();
|
||||||
void Back();
|
void Back();
|
||||||
void Close();
|
void Close();
|
||||||
|
void DisableAllCheats();
|
||||||
|
|
||||||
State GetState() const { return _state; }
|
State GetState() const { return _state; }
|
||||||
const ICheatCategory* GetCurrentCheatCategory() const { return _categoryStack[_categoryStackLevel].cheatCategory; }
|
const ICheatCategory* GetCurrentCheatCategory() const { return _categoryStack[_categoryStackLevel].cheatCategory; }
|
||||||
@@ -45,4 +46,6 @@ private:
|
|||||||
bool _changed = false;
|
bool _changed = false;
|
||||||
u32 _categoryStackLevel = 0;
|
u32 _categoryStackLevel = 0;
|
||||||
std::array<CategoryStackEntry, 8> _categoryStack;
|
std::array<CategoryStackEntry, 8> _categoryStack;
|
||||||
|
|
||||||
|
void DisableAllCheats(const ICheatCategory* cheatCategory);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#define LIST_X 16
|
#define LIST_X 16
|
||||||
#define LIST_Y 36
|
#define LIST_Y 36
|
||||||
#define LIST_WIDTH 224
|
#define LIST_WIDTH 224
|
||||||
#define LIST_HEIGHT /*124*/108
|
#define LIST_HEIGHT 108
|
||||||
|
|
||||||
CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr<CheatsViewModel> viewModel,
|
CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr<CheatsViewModel> viewModel,
|
||||||
const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository,
|
const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository,
|
||||||
@@ -214,6 +214,11 @@ bool CheatsBottomSheetView::HandleInput(const InputProvider& inputProvider, Focu
|
|||||||
_viewModel->Close();
|
_viewModel->Close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (inputProvider.Triggered(InputKey::X))
|
||||||
|
{
|
||||||
|
_viewModel->DisableAllCheats();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user