Load the icon on the game screen with the bg.

Still looks nicer this way.
This commit is contained in:
Unknown W. Brackets 2014-06-21 14:03:50 -07:00
parent 53547bd8b9
commit a22fb9289d
3 changed files with 16 additions and 4 deletions

View File

@ -341,8 +341,8 @@ handleELF:
ReadFileToString(&umd, "/PSP_GAME/ICON0.PNG", &info_->iconTextureData, &info_->lock);
if (info_->wantBG) {
ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0TextureData, &info_->lock);
ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1TextureData, &info_->lock);
}
ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1TextureData, &info_->lock);
break;
}
case FILETYPE_PSP_ISO:
@ -367,8 +367,8 @@ handleELF:
if (info_->wantBG) {
ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0TextureData, &info_->lock);
ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1TextureData, &info_->lock);
}
ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1TextureData, &info_->lock);
}
// Fall back to unknown icon if ISO is broken/is a homebrew ISO, override is allowed though

View File

@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <algorithm>
#include "base/colorutil.h"
#include "base/timeutil.h"
#include "gfx_es2/draw_buffer.h"
@ -97,7 +98,15 @@ void GameScreen::update(InputState &input) {
tvTitle_->SetText(info->title + " (" + info->id + ")");
if (info->iconTexture && texvGameIcon_) {
texvGameIcon_->SetTexture(info->iconTexture);
uint32_t color = whiteAlpha(ease((time_now_d() - info->timeIconWasLoaded) * 3));
// Fade the icon with the background.
double loadTime = info->timeIconWasLoaded;
if (info->pic1Texture) {
loadTime = std::max(loadTime, info->timePic1WasLoaded);
}
if (info->pic0Texture) {
loadTime = std::max(loadTime, info->timePic0WasLoaded);
}
uint32_t color = whiteAlpha(ease((time_now_d() - loadTime) * 3));
texvGameIcon_->SetColor(color);
}

View File

@ -110,15 +110,18 @@ void DrawGameBackground(UIContext &dc, const std::string &gamePath) {
if (ginfo) {
bool hasPic = false;
double loadTime;
if (ginfo->pic1Texture) {
ginfo->pic1Texture->Bind(0);
loadTime = ginfo->timePic1WasLoaded;
hasPic = true;
} else if (ginfo->pic0Texture) {
ginfo->pic0Texture->Bind(0);
loadTime = ginfo->timePic0WasLoaded;
hasPic = true;
}
if (hasPic) {
uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0;
uint32_t color = whiteAlpha(ease((time_now_d() - loadTime) * 3)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0,0,1,1, color);
dc.Flush();
dc.RebindTexture();