mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-26 02:31:18 +01:00
-fixed fanart usage
This commit is contained in:
parent
12d8f86ced
commit
bdf2850b20
@ -24,6 +24,10 @@ void CFanart::unload()
|
|||||||
m_cfg.unload();
|
m_cfg.unload();
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
m_elms.clear();
|
m_elms.clear();
|
||||||
|
if(m_bg.data.get() != NULL)
|
||||||
|
m_bg.data.release();
|
||||||
|
if(m_bglq.data.get() != NULL)
|
||||||
|
m_bglq.data.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
|
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
|
||||||
@ -35,29 +39,37 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
|
|||||||
|
|
||||||
unload();
|
unload();
|
||||||
|
|
||||||
const char *dir = fmt("%s/%s", path, id);
|
char dir[64];
|
||||||
|
memset(dir,0, 64);
|
||||||
|
strncpy(dir, fmt("%s/%s", path, id), 63);
|
||||||
STexture fanBg, fanBgLq;
|
STexture fanBg, fanBgLq;
|
||||||
|
|
||||||
STexture::TexErr texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
|
STexture::TexErr texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
|
||||||
if(texErr == STexture::TE_ERROR)
|
if(texErr == STexture::TE_ERROR)
|
||||||
{
|
{
|
||||||
dir = fmt("%s/%.3s", path, id);
|
memset(dir,0, 64);
|
||||||
|
strncpy(dir, fmt("%s/%.3s", path, id), 63);
|
||||||
texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
|
texErr = fanBg.fromImageFile(fmt("%s/background.png", dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texErr == STexture::TE_OK)
|
if (texErr == STexture::TE_OK)
|
||||||
{
|
{
|
||||||
m_cfg.load(fmt("%s/%s.ini", dir, id));
|
char cfg_char[64];
|
||||||
if (!m_cfg.loaded()) m_cfg.load(fmt("%s/%.3s.ini", dir, id));
|
memset(cfg_char,0, 64);
|
||||||
|
strncpy(cfg_char, fmt("%s/%s.ini", dir, id), 63);
|
||||||
|
m_cfg.load(cfg_char);
|
||||||
|
if(!m_cfg.loaded())
|
||||||
|
{
|
||||||
|
memset(cfg_char,0, 64);
|
||||||
|
strncpy(cfg_char, fmt("%s/%.3s.ini", dir, id), 63);
|
||||||
|
m_cfg.load(cfg_char);
|
||||||
|
}
|
||||||
fanBgLq.fromImageFile(fmt("%s/background_lq.png", dir));
|
fanBgLq.fromImageFile(fmt("%s/background_lq.png", dir));
|
||||||
|
|
||||||
for(int i = 1; i <= 6; i++)
|
for(int i = 1; i <= 6; i++)
|
||||||
{
|
{
|
||||||
CFanartElement elm(m_cfg, dir, i);
|
CFanartElement elm(m_cfg, dir, i);
|
||||||
if (elm.IsValid()) m_elms.push_back(elm);
|
if (elm.IsValid()) m_elms.push_back(elm);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
retval = true;
|
retval = true;
|
||||||
m_defaultDelay = m_globalConfig.getInt("FANART", "delay_after_animation", 200);
|
m_defaultDelay = m_globalConfig.getInt("FANART", "delay_after_animation", 200);
|
||||||
@ -89,7 +101,7 @@ CColor CFanart::getTextColor(CColor themeTxtColor)
|
|||||||
|
|
||||||
bool CFanart::hideCover()
|
bool CFanart::hideCover()
|
||||||
{
|
{
|
||||||
if (!isLoaded())
|
if(!m_loaded)
|
||||||
return false; // If no fanart is loaded, return false
|
return false; // If no fanart is loaded, return false
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -148,6 +160,7 @@ void CFanart::tick()
|
|||||||
|
|
||||||
void CFanart::draw(bool front)
|
void CFanart::draw(bool front)
|
||||||
{
|
{
|
||||||
|
if(!m_loaded) return; //derp
|
||||||
if(!m_allowArtworkOnTop && front)
|
if(!m_allowArtworkOnTop && front)
|
||||||
return; // It's not allowed to draw fanart on top, it has already been drawn
|
return; // It's not allowed to draw fanart on top, it has already been drawn
|
||||||
|
|
||||||
@ -209,6 +222,8 @@ CFanartElement::CFanartElement(Config &cfg, const char *dir, int artwork)
|
|||||||
|
|
||||||
CFanartElement::~CFanartElement(void)
|
CFanartElement::~CFanartElement(void)
|
||||||
{
|
{
|
||||||
|
if(m_art.data.get() != NULL)
|
||||||
|
m_art.data.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFanartElement::IsValid()
|
bool CFanartElement::IsValid()
|
||||||
@ -248,10 +263,8 @@ void CFanartElement::tick()
|
|||||||
m_event_angle = (int) (m_event_angle + m_step_angle);
|
m_event_angle = (int) (m_event_angle + m_step_angle);
|
||||||
|
|
||||||
if(m_event_duration > 0)
|
if(m_event_duration > 0)
|
||||||
{
|
|
||||||
m_event_duration--;
|
m_event_duration--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void CFanartElement::draw()
|
void CFanartElement::draw()
|
||||||
{
|
{
|
||||||
|
@ -1883,9 +1883,9 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
|
|||||||
m_cf.drawText(adjusting);
|
m_cf.drawText(adjusting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(m_fa.isLoaded())
|
||||||
m_fa.draw();
|
m_fa.draw();
|
||||||
if(m_banner->GetSelectedGame() && (!m_banner->GetInGameSettings() || (m_banner->GetInGameSettings() && m_bnr_settings)))
|
else if(m_banner->GetSelectedGame() && (!m_banner->GetInGameSettings() || (m_banner->GetInGameSettings() && m_bnr_settings)))
|
||||||
m_banner->Draw();
|
m_banner->Draw();
|
||||||
|
|
||||||
m_btnMgr.draw();
|
m_btnMgr.draw();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user