- some more fanart code cleanup

This commit is contained in:
Fledge68 2019-02-17 15:35:36 -06:00
parent 09e793655d
commit 0e58df8918
3 changed files with 35 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -58,8 +58,12 @@ bool CFanart::load(Config &m_wiiflowConfig, const char *path, const dir_discHdr
strncpy(fanartDir, fmt("%s/%.3s", path, id), 163); strncpy(fanartDir, fmt("%s/%.3s", path, id), 163);
texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir)); texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", fanartDir));
} }
if(texErr == TE_OK) if(texErr == TE_ERROR)
{ {
TexHandle.Cleanup(m_bg);
return false;
}
char faConfig_Path[164]; char faConfig_Path[164];
faConfig_Path[163] = '\0'; faConfig_Path[163] = '\0';
strncpy(faConfig_Path, fmt("%s/%s.ini", fanartDir, id), 163); strncpy(faConfig_Path, fmt("%s/%s.ini", fanartDir, id), 163);
@ -68,23 +72,23 @@ bool CFanart::load(Config &m_wiiflowConfig, const char *path, const dir_discHdr
{ {
strncpy(faConfig_Path, fmt("%s/%.3s.ini", fanartDir, id), 163); strncpy(faConfig_Path, fmt("%s/%.3s.ini", fanartDir, id), 163);
m_faConfig.load(faConfig_Path); m_faConfig.load(faConfig_Path);
}
if(!m_faConfig.loaded()) if(!m_faConfig.loaded())
{ {
TexHandle.Cleanup(m_bg); TexHandle.Cleanup(m_bg);
return false; return false;
} }
}
TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", fanartDir)); TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", fanartDir));
for(int i = 1; i <= 6; i++) for(int i = 1; i <= 6; i++)
{ {
CFanartElement elm(m_faConfig, fanartDir, i); CFanartElement elm(m_faConfig, fanartDir, i);
if (elm.IsValid()) m_elms.push_back(elm); if(elm.IsValid()) m_elms.push_back(elm);
} }
m_loaded = true; m_loaded = true;
m_defaultDelay = m_wiiflowConfig.getInt("FANART", "delay_after_animation", 200); m_defaultDelay = m_wiiflowConfig.getInt("FANART", "delay_after_animation", 200);
m_delayAfterAnimation = m_faConfig.getInt("GENERAL", "delay_after_animation", m_defaultDelay); m_delayAfterAnimation = m_faConfig.getInt("GENERAL", "delay_after_animation", m_defaultDelay);
m_globalShowCoverAfterAnimation = m_wiiflowConfig.getOptBool("FANART", "show_cover_after_animation", 2); m_globalShowCoverAfterAnimation = m_wiiflowConfig.getOptBool("FANART", "show_cover_after_animation", 2);
}
return true; return true;
} }

View File

@ -317,7 +317,7 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void) void CMenu::_showGame(void)
{ {
CoverFlow.showCover(); bool faPrevLoaded = m_fa.isLoaded();
const dir_discHdr *GameHdr = CoverFlow.getHdr(); const dir_discHdr *GameHdr = CoverFlow.getHdr();
const char *coverDir = NULL; const char *coverDir = NULL;
@ -334,12 +334,14 @@ void CMenu::_showGame(void)
const TexData *bg = NULL; const TexData *bg = NULL;
const TexData *bglq = NULL; const TexData *bglq = NULL;
m_fa.getBackground(bg, bglq); m_fa.getBackground(bg, bglq);
if(bg != NULL && bglq != NULL)
_setBg(*bg, *bglq); _setBg(*bg, *bglq);
CoverFlow.hideCover(); CoverFlow.hideCover();
} }
else else if(faPrevLoaded)
{
CoverFlow.showCover();
_setMainBg(); _setMainBg();
}
} }
void CMenu::_cleanupBanner(bool gamechange) void CMenu::_cleanupBanner(bool gamechange)