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)
|
||||
{
|
||||
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 selected = _selectedItem->itemIdx;
|
||||
|
||||
@@ -26,12 +26,24 @@ CheatsViewModel::CheatsViewModel(const FileInfo& romFileInfo, IRomBrowserControl
|
||||
|
||||
void CheatsViewModel::ActivateSelectedItem()
|
||||
{
|
||||
if (_state != State::DisplayCheats)
|
||||
{
|
||||
// No cheats or not yet loaded
|
||||
return;
|
||||
}
|
||||
|
||||
auto cheatCategory = GetCurrentCheatCategory();
|
||||
u32 numberOfCategories = 0;
|
||||
auto categories = cheatCategory->GetCategories(numberOfCategories);
|
||||
u32 numberOfCheats = 0;
|
||||
auto cheats = cheatCategory->GetCheats(numberOfCheats);
|
||||
|
||||
if (numberOfCategories + numberOfCheats == 0)
|
||||
{
|
||||
// There is nothing to activate
|
||||
return;
|
||||
}
|
||||
|
||||
if (_selectedItem < (int)numberOfCategories)
|
||||
{
|
||||
// Category activated
|
||||
@@ -92,9 +104,12 @@ void CheatsViewModel::Close()
|
||||
}
|
||||
|
||||
void CheatsViewModel::DisableAllCheats()
|
||||
{
|
||||
if (_state == State::DisplayCheats)
|
||||
{
|
||||
DisableAllCheats(_cheats.get());
|
||||
}
|
||||
}
|
||||
|
||||
void CheatsViewModel::DisableAllCheats(const ICheatCategory* cheatCategory)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user