- made fanart to work with plugins.

plugin fanart goes in wiiflow/fanart/{coverfolder}/{gametitle}

replace {coverfolder} with the coverfolder= that's set in the plugin's ini file.
replace {gametitle} with title of the rom file without the extension.

the fanart ini file must match the {gametitle} you used for the folder.
This commit is contained in:
Fledge68 2018-10-17 09:00:01 -05:00
parent 66b34244fb
commit f1398ea406
4 changed files with 21 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -1,3 +1,4 @@
#include "fanart.hpp"
#include "pngu.h"
#include "boxmesh.hpp"
@ -30,7 +31,7 @@ void CFanart::unload()
TexHandle.Cleanup(m_bglq);
}
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
bool CFanart::load(Config &m_globalConfig, const char *path, const char *id, bool plugin_rom)
{
bool retval = false;
@ -44,7 +45,7 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
strncpy(dir, fmt("%s/%s", path, id), 63);
TexErr texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", dir));
if(texErr == TE_ERROR)
if(texErr == TE_ERROR && !plugin_rom)
{
strncpy(dir, fmt("%s/%.3s", path, id), 63);
texErr = TexHandle.fromImageFile(m_bg, fmt("%s/background.png", dir));
@ -55,12 +56,15 @@ bool CFanart::load(Config &m_globalConfig, const char *path, const char *id)
cfg_char[63] = '\0';
strncpy(cfg_char, fmt("%s/%s.ini", dir, id), 63);
m_cfg.load(cfg_char);
if(!m_cfg.loaded())
if(!m_cfg.loaded() && !plugin_rom)
{
strncpy(cfg_char, fmt("%s/%.3s.ini", dir, id), 63);
m_cfg.load(cfg_char);
if(!m_cfg.loaded())
{
TexHandle.Cleanup(m_bg);
return retval;
}
}
TexHandle.fromImageFile(m_bglq, fmt("%s/background_lq.png", dir));
for(int i = 1; i <= 6; i++)

View File

@ -62,7 +62,7 @@ public:
~CFanart(void);
void unload();
bool load(Config &m_globalConfig, const char *path, const char *id);
bool load(Config &m_globalConfig, const char *path, const char *id, bool plugin_rom);
bool isAnimationComplete();
bool isLoaded();

View File

@ -295,9 +295,16 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void)
{
CoverFlow.showCover();
//if(m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getFilenameId(CoverFlow.getHdr(), false)))
if(m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getId()))
const char *coverDir = NULL;
const char *Path = NULL;
if(CoverFlow.getHdr()->type == TYPE_PLUGIN)
coverDir = m_plugin.GetCoverFolderName(CoverFlow.getHdr()->settings[0]);
if(coverDir == NULL || strlen(coverDir) == 0)
Path = fmt("%s", m_fanartDir.c_str());
else
Path = fmt("%s/%s", m_fanartDir.c_str(), coverDir);
if(m_fa.load(m_cfg, Path, CoverFlow.getFilenameId(CoverFlow.getHdr(), false), CoverFlow.getHdr()->type == TYPE_PLUGIN))
{
const TexData *bg = NULL;
const TexData *bglq = NULL;
@ -336,8 +343,6 @@ void CMenu::_cleanupBanner(bool gamechange)
m_banner.DeleteBanner(gamechange);
//movie
_cleanupVideo();
//fanart
//m_fa.unload();
}
void CMenu::_cleanupVideo()
@ -795,8 +800,6 @@ void CMenu::_game(bool launch)
}
if(startGameSound == -10)// if -10 then we moved to new cover
{
m_fa.unload();
CoverFlow.showCover();
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header
_setCurrentItem(hdr);
@ -829,7 +832,7 @@ void CMenu::_game(bool launch)
}
/* showing and hiding buttons based on banner zoomed state */
if(!m_zoom_banner)
if(!m_zoom_banner || m_fa.isLoaded())
{
/* always hide full banner buttons */
m_btnMgr.hide(m_gameBtnPlayFull);
@ -875,7 +878,7 @@ void CMenu::_game(bool launch)
}
/* show or hide small banner toggle btn and frame */
if(m_banner_loaded && !m_soundThrdBusy && !coverFlipped && !m_video_playing)
if(m_banner_loaded && !m_soundThrdBusy && !coverFlipped && !m_video_playing && !m_fa.isLoaded())
{
/* show only if the game has a banner */
m_btnMgr.show(m_gameBtnToggle);
@ -2036,7 +2039,7 @@ void CMenu::_initGameMenu()
m_gameBtnToggle = _addPicButton("GAME/TOOGLE_BTN", texToggleBanner, texToggleBanner, 385, 31, 236, 127);
m_gameBtnToggleFull = _addPicButton("GAME/TOOGLE_FULL_BTN", texToggleBanner, texToggleBanner, 20, 12, 608, 344);
m_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 0);
m_gameButtonsZone.x = m_theme.getInt("GAME/ZONES", "buttons_x", 380);
m_gameButtonsZone.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0);
m_gameButtonsZone.w = m_theme.getInt("GAME/ZONES", "buttons_w", 640);
m_gameButtonsZone.h = m_theme.getInt("GAME/ZONES", "buttons_h", 480);