mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-added custom banner support, to use just place *.bnr files
which either got the ID3 or the ID6 as name into wiiflow/banners -removed security check for banners since some custom banners are poorly made and not 100% valid -on game switching just display blackscreen instead of the old banner in the time of switching
This commit is contained in:
parent
365884d556
commit
7f6394fa36
@ -47,9 +47,10 @@ void BannerWindow::LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2)
|
||||
changing = false;
|
||||
}
|
||||
|
||||
void BannerWindow::DeleteBanner()
|
||||
void BannerWindow::DeleteBanner(bool gamechange)
|
||||
{
|
||||
gameSelected = 0;
|
||||
if(!gamechange)
|
||||
gameSelected = 0;
|
||||
gameBanner->Clear();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class BannerWindow
|
||||
{
|
||||
public:
|
||||
BannerWindow();
|
||||
void DeleteBanner();
|
||||
void DeleteBanner(bool gamechange = false);
|
||||
void LoadBanner(Banner *banner, CVideo *vid, u8 *font1, u8 *font2);
|
||||
int GetSelectedGame() { return gameSelected; }
|
||||
bool GetZoomSetting() { return AnimZoom; }
|
||||
|
@ -58,6 +58,7 @@ Banner::Banner(u8 *bnr, u64 title)
|
||||
|
||||
if (imet->sig == IMET_SIGNATURE)
|
||||
{
|
||||
/*
|
||||
unsigned char md5[16];
|
||||
unsigned char imetmd5[16];
|
||||
|
||||
@ -66,13 +67,13 @@ Banner::Banner(u8 *bnr, u64 title)
|
||||
|
||||
MD5(md5, (unsigned char*)(imet), sizeof(IMET));
|
||||
if (memcmp(imetmd5, md5, 16) == 0)
|
||||
{
|
||||
{*/
|
||||
this->imet = imet;
|
||||
}
|
||||
/*}
|
||||
else
|
||||
{
|
||||
gprintf("Invalid md5, banner not valid for title %08x\n", title);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -283,6 +283,7 @@ void CMenu::init(void)
|
||||
m_app_update_zip = sfmt("%s/update.zip", m_appDir.c_str());
|
||||
m_data_update_zip = sfmt("%s/update.zip", m_dataDir.c_str());
|
||||
|
||||
m_bannerDir = m_cfg.getString("GENERAL", "dir_banners", sfmt("%s/banners", m_dataDir.c_str()));
|
||||
m_pluginsDir = m_cfg.getString("GENERAL", "dir_plugins", sfmt("%s/plugins", m_dataDir.c_str()));
|
||||
m_cacheDir = m_cfg.getString("GENERAL", "dir_cache", sfmt("%s/cache", m_dataDir.c_str()));
|
||||
m_settingsDir = m_cfg.getString("GENERAL", "dir_settings", sfmt("%s/settings", m_dataDir.c_str()));
|
||||
@ -346,6 +347,8 @@ void CMenu::init(void)
|
||||
fsop_MakeFolder((char *)m_wipDir.c_str());
|
||||
fsop_MakeFolder((char *)m_listCacheDir.c_str());
|
||||
fsop_MakeFolder((char *)m_helpDir.c_str());
|
||||
fsop_MakeFolder((char *)m_pluginsDir.c_str());
|
||||
fsop_MakeFolder((char *)m_bannerDir.c_str());
|
||||
|
||||
// INI files
|
||||
m_cat.load(fmt("%s/" CAT_FILENAME, m_settingsDir.c_str()));
|
||||
|
@ -83,13 +83,13 @@ private:
|
||||
s16 m_showtimer;
|
||||
string m_curLanguage;
|
||||
string m_curGameId;
|
||||
string m_curChanId;
|
||||
|
||||
u8 m_numCFVersions;
|
||||
|
||||
string m_themeDataDir;
|
||||
string m_appDir;
|
||||
string m_dataDir;
|
||||
string m_bannerDir;
|
||||
string m_pluginsDir;
|
||||
string m_picDir;
|
||||
string m_boxPicDir;
|
||||
|
@ -600,6 +600,7 @@ void CMenu::_game(bool launch)
|
||||
m_gameSound.Stop();
|
||||
m_gameSelected = false;
|
||||
m_fa.unload();
|
||||
m_banner->DeleteBanner(true);
|
||||
_setBg(m_mainBg, m_mainBgLQ);
|
||||
}
|
||||
if(m_show_zone_game && !m_zoom_banner)
|
||||
@ -1485,31 +1486,54 @@ unsigned int gameSoundThreadStackSize = (unsigned int)32768;
|
||||
|
||||
void CMenu::_gameSoundThread(CMenu *m)
|
||||
{
|
||||
if(m->m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
else if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSound.Load(m->m_plugin.GetBannerSound(m->m_cf.getHdr()->settings[0]), m->m_plugin.GetBannerSoundSize(), false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
u8 *custom_bnr_file = NULL;
|
||||
u32 custom_bnr_size = 0;
|
||||
char custom_banner[256];
|
||||
snprintf(custom_banner, sizeof(custom_banner), "%s/%.6s.bnr", m->m_bannerDir.c_str(), m->m_cf.getHdr()->id);
|
||||
FILE *fp = fopen(custom_banner, "rb");
|
||||
if(!fp)
|
||||
{
|
||||
snprintf(custom_banner, sizeof(custom_banner), "%s/%.3s.bnr", m->m_bannerDir.c_str(), m->m_cf.getHdr()->id);
|
||||
fp = fopen(custom_banner, "rb");
|
||||
if(!fp && m->m_cf.getHdr()->type == TYPE_GC_GAME)
|
||||
{
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
|
||||
m->m_gamesound_changed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(fp)
|
||||
{
|
||||
fseek(fp, 0, SEEK_END);
|
||||
custom_bnr_size = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
custom_bnr_file = (u8*)MEM2_alloc(custom_bnr_size);
|
||||
fread(custom_bnr_file, 1, custom_bnr_size, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
m->m_gameSoundHdr = m->m_cf.getHdr();
|
||||
m->m_gamesound_changed = false;
|
||||
u32 sndSize = 0;
|
||||
|
||||
Banner *banner = m->m_gameSoundHdr->type == TYPE_WII_GAME ?
|
||||
_extractBnr(m->m_gameSoundHdr) : m->m_gameSoundHdr->type == TYPE_CHANNEL ?
|
||||
_extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL;
|
||||
Banner *banner = custom_bnr_file != NULL ? new Banner((u8 *)custom_bnr_file) :
|
||||
(m->m_gameSoundHdr->type == TYPE_WII_GAME ? _extractBnr(m->m_gameSoundHdr) : (m->m_gameSoundHdr->type == TYPE_CHANNEL ?
|
||||
_extractChannelBnr(TITLE_ID(m->m_gameSoundHdr->settings[0],m->m_gameSoundHdr->settings[1])) : NULL));
|
||||
m->m_gameSoundHdr = NULL;
|
||||
|
||||
if (banner == NULL || !banner->IsValid())
|
||||
{
|
||||
gprintf("no valid banner found\n");
|
||||
m_banner->DeleteBanner();
|
||||
delete banner;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user