Avoid having a single frame where the icon was not displayed on the top screen after selecting a different rom

This commit is contained in:
Gericom
2026-03-29 12:21:20 +02:00
parent 9ca3e38668
commit 53727e5fdd
15 changed files with 57 additions and 41 deletions

View File

@@ -119,7 +119,6 @@ void MaterialBannerListItemView::Draw(GraphicsContext& graphicsContext)
if (_icon)
{
_icon->SetObjVramOffset(_iconVramOffset);
_icon->SetPosition(6 + _position.x, 6 + _position.y);
_icon->Draw(graphicsContext, frontColor);
}

View File

@@ -24,23 +24,26 @@ MaterialFileIcon::MaterialFileIcon(const TCHAR* name, const MaterialColorScheme*
_displayName[i] = 0;
}
void MaterialFileIcon::UploadGraphics(vu16* vram)
void MaterialFileIcon::UploadGraphics()
{
dma_ntrCopy32(3, GetIconTiles(), vram, 32 * 32 / 2);
if (_vramAddress != nullptr)
{
dma_ntrCopy32(3, GetIconTiles(), _vramAddress, 32 * 32 / 2);
auto font = _fontRepository->GetFont(FontType::Medium11);
u8 tileBuffer[32 * 16 / 2];
memset(tileBuffer, 0, sizeof(tileBuffer));
u32 textWidth, textHeight;
nft2_measureString(font, _displayName, textWidth, textHeight);
nft2_string_render_params_t renderParams;
renderParams.x = ((int)32 - (int)textWidth) / 2;
renderParams.y = 0;
renderParams.width = 32;
renderParams.height = 16;
renderParams.a5i3 = false;
nft2_renderString(font, _displayName, tileBuffer, 32, &renderParams);
memcpy((u8*)vram + largeFolderIconTilesLen, tileBuffer, sizeof(tileBuffer));
auto font = _fontRepository->GetFont(FontType::Medium11);
u8 tileBuffer[32 * 16 / 2];
memset(tileBuffer, 0, sizeof(tileBuffer));
u32 textWidth, textHeight;
nft2_measureString(font, _displayName, textWidth, textHeight);
nft2_string_render_params_t renderParams;
renderParams.x = ((int)32 - (int)textWidth) / 2;
renderParams.y = 0;
renderParams.width = 32;
renderParams.height = 16;
renderParams.a5i3 = false;
nft2_renderString(font, _displayName, tileBuffer, 32, &renderParams);
memcpy((u8*)_vramAddress + largeFolderIconTilesLen, tileBuffer, sizeof(tileBuffer));
}
}
void MaterialFileIcon::Draw(GraphicsContext& graphicsContext, const Rgb<8, 8, 8>& backgroundColor)

View File

@@ -11,7 +11,7 @@ public:
MaterialFileIcon(const TCHAR* name, const MaterialColorScheme* materialColorScheme,
const IFontRepository* fontRepository);
void UploadGraphics(vu16* vram) override;
void UploadGraphics() override;
void Draw(GraphicsContext& graphicsContext, const Rgb<8, 8, 8>& backgroundColor) override;
protected:

View File

@@ -78,7 +78,6 @@ void MaterialFileInfoCardView::Draw(GraphicsContext& graphicsContext)
if (_icon)
{
_icon->SetObjVramOffset(_iconVramOffset);
_icon->Draw(graphicsContext, fgColor);
}
}

View File

@@ -47,7 +47,6 @@ void MaterialIconGridItemView::Draw(GraphicsContext& graphicsContext)
if (_icon)
{
_icon->SetObjVramOffset(_iconVramOffset);
_icon->SetPosition(6 + _position.x, 6 + _position.y);
_icon->Draw(graphicsContext, frontColor);
}