mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 00:56:55 +02:00
Fix some bugs in the cheats panel
This commit is contained in:
@@ -309,7 +309,7 @@ View* RecyclerView::MoveFocusVertical(View* currentFocus, FocusMoveDirection dir
|
|||||||
|
|
||||||
bool RecyclerView::HandleInput(const InputProvider& inputProvider, FocusManager& focusManager)
|
bool RecyclerView::HandleInput(const InputProvider& inputProvider, FocusManager& focusManager)
|
||||||
{
|
{
|
||||||
if (inputProvider.Triggered(InputKey::L | InputKey::R))
|
if (_itemCount != 0 && inputProvider.Triggered(InputKey::L | InputKey::R))
|
||||||
{
|
{
|
||||||
int direction = inputProvider.Triggered(InputKey::L) ? 1 : -1;
|
int direction = inputProvider.Triggered(InputKey::L) ? 1 : -1;
|
||||||
int selected = _selectedItem->itemIdx;
|
int selected = _selectedItem->itemIdx;
|
||||||
|
|||||||
@@ -26,12 +26,24 @@ CheatsViewModel::CheatsViewModel(const FileInfo& romFileInfo, IRomBrowserControl
|
|||||||
|
|
||||||
void CheatsViewModel::ActivateSelectedItem()
|
void CheatsViewModel::ActivateSelectedItem()
|
||||||
{
|
{
|
||||||
|
if (_state != State::DisplayCheats)
|
||||||
|
{
|
||||||
|
// No cheats or not yet loaded
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto cheatCategory = GetCurrentCheatCategory();
|
auto cheatCategory = GetCurrentCheatCategory();
|
||||||
u32 numberOfCategories = 0;
|
u32 numberOfCategories = 0;
|
||||||
auto categories = cheatCategory->GetCategories(numberOfCategories);
|
auto categories = cheatCategory->GetCategories(numberOfCategories);
|
||||||
u32 numberOfCheats = 0;
|
u32 numberOfCheats = 0;
|
||||||
auto cheats = cheatCategory->GetCheats(numberOfCheats);
|
auto cheats = cheatCategory->GetCheats(numberOfCheats);
|
||||||
|
|
||||||
|
if (numberOfCategories + numberOfCheats == 0)
|
||||||
|
{
|
||||||
|
// There is nothing to activate
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_selectedItem < (int)numberOfCategories)
|
if (_selectedItem < (int)numberOfCategories)
|
||||||
{
|
{
|
||||||
// Category activated
|
// Category activated
|
||||||
@@ -93,7 +105,10 @@ void CheatsViewModel::Close()
|
|||||||
|
|
||||||
void CheatsViewModel::DisableAllCheats()
|
void CheatsViewModel::DisableAllCheats()
|
||||||
{
|
{
|
||||||
DisableAllCheats(_cheats.get());
|
if (_state == State::DisplayCheats)
|
||||||
|
{
|
||||||
|
DisableAllCheats(_cheats.get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatsViewModel::DisableAllCheats(const ICheatCategory* cheatCategory)
|
void CheatsViewModel::DisableAllCheats(const ICheatCategory* cheatCategory)
|
||||||
|
|||||||
Reference in New Issue
Block a user