Possible fix for #170 (although I can't reproduce it)

This commit is contained in:
Stephen White 2020-01-25 18:21:08 +11:00
parent 40b5feb576
commit 126400806b

View file

@ -327,6 +327,8 @@ void DiskCaddy::Display()
for (caddyIndex = 0; caddyIndex < numberOfImages; ++caddyIndex)
{
DiskImage* image = GetImage(caddyIndex);
if (image)
{
const char* name = image->GetName();
if (name)
{
@ -338,6 +340,7 @@ void DiskCaddy::Display()
}
}
}
}
#endif
ShowSelectedImage(0);
}
@ -346,6 +349,10 @@ void DiskCaddy::ShowSelectedImage(u32 index)
{
DiskImage* image = GetImage(index);
if (image == 0)
{
return;
}
u32 x;
u32 y;
#if not defined(EXPERIMENTALZERO)
@ -398,10 +405,12 @@ void DiskCaddy::ShowSelectedImage(u32 index)
for (; caddyIndex < numberOfImages; ++caddyIndex)
{
DiskImage* image = GetImage(caddyIndex);
if (image)
{
const char* name = image->GetName();
if (name)
{
memset(buffer, ' ', screenLCD->Width()/screenLCD->GetFontWidth());
memset(buffer, ' ', screenLCD->Width() / screenLCD->GetFontWidth());
screenLCD->PrintText(false, x, y, buffer, BkColour, BkColour);
snprintf(buffer, 256, "%d %s", caddyIndex + 1, name);
screenLCD->PrintText(false, x, y, buffer, 0, caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour);
@ -410,6 +419,7 @@ void DiskCaddy::ShowSelectedImage(u32 index)
if (y >= screenLCD->Height())
break;
}
}
while (y < screenLCD->Height()) {
memset(buffer, ' ', screenLCD->Width()/screenLCD->GetFontWidth());
screenLCD->PrintText(false, x, y, buffer, BkColour, BkColour);
@ -432,6 +442,8 @@ bool DiskCaddy::Update()
x = screen->ScaleX(screenPosXCaddySelections);
y = screen->ScaleY(screenPosYCaddySelections) + 16 + 16 * oldCaddyIndex;
DiskImage* image = GetImage(oldCaddyIndex);
if (image)
{
const char* name = image->GetName();
if (name)
{
@ -441,6 +453,7 @@ bool DiskCaddy::Update()
screen->PrintText(false, x, y, buffer, grey, greyDark);
}
}
}
#endif
oldCaddyIndex = caddyIndex;