mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 17:16:57 +02:00
Change cheat implementation to show cheats in database order, fix some bugs
- AdvancedPaletteManager incorrectly handled negative y positions - FocusManager still had a pointer to a view that was destroyed in the cheats panel. After changing focus, memory got corrupted.
This commit is contained in:
@@ -237,6 +237,9 @@ bool CheatsBottomSheetView::HandleInput(const InputProvider& inputProvider, Focu
|
||||
|
||||
void CheatsBottomSheetView::UpdateCheatList()
|
||||
{
|
||||
// Need to unfocus first, otherwise the focus manager still contains a pointer to a view that is going to be destroyed
|
||||
_focusManager->Unfocus();
|
||||
|
||||
auto oldAdapter = _cheatsAdapter;
|
||||
_cheatsAdapter = new CheatsAdapter(
|
||||
_viewModel->GetCurrentCheatCategory(), _materialColorScheme, _fontRepository, _vramOffsets);
|
||||
@@ -261,21 +264,8 @@ void CheatsBottomSheetView::UpdateDescriptionText()
|
||||
else
|
||||
{
|
||||
auto cheatCategory = _viewModel->GetCurrentCheatCategory();
|
||||
u32 numberOfCategories = 0;
|
||||
auto categories = cheatCategory->GetCategories(numberOfCategories);
|
||||
u32 numberOfCheats = 0;
|
||||
auto cheats = cheatCategory->GetCheats(numberOfCheats);
|
||||
if ((u32)selectedItem < numberOfCategories)
|
||||
{
|
||||
_descriptionLabel.SetText(categories[selectedItem].GetDescription());
|
||||
}
|
||||
else if ((u32)selectedItem < numberOfCategories + numberOfCheats)
|
||||
{
|
||||
_descriptionLabel.SetText(cheats[selectedItem - numberOfCategories].GetDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
_descriptionLabel.SetText("");
|
||||
}
|
||||
u32 numberOfSubEntries = 0;
|
||||
auto subEntries = cheatCategory->GetSubEntries(numberOfSubEntries);
|
||||
_descriptionLabel.SetText(subEntries[selectedItem].GetDescription());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user