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

View File

@ -62,7 +62,7 @@ public:
~CFanart(void); ~CFanart(void);
void unload(); 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 isAnimationComplete();
bool isLoaded(); bool isLoaded();

View File

@ -295,9 +295,16 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void) void CMenu::_showGame(void)
{ {
CoverFlow.showCover(); CoverFlow.showCover();
const char *coverDir = NULL;
const char *Path = NULL;
if(CoverFlow.getHdr()->type == TYPE_PLUGIN)
coverDir = m_plugin.GetCoverFolderName(CoverFlow.getHdr()->settings[0]);
//if(m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getFilenameId(CoverFlow.getHdr(), false))) if(coverDir == NULL || strlen(coverDir) == 0)
if(m_fa.load(m_cfg, m_fanartDir.c_str(), CoverFlow.getId())) 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 *bg = NULL;
const TexData *bglq = NULL; const TexData *bglq = NULL;
@ -336,8 +343,6 @@ void CMenu::_cleanupBanner(bool gamechange)
m_banner.DeleteBanner(gamechange); m_banner.DeleteBanner(gamechange);
//movie //movie
_cleanupVideo(); _cleanupVideo();
//fanart
//m_fa.unload();
} }
void CMenu::_cleanupVideo() void CMenu::_cleanupVideo()
@ -795,8 +800,6 @@ void CMenu::_game(bool launch)
} }
if(startGameSound == -10)// if -10 then we moved to new cover 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 memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header
_setCurrentItem(hdr); _setCurrentItem(hdr);
@ -829,7 +832,7 @@ void CMenu::_game(bool launch)
} }
/* showing and hiding buttons based on banner zoomed state */ /* 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 */ /* always hide full banner buttons */
m_btnMgr.hide(m_gameBtnPlayFull); m_btnMgr.hide(m_gameBtnPlayFull);
@ -875,7 +878,7 @@ void CMenu::_game(bool launch)
} }
/* show or hide small banner toggle btn and frame */ /* 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 */ /* show only if the game has a banner */
m_btnMgr.show(m_gameBtnToggle); 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_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_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.y = m_theme.getInt("GAME/ZONES", "buttons_y", 0);
m_gameButtonsZone.w = m_theme.getInt("GAME/ZONES", "buttons_w", 640); m_gameButtonsZone.w = m_theme.getInt("GAME/ZONES", "buttons_w", 640);
m_gameButtonsZone.h = m_theme.getInt("GAME/ZONES", "buttons_h", 480); m_gameButtonsZone.h = m_theme.getInt("GAME/ZONES", "buttons_h", 480);