From 0eda1a8fe5cd7586bf85f143349d2bb082aea439 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 31 Mar 2013 01:04:46 +0100 Subject: [PATCH] Show bg and icon on pause screen. --- UI/GameInfoCache.cpp | 9 ++++++++- UI/GameInfoCache.h | 2 ++ UI/MenuScreens.cpp | 21 +++++++++++++++++++++ Windows/InputDevice.h | 1 - 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 9e75f03f41..daab7ccf77 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -77,6 +77,11 @@ GameInfo *GameInfoCache::GetInfo(const std::string &gamePath, bool wantBG) { auto iter = info_.find(gamePath); if (iter != info_.end()) { GameInfo *info = iter->second; + if (!info->wantBG && wantBG) { + // Need to start over. + delete info; + goto again; + } if (info->iconTextureData.size()) { info->iconTexture = new Texture(); // TODO: We could actually do the PNG decoding as well on the async thread. @@ -97,6 +102,8 @@ GameInfo *GameInfoCache::GetInfo(const std::string &gamePath, bool wantBG) { return iter->second; } +again: + // return info; // TODO: Everything below here should be asynchronous and run on a thread, @@ -116,7 +123,7 @@ GameInfo *GameInfoCache::GetInfo(const std::string &gamePath, bool wantBG) { ISOFileSystem umd(&handles, bd); GameInfo *info = new GameInfo(); - + info->wantBG = wantBG; // Alright, let's fetch the PARAM.SFO. std::string paramSFOcontents; diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index c24b19ad13..982b8f5306 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -41,6 +41,8 @@ struct GameInfo { std::string bgTextureData; Texture *bgTexture; + bool wantBG; + double lastAccessedTime; // The time at which the Icon and the BG were loaded. diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 4327f69f8b..e50994426c 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -47,6 +47,7 @@ namespace MainWindow { #include "Common/StringUtil.h" #include "Core/System.h" +#include "Core/CoreParameter.h" #include "GPU/ge_constants.h" #include "GPU/GPUState.h" #include "GPU/GPUInterface.h" @@ -303,6 +304,26 @@ void PauseScreen::render() { title = game_title.c_str(); } + + UIContext *ctx = screenManager()->getUIContext(); + // This might create a texture so we must flush first. + UIFlush(); + GameInfo *ginfo = g_gameInfoCache.GetInfo(PSP_CoreParameter().fileToStart, true); + + if (ginfo && ginfo->bgTexture) { + ginfo->bgTexture->Bind(0); + ui_draw2d.DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,0xFFc0c0c0); + ui_draw2d.Flush(); + ctx->RebindTexture(); + } + + if (ginfo && ginfo->iconTexture) { + ginfo->iconTexture->Bind(0); + ui_draw2d.DrawTexRect(10,10,10+144, 10+80, 0,0,1,1,0xFFFFFFFF); + ui_draw2d.Flush(); + ctx->RebindTexture(); + } + ui_draw2d.DrawText(UBUNTU48, title, dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER); int x = 30; diff --git a/Windows/InputDevice.h b/Windows/InputDevice.h index ebbc8a5a7a..372d16a8c8 100644 --- a/Windows/InputDevice.h +++ b/Windows/InputDevice.h @@ -4,7 +4,6 @@ #include #include "../Common/CommonTypes.h" -#include "../Core/HLE/sceCtrl.h" struct InputState;