From dc679cccedbd403a728a2258358c54cf29e73401 Mon Sep 17 00:00:00 2001 From: Fledge68 Date: Tue, 22 Jan 2019 18:18:13 -0600 Subject: [PATCH] - added optional custom coverflow background via source menu button. add 'background=img_name.png or .jpg to any source menu button. put the background images in wiiflow/backgrounds. --- source/menu/menu.hpp | 4 +++- source/menu/menu_game.cpp | 2 +- source/menu/menu_main.cpp | 26 ++++++++++++++++++++++---- source/menu/menu_plugin.cpp | 1 + source/menu/menu_source.cpp | 4 +++- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index a1e02e82..af691d19 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -163,13 +163,14 @@ private: const char *m_txt_path; // Background image stuff - TexData sfbgimg; TexData m_curBg; const TexData *m_prevBg; const TexData *m_nextBg; const TexData *m_lqBg; u8 m_bgCrossFade; // + TexData sfbgimg; + TexData m_mainAltBg; TexData m_errorBg; TexData m_mainBg; TexData m_configBg; @@ -1028,6 +1029,7 @@ private: void _updateCheckboxes(void); void _getGameCategories(void); void _setGameCategories(void); + void _setMainBg(void); void _setBg(const TexData &bgTex, const TexData &bglqTex, bool force_change = false); void _updateBg(void); void _drawBg(void); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 4d2ee02f..ecdc6415 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -335,7 +335,7 @@ void CMenu::_showGame(void) CoverFlow.hideCover(); } else - _setBg(m_gameBg, m_gameBgLQ); + _setMainBg(); return; if(!m_zoom_banner) diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 9ec7324c..efc158d3 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -41,9 +41,24 @@ void CMenu::_hideMain(bool instant) m_btnMgr.hide(m_mainLblUser[i], instant); } +void CMenu::_setMainBg() +{ + string fn = m_cfg.getString("general", "main_background", ""); + if(fn.length() > 0) + { + TexHandle.Cleanup(m_mainAltBg); + if(TexHandle.fromImageFile(m_mainAltBg, fmt("%s/backgrounds/%s", m_dataDir.c_str(), fn.c_str())) == TE_OK) + _setBg(m_mainAltBg, m_mainAltBg, true); + else + _setBg(m_mainBg, m_mainBgLQ); + } + else + _setBg(m_mainBg, m_mainBgLQ); +} + void CMenu::_showMain() { - _setBg(m_mainBg, m_mainBgLQ); + _setMainBg(); if(m_refreshGameList) _showCF(m_refreshGameList); } @@ -318,7 +333,7 @@ int CMenu::main(void) if(m_sourceflow)//if exiting sourceflow via b button { m_sourceflow = false; - _setBg(m_mainBg, m_mainBgLQ); + _setMainBg(); _showCF(true); continue; } @@ -426,6 +441,8 @@ int CMenu::main(void) m_source_cnt = 1; m_cfg.setUInt("GENERAL", "sources", m_current_view); m_catStartPage = 1; + m_cfg.remove("GENERAL", "main_background"); + _setMainBg(); _showCF(true); } else if(m_btnMgr.selected(m_mainBtnConfig)) @@ -501,6 +518,7 @@ int CMenu::main(void) if(m_sourceflow) { _sourceFlow();// set the source selected + _setMainBg(); _showCF(true); continue; } @@ -514,7 +532,7 @@ int CMenu::main(void) bheld = true; bUsed = true; } - _setBg(m_mainBg, m_mainBgLQ); + _setMainBg(); if(m_refreshGameList) { /* if changes were made to favorites, parental lock, or categories */ @@ -541,7 +559,7 @@ int CMenu::main(void) } else bheld = false; - _setBg(m_mainBg, m_mainBgLQ); + _setMainBg(); if(m_refreshGameList) { m_refreshGameList = false; diff --git a/source/menu/menu_plugin.cpp b/source/menu/menu_plugin.cpp index 7cfb98a6..b6dea727 100644 --- a/source/menu/menu_plugin.cpp +++ b/source/menu/menu_plugin.cpp @@ -174,6 +174,7 @@ void CMenu::_PluginSettings() m_cfg.setUInt("GENERAL", "sources", m_current_view); m_source_cnt = 1; m_catStartPage = 1; + m_cfg.remove("GENERAL", "main_background"); } else m_current_view = m_cfg.getUInt("GENERAL", "sources"); diff --git a/source/menu/menu_source.cpp b/source/menu/menu_source.cpp index 6b1d1046..07fbde76 100644 --- a/source/menu/menu_source.cpp +++ b/source/menu/menu_source.cpp @@ -135,7 +135,6 @@ void CMenu::_sourceFlow() m_cfg.setUInt("GENERAL", "sources", m_current_view); m_source_cnt = 1; _setSrcOptions(); - _setBg(m_mainBg, m_mainBgLQ); } int CMenu::_getSrcFlow(void) @@ -201,6 +200,8 @@ void CMenu::_setSrcFlowBg(void) TexHandle.Cleanup(sfbgimg); if(TexHandle.fromImageFile(sfbgimg, fmt("%s/backgrounds/%s", m_sourceDir.c_str(), fn.c_str())) == TE_OK) _setBg(sfbgimg, sfbgimg, true); + else + _setBg(m_mainBg, m_mainBgLQ); } else _setBg(m_mainBg, m_mainBgLQ); @@ -771,6 +772,7 @@ bool CMenu::_shortCover(const char *magic) void CMenu::_setSrcOptions(void) { + m_cfg.setString("GENERAL", "main_background", m_source.getString(btn_selected, "background", "")); m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); u8 category = m_source.getInt(btn_selected, "category", 0); if(category > 0)