mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Fix a few bugs related to the cheat panel
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "SdFolderFactory.h"
|
||||
#include "services/settings/IAppSettingsService.h"
|
||||
#include "cheats/UsrCheatRepositoryFactory.h"
|
||||
#include "cheats/EmptyCheatRepository.h"
|
||||
#include "cheats/PicoLoaderCheatDataFactory.h"
|
||||
#include "RomBrowserController.h"
|
||||
|
||||
@@ -145,6 +146,11 @@ void RomBrowserController::HandleNavigateTrigger()
|
||||
if (!_cheatRepository)
|
||||
{
|
||||
_cheatRepository = UsrCheatRepositoryFactory().FromUsrCheatDat("/_pico/usrcheat.dat");
|
||||
if (!_cheatRepository)
|
||||
{
|
||||
// When usrcheat.dat is not found or cannot be read use a dummy empty cheat repository
|
||||
_cheatRepository = std::make_unique<EmptyCheatRepository>();
|
||||
}
|
||||
}
|
||||
|
||||
u64 startTick = gTickCounter.GetValue();
|
||||
|
||||
@@ -29,19 +29,16 @@ public:
|
||||
|
||||
View* CreateView() const override
|
||||
{
|
||||
LOG_DEBUG("CheatsAdapter::CreateView\n");
|
||||
return new CheatListItemView(_vramOffsets, _materialColorScheme, _fontRepository);
|
||||
}
|
||||
|
||||
void DestroyView(View* view) const override
|
||||
{
|
||||
LOG_DEBUG("CheatsAdapter::DestroyView\n");
|
||||
delete (CheatListItemView*)view;
|
||||
}
|
||||
|
||||
void BindView(View* view, int index) const override
|
||||
{
|
||||
LOG_DEBUG("CheatsAdapter::BindView\n");
|
||||
auto listItemView = static_cast<CheatListItemView*>(view);
|
||||
u32 numberOfCategories = 0;
|
||||
auto categories = _cheatCategory->GetCategories(numberOfCategories);
|
||||
@@ -60,7 +57,7 @@ public:
|
||||
|
||||
void ReleaseView(View* view, int index) const override
|
||||
{
|
||||
LOG_DEBUG("CheatsAdapter::ReleaseView\n");
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -67,7 +67,7 @@ void CheatsBottomSheetView::Update()
|
||||
_cheatListRecycler->SetPosition(LIST_X, _position.y + LIST_Y);
|
||||
if (_viewModel->GetState() == CheatsViewModel::State::DisplayCheats)
|
||||
{
|
||||
if (_cheatsAdapter == nullptr)
|
||||
if (_cheatsAdapter == nullptr && _objVramManager != nullptr)
|
||||
{
|
||||
_cheatsAdapter = new CheatsAdapter(
|
||||
_viewModel->GetCurrentCheatCategory(), _materialColorScheme, _fontRepository, _vramOffsets);
|
||||
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
CheatsAdapter* _cheatsAdapter = nullptr;
|
||||
const MaterialColorScheme* _materialColorScheme;
|
||||
const IFontRepository* _fontRepository;
|
||||
IVramManager* _objVramManager;
|
||||
IVramManager* _objVramManager = nullptr;
|
||||
FocusManager* _focusManager;
|
||||
CheatListItemView::VramOffsets _vramOffsets;
|
||||
u32 _savedVramState = 0;
|
||||
|
||||
Reference in New Issue
Block a user