diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 9a362ca0..619df897 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -2620,6 +2620,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover) u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565; const char *path = box ? (blankBoxCover ? mainMenu.getBlankCoverPath(m_items[i].hdr) : mainMenu.getBoxPath(m_items[i].hdr)) : mainMenu.getFrontPath(m_items[i].hdr); + if(path == NULL) + return false; TexData tex; tex.thread = true; m_renderingTex = &tex; @@ -2659,6 +2661,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover) { if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN) coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]); + if(m_items[i].hdr->type == TYPE_SOURCE) + coverDir = "sourceflow"; if(strrchr(m_items[i].hdr->path, '/') != NULL) gamePath = strrchr(m_items[i].hdr->path, '/') + 1; else @@ -2774,6 +2778,8 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank { if(m_pluginCacheFolders && m_items[i].hdr->type == TYPE_PLUGIN) coverDir = m_plugin.GetCoverFolderName(m_items[i].hdr->settings[0]); + if(m_items[i].hdr->type == TYPE_SOURCE) + coverDir = "sourceflow"; if(strrchr(m_items[i].hdr->path, '/') != NULL) gamePath = strrchr(m_items[i].hdr->path, '/') + 1; else diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 821794b3..33d4e55f 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -128,6 +128,7 @@ CMenu::CMenu() init_network = false; m_use_source = true; m_multisource = false; + m_sourceflow = false; m_clearCats = true; m_catStartPage = 1; m_combined_view = false; @@ -317,6 +318,7 @@ void CMenu::init() m_app_update_zip = fmt("%s/update.zip", m_appDir.c_str()); m_data_update_zip = fmt("%s/update.zip", m_dataDir.c_str()); + m_sourceDir = m_cfg.getString("GENERAL", "dir_Source", fmt("%s/source_menu", m_dataDir.c_str())); m_miosDir = m_cfg.getString("GENERAL", "dir_mios", fmt("%s/mios", m_dataDir.c_str())); m_customBnrDir = m_cfg.getString("GENERAL", "dir_custom_banners", fmt("%s/custom_banners", m_dataDir.c_str())); m_pluginsDir = m_cfg.getString("GENERAL", "dir_plugins", fmt("%s/plugins", m_dataDir.c_str())); @@ -377,6 +379,7 @@ void CMenu::init() /* Create our Folder Structure */ fsop_MakeFolder(m_dataDir.c_str()); //D'OH! + fsop_MakeFolder(m_sourceDir.c_str()); fsop_MakeFolder(m_miosDir.c_str()); fsop_MakeFolder(m_customBnrDir.c_str()); fsop_MakeFolder(m_pluginsDir.c_str()); @@ -526,6 +529,7 @@ void CMenu::cleanup() _cleanupDefaultFont(); m_banner.DeleteBanner(); m_plugin.Cleanup(); + m_source.unload(); _stopSounds(); _Theme_Cleanup(); @@ -752,10 +756,12 @@ float CMenu::_getCFFloat(const string &domain, const string &key, float def, boo void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt) { - bool homebrew = m_current_view == COVERFLOW_HOMEBREW; + bool homebrew = (m_sourceflow && m_cfg.getBool(_domainFromView(), "smallbox", true)) || m_current_view == COVERFLOW_HOMEBREW; bool smallbox = (homebrew || m_current_view == COVERFLOW_PLUGIN) && m_cfg.getBool(_domainFromView(), "smallbox", true); - string domain(homebrew ? fmt("_BREWFLOW_%i", version) : m_current_view == COVERFLOW_PLUGIN ? fmt("_EMUFLOW_%i", version) : fmt("_COVERFLOW_%i", version)); - string domainSel(homebrew ? fmt("_BREWFLOW_%i_S", version) : m_current_view == COVERFLOW_PLUGIN ? fmt("_EMUFLOW_%i_S", version) : fmt("_COVERFLOW_%i_S", version)); + string domain = (homebrew ? fmt("_BREWFLOW_%i", version) : (m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) ? + fmt("_EMUFLOW_%i", version) : fmt("_COVERFLOW_%i", version)); + string domainSel = (homebrew ? fmt("_BREWFLOW_%i_S", version) : (m_current_view == COVERFLOW_PLUGIN && !m_sourceflow) ? + fmt("_EMUFLOW_%i_S", version) : fmt("_COVERFLOW_%i_S", version)); bool sf = otherScrnFmt; int max_fsaa = m_theme.getInt(domain, "max_fsaa", 3); @@ -1179,6 +1185,7 @@ void CMenu::_buildMenus(void) _initCheatSettingsMenu(); _initLangSettingsMenu(); _initSourceMenu(); + _initCfgSrc(); _initPluginSettingsMenu(); _initCategorySettingsMenu(); _initSystemMenu(); @@ -1560,7 +1567,14 @@ void CMenu::_initCF(void) string id; char tmp_id[256]; u64 chantitle = TITLE_ID(element->settings[0],element->settings[1]); - if(element->type == TYPE_HOMEBREW) + if(m_sourceflow) + { + memset(tmp_id, 0, 256); + wcstombs(tmp_id, element->title, 63); + id = "source/"; + id.append(tmp_id); + } + else if(element->type == TYPE_HOMEBREW) id = strrchr(element->path, '/') + 1; else if(element->type == TYPE_PLUGIN) { @@ -1675,6 +1689,7 @@ void CMenu::_initCF(void) catDomain = "NAND"; break; case TYPE_HOMEBREW: + case TYPE_SOURCE: catDomain = "HOMEBREW"; break; case TYPE_GC_GAME: @@ -1798,8 +1813,8 @@ void CMenu::_initCF(void) u8 view = m_current_view; if(m_current_view == COVERFLOW_MAX) // target the last launched game type view m_current_view = m_last_view; - bool path = (m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW); - if(!CoverFlow.findId(m_cfg.getString(_domainFromView(), "current_item").c_str(), true, path)) + bool path = m_sourceflow || (m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW); + if(!CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true, path)) CoverFlow.defaultLoad(); m_current_view = view; CoverFlow.startCoverLoader(); @@ -2484,6 +2499,8 @@ const char *CMenu::_getId() const char *CMenu::_domainFromView() { + if(m_sourceflow) + return "SOURCEFLOW"; switch(m_current_view) { case COVERFLOW_CHANNEL: @@ -2669,6 +2686,15 @@ const char *CMenu::getBoxPath(const dir_discHdr *element) } else if(element->type == TYPE_HOMEBREW) return fmt("%s/%s.png", m_boxPicDir.c_str(), strrchr(element->path, '/') + 1); + else if(element->type == TYPE_SOURCE) + { + if(m_cfg.getBool("SOURCEFLOW", "smallbox")) + return NULL; + const char *tempname = element->path; + if(strchr(element->path, '/') != NULL) + tempname = strrchr(element->path, '/') + 1; + return fmt("%s/full_covers/%s", m_sourceDir.c_str(), tempname); + } return fmt("%s/%s.png", m_boxPicDir.c_str(), element->id); } @@ -2687,5 +2713,22 @@ const char *CMenu::getFrontPath(const dir_discHdr *element) } else if(element->type == TYPE_HOMEBREW) return fmt("%s/icon.png", element->path); + else if(element->type == TYPE_SOURCE) + { + const char *temppath = NULL; + const char *tempname = element->path; + if(strchr(element->path, '/') != NULL) + tempname = strrchr(element->path, '/') + 1; + if(!m_cfg.getBool("SOURCEFLOW", "smallbox")) + { + temppath = fmt("%s/front_covers/%s", m_sourceDir.c_str(), tempname); + if(fsop_FileExist(temppath)) + return temppath; + } + temppath = fmt("%s/small_covers/%s", m_sourceDir.c_str(), tempname); + if(fsop_FileExist(temppath)) + return temppath; + return fmt("%s", element->path); + } return fmt("%s/%s.png", m_picDir.c_str(), element->id); } diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index b5c410a7..00987778 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -91,11 +91,13 @@ private: bool m_allow_random; bool m_multisource; bool m_load_view; + bool m_sourceflow; s16 m_showtimer; string m_curLanguage; u8 m_numCFVersions; + string m_sourceDir; string m_miosDir; string m_themeDataDir; string m_appDir; @@ -850,6 +852,7 @@ private: void _initCheatSettingsMenu(); void _initCheatButtons(); void _initSourceMenu(); + void _initCfgSrc(); void _initPluginSettingsMenu(); void _initCategorySettingsMenu(); void _initSystemMenu(); @@ -863,6 +866,7 @@ private: void _initFTP(); // void _textSource(void); + void _textCfgSrc(void); void _textPluginSettings(void); void _textCategorySettings(void); void _textCheatSettings(void); @@ -894,6 +898,7 @@ private: void _textFTP(void); // void _refreshBoot(); + void _refreshCfgSrc(); void _refreshExplorer(s8 direction = 0); void _refreshLangSettings(); // @@ -1018,6 +1023,7 @@ private: void _Wad(const char *wad_path = NULL, bool autoInstall = false); void _CheatSettings(); bool _Source(); + void _CfgSrc(); void _PluginSettings(); void _CategorySettings(bool fromGameSet = false); bool _Home(); @@ -1026,6 +1032,8 @@ private: bool _ExitTo(); bool _Boot(); void _Paths(); + void _sourceFlow(); + void _createSFList(); void _mainLoopCommon(bool withCF = false, bool adjusting = false); public: void directlaunch(const char *GameID); diff --git a/source/menu/menu_boot.cpp b/source/menu/menu_boot.cpp index 19190691..8071b89d 100644 --- a/source/menu/menu_boot.cpp +++ b/source/menu/menu_boot.cpp @@ -36,18 +36,15 @@ s16 m_bootLblCIOSrevP; s16 m_bootLblUSBPort; s16 m_bootBtnUSBPort; +s16 m_bootLblManageSM; +s16 m_bootBtnManageSM; + s16 m_bootLblAsyncNet; s16 m_bootBtnAsyncNet; s16 m_bootLblCategoryOnBoot; s16 m_bootBtnCategoryOnBoot; -s16 m_bootLblSourceOnBoot; -s16 m_bootBtnSourceOnBoot; - -s16 m_bootLblMultisource; -s16 m_bootBtnMultisource; - s16 m_bootLblFtpOnBoot; s16 m_bootBtnFtpOnBoot; @@ -91,18 +88,15 @@ static void hideBoot(bool instant, bool common) m_btnMgr.hide(m_bootLblUSBPort, instant); m_btnMgr.hide(m_bootBtnUSBPort, instant); + m_btnMgr.hide(m_bootLblManageSM, instant); + m_btnMgr.hide(m_bootBtnManageSM, instant); + /* page 2 */ m_btnMgr.hide(m_bootLblAsyncNet, instant); m_btnMgr.hide(m_bootBtnAsyncNet, instant); - /* page 2 */ + m_btnMgr.hide(m_bootLblCategoryOnBoot, instant); m_btnMgr.hide(m_bootBtnCategoryOnBoot, instant); - m_btnMgr.hide(m_bootLblSourceOnBoot, instant); - m_btnMgr.hide(m_bootBtnSourceOnBoot, instant); - - m_btnMgr.hide(m_bootLblMultisource, instant); - m_btnMgr.hide(m_bootBtnMultisource, instant); - m_btnMgr.hide(m_bootLblFtpOnBoot, instant); m_btnMgr.hide(m_bootBtnFtpOnBoot, instant); } @@ -178,6 +172,13 @@ bool CMenu::_Boot(void) set_port = !set_port; m_btnMgr.setText(m_bootBtnUSBPort, wfmt(L"%i", set_port)); } + else if (m_btnMgr.selected(m_bootBtnManageSM)) + { + hideBoot(true, true); + _CfgSrc(); + showBoot(); + _refreshBoot(); + } else if (m_btnMgr.selected(m_bootBtnAsyncNet)) { m_cfg.setBool("GENERAL", "async_network", !m_cfg.getBool("GENERAL", "async_network", false)); @@ -188,17 +189,6 @@ bool CMenu::_Boot(void) m_cfg.setBool("GENERAL", "category_on_start", !m_cfg.getBool("GENERAL", "category_on_start", false)); m_btnMgr.setText(m_bootBtnCategoryOnBoot, m_cfg.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off")); } - else if (m_btnMgr.selected(m_bootBtnSourceOnBoot)) - { - m_cfg.setBool("GENERAL", "source_on_start", !m_cfg.getBool("GENERAL", "source_on_start", false)); - m_btnMgr.setText(m_bootBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off")); - } - else if (m_btnMgr.selected(m_bootBtnMultisource)) - { - m_cfg.setBool("GENERAL", "multisource", !m_cfg.getBool("GENERAL", "multisource", false)); - m_btnMgr.setText(m_bootBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off")); - m_multisource = m_cfg.getBool("GENERAL", "multisource", false); - } else if (m_btnMgr.selected(m_bootBtnFtpOnBoot)) { m_cfg.setBool(FTP_DOMAIN, "auto_start", !m_cfg.getBool(FTP_DOMAIN, "auto_start", false)); @@ -233,7 +223,6 @@ void CMenu::_refreshBoot() m_btnMgr.setText(m_bootLblCurCIOSrev, wfmt(L"%i", cur_ios)); else m_btnMgr.setText(m_bootLblCurCIOSrev, L"AUTO"); - m_btnMgr.setText(m_bootBtnAsyncNet, m_cfg.getBool("GENERAL", "async_network", false) ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.show(m_bootLblLoadCIOS); m_btnMgr.show(m_bootBtnLoadCIOS); @@ -246,25 +235,21 @@ void CMenu::_refreshBoot() m_btnMgr.show(m_bootLblUSBPort); m_btnMgr.show(m_bootBtnUSBPort); - m_btnMgr.show(m_bootLblAsyncNet); - m_btnMgr.show(m_bootBtnAsyncNet); + m_btnMgr.show(m_bootLblManageSM); + m_btnMgr.show(m_bootBtnManageSM); } else { + m_btnMgr.setText(m_bootBtnAsyncNet, m_cfg.getBool("GENERAL", "async_network", false) ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_bootBtnCategoryOnBoot, m_cfg.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off")); - m_btnMgr.setText(m_bootBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off")); - m_btnMgr.setText(m_bootBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_bootBtnFtpOnBoot, m_cfg.getBool(FTP_DOMAIN, "auto_start") ? _t("on", L"On") : _t("off", L"Off")); + m_btnMgr.show(m_bootLblAsyncNet); + m_btnMgr.show(m_bootBtnAsyncNet); + m_btnMgr.show(m_bootLblCategoryOnBoot); m_btnMgr.show(m_bootBtnCategoryOnBoot); - m_btnMgr.show(m_bootLblSourceOnBoot); - m_btnMgr.show(m_bootBtnSourceOnBoot); - - m_btnMgr.show(m_bootLblMultisource); - m_btnMgr.show(m_bootBtnMultisource); - m_btnMgr.show(m_bootLblFtpOnBoot); m_btnMgr.show(m_bootBtnFtpOnBoot); } @@ -276,10 +261,10 @@ void CMenu::_textBoot(void) m_btnMgr.setText(m_bootLblLoadCIOS, _t("cfgbt2", L"Force Load cIOS")); m_btnMgr.setText(m_bootLblCIOSrev, _t("cfgbt3", L"Force cIOS Revision")); m_btnMgr.setText(m_bootLblUSBPort, _t("cfgbt4", L"USB Port")); + m_btnMgr.setText(m_bootLblManageSM, _t("cfgsm7", L"Manage Source Menu")); + m_btnMgr.setText(m_bootBtnManageSM, _t("cfgc5", L"Go")); m_btnMgr.setText(m_bootLblAsyncNet, _t("cfgp3", L"Init network on boot")); m_btnMgr.setText(m_bootLblCategoryOnBoot, _t("cfgd7", L"Show categories on boot")); - m_btnMgr.setText(m_bootLblSourceOnBoot, _t("cfgbt5", L"Show source menu on boot")); - m_btnMgr.setText(m_bootLblMultisource, _t("cfgbt6", L"Enable Multisource Features")); m_btnMgr.setText(m_bootLblFtpOnBoot, _t("cfgbt7", L"Start FTP Server on boot")); m_btnMgr.setText(m_bootBtnBack, _t("cfg10", L"Back")); } @@ -304,21 +289,18 @@ void CMenu::_initBoot(void) m_bootLblUSBPort = _addLabel("BOOT/USB_PORT", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_bootBtnUSBPort = _addButton("BOOT/USB_PORT_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor); - - m_bootLblAsyncNet = _addLabel("BOOT/ASYNCNET", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); - m_bootBtnAsyncNet = _addButton("BOOT/ASYNCNET_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor); + + m_bootLblManageSM = _addLabel("BOOT/MANAGE_SOURCE", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_bootBtnManageSM = _addButton("BOOT/MANAGE_SOURCE_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor); /* page 2 */ - m_bootLblCategoryOnBoot = _addLabel("BOOT/CAT_ON_START", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); - m_bootBtnCategoryOnBoot = _addButton("BOOT/CAT_ON_START_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor); + m_bootLblAsyncNet = _addLabel("BOOT/ASYNCNET", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_bootBtnAsyncNet = _addButton("BOOT/ASYNCNET_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor); + + m_bootLblCategoryOnBoot = _addLabel("BOOT/CAT_ON_START", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_bootBtnCategoryOnBoot = _addButton("BOOT/CAT_ON_START_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor); - m_bootLblSourceOnBoot = _addLabel("BOOT/SOURCE_ON_START", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); - m_bootBtnSourceOnBoot = _addButton("BOOT/SOURCE_ON_START_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor); - - m_bootLblMultisource = _addLabel("BOOT/MULTISOURCE", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); - m_bootBtnMultisource = _addButton("BOOT/MULTISOURCE_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor); - - m_bootLblFtpOnBoot = _addLabel("BOOT/FTP", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); - m_bootBtnFtpOnBoot = _addButton("BOOT/FTP_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor); + m_bootLblFtpOnBoot = _addLabel("BOOT/FTP", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_bootBtnFtpOnBoot = _addButton("BOOT/FTP_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor); _setHideAnim(m_bootLblTitle, "BOOT/TITLE", 0, -200, 0.f, 1.f); _setHideAnim(m_bootBtnBack, "BOOT/BACK_BTN", 0, 0, 1.f, -1.f); @@ -336,18 +318,15 @@ void CMenu::_initBoot(void) _setHideAnim(m_bootLblUSBPort, "BOOT/USB_PORT", -200, 0, 1.f, 0.f); _setHideAnim(m_bootBtnUSBPort, "BOOT/USB_PORT_BTN", 200, 0, 1.f, 0.f); + _setHideAnim(m_bootLblManageSM, "BOOT/MANAGE_SOURCE", -200, 0, 1.f, 0.f); + _setHideAnim(m_bootBtnManageSM, "BOOT/MANAGE_SOURCE_BTN", 200, 0, 1.f, 0.f); + _setHideAnim(m_bootLblAsyncNet, "BOOT/ASYNCNET", -200, 0, 1.f, 0.f); _setHideAnim(m_bootBtnAsyncNet, "BOOT/ASYNCNET_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_bootLblCategoryOnBoot, "BOOT/CAT_ON_START", -200, 0, 1.f, 0.f); _setHideAnim(m_bootBtnCategoryOnBoot, "BOOT/CAT_ON_START_BTN", 200, 0, 1.f, 0.f); - _setHideAnim(m_bootLblSourceOnBoot, "BOOT/SOURCE_ON_START", -200, 0, 1.f, 0.f); - _setHideAnim(m_bootBtnSourceOnBoot, "BOOT/SOURCE_ON_START_BTN", 200, 0, 1.f, 0.f); - - _setHideAnim(m_bootLblMultisource, "BOOT/MULTISOURCE", -200, 0, 1.f, 0.f); - _setHideAnim(m_bootBtnMultisource, "BOOT/MULTISOURCE_BTN", 200, 0, 1.f, 0.f); - _setHideAnim(m_bootLblFtpOnBoot, "BOOT/FTP", -200, 0, 1.f, 0.f); _setHideAnim(m_bootBtnFtpOnBoot, "BOOT/FTP_BTN", 200, 0, 1.f, 0.f); diff --git a/source/menu/menu_config_source.cpp b/source/menu/menu_config_source.cpp new file mode 100644 index 00000000..230e1e17 --- /dev/null +++ b/source/menu/menu_config_source.cpp @@ -0,0 +1,287 @@ +/**************************************************************************** + * Copyright (C) 2012 Fledge68 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + ****************************************************************************/ +#include "menu.hpp" + +s16 m_cfgsrcLblTitle; +s16 m_cfgsrcBtnBack; +s16 m_cfgsrcLblPage; +s16 m_cfgsrcBtnPageM; +s16 m_cfgsrcBtnPageP; +s16 m_cfgsrcLblUser[4]; + +s16 m_cfgsrcLblEnableSM; +s16 m_cfgsrcBtnEnableSM; + +s16 m_cfgsrcLblSourceOnBoot; +s16 m_cfgsrcBtnSourceOnBoot; + +s16 m_cfgsrcLblEnableSF; +s16 m_cfgsrcBtnEnableSF; + +s16 m_cfgsrcLblSmallbox; +s16 m_cfgsrcBtnSmallbox; + +s16 m_cfgsrcLblClearSF; +s16 m_cfgsrcBtnClearSF; + +s16 m_cfgsrcLblMultisource; +s16 m_cfgsrcBtnMultisource; + +s16 m_cfgsrcLblBonMode; +s16 m_cfgsrcBtnBonMode; + +u8 cfgsrc_curPage = 1; +u8 cfgsrc_Pages = 2; + +static void showCfgSrc(void) +{ + m_btnMgr.show(m_cfgsrcLblTitle); + m_btnMgr.show(m_cfgsrcBtnBack); + m_btnMgr.show(m_cfgsrcLblPage); + m_btnMgr.show(m_cfgsrcBtnPageM); + m_btnMgr.show(m_cfgsrcBtnPageP); + for(u8 i = 0; i < ARRAY_SIZE(m_cfgsrcLblUser); ++i) + if(m_cfgsrcLblUser[i] != -1) + m_btnMgr.show(m_cfgsrcLblUser[i]); +} + +static void hideCfgSrc(bool instant, bool common) +{ + if(common) + { + m_btnMgr.hide(m_cfgsrcLblTitle, instant); + m_btnMgr.hide(m_cfgsrcBtnBack, instant); + m_btnMgr.hide(m_cfgsrcLblPage, instant); + m_btnMgr.hide(m_cfgsrcBtnPageM, instant); + m_btnMgr.hide(m_cfgsrcBtnPageP, instant); + for(u8 i = 0; i < ARRAY_SIZE(m_cfgsrcLblUser); ++i) + if(m_cfgsrcLblUser[i] != -1) + m_btnMgr.hide(m_cfgsrcLblUser[i], instant); + } + m_btnMgr.hide(m_cfgsrcLblEnableSM, instant); + m_btnMgr.hide(m_cfgsrcBtnEnableSM, instant); + + m_btnMgr.hide(m_cfgsrcLblSourceOnBoot, instant); + m_btnMgr.hide(m_cfgsrcBtnSourceOnBoot, instant); + + m_btnMgr.hide(m_cfgsrcLblEnableSF, instant); + m_btnMgr.hide(m_cfgsrcBtnEnableSF, instant); + + m_btnMgr.hide(m_cfgsrcLblSmallbox, instant); + m_btnMgr.hide(m_cfgsrcBtnSmallbox, instant); + /* page 2 */ + m_btnMgr.hide(m_cfgsrcLblClearSF, instant); + m_btnMgr.hide(m_cfgsrcBtnClearSF, instant); + + m_btnMgr.hide(m_cfgsrcLblMultisource, instant); + m_btnMgr.hide(m_cfgsrcBtnMultisource, instant); + + m_btnMgr.hide(m_cfgsrcLblBonMode, instant); + m_btnMgr.hide(m_cfgsrcBtnBonMode, instant); +} + +void CMenu::_CfgSrc(void) +{ + cfgsrc_curPage = 1; + SetupInput(); + showCfgSrc(); + _refreshCfgSrc(); + + while(!m_exit) + { + _mainLoopCommon(); + if(BTN_HOME_PRESSED || BTN_B_PRESSED) + break; + else if(BTN_UP_PRESSED) + m_btnMgr.up(); + else if(BTN_DOWN_PRESSED) + m_btnMgr.down(); + else if((BTN_MINUS_PRESSED || BTN_LEFT_PRESSED) || (BTN_A_PRESSED && m_btnMgr.selected(m_cfgsrcBtnPageM))) + { + cfgsrc_curPage--; + if(cfgsrc_curPage == 0) cfgsrc_curPage = cfgsrc_Pages; + if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED) + m_btnMgr.click(m_cfgsrcBtnPageM); + _refreshCfgSrc(); + } + else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED)) || (BTN_A_PRESSED && m_btnMgr.selected(m_cfgsrcBtnPageP))) + { + cfgsrc_curPage++; + if(cfgsrc_curPage > cfgsrc_Pages) cfgsrc_curPage = 1; + if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED) + m_btnMgr.click(m_cfgsrcBtnPageP); + _refreshCfgSrc(); + } + else if(BTN_A_PRESSED) + { + if(m_btnMgr.selected(m_cfgsrcBtnBack)) + break; + else if (m_btnMgr.selected(m_cfgsrcBtnEnableSM)) + { + m_cfg.setBool("GENERAL", "use_source", !m_cfg.getBool("GENERAL", "use_source", false)); + m_btnMgr.setText(m_cfgsrcBtnEnableSM, m_cfg.getBool("GENERAL", "use_source", false) ? _t("on", L"On") : _t("off", L"Off")); + } + else if (m_btnMgr.selected(m_cfgsrcBtnSourceOnBoot)) + { + m_cfg.setBool("GENERAL", "source_on_start", !m_cfg.getBool("GENERAL", "source_on_start", false)); + m_btnMgr.setText(m_cfgsrcBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off")); + } + else if (m_btnMgr.selected(m_cfgsrcBtnEnableSF)) + { + m_cfg.setBool("SOURCEFLOW", "enabled", !m_cfg.getBool("SOURCEFLOW", "enabled", false)); + m_btnMgr.setText(m_cfgsrcBtnEnableSF, m_cfg.getBool("SOURCEFLOW", "enabled") ? _t("on", L"On") : _t("off", L"Off")); + } + else if (m_btnMgr.selected(m_cfgsrcBtnSmallbox)) + { + fsop_deleteFolder(fmt("%s/sourceflow", m_cacheDir.c_str())); + m_cfg.setBool("SOURCEFLOW", "smallbox", !m_cfg.getBool("SOURCEFLOW", "smallbox", false)); + m_btnMgr.setText(m_cfgsrcBtnSmallbox, m_cfg.getBool("SOURCEFLOW", "smallbox") ? _t("on", L"On") : _t("off", L"Off")); + } + else if (m_btnMgr.selected(m_cfgsrcBtnClearSF)) + { + fsop_deleteFolder(fmt("%s/sourceflow", m_cacheDir.c_str())); + } + else if (m_btnMgr.selected(m_cfgsrcBtnMultisource)) + { + m_cfg.setBool("GENERAL", "multisource", !m_cfg.getBool("GENERAL", "multisource", false)); + m_btnMgr.setText(m_cfgsrcBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off")); + m_multisource = m_cfg.getBool("GENERAL", "multisource", false); + } + else if (m_btnMgr.selected(m_cfgsrcBtnBonMode)) + { + m_cfg.setBool("GENERAL", "b_on_mode_to_source", !m_cfg.getBool("GENERAL", "b_on_mode_to_source", false)); + m_btnMgr.setText(m_cfgsrcBtnBonMode, m_cfg.getBool("GENERAL", "b_on_mode_to_source") ? _t("on", L"On") : _t("off", L"Off")); + } + } + } + hideCfgSrc(false, true); +} + +void CMenu::_refreshCfgSrc() +{ + hideCfgSrc(true, false); + m_btnMgr.setText(m_cfgsrcLblPage, wfmt(L"%i / %i", cfgsrc_curPage, cfgsrc_Pages)); + if(cfgsrc_curPage == 1) + { + m_btnMgr.setText(m_cfgsrcBtnEnableSM, m_cfg.getBool("GENERAL", "use_source") ? _t("on", L"On") : _t("off", L"Off")); + m_btnMgr.setText(m_cfgsrcBtnSourceOnBoot, m_cfg.getBool("GENERAL", "source_on_start") ? _t("on", L"On") : _t("off", L"Off")); + m_btnMgr.setText(m_cfgsrcBtnEnableSF, m_cfg.getBool("SOURCEFLOW", "enabled") ? _t("on", L"On") : _t("off", L"Off")); + m_btnMgr.setText(m_cfgsrcBtnSmallbox, m_cfg.getBool("SOURCEFLOW", "smallbox") ? _t("on", L"On") : _t("off", L"Off")); + + m_btnMgr.show(m_cfgsrcLblEnableSM); + m_btnMgr.show(m_cfgsrcBtnEnableSM); + + m_btnMgr.show(m_cfgsrcLblSourceOnBoot); + m_btnMgr.show(m_cfgsrcBtnSourceOnBoot); + + m_btnMgr.show(m_cfgsrcLblEnableSF); + m_btnMgr.show(m_cfgsrcBtnEnableSF); + + m_btnMgr.show(m_cfgsrcLblSmallbox); + m_btnMgr.show(m_cfgsrcBtnSmallbox); + } + else + { + m_btnMgr.setText(m_cfgsrcBtnMultisource, m_cfg.getBool("GENERAL", "multisource") ? _t("on", L"On") : _t("off", L"Off")); + m_btnMgr.setText(m_cfgsrcBtnBonMode, m_cfg.getBool("GENERAL", "b_on_mode_to_source") ? _t("on", L"On") : _t("off", L"Off")); + + m_btnMgr.show(m_cfgsrcLblClearSF); + m_btnMgr.show(m_cfgsrcBtnClearSF); + + m_btnMgr.show(m_cfgsrcLblMultisource); + m_btnMgr.show(m_cfgsrcBtnMultisource); + + m_btnMgr.show(m_cfgsrcLblBonMode); + m_btnMgr.show(m_cfgsrcBtnBonMode); + } +} + +void CMenu::_textCfgSrc(void) +{ + m_btnMgr.setText(m_cfgsrcLblTitle, _t("cfgsm1", L"Source Menu Settings")); + m_btnMgr.setText(m_cfgsrcLblEnableSM, _t("cfgsm2", L"Enable Source Menu")); + m_btnMgr.setText(m_cfgsrcLblSourceOnBoot, _t("cfgbt5", L"Show source menu on boot")); + m_btnMgr.setText(m_cfgsrcLblEnableSF, _t("cfgsm3", L"Enable Sourceflow")); + m_btnMgr.setText(m_cfgsrcLblSmallbox, _t("cfgsm4", L"Sourceflow Smallbox")); + m_btnMgr.setText(m_cfgsrcLblClearSF, _t("cfgsm5", L"Clear Sourceflow Cache")); + m_btnMgr.setText(m_cfgsrcBtnClearSF, _t("cfgc5", L"Go")); + m_btnMgr.setText(m_cfgsrcLblMultisource, _t("cfgbt6", L"Enable Multisource Features")); + m_btnMgr.setText(m_cfgsrcLblBonMode, _t("cfgsm6", L"B On Mode To Source")); + m_btnMgr.setText(m_cfgsrcBtnBack, _t("cfg10", L"Back")); +} + + +void CMenu::_initCfgSrc(void) +{ + _addUserLabels(m_cfgsrcLblUser, ARRAY_SIZE(m_cfgsrcLblUser), "CFG_SRC"); + m_cfgsrcLblTitle = _addTitle("CFG_SRC/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnBack = _addButton("CFG_SRC/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor); + m_cfgsrcLblPage = _addLabel("CFG_SRC/PAGE_BTN", theme.btnFont, L"", 76, 400, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); + m_cfgsrcBtnPageM = _addPicButton("CFG_SRC/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 400, 56, 56); + m_cfgsrcBtnPageP = _addPicButton("CFG_SRC/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 400, 56, 56); + + m_cfgsrcLblEnableSM = _addLabel("CFG_SRC/ENABLE_SM", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnEnableSM = _addButton("CFG_SRC/ENABLE_SM_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor); + + m_cfgsrcLblSourceOnBoot = _addLabel("CFG_SRC/SOURCE_ON_START", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnSourceOnBoot = _addButton("CFG_SRC/SOURCE_ON_START_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor); + + m_cfgsrcLblEnableSF = _addLabel("CFG_SRC/ENABLE_SF", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnEnableSF = _addButton("CFG_SRC/ENABLE_SF_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor); + + m_cfgsrcLblSmallbox = _addLabel("CFG_SRC/SF_SMALLBOX", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnSmallbox = _addButton("CFG_SRC/SF_SMALLBOX_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor); + /* page 2 */ + m_cfgsrcLblClearSF = _addLabel("CFG_SRC/CLEAR_SF", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnClearSF = _addButton("CFG_SRC/CLEAR_SF_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor); + + m_cfgsrcLblMultisource = _addLabel("CFG_SRC/MULTISOURCE", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnMultisource = _addButton("CFG_SRC/MULTISOURCE_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor); + + m_cfgsrcLblBonMode = _addLabel("CFG_SRC/B_ON_MODE", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_cfgsrcBtnBonMode = _addButton("CFG_SRC/B_ON_MODE_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor); + + _setHideAnim(m_cfgsrcLblTitle, "CFG_SRC/TITLE", 0, -200, 0.f, 1.f); + _setHideAnim(m_cfgsrcBtnBack, "CFG_SRC/BACK_BTN", 0, 0, 1.f, -1.f); + _setHideAnim(m_cfgsrcLblPage, "CFG_SRC/PAGE_BTN", 0, 0, 1.f, -1.f); + _setHideAnim(m_cfgsrcBtnPageM, "CFG_SRC/PAGE_MINUS", 0, 0, 1.f, -1.f); + _setHideAnim(m_cfgsrcBtnPageP, "CFG_SRC/PAGE_PLUS", 0, 0, 1.f, -1.f); + + _setHideAnim(m_cfgsrcLblEnableSM, "CFG_SRC/ENABLE_SM", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnEnableSM, "CFG_SRC/ENABLE_SM_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblSourceOnBoot, "CFG_SRC/SOURCE_ON_START", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnSourceOnBoot, "CFG_SRC/SOURCE_ON_START_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblEnableSF, "CFG_SRC/ENABLE_SF", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnEnableSF, "CFG_SRC/ENABLE_SF_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblSmallbox, "CFG_SRC/SF_SMALLBOX", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnSmallbox, "CFG_SRC/SF_SMALLBOX_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblClearSF, "CFG_SRC/CLEAR_SF", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnClearSF, "CFG_SRC/CLEAR_SF_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblMultisource, "CFG_SRC/MULTISOURCE", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnMultisource, "CFG_SRC/MULTISOURCE_BTN", 200, 0, 1.f, 0.f); + + _setHideAnim(m_cfgsrcLblBonMode, "CFG_SRC/B_ON_MODE", -200, 0, 1.f, 0.f); + _setHideAnim(m_cfgsrcBtnBonMode, "CFG_SRC/B_ON_MODE_BTN", 200, 0, 1.f, 0.f); + + hideCfgSrc(true, true); + _textCfgSrc(); +} diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index 42d64bb4..2470bd89 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -162,11 +162,17 @@ void CMenu::_hideSettings(bool instant) m_btnMgr.hide(m_downloadBtnKOs, instant); m_btnMgr.hide(m_downloadBtnZHCNs, instant); m_btnMgr.hide(m_downloadBtnAUs, instant); - m_btnMgr.hide(m_downloadBtnBack, instant); + m_btnMgr.hide(m_downloadBtnBack, instant); + for(u8 i = 0; i < ARRAY_SIZE(m_downloadLblUser); ++i) + if(m_downloadLblUser[i] != -1) + m_btnMgr.hide(m_downloadLblUser[i], instant); } void CMenu::_showSettings() { _hideDownload(); + for(u8 i = 0; i < ARRAY_SIZE(m_downloadLblUser); ++i) + if(m_downloadLblUser[i] != -1) + m_btnMgr.show(m_downloadLblUser[i]); m_btnMgr.show(m_downloadLblSetTitle); m_btnMgr.show(m_downloadLblCoverPrio); m_btnMgr.show(m_downloadLblPrio); diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 6d9a9f37..c8158281 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -193,14 +193,19 @@ void CMenu::LoadView(void) } m_clearCats = true; m_favorites = false; - if (m_cfg.getBool("GENERAL", "save_favorites_mode", false)) + if(m_cfg.getBool("GENERAL", "save_favorites_mode", false)) m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false); - _loadList(); + if(m_sourceflow) + _createSFList(); + else + _loadList(); _showMain(); _initCF(); _loadCFLayout(m_cfg.getInt(_domainFromView(), "last_cf_mode", 1)); CoverFlow.applySettings(); + if(m_sourceflow) + return; const char *mode = (m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool(CHANNEL_DOMAIN, "disable", true)) ? CHANNEL_DOMAIN : DeviceName[currentPartition]; @@ -271,14 +276,22 @@ int CMenu::main(void) if(m_cfg.getBool("GENERAL", "source_on_start", false)) { _hideMain(); - if(!_Source()) + if(m_cfg.getBool("SOURCEFLOW", "enabled", false)) + { + m_sourceflow = true; LoadView(); + } else { - if(BTN_B_HELD) - bUsed = true; - _initCF(); - _showMain(); + if(!_Source()) + LoadView(); + else + { + if(BTN_B_HELD) + bUsed = true; + _initCF(); + _showMain(); + } } } @@ -292,20 +305,32 @@ int CMenu::main(void) { bheld = false; if(bUsed) - { bUsed = false; - } else { - _hideMain(); - if(!_Source()) //Different source selected + if(m_sourceflow) + { + m_sourceflow = false; LoadView(); + continue; + } + _hideMain(); + if(m_cfg.getBool("SOURCEFLOW", "enabled", false)) + { + m_sourceflow = true; + LoadView(); + } else { - if(BTN_B_HELD) - bUsed = true; - _initCF(); - _showMain(); + if(!_Source()) //Different source selected + LoadView(); + else + { + if(BTN_B_HELD) + bUsed = true; + _initCF(); + _showMain(); + } } continue; } @@ -346,7 +371,7 @@ int CMenu::main(void) LoadView(); continue; } - if(BTN_HOME_PRESSED) + if(BTN_HOME_PRESSED && !m_sourceflow) { _hideMain(); if(_Home()) //exit wiiflow @@ -484,13 +509,22 @@ int CMenu::main(void) else if(!CoverFlow.empty() && CoverFlow.select()) { _hideMain(); - _game(BTN_B_HELD); - if(m_exit) - break; - if(BTN_B_HELD) - bUsed = true; - CoverFlow.cancel(); - _showMain(); + if(m_sourceflow) + { + _sourceFlow(); + LoadView(); + continue; + } + else + { + _game(BTN_B_HELD); + if(m_exit) + break; + if(BTN_B_HELD) + bUsed = true; + CoverFlow.cancel(); + _showMain(); + } } } else if(BTN_B_PRESSED) @@ -659,7 +693,7 @@ int CMenu::main(void) else MusicPlayer.Next(); } - else if(BTN_PLUS_PRESSED && !m_locked) + else if(BTN_PLUS_PRESSED && !m_locked && !m_sourceflow) { bUsed = true; u32 sort = 0; @@ -687,7 +721,7 @@ int CMenu::main(void) m_btnMgr.setText(m_mainLblNotice, curSort); m_btnMgr.show(m_mainLblNotice); } - else if(BTN_MINUS_PRESSED && !m_locked) + else if(BTN_MINUS_PRESSED && !m_locked && !m_sourceflow) { bUsed = true; const char *partition = NULL; @@ -739,7 +773,7 @@ int CMenu::main(void) m_btnMgr.show(m_mainBtnNext); else m_btnMgr.hide(m_mainBtnNext); - if(!m_gameList.empty() && m_show_zone_main) + if(!m_gameList.empty() && m_show_zone_main && !m_sourceflow) { m_btnMgr.show(m_mainLblUser[0]); m_btnMgr.show(m_mainLblUser[1]); @@ -762,7 +796,7 @@ int CMenu::main(void) m_btnMgr.hide(m_mainBtnFavoritesOn); m_btnMgr.hide(m_mainBtnFavoritesOff); } - if(!m_cfg.getBool("GENERAL", "hideviews", false) && (m_gameList.empty() || m_show_zone_main2)) + if((!m_cfg.getBool("GENERAL", "hideviews", false) && (m_gameList.empty() || m_show_zone_main2)) && !m_sourceflow) { switch(m_current_view) { @@ -819,7 +853,7 @@ int CMenu::main(void) m_btnMgr.hide(m_mainLblUser[2]); m_btnMgr.hide(m_mainLblUser[3]); } - if((disc_check & 0x2) && (m_gameList.empty() || m_show_zone_main3)) + if(((disc_check & 0x2) && (m_gameList.empty() || m_show_zone_main3)) && !m_sourceflow) { m_btnMgr.show(m_mainBtnDVD); m_btnMgr.show(m_mainLblUser[4]); diff --git a/source/menu/menu_source.cpp b/source/menu/menu_source.cpp index 8d23b55a..e9931029 100644 --- a/source/menu/menu_source.cpp +++ b/source/menu/menu_source.cpp @@ -38,9 +38,9 @@ u8 sourceBtn; u8 selectedBtns; int source_curPage; int source_Pages; -string m_sourceDir; string themeName; vector magicNums; +char btn_selected[256]; void CMenu::_hideSource(bool instant) { @@ -190,6 +190,158 @@ void CMenu::_showSourceNotice(void) m_btnMgr.show(m_sourceLblNotice); } +dir_discHdr sourceList; +void CMenu::_createSFList() +{ + bool show_homebrew = !m_cfg.getBool(HOMEBREW_DOMAIN, "disable", false); + bool show_channel = !m_cfg.getBool("GENERAL", "hidechannel", false); + bool show_emu = !m_cfg.getBool(PLUGIN_DOMAIN, "disable", false); + bool parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false); + m_gameList.clear(); + for(u8 i = 0; i < m_cfg.getInt("GENERAL", "max_source_buttons", 71); i++) + { + memset(btn_selected, 0, 256); + strncpy(btn_selected, fmt("BUTTON_%i", i), 255); + string source = m_source.getString(btn_selected, "source",""); + if(source == "") + continue; + if(source == "dml" && !m_show_dml && !m_devo_installed) + continue; + else if(source == "emunand" && !show_channel) + continue; + else if(source == "homebrew" && (!show_homebrew || (!parental_homebrew && m_locked))) + continue; + else if((source == "plugin" || source == "allplugins") && !show_emu) + continue; + const char *path = fmt("%s/%s", m_sourceDir.c_str(), m_source.getString(btn_selected, "image", "").c_str()); + memset((void*)&sourceList, 0, sizeof(dir_discHdr)); + sourceList.index = m_gameList.size(); + strncpy(sourceList.id, "SOURCE", 6); + strncpy(sourceList.path, path, sizeof(sourceList.path) - 1); + sourceList.casecolor = 0xFFFFFF; + sourceList.type = TYPE_SOURCE; + sourceList.settings[0] = i; + const char *title = m_source.getString(btn_selected, "title", fmt("title_%i", i)).c_str(); + mbstowcs(sourceList.title, title, 63); + Asciify(sourceList.title); + m_gameList.push_back(sourceList); + } +} + +void CMenu::_sourceFlow() +{ + u8 numPlugins = 0, k; + if(!m_cfg.getBool(PLUGIN_DOMAIN, "disable", false)) + { + Config m_plugin_cfg; + DIR *pdir; + struct dirent *pent; + pdir = opendir(m_pluginsDir.c_str()); + while((pent = readdir(pdir)) != NULL) + { + if(pent->d_name[0] == '.'|| strcasecmp(pent->d_name, "scummvm.ini") == 0) + continue; + if(strcasestr(pent->d_name, ".ini") != NULL) + { + m_plugin_cfg.load(fmt("%s/%s", m_pluginsDir.c_str(), pent->d_name)); + if (m_plugin_cfg.loaded()) + { + numPlugins++; + m_plugin.AddPlugin(m_plugin_cfg); + } + m_plugin_cfg.unload(); + } + } + closedir(pdir); + m_plugin.EndAdd(); + } + const dir_discHdr *hdr = CoverFlow.getHdr(); + m_cfg.setString("SOURCEFLOW", "current_item", strrchr(hdr->path, '/') + 1); + memset(btn_selected, 0, 256); + strncpy(btn_selected, fmt("BUTTON_%i", hdr->settings[0]), 255); + string source = m_source.getString(btn_selected, "source", ""); + _clearSources(); + if(source == "wii") + { + m_current_view = COVERFLOW_USB; + m_cfg.setBool(WII_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + } + else if(source == "dml") + { + m_current_view = COVERFLOW_DML; + m_cfg.setBool(GC_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + } + else if(source == "emunand") + { + m_current_view = COVERFLOW_CHANNEL; + m_cfg.setBool(CHANNEL_DOMAIN, "disable", false); + m_cfg.setBool(CHANNEL_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + } + else if(source == "realnand") + { + m_current_view = COVERFLOW_CHANNEL; + m_cfg.setBool(CHANNEL_DOMAIN, "disable", true); + m_cfg.setBool(CHANNEL_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + } + else if(source == "homebrew") + { + m_current_view = COVERFLOW_HOMEBREW; + m_cfg.setBool(HOMEBREW_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + } + else if(source == "allplugins") + { + m_current_view = COVERFLOW_PLUGIN; + m_cfg.setBool(PLUGIN_DOMAIN, "source", true); + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + for(k = 0; k < numPlugins; ++k) + m_plugin.SetEnablePlugin(m_cfg, k, 2); /* force enable */ + } + else if(source == "plugin") + { + magicNums.clear(); + magicNums = m_source.getStrings(btn_selected, "magic", ','); + u32 plugin_magic_nums = magicNums.size(); + if(plugin_magic_nums != 0) + { + m_current_view = COVERFLOW_PLUGIN; + m_cfg.setBool(PLUGIN_DOMAIN, "source", true); + for(k = 0; k < numPlugins; ++k) + m_plugin.SetEnablePlugin(m_cfg, k, 1); /* force disable */ + for(vector::iterator itr = magicNums.begin(); itr != magicNums.end(); itr++) + { + s8 exist = m_plugin.GetPluginPosition(strtoul(itr->c_str(), NULL, 16)); + if(exist >= 0) + m_plugin.SetEnablePlugin(m_cfg, exist, 2); + if(plugin_magic_nums == 1) + { + currentPartition = m_cfg.getInt("PLUGINS/PARTITION", itr->c_str(), 1); + m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition); + } + } + } + m_catStartPage = m_source.getInt(btn_selected, "cat_page", 1); + int layout = m_source.getInt(btn_selected, "emuflow", 0); + if(layout > 0) + m_cfg.setInt(PLUGIN_DOMAIN, "last_cf_mode", layout); + int category = m_source.getInt(btn_selected, "category", 0); + if(category > 0) + { + m_cat.remove("GENERAL", "selected_categories"); + m_cat.remove("GENERAL", "required_categories"); + char cCh = static_cast(category + 32); + string newSelCats(1, cCh); + m_cat.setString("GENERAL", "selected_categories", newSelCats); + m_clearCats = false; + } + } + m_sourceflow = false; +} + bool CMenu::_Source() { CoverFlow.clear(); @@ -285,6 +437,21 @@ bool CMenu::_Source() if(selectedBtns == 0) m_cfg.setBool(WII_DOMAIN, "source", true); + vector plugin_list = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount); + if(enabledPluginsCount == 1) + { + u8 i = 0; + for(i = 0; i < enabledPluginsCount; ++i) + { + if(plugin_list[i] == true) + break; + } + char PluginMagicWord[9]; + memset(PluginMagicWord, 0, sizeof(PluginMagicWord)); + strncpy(PluginMagicWord, fmt("%08x", m_plugin.getPluginMagic(i)), 8); + currentPartition = m_cfg.getInt("PLUGINS/PARTITION", PluginMagicWord, 1); + m_cfg.setInt(PLUGIN_DOMAIN, "partition", currentPartition); + } u8 sourceCount = 0; if(m_cfg.getBool(WII_DOMAIN, "source", false)) sourceCount++; @@ -386,7 +553,6 @@ bool CMenu::_Source() { if(m_btnMgr.selected(m_sourceBtnSource[i])) { - char btn_selected[256]; memset(btn_selected, 0, 256); strncpy(btn_selected, fmt("BUTTON_%i", i + j), 255); string source = m_source.getString(btn_selected, "source", ""); @@ -641,11 +807,11 @@ void CMenu::_initSourceMenu() m_sourceBtnDML = _addPicButton("SOURCE/DML_BTN", texDML, texDMLs, 295, 200, 48, 48); m_sourceBtnEmu = _addPicButton("SOURCE/EMU_BTN", texEmu, texEmus, 355, 200, 48, 48); - m_sourceDir = m_cfg.getString("GENERAL", "dir_Source", fmt("%s/source_menu", m_dataDir.c_str())); - themeName = m_cfg.getString("GENERAL", "theme", "default"); if(!m_source.load(fmt("%s/%s/%s", m_sourceDir.c_str(), themeName.c_str(), SOURCE_FILENAME))) - m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME)); + m_source.load(fmt("%s/%s", m_sourceDir.c_str(), SOURCE_FILENAME)); + else + m_sourceDir = fmt("%s/%s", m_sourceDir.c_str(), themeName.c_str()); int row; int col; diff --git a/source/types.h b/source/types.h index 1f20871e..33458b98 100644 --- a/source/types.h +++ b/source/types.h @@ -29,9 +29,10 @@ enum TYPE_CHANNEL, TYPE_PLUGIN, TYPE_HOMEBREW, + TYPE_SOURCE, TYPE_END }; -#define NoGameID(x) (x == TYPE_PLUGIN || x == TYPE_HOMEBREW) +#define NoGameID(x) (x == TYPE_PLUGIN || x == TYPE_HOMEBREW || x == TYPE_SOURCE) enum { diff --git a/wii/wiiflow/Languages/english.ini b/wii/wiiflow/Languages/english.ini index f8f2a023..adaa48fc 100644 --- a/wii/wiiflow/Languages/english.ini +++ b/wii/wiiflow/Languages/english.ini @@ -163,6 +163,13 @@ cfgs1=Music volume cfgs2=GUI sound volume cfgs3=Coverflow sound volume cfgs4=Game sound volume +cfgsm1=Source Menu Settings +cfgsm2=Enable Source Menu +cfgsm3=Enable Sourceflow +cfgsm4=Sourceflow Smallbox +cfgsm5=Clear Sourceflow Cache +cfgsm6=B On Mode To Source +cfgsm7=Manage Source Menu cheat1=Back cheat2=Apply cheat3=Cheat file for game not found.