Removed the 64K limitation on the icon file size.
This commit is contained in:
parent
a22005971a
commit
9c75e0bb97
2 changed files with 26 additions and 25 deletions
|
@ -820,7 +820,7 @@ bool FileBrowser::CheckForPNG(const char* filename, FILINFO& filIcon)
|
|||
|
||||
strcat(fileName, ".png");
|
||||
|
||||
if (f_stat(fileName, &filIcon) == FR_OK && filIcon.fsize < FILEBROWSER_MAX_PNG_SIZE)
|
||||
if (f_stat(fileName, &filIcon) == FR_OK)
|
||||
foundValid = true;
|
||||
}
|
||||
}
|
||||
|
@ -829,17 +829,20 @@ bool FileBrowser::CheckForPNG(const char* filename, FILINFO& filIcon)
|
|||
|
||||
void FileBrowser::DisplayPNG(FILINFO& filIcon, int x, int y)
|
||||
{
|
||||
if (filIcon.fname[0] != 0 && filIcon.fsize < FILEBROWSER_MAX_PNG_SIZE)
|
||||
if (filIcon.fname[0] != 0)
|
||||
{
|
||||
FIL fp;
|
||||
FRESULT res;
|
||||
|
||||
res = f_open(&fp, filIcon.fname, FA_READ);
|
||||
if (res == FR_OK)
|
||||
{
|
||||
char* PNG = (char*)malloc(filIcon.fsize);
|
||||
if (PNG)
|
||||
{
|
||||
u32 bytesRead;
|
||||
SetACTLed(true);
|
||||
f_read(&fp, PNG, FILEBROWSER_MAX_PNG_SIZE, &bytesRead);
|
||||
f_read(&fp, PNG, filIcon.fsize, &bytesRead);
|
||||
SetACTLed(false);
|
||||
f_close(&fp);
|
||||
|
||||
|
@ -859,6 +862,8 @@ void FileBrowser::DisplayPNG(FILINFO& filIcon, int x, int y)
|
|||
//DEBUG_LOG("Invalid PNG size %d x %d\r\n", w, h);
|
||||
}
|
||||
#endif
|
||||
free(PNG);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -874,7 +879,7 @@ void FileBrowser::DisplayPNG()
|
|||
{
|
||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||
u32 x = screenMain->ScaleX(1024) - PNG_WIDTH;
|
||||
u32 y = screenMain->ScaleY(666) - PNG_HEIGHT;
|
||||
u32 y = screenMain->ScaleY(616) - PNG_HEIGHT;
|
||||
DisplayPNG(current->filIcon, x, y);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#define VIC2_COLOUR_INDEX_LBLUE 14
|
||||
#define VIC2_COLOUR_INDEX_LGREY 15
|
||||
|
||||
#define FILEBROWSER_MAX_PNG_SIZE 0x10000
|
||||
|
||||
#define STATUS_BAR_POSITION_Y (40 * 16 + 10)
|
||||
|
||||
#define KEYBOARD_SEARCH_BUFFER_SIZE 512
|
||||
|
@ -253,7 +251,5 @@ private:
|
|||
float scrollHighlightRate;
|
||||
|
||||
bool displayingDevices;
|
||||
|
||||
char PNG[FILEBROWSER_MAX_PNG_SIZE];
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue