-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_btnMgr.setSoundVolume(m_cfg.getInt("GENERAL", "sound_volume_gui", 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_cfg.setString("GAMERCARD", "gamercards", "wiinnertag|dutag");
@ -2452,6 +2448,38 @@ void CMenu::_cleanupDefaultFont()
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()
{
switch(m_current_view)

View File

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

View File

@ -121,19 +121,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
gameSet = fromGameSet;
if(fromGameSet)
{
if(m_current_view != COVERFLOW_EMU)
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;
}
id = _getId();
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
}
@ -187,19 +175,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
_hideCategorySettings();
m_cf.right();
curPage = 1;
if(m_current_view != COVERFLOW_EMU)
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;
}
id = _getId();
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());
@ -216,19 +192,7 @@ void CMenu::_CategorySettings(bool fromGameSet)
_hideCategorySettings();
m_cf.left();
curPage = 1;
if(m_current_view != COVERFLOW_EMU)
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;
}
id = _getId();
catSettings = m_cat.getString(_domainFromView(), id, "").c_str();
m_btnMgr.setText(m_categoryLblTitle, m_cf.getTitle());

View File

@ -69,7 +69,7 @@ void CMenu::_showConfig4(void)
int i;
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_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"));
Config titles, custom_titles;
@ -125,7 +125,7 @@ int CMenu::_config4(void)
}
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();
}
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))
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))
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))
{
m_gameSound.FreeMemory();
@ -673,7 +673,7 @@ void CMenu::_game(bool launch)
}
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.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
m_btnMgr.show(m_gameBtnPlay);
@ -689,7 +689,7 @@ void CMenu::_game(bool launch)
}
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.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
m_btnMgr.show(m_gameBtnSettings);
@ -795,10 +795,12 @@ void CMenu::_launch(dir_discHdr *hdr)
}
else if(hdr->type == TYPE_HOMEBREW)
{
string title(&hdr->path[string(hdr->path).find_last_of("/")+1]);
char gamepath[128];
snprintf(gamepath, sizeof(gamepath), "%s/boot.dol", hdr->path);
if(!fsop_FileExist((const char*)gamepath))
snprintf(gamepath, sizeof(gamepath), "%s/boot.elf", hdr->path);
m_cfg.setString("HOMEBREW", "current_item", title);
_launchHomebrew(gamepath, m_homebrewArgs);
}
}

View File

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

View File

@ -39,8 +39,8 @@ age_lock=
age_lock_default=
#Boolean: Hide the coverflow icons to switch modes - Defaults to false
hideviews=
#Boolean: Whether the favorites view is selected on boot - Defaults to false
favorites_on_startup=
#Boolean: Whether to use favorites last state or not - Defaults to false
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
watchdog_timeout=
#String: Name of the currently selected theme - Defaults to DEFAULT