-Fixed homebrew mode saving current item

-Fixed favorites_on_startup.  renamed it save_favorites_mode. defaults to off. set to yes and wiiflow will remember if favorites was on or off for each view/mode. Still can be set on page 4 of config menu.
-Fixed favorites and parental lock for plugins.  Parental lock might come in handy for movies. 
-And restored save for categories_v4.ini on exit of wiiflow
This commit is contained in:
fledge68 2012-09-11 12:01:07 +00:00
parent f9040335a7
commit 49ada11bb9
7 changed files with 51 additions and 53 deletions

View File

@ -457,10 +457,6 @@ void CMenu::init(void)
m_cf.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255)); m_cf.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_coverflow", 255));
m_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 255)); m_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 255));
m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255); m_bnrSndVol = m_cfg.getInt("GENERAL", "sound_volume_bnr", 255);
if (m_cfg.getBool("GENERAL", "favorites_on_startup", false))
m_favorites = m_cfg.getBool(domain, "favorites", false);
m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true); m_bnr_settings = m_cfg.getBool("GENERAL", "banner_in_settings", true);
m_cfg.setString("GAMERCARD", "gamercards", "wiinnertag|dutag"); m_cfg.setString("GAMERCARD", "gamercards", "wiinnertag|dutag");
@ -2452,6 +2448,38 @@ void CMenu::_cleanupDefaultFont()
MEM1_lo_free(m_wbf2_font); MEM1_lo_free(m_wbf2_font);
} }
string CMenu::_getId()
{
string id;
if(m_current_view != COVERFLOW_EMU && m_current_view != COVERFLOW_HOMEBREW)
id = m_cf.getId();
else
{
dir_discHdr *hdr = m_cf.getHdr();
string tempname(hdr->path);
if(m_current_view == COVERFLOW_HOMEBREW)
{
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
id = tempname;
}
else if(m_current_view == COVERFLOW_EMU)
{
if(!m_plugin.isScummVM(hdr->settings[0]))
{
tempname.erase(0, tempname.find_first_of('/')+1);
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
if(tempname.find_last_of('.') != string::npos)
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
id = dirName+tempname;
}
else
id = tempname;
}
}
return id;
}
const char *CMenu::_domainFromView() const char *CMenu::_domainFromView()
{ {
switch(m_current_view) switch(m_current_view)

View File

@ -994,6 +994,7 @@ private:
void _buildMenus(void); void _buildMenus(void);
void _loadDefaultFont(bool korean); void _loadDefaultFont(bool korean);
void _cleanupDefaultFont(); void _cleanupDefaultFont();
string _getId(void);
const char *_domainFromView(void); const char *_domainFromView(void);
const char *_cfDomain(bool selected = false); const char *_cfDomain(bool selected = false);
void UpdateCache(u32 view = COVERFLOW_MAX); void UpdateCache(u32 view = COVERFLOW_MAX);

View File

@ -121,19 +121,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
gameSet = fromGameSet; gameSet = fromGameSet;
if(fromGameSet) if(fromGameSet)
{ {
if(m_current_view != COVERFLOW_EMU) id = _getId();
id = m_cf.getId();
else
{
dir_discHdr *hdr = m_cf.getHdr();
string tempname(hdr->path);
tempname.erase(0, tempname.find_first_of('/')+1);
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
if(tempname.find_last_of('.') != string::npos)
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
id = dirName+tempname;
}
catSettings = m_cat.getString(_domainFromView(), id, "").c_str(); catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle()); m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
} }
@ -187,19 +175,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
_hideCategorySettings(); _hideCategorySettings();
m_cf.right(); m_cf.right();
curPage = 1; curPage = 1;
if(m_current_view != COVERFLOW_EMU) id = _getId();
id = m_cf.getId();
else
{
dir_discHdr *hdr = m_cf.getHdr();
string tempname(hdr->path);
tempname.erase(0, tempname.find_first_of('/')+1);
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
if(tempname.find_last_of('.') != string::npos)
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
id = dirName+tempname;
}
catSettings = m_cat.getString(_domainFromView(), id, "").c_str(); catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle()); m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
@ -216,19 +192,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
_hideCategorySettings(); _hideCategorySettings();
m_cf.left(); m_cf.left();
curPage = 1; curPage = 1;
if(m_current_view != COVERFLOW_EMU) id = _getId();
id = m_cf.getId();
else
{
dir_discHdr *hdr = m_cf.getHdr();
string tempname(hdr->path);
tempname.erase(0, tempname.find_first_of('/')+1);
string dirName = tempname.substr(0, tempname.find_first_of('/')+1);
tempname.assign(&tempname[tempname.find_last_of('/') + 1]);
if(tempname.find_last_of('.') != string::npos)
tempname.erase(tempname.find_last_of('.'), tempname.size() - tempname.find_last_of('.'));
id = dirName+tempname;
}
catSettings = m_cat.getString(_domainFromView(), id, "").c_str(); catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle()); m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());

View File

@ -69,7 +69,7 @@ void CMenu::_showConfig4(void)
int i; int i;
i = min(max(0, m_cfg.getInt("GENERAL", "exit_to", 0)), (int)ARRAY_SIZE(CMenu::_exitTo) - 1); i = min(max(0, m_cfg.getInt("GENERAL", "exit_to", 0)), (int)ARRAY_SIZE(CMenu::_exitTo) - 1);
m_btnMgr.setText(m_config4BtnHome, _t(CMenu::_exitTo[i].id, CMenu::_exitTo[i].text)); m_btnMgr.setText(m_config4BtnHome, _t(CMenu::_exitTo[i].id, CMenu::_exitTo[i].text));
m_btnMgr.setText(m_config4BtnSaveFavMode, m_cfg.getBool("GENERAL", "favorites_on_startup") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_config4BtnSaveFavMode, m_cfg.getBool("GENERAL", "save_favorites_mode") ? _t("on", L"On") : _t("off", L"Off"));
m_btnMgr.setText(m_config4BtnCategoryOnBoot, m_cat.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off")); m_btnMgr.setText(m_config4BtnCategoryOnBoot, m_cat.getBool("GENERAL", "category_on_start") ? _t("on", L"On") : _t("off", L"Off"));
Config titles, custom_titles; Config titles, custom_titles;
@ -125,7 +125,7 @@ int CMenu::_config4(void)
} }
else if (m_btnMgr.selected(m_config4BtnSaveFavMode)) else if (m_btnMgr.selected(m_config4BtnSaveFavMode))
{ {
m_cfg.setBool("GENERAL", "favorites_on_startup", !m_cfg.getBool("GENERAL", "favorites_on_startup")); m_cfg.setBool("GENERAL", "save_favorites_mode", !m_cfg.getBool("GENERAL", "save_favorites_mode"));
_showConfig4(); _showConfig4();
} }
else if (m_btnMgr.selected(m_config4BtnCategoryOnBoot)) else if (m_btnMgr.selected(m_config4BtnCategoryOnBoot))

View File

@ -511,9 +511,9 @@ void CMenu::_game(bool launch)
} }
} }
else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff)) else if(m_btnMgr.selected(m_gameBtnFavoriteOn) || m_btnMgr.selected(m_gameBtnFavoriteOff))
m_gcfg1.setBool("FAVORITES", m_cf.getId(), !m_gcfg1.getBool("FAVORITES", m_cf.getId(), false)); m_gcfg1.setBool("FAVORITES", _getId(), !m_gcfg1.getBool("FAVORITES", _getId(), false));
else if(m_btnMgr.selected(m_gameBtnAdultOn) || m_btnMgr.selected(m_gameBtnAdultOff)) else if(m_btnMgr.selected(m_gameBtnAdultOn) || m_btnMgr.selected(m_gameBtnAdultOff))
m_gcfg1.setBool("ADULTONLY", m_cf.getId(), !m_gcfg1.getBool("ADULTONLY", m_cf.getId(), false)); m_gcfg1.setBool("ADULTONLY", _getId(), !m_gcfg1.getBool("ADULTONLY", _getId(), false));
else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull)) else if(m_btnMgr.selected(m_gameBtnBack) || m_btnMgr.selected(m_gameBtnBackFull))
{ {
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
@ -673,7 +673,7 @@ void CMenu::_game(bool launch)
} }
if(m_show_zone_game && !m_zoom_banner) if(m_show_zone_game && !m_zoom_banner)
{ {
bool b = m_gcfg1.getBool("FAVORITES", m_cf.getId(), false); bool b = m_gcfg1.getBool("FAVORITES", _getId(), false);
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff); m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn); m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
m_btnMgr.show(m_gameBtnPlay); m_btnMgr.show(m_gameBtnPlay);
@ -689,7 +689,7 @@ void CMenu::_game(bool launch)
} }
if(!m_locked) if(!m_locked)
{ {
b = m_gcfg1.getBool("ADULTONLY", m_cf.getId(), false); b = m_gcfg1.getBool("ADULTONLY", _getId(), false);
m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff); m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff);
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn); m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
m_btnMgr.show(m_gameBtnSettings); m_btnMgr.show(m_gameBtnSettings);
@ -795,10 +795,12 @@ void CMenu::_launch(dir_discHdr *hdr)
} }
else if(hdr->type == TYPE_HOMEBREW) else if(hdr->type == TYPE_HOMEBREW)
{ {
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
char gamepath[128]; char gamepath[128];
snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path); snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path);
if(!fsop_FileExist((const char*)gamepath)) if(!fsop_FileExist((const char*)gamepath))
snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path); snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path);
m_cfg.setString("HOMEBREW", "current_item", title);
_launchHomebrew(gamepath, m_homebrewArgs); _launchHomebrew(gamepath, m_homebrewArgs);
} }
} }

View File

@ -188,6 +188,9 @@ void CMenu::LoadView(void)
if(!m_vid.showingWaitMessage()) if(!m_vid.showingWaitMessage())
_showWaitMessage(); _showWaitMessage();
m_favorites = false;
if (m_cfg.getBool("GENERAL", "save_favorites_mode", false))
m_favorites = m_cfg.getBool(_domainFromView(), "favorites", false);
_loadList(); _loadList();
_showMain(); _showMain();
_initCF(); _initCF();
@ -428,7 +431,7 @@ int CMenu::main(void)
else if(m_btnMgr.selected(m_mainBtnFavoritesOn) || m_btnMgr.selected(m_mainBtnFavoritesOff)) else if(m_btnMgr.selected(m_mainBtnFavoritesOn) || m_btnMgr.selected(m_mainBtnFavoritesOff))
{ {
m_favorites = !m_favorites; m_favorites = !m_favorites;
m_cfg.setInt("GENERAL", "favorites", m_favorites); m_cfg.setBool(_domainFromView(), "favorites", m_favorites);
m_curGameId = m_cf.getId(); m_curGameId = m_cf.getId();
_initCF(); _initCF();
} }
@ -830,7 +833,7 @@ int CMenu::main(void)
} }
gprintf("Saving configuration files\n"); gprintf("Saving configuration files\n");
m_cfg.save(); m_cfg.save();
m_cat.unload(); m_cat.save();
// m_loc.save(); // m_loc.save();
return 0; return 0;
} }

View File

@ -39,8 +39,8 @@ age_lock=
age_lock_default= age_lock_default=
#Boolean: Hide the coverflow icons to switch modes - Defaults to false #Boolean: Hide the coverflow icons to switch modes - Defaults to false
hideviews= hideviews=
#Boolean: Whether the favorites view is selected on boot - Defaults to false #Boolean: Whether to use favorites last state or not - Defaults to false
favorites_on_startup= save_favorites_mode=
#Boolean: To configure watchdog for the ehci Module in d2xv7, not in use until v7 ehci is stable, ehci v6 has time hardcoded to 10s - Defaults to 10 #Boolean: To configure watchdog for the ehci Module in d2xv7, not in use until v7 ehci is stable, ehci v6 has time hardcoded to 10s - Defaults to 10
watchdog_timeout= watchdog_timeout=
#String: Name of the currently selected theme - Defaults to DEFAULT #String: Name of the currently selected theme - Defaults to DEFAULT