mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 02:29:16 +01:00
load cover images directly from file instead of an intermediary buffer
This commit is contained in:
parent
fbbb4ce0b7
commit
2cf4a1c4aa
@ -929,6 +929,16 @@ static void WindowCredits(void * ptr)
|
||||
* Displays a list of games on the specified load device, and allows the user
|
||||
* to browse and select from this list.
|
||||
***************************************************************************/
|
||||
static char* getImageFolder()
|
||||
{
|
||||
switch(GCSettings.PreviewImage)
|
||||
{
|
||||
case 1 : return GCSettings.CoverFolder; break;
|
||||
case 2 : return GCSettings.ArtworkFolder; break;
|
||||
default: return GCSettings.ScreenshotsFolder; break;
|
||||
}
|
||||
}
|
||||
|
||||
static int MenuGameSelection()
|
||||
{
|
||||
int menu = MENU_NONE;
|
||||
@ -1098,27 +1108,18 @@ static int MenuGameSelection()
|
||||
{
|
||||
previousBrowserIndex = browser.selIndex;
|
||||
previousPreviewImg = GCSettings.PreviewImage;
|
||||
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname);
|
||||
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], getImageFolder(), browserList[browser.selIndex].displayname);
|
||||
|
||||
AllocSaveBuffer();
|
||||
int width, height;
|
||||
if(LoadFile(imagePath, SILENT))
|
||||
if(DecodePNGFromFile(imagePath, &width, &height, imgBuffer, 512, 512))
|
||||
{
|
||||
if(DecodePNG(savebuffer, &width, &height, imgBuffer, 512, 512))
|
||||
{
|
||||
preview.SetImage(imgBuffer, width, height);
|
||||
preview.SetScale( MIN(225.0f / width, 235.0f / height) );
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
}
|
||||
preview.SetImage(imgBuffer, width, height);
|
||||
preview.SetScale( MIN(225.0f / width, 235.0f / height) );
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
}
|
||||
FreeSaveBuffer();
|
||||
}
|
||||
|
||||
if(settingsBtn.GetState() == STATE_CLICKED)
|
||||
|
1506
source/utils/pngu.c
1506
source/utils/pngu.c
File diff suppressed because it is too large
Load Diff
@ -76,6 +76,7 @@ int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties);
|
||||
****************************************************************************/
|
||||
|
||||
u8 * DecodePNG(const u8 *src, int *width, int *height, u8 *dst, int maxwidth, int maxheight);
|
||||
u8 * DecodePNGFromFile(const char *filepath, int *width, int *height, u8 *dst, int maxwidth, int maxheight);
|
||||
int PNGU_EncodeFromRGB (IMGCTX ctx, u32 width, u32 height, void *buffer, u32 stride);
|
||||
int PNGU_EncodeFromGXTexture (IMGCTX ctx, u32 width, u32 height, void *buffer, u32 stride);
|
||||
int PNGU_EncodeFromEFB (IMGCTX ctx, u32 width, u32 height);
|
||||
|
@ -470,13 +470,3 @@ int main(int argc, char *argv[])
|
||||
} // main loop
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* ImageFolder()
|
||||
{
|
||||
switch(GCSettings.PreviewImage)
|
||||
{
|
||||
case 1 : return GCSettings.CoverFolder; break;
|
||||
case 2 : return GCSettings.ArtworkFolder; break;
|
||||
default: return GCSettings.ScreenshotsFolder; break;
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,6 @@ struct SGCSettings
|
||||
char smbshare[20];
|
||||
};
|
||||
|
||||
char* ImageFolder();
|
||||
|
||||
void ExitApp();
|
||||
void ShutdownWii();
|
||||
bool SupportedIOS(u32 ios);
|
||||
|
Loading…
Reference in New Issue
Block a user