-fixed fanart backgrounds and codedumps

This commit is contained in:
fix94.1 2012-11-16 22:40:20 +00:00
parent cdf717916a
commit 5a827e48fc
11 changed files with 40 additions and 35 deletions

View File

@ -725,11 +725,12 @@ void CCoverFlow::_drawMirrorZ(void)
GX_SetColorUpdate(GX_TRUE);
}
void CCoverFlow::_effectBg(const STexture &tex)
void CCoverFlow::_effectBg(const STexture * &tex)
{
Mtx modelViewMtx;
GXTexObj texObj;
if(tex == NULL || tex->data == NULL)
return;
GX_ClearVtxDesc();
GX_SetNumTevStages(1);
GX_SetNumChans(0);
@ -750,7 +751,7 @@ void CCoverFlow::_effectBg(const STexture &tex)
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, tex.data, tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_InitTexObj(&texObj, tex->data, tex->width, tex->height, tex->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position3f32(0.f, 0.f, 0.f);
@ -907,7 +908,7 @@ bool CCoverFlow::_effectVisible(void)
|| lo.shadowColorEnd.a > 0 || lo.shadowColorOff.a > 0;
}
void CCoverFlow::makeEffectTexture(const STexture &bg)
void CCoverFlow::makeEffectTexture(const STexture * &bg)
{
if (!_effectVisible()) return;
int aa = 8;

View File

@ -71,7 +71,7 @@ public:
void flip(bool force = false, bool f = true);
void cancel(void);
bool selected(void) const { return m_selected; }
void makeEffectTexture(const STexture &bg);
void makeEffectTexture(const STexture * &bg);
void drawText(bool withRectangle = false);
void draw(void);
void drawEffect(void);
@ -306,7 +306,7 @@ private:
private:
void _draw(DrawMode dm = CFDR_NORMAL, bool mirror = false, bool blend = true);
u32 _currentPos(void) const;
void _effectBg(const STexture &tex);
void _effectBg(const STexture * &tex);
void _effectBlur(bool vertical);
bool _effectVisible(void);
void _drawMirrorZ(void);

View File

@ -77,13 +77,15 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
return retval;
}
void CFanart::getBackground(STexture &hq, STexture &lq)
void CFanart::getBackground(const STexture * &hq, const STexture * &lq)
{
if(m_loaded)
{
hq = m_bg;
lq = m_bglq;
hq = &m_bg;
lq = &m_bglq;
}
if(lq == NULL || lq->data == NULL)
lq = hq;
}
CColor CFanart::getTextColor(CColor themeTxtColor)

View File

@ -66,7 +66,7 @@ public:
bool isAnimationComplete();
bool isLoaded();
void getBackground(STexture &hq, STexture &lq);
void getBackground(const STexture * &hq, const STexture * &lq);
CColor getTextColor(CColor themeTxtColor = CColor(0xFFFFFFFF));
bool hideCover();
void draw(bool front = true);

View File

@ -213,23 +213,23 @@ void STexture::Cleanup(void)
maxLOD = 0;
}
bool STexture::CopyTexture(const STexture *tex)
bool STexture::CopyTexture(const STexture &tex)
{
if(tex == this || tex == NULL || tex->data == NULL || tex->dataSize == 0)
if(tex.data == NULL || tex.dataSize == 0 || tex.data == data)
return false;
if(dataSize != tex->dataSize)
if(dataSize != tex.dataSize)
Cleanup();
if(data == NULL)
data = (u8*)MEM2_alloc(tex->dataSize);
data = (u8*)MEM2_alloc(tex.dataSize);
if(data == NULL)
return false;
dataSize = tex->dataSize;
memcpy(data, tex->data, dataSize);
dataSize = tex.dataSize;
memcpy(data, tex.data, dataSize);
DCFlushRange(data, dataSize);
width = tex->width;
height = tex->height;
format = tex->format;
maxLOD = tex->maxLOD;
width = tex.width;
height = tex.height;
format = tex.format;
maxLOD = tex.maxLOD;
return true;
}

View File

@ -16,7 +16,7 @@ class STexture
public:
STexture(void) : data(NULL), dataSize(0), width(0), height(0), format(-1), maxLOD(0), thread(false) { }
void Cleanup();
bool CopyTexture(const STexture *tex);
bool CopyTexture(const STexture &tex);
u8 *data;
u32 dataSize;
u32 width;

View File

@ -654,7 +654,7 @@ s32 CVideo::TakeScreenshot(const char *path)
return ret;
}
void DrawTexture(const STexture *tex)
void DrawTexture(STexture * &tex)
{
if(tex == NULL)
return;

View File

@ -119,7 +119,7 @@ private:
CVideo(const CVideo &);
};
void DrawTexture(const STexture *tex);
void DrawTexture(STexture * &tex);
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
extern CVideo m_vid;

View File

@ -145,6 +145,7 @@ CMenu::CMenu()
m_Emulator_boot = false;
m_music_info = true;
m_nextBg = NULL;
m_lqBg = NULL;
}
void CMenu::init()
@ -529,7 +530,7 @@ void CMenu::_Theme_Cleanup(void)
m_prevBg.Cleanup();
m_nextBg = NULL;
m_curBg.Cleanup();
m_lqBg.Cleanup();
m_lqBg = NULL;
/* Buttons */
theme.btnTexL.Cleanup();
theme.btnTexR.Cleanup();
@ -2053,10 +2054,10 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
void CMenu::_setBg(const STexture &tex, const STexture &lqTex)
{
m_lqBg = lqTex;
m_lqBg = &lqTex;
if(m_nextBg == &tex)
return;
m_prevBg.CopyTexture(&m_curBg);
m_prevBg.CopyTexture(m_curBg);
m_curBg.Cleanup();
m_nextBg = &tex;
m_bgCrossFade = 0xFF;
@ -2070,9 +2071,9 @@ void CMenu::_updateBg(void)
if (m_bgCrossFade == 0) return;
m_bgCrossFade = max(0, (int)m_bgCrossFade - 14);
if(m_bgCrossFade == 0)
if(m_bgCrossFade == 0 && m_nextBg != NULL)
{
m_curBg.CopyTexture(m_nextBg);
m_curBg.CopyTexture(*m_nextBg);
return;
}
GX_ClearVtxDesc();
@ -2130,9 +2131,9 @@ void CMenu::_updateBg(void)
m_curBg.format = GX_TF_RGBA8;
m_curBg.maxLOD = 0;
m_vid.renderToTexture(m_curBg, true);
if(m_curBg.data == NULL)
if(m_curBg.data == NULL && m_nextBg != NULL)
{
m_curBg.CopyTexture(m_nextBg);
m_curBg.CopyTexture(*m_nextBg);
m_bgCrossFade = 0;
}
}

View File

@ -117,9 +117,9 @@ private:
/* End Updates */
//
STexture m_prevBg;
const STexture *m_nextBg;
STexture m_curBg;
STexture m_lqBg;
const STexture *m_nextBg;
const STexture *m_lqBg;
u8 m_bgCrossFade;
//
STexture m_errorBg;

View File

@ -334,10 +334,11 @@ void CMenu::_showGame(void)
if (m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getId().c_str()))
{
STexture bg, bglq;
const STexture *bg = NULL;
const STexture *bglq = NULL;
m_fa.getBackground(bg, bglq);
_setBg(bg, bglq);
if(bg != NULL && bglq != NULL)
_setBg(*bg, *bglq);
if (m_fa.hideCover())
CoverFlow.hideCover();
}