Add touch input support, add fast scrolling support for coverflow display mode, fix use after free bug in banner list mode

This commit is contained in:
Gericom
2026-04-04 19:24:39 +02:00
parent 21a8790ebc
commit 97762b14d3
119 changed files with 2251 additions and 762 deletions

View File

@@ -21,37 +21,43 @@ RomBrowserBottomScreenView::RomBrowserBottomScreenView(
, _romBrowserViewFactory(romBrowserViewFactory)
, _romBrowserDisplayMode(displayMode)
, _themeFileIconFactory(themeFileIconFactory)
, _romBrowserAppBarView(_viewModel->GetRomBrowserAppBarViewModel(),
*displayMode, romBrowserViewFactory)
, _romBrowserAppBarView(RomBrowserAppBarView::CreateShared(_viewModel->GetRomBrowserAppBarViewModel(),
*displayMode, romBrowserViewFactory))
, _vblankTextureLoader(vblankTextureLoader)
{
_romBrowserAppBarView.SetParent(this);
_romBrowserAppBarView->SetParent(this);
}
void RomBrowserBottomScreenView::InitVram(const VramContext& vramContext)
{
_romBrowserAppBarView.InitVram(vramContext);
_romBrowserAppBarView->InitVram(vramContext);
}
void RomBrowserBottomScreenView::Update()
{
_romBrowserAppBarView.Update();
_romBrowserAppBarView->Update();
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->Update();
}
}
void RomBrowserBottomScreenView::Draw(GraphicsContext& graphicsContext)
{
_romBrowserAppBarView.Draw(graphicsContext);
_romBrowserAppBarView->Draw(graphicsContext);
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->Draw(graphicsContext);
}
}
void RomBrowserBottomScreenView::VBlank()
{
_romBrowserAppBarView.VBlank();
_romBrowserAppBarView->VBlank();
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->VBlank();
}
}
SharedPtr<View> RomBrowserBottomScreenView::MoveFocus(const SharedPtr<View>& currentFocus, FocusMoveDirection direction, View* source)
@@ -60,31 +66,39 @@ SharedPtr<View> RomBrowserBottomScreenView::MoveFocus(const SharedPtr<View>& cur
{
return nullptr;
}
if (source == &_romBrowserAppBarView)
if (source == _romBrowserAppBarView.GetPointer())
{
if (_romBrowserDisplayMode->IsVertical())
{
if (direction == FocusMoveDirection::Right)
{
return _romBrowserView->MoveFocus(currentFocus, direction, this);
}
}
else
{
if (direction == FocusMoveDirection::Down)
{
return _romBrowserView->MoveFocus(currentFocus, direction, this);
}
}
return nullptr;
}
else if (source == _romBrowserView.get())
else if (source == _romBrowserView.GetPointer())
{
if (_romBrowserDisplayMode->IsVertical())
{
if (direction == FocusMoveDirection::Left)
return _romBrowserAppBarView.MoveFocus(currentFocus, direction, this);
{
return _romBrowserAppBarView->MoveFocus(currentFocus, direction, this);
}
}
else
{
if (direction == FocusMoveDirection::Up)
return _romBrowserAppBarView.MoveFocus(currentFocus, direction, this);
{
return _romBrowserAppBarView->MoveFocus(currentFocus, direction, this);
}
}
return nullptr;
}
@@ -101,11 +115,38 @@ bool RomBrowserBottomScreenView::HandleInput(const InputProvider& inputProvider,
return View::HandleInput(inputProvider, focusManager);
}
void RomBrowserBottomScreenView::HandlePenDown(const Point& touchPoint, FocusManager& focusManager)
{
_romBrowserAppBarView->HandlePenDown(touchPoint, focusManager);
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->HandlePenDown(touchPoint, focusManager);
}
}
void RomBrowserBottomScreenView::HandlePenMove(const Point& touchPoint, FocusManager& focusManager)
{
_romBrowserAppBarView->HandlePenMove(touchPoint, focusManager);
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->HandlePenMove(touchPoint, focusManager);
}
}
void RomBrowserBottomScreenView::HandlePenUp(const Point& lastTouchPoint, FocusManager& focusManager)
{
_romBrowserAppBarView->HandlePenUp(lastTouchPoint, focusManager);
if (_romBrowserView && _viewModel->IsRomBrowserVisible())
{
_romBrowserView->HandlePenUp(lastTouchPoint, focusManager);
}
}
void RomBrowserBottomScreenView::RomBrowserViewModelInvalidated(const VramContext& vramContext)
{
if (_viewModel->GetRomBrowserViewModel().IsValid())
{
_romBrowserView = std::make_unique<RomBrowserView>(
_romBrowserView = RomBrowserView::CreateShared(
_viewModel->GetRomBrowserViewModel(), *_romBrowserDisplayMode,
_themeFileIconFactory, _romBrowserViewFactory, _vblankTextureLoader);
_romBrowserView->SetParent(this);
@@ -113,6 +154,6 @@ void RomBrowserBottomScreenView::RomBrowserViewModelInvalidated(const VramContex
}
else
{
_romBrowserView.reset();
_romBrowserView.Reset();
}
}