Merge branch 'master' into cleanup

This commit is contained in:
penfold42 2018-07-30 22:28:37 +10:00
commit 2f5914ec54
5 changed files with 25 additions and 2 deletions

View file

@ -292,7 +292,11 @@ void DiskCaddy::ShowSelectedImage(u32 index)
x = 0;
y = 0;
snprintf(buffer, 256, " D %d/%d ", index + 1, numberOfImages);
snprintf(buffer, 256, " D %d/%d %c "
, index + 1
, numberOfImages
, GetImage(index)->GetReadOnly() ? 'R' : ' '
);
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), RGBA(0xff, 0xff, 0xff, 0xff));
y += LCDFONTHEIGHT;

View file

@ -1153,7 +1153,11 @@ void FileBrowser::ShowDeviceAndROM()
u32 x = 0; // 43 * 8
u32 y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
snprintf(buffer, 256, "Device %2d %s\r\n", *deviceID, roms->ROMNames[roms->currentROMIndex]);
snprintf(buffer, 256, "Device %2d %*s\r\n"
, *deviceID
, roms->GetLongestRomNameLen()
, roms->ROMNames[roms->currentROMIndex]
);
screenMain->PrintText(false, x, y, buffer, textColour, bgColour);
}

View file

@ -43,3 +43,10 @@ void ROMs::SelectROM(const char* ROMName)
}
}
unsigned ROMs::UpdateLongestRomNameLen( unsigned maybeLongest )
{
if (maybeLongest > longestRomNameLen)
longestRomNameLen = maybeLongest;
return longestRomNameLen;
}

View file

@ -42,5 +42,12 @@ public:
unsigned currentROMIndex;
unsigned lastManualSelectedROMIndex;
unsigned GetLongestRomNameLen() { return longestRomNameLen; }
unsigned UpdateLongestRomNameLen( unsigned maybeLongest );
protected:
unsigned longestRomNameLen;
};
#endif

View file

@ -1238,6 +1238,7 @@ static void CheckOptions()
{
strncpy(roms.ROMNames[ROMIndex], ROMName, 255);
roms.ROMValid[ROMIndex] = true;
roms.UpdateLongestRomNameLen( strlen(roms.ROMNames[ROMIndex]) );
}
f_close(&fp);
//DEBUG_LOG("Read ROM %s from options\r\n", ROMName);