-added cat_page fix to sourceflow and now wiiflow checks custom banner folder first before cached

This commit is contained in:
fledge68 2013-10-28 18:36:52 +00:00
parent ff3504d691
commit 82ba28bd02
2 changed files with 36 additions and 34 deletions

View File

@ -1624,56 +1624,57 @@ void CMenu::_gameSoundThread(CMenu *m)
char cached_banner[256]; char cached_banner[256];
cached_banner[255] = '\0'; cached_banner[255] = '\0';
strncpy(cached_banner, fmt("%s/%s.bnr", m->m_bnrCacheDir.c_str(), GameHdr->id), 255); char custom_banner[256];
fsop_GetFileSizeBytes(cached_banner, &cached_bnr_size); custom_banner[255] = '\0';
if(cached_bnr_size > 0 && cached_bnr_size < BNR_MAX_SIZE) /* check custom ID6 first */
strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255);
fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size);
if(custom_bnr_size > 0 && custom_bnr_size < BNR_MAX_SIZE)
{ {
cached_bnr_file = BNR_LOC; custom_bnr_file = BNR_LOC;
fsop_ReadFileLoc(cached_banner, cached_bnr_size, BNR_LOC); fsop_ReadFileLoc(custom_banner, custom_bnr_size, BNR_LOC);
} }
else /* no cached or too big */ else /* no custom ID6 or too big, try ID3 */
{ {
char custom_banner[256]; strncpy(custom_banner, fmt("%s/%.3s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255);
custom_banner[255] = '\0';
strncpy(custom_banner, fmt("%s/%s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255);
fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size);
if(custom_bnr_size > 0 && custom_bnr_size < BNR_MAX_SIZE) if(custom_bnr_size > 0 && custom_bnr_size < BNR_MAX_SIZE)
{ {
custom_bnr_file = BNR_LOC; custom_bnr_file = BNR_LOC;
fsop_ReadFileLoc(custom_banner, custom_bnr_size, BNR_LOC); fsop_ReadFileLoc(custom_banner, custom_bnr_size, BNR_LOC);
} }
else /* no custom ID6 or too big, try ID3 */ }
if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME)
{
if(m->_QF_Game(GameHdr->id) == false)
{ {
strncpy(custom_banner, fmt("%s/%.3s.bnr", m->m_customBnrDir.c_str(), GameHdr->id), 255); GC_Disc_Reader.init(GameHdr->path);
fsop_GetFileSizeBytes(custom_banner, &custom_bnr_size); u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner();
if(custom_bnr_size > 0 && custom_bnr_size < BNR_MAX_SIZE) if(opening_bnr != NULL)
{ m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, GameHdr->title);
custom_bnr_file = BNR_LOC; GC_Disc_Reader.clear();
fsop_ReadFileLoc(custom_banner, custom_bnr_size, BNR_LOC);
}
} }
if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME) m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true;
m->m_soundThrdBusy = false;
return;
}
if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner*/
{
strncpy(cached_banner, fmt("%s/%s.bnr", m->m_bnrCacheDir.c_str(), GameHdr->id), 255);
fsop_GetFileSizeBytes(cached_banner, &cached_bnr_size);
if(cached_bnr_size > 0 && cached_bnr_size < BNR_MAX_SIZE)
{ {
if(m->_QF_Game(GameHdr->id) == false) cached_bnr_file = BNR_LOC;
{ fsop_ReadFileLoc(cached_banner, cached_bnr_size, BNR_LOC);
GC_Disc_Reader.init(GameHdr->path);
u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner();
if(opening_bnr != NULL)
m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, GameHdr->title);
GC_Disc_Reader.clear();
}
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true;
m->m_soundThrdBusy = false;
return;
} }
} }
if(cached_bnr_file != NULL) if(custom_bnr_file != NULL)
CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size);
else if(custom_bnr_file != NULL)
CurrentBanner.SetBanner(custom_bnr_file, custom_bnr_size, true); CurrentBanner.SetBanner(custom_bnr_file, custom_bnr_size, true);
else if(cached_bnr_file != NULL)
CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size);
else if(GameHdr->type == TYPE_WII_GAME) else if(GameHdr->type == TYPE_WII_GAME)
_extractBnr(GameHdr); _extractBnr(GameHdr);
else if(GameHdr->type == TYPE_CHANNEL) else if(GameHdr->type == TYPE_CHANNEL)

View File

@ -266,6 +266,7 @@ void CMenu::_sourceFlow()
memset(btn_selected, 0, 256); memset(btn_selected, 0, 256);
strncpy(btn_selected, fmt("BUTTON_%i", hdr->settings[0]), 255); strncpy(btn_selected, fmt("BUTTON_%i", hdr->settings[0]), 255);
string source = m_source.getString(btn_selected, "source", ""); string source = m_source.getString(btn_selected, "source", "");
m_cfg.setInt("GENERAL", "last_source_btn", hdr->settings[0]);
_clearSources(); _clearSources();
if(source == "wii") if(source == "wii")
{ {