- Removed agelock. Sorry yardape. great idea but i just had no use for it.

This commit is contained in:
fledge68 2016-04-02 16:47:18 +00:00
parent e7ac70512d
commit b99363223c
5 changed files with 85 additions and 247 deletions

View File

@ -14,7 +14,6 @@
#define SOURCE_FILENAME "source_menu.ini"
#define TITLES_FILENAME "titles.ini"
#define CTITLES_FILENAME "custom_titles.ini"
#define AGE_LOCK_FILENAME "age_lock.ini"
#define TITLES_DUMP_FILENAME "titlesdump.ini"
#define GAME_SETTINGS1_FILENAME "gameconfig1.ini"
#define GAME_SETTINGS2_FILENAME "gameconfig2.ini"
@ -28,8 +27,6 @@
#define MUSIC_DOMAIN "MUSIC"
#define FTP_DOMAIN "FTP"
#define AGE_LOCK_DEFAULT 13
#define DEVELOPERS "FIX94, Fledge68, OverjoY"
#define PAST_DEVELOPERS "Hibernatus, Narolez, Hulk, Miigotu, r-win"
#define LOADER_AUTHOR "Kwiirk, Waninkoko, Hermes"

View File

@ -1630,8 +1630,7 @@ void CMenu::_addUserLabels(s16 *ids, u32 start, u32 size, const char *domain)
void CMenu::_initCF(void)
{
Config dump, gameAgeList;
GameTDB gametdb;
Config dump;
const char *domain = _domainFromView();
CoverFlow.clear();
@ -1642,18 +1641,6 @@ void CMenu::_initCF(void)
m_gcfg1.load(fmt("%s/" GAME_SETTINGS1_FILENAME, m_settingsDir.c_str()));
int ageLock = m_cfg.getInt("GENERAL", "age_lock");
if (ageLock < 2 || ageLock > 19)
ageLock = 19;
if (ageLock < 19)
{
gameAgeList.load(fmt("%s/" AGE_LOCK_FILENAME, m_settingsDir.c_str()));
if(!gametdb.IsLoaded())
{
gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
}
}
const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
for(vector<dir_discHdr>::iterator element = m_gameList.begin(); element != m_gameList.end(); ++element)
@ -1697,96 +1684,24 @@ void CMenu::_initCF(void)
id = tmp;
}
}
bool ageLocked = false;
if(ageLock < 19)
{
int ageRated = min(max(gameAgeList.getInt(domain, id), 0), 19);
if(ageRated == 0 && gametdb.IsLoaded() && (element->type == TYPE_WII_GAME || element->type == TYPE_GC_GAME || element->type == TYPE_CHANNEL))
{
const char *RatingValue = NULL;
if(gametdb.GetRatingValue(element->id, RatingValue))
{
switch(gametdb.GetRating(element->id))
{
case GAMETDB_RATING_TYPE_CERO:
if(RatingValue[0] == 'A')
ageRated = 3;
else if(RatingValue[0] == 'B')
ageRated = 12;
else if(RatingValue[0] == 'D')
ageRated = 15;
else if(RatingValue[0] == 'C')
ageRated = 17;
else if(RatingValue[0] == 'Z')
ageRated = 18;
break;
case GAMETDB_RATING_TYPE_ESRB:
if(RatingValue[0] == 'E')
ageRated = 6;
else if(memcmp(RatingValue, "EC", 2) == 0)
ageRated = 3;
else if(memcmp(RatingValue, "E10+", 4) == 0)
ageRated = 10;
else if(RatingValue[0] == 'T')
ageRated = 13;
else if(RatingValue[0] == 'M')
ageRated = 17;
else if(memcmp(RatingValue, "AO", 2) == 0)
ageRated = 18;
break;
case GAMETDB_RATING_TYPE_PEGI:
if(RatingValue[0] == '3')
ageRated = 3;
else if(RatingValue[0] == '7')
ageRated = 7;
else if(memcmp(RatingValue, "12", 2) == 0)
ageRated = 12;
else if(memcmp(RatingValue, "16", 2) == 0)
ageRated = 16;
else if(memcmp(RatingValue, "18", 2) == 0)
ageRated = 18;
break;
case GAMETDB_RATING_TYPE_GRB:
if(RatingValue[0] == 'A')
ageRated = 3;
else if(memcmp(RatingValue, "12", 2) == 0)
ageRated = 12;
else if(memcmp(RatingValue, "15", 2) == 0)
ageRated = 15;
else if(memcmp(RatingValue, "18", 2) == 0)
ageRated = 18;
break;
default:
break;
}
}
}
if(ageRated == 0)
ageRated = min(max(m_cfg.getInt("GENERAL", "age_lock_default", AGE_LOCK_DEFAULT), 2), 19);
if(ageRated == 0)
ageRated = AGE_LOCK_DEFAULT;
if(ageRated > ageLock)
ageLocked = true;
}
if((!m_favorites || m_gcfg1.getBool("FAVORITES", id, false))
&& (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false))
&& !ageLocked)
&& (!m_locked || !m_gcfg1.getBool("ADULTONLY", id, false)))
{
string catDomain;
switch(element->type)
{
case TYPE_CHANNEL:
catDomain = "NAND";
catDomain = "CHANNELS";
break;
case TYPE_HOMEBREW:
case TYPE_SOURCE:
catDomain = "HOMEBREW";
break;
case TYPE_GC_GAME:
catDomain = "DML";
catDomain = "GAMECUBE";
break;
case TYPE_WII_GAME:
catDomain = "GAMES";
catDomain = "WII";
break;
default:
catDomain = (m_plugin.GetPluginName(m_plugin.GetPluginPosition(element->settings[0]))).toUTF8();
@ -1883,10 +1798,8 @@ void CMenu::_initCF(void)
CoverFlow.addItem(&(*element), playcount, lastPlayed);
}
}
if(gametdb.IsLoaded())
gametdb.CloseFile();
m_gcfg1.unload();
if (dumpGameLst)
if(dumpGameLst)
{
dump.save(true);
m_cfg.setBool(domain, "dump_list", false);

View File

@ -419,8 +419,6 @@ private:
s16 m_codeBtnKey[10];
s16 m_codeBtnBack;
s16 m_codeBtnErase;
s16 m_codeBtnAge;
s16 m_codeLblAge;
s16 m_codeLblUser[4];
//menu_wbfs
s16 m_wbfsLblTitle;
@ -493,14 +491,14 @@ private:
s16 m_gameSettingsLblDM_Widescreen;
s16 m_gameSettingsBtnDM_Widescreen;
s16 m_gameSettingsLblUSB_HID;
s16 m_gameSettingsBtnUSB_HID;
s16 m_gameSettingsLblUSB_HID;
s16 m_gameSettingsBtnUSB_HID;
s16 m_gameSettingsLblNATIVE_CTL;
s16 m_gameSettingsBtnNATIVE_CTL;
s16 m_gameSettingsLblNATIVE_CTL;
s16 m_gameSettingsBtnNATIVE_CTL;
s16 m_gameSettingsLblDeflicker;
s16 m_gameSettingsBtnDeflicker;
s16 m_gameSettingsLblDeflicker;
s16 m_gameSettingsBtnDeflicker;
s16 m_gameSettingsLblGCLoader;
s16 m_gameSettingsLblGCLoader_Val;
@ -1038,7 +1036,7 @@ private:
void _download(string gameId = string());
void _downloadBnr(const char *gameID);
bool _LangSettings(void);
void _code(void);
bool _code(char code[4], bool erase = false);
void _about(bool help = false);
bool _wbfsOp(WBFS_OP op);
void _cfTheme(void);

View File

@ -7,12 +7,10 @@ void CMenu::_hideCode(bool instant)
m_btnMgr.hide(m_codeBtnKey[i], instant);
m_btnMgr.hide(m_codeBtnBack, instant);
m_btnMgr.hide(m_codeBtnErase, instant);
m_btnMgr.hide(m_codeBtnAge, instant);
m_btnMgr.hide(m_codeLblTitle, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_codeLblUser); ++i)
if(m_codeLblUser[i] != -1)
m_btnMgr.hide(m_codeLblUser[i], instant);
m_btnMgr.hide(m_codeLblAge, true);
}
void CMenu::_showCode(void)
@ -25,169 +23,82 @@ void CMenu::_showCode(void)
for(u8 i = 0; i < ARRAY_SIZE(m_codeLblUser); ++i)
if(m_codeLblUser[i] != -1)
m_btnMgr.show(m_codeLblUser[i]);
m_btnMgr.hide(m_codeLblAge, true);
}
void CMenu::_code(void)
bool CMenu::_code(char code[4], bool erase)
{
char code[4];
_hideConfig();
u32 n = 0;
wchar_t codeLbl[] = L"_ _ _ _";
SetupInput();
memset(code, 0, sizeof code);
memset(code, 0, 4);
m_btnMgr.setText(m_codeLblTitle, codeLbl);
_showCode();
bool ageLockMode = false;
bool modeChanged = false;
bool goBack = false;
if (!m_locked)
{
m_btnMgr.show(m_codeBtnAge);
if(erase)
m_btnMgr.show(m_codeBtnErase);
}
while(!m_exit)
{
int c = -1;
_mainLoopCommon();
if (BTN_HOME_PRESSED)
goBack = true;
if (WPadIR_ANY())
if(BTN_HOME_PRESSED)
break;
else if(WPadIR_ANY())
{
if (BTN_B_PRESSED)
goBack = true;
else if (BTN_UP_PRESSED)
if(BTN_B_PRESSED)
break;
else if(BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
else if(BTN_DOWN_PRESSED)
m_btnMgr.down();
else if (BTN_A_PRESSED)
if(BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_codeBtnBack))
goBack = true;
else if (m_btnMgr.selected(m_codeBtnErase))
if(!m_locked && m_btnMgr.selected(m_codeBtnErase))
{
goBack = true;
_cfNeedsUpdate();
if (ageLockMode)
m_cfg.remove("GENERAL", "age_lock");
else
{
m_cfg.remove("GENERAL", "parent_code");
m_locked = false;
}
memset(code, 0, 4);
m_cfg.remove("GENERAL", "parent_code");
n = 0;
m_locked = false;
break;
}
else if (m_btnMgr.selected(m_codeBtnAge))
modeChanged = true;
if(m_btnMgr.selected(m_codeBtnBack))
break;
else
for (int i = 0; i < 10; ++i)
if (m_btnMgr.selected(m_codeBtnKey[i]))
for(int i = 0; i < 10; ++i)
if(m_btnMgr.selected(m_codeBtnKey[i]))
{
c = i;
codeLbl[n * 2] = 'X';
code[n++] = '0' + i;
m_btnMgr.setText(m_codeLblTitle, codeLbl);
break;
}
}
}
else if (!ageLockMode)
{
// Map buttons to numbers
c = -1;
if (BTN_UP_PRESSED) c = 0;
else if (BTN_LEFT_PRESSED) c = 1;
else if (BTN_RIGHT_PRESSED) c = 2;
else if (BTN_DOWN_PRESSED) c = 3;
else if (BTN_MINUS_PRESSED) c = 4;
else if (BTN_PLUS_PRESSED) c = 5;
else if (BTN_A_PRESSED) c = 6;
else if (BTN_B_PRESSED) c = 7;
else if (BTN_1_PRESSED) c = 8;
else if (BTN_2_PRESSED) c = 9;
}
if (goBack)
{
if (!ageLockMode)
break;
modeChanged = true;
goBack = false;
}
// ageLockMode allows entry of numbers 2 - 19
// a first digit of 0 is ignored
// a first digit of 2 - 9 is taken to mean a single digit number
// a first digit of 1 will be the start of a 2 digit number
else if (c != -1 && !(ageLockMode && (n == 0 && c == 0)))
{
codeLbl[n * 2] = ageLockMode ? '0' + c : 'X';
code[n++] = '0' + c;
m_btnMgr.setText(m_codeLblTitle, codeLbl);
}
if (modeChanged)
{
modeChanged = false;
memset(code, 0, sizeof code);
n = 0;
ageLockMode = !ageLockMode;
if (ageLockMode)
{
int ageLockM = m_cfg.getInt("GENERAL", "age_lock");
if (ageLockM < 2 || ageLockM > 19)
ageLockM = 19;
m_btnMgr.hide(m_codeBtnAge, true);
wchar_t ageLbl[40];
wcsncpy(ageLbl, (_t("cd3", L"Age Lock")).c_str(), 35);
ageLbl[35] = 0;
swprintf(ageLbl, 40, L"%ls: %d", ageLbl, ageLockM);
m_btnMgr.setText(m_codeLblAge, ageLbl);
m_btnMgr.show(m_codeLblAge);
}
else if (!m_locked)
{
m_btnMgr.show(m_codeBtnAge);
m_btnMgr.hide(m_codeLblAge, true);
}
for (u32 i = 0; i < sizeof code; i++)
codeLbl[i*2] = (ageLockMode && i > 1) ? ' ' : '_';
m_btnMgr.setText(m_codeLblTitle, codeLbl);
}
else
{
if (ageLockMode)
// Map buttons to numbers
int c = -1;
if(BTN_UP_PRESSED) c = 0;
else if(BTN_LEFT_PRESSED) c = 1;
else if(BTN_RIGHT_PRESSED) c = 2;
else if(BTN_DOWN_PRESSED) c = 3;
else if(BTN_MINUS_PRESSED) c = 4;
else if(BTN_PLUS_PRESSED) c = 5;
else if(BTN_A_PRESSED) c = 6;
else if(BTN_B_PRESSED) c = 7;
else if(BTN_1_PRESSED) c = 8;
else if(BTN_2_PRESSED) c = 9;
if(c != -1)
{
if ((n >= 2) || (n == 1 && c > 1))
{
modeChanged = true;
m_cfg.setString("GENERAL", "age_lock", string(code, 2).c_str());
_cfNeedsUpdate(); }
}
else if (n >= sizeof code)
{
if (m_locked)
{
if (memcmp(code, m_cfg.getString("GENERAL", "parent_code").c_str(), 4) == 0)
{
m_locked = false;
_cfNeedsUpdate();
}
else
error(_t("cfgg25", L"Password incorrect."));
}
else
{
m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str());
m_locked = true;
_cfNeedsUpdate();
}
break;
codeLbl[n * 2] = 'X';
code[n++] = '0' + c;
m_btnMgr.setText(m_codeLblTitle, codeLbl);
}
}
}
_hideCode();
_showConfig();
return n == sizeof code;
}
void CMenu::_initCodeMenu()
@ -198,14 +109,12 @@ void CMenu::_initCodeMenu()
m_codeBtnKey[0] = _addButton("CODE/0_BTN", theme.btnFont, L"0", 270, 320, 100, 50, theme.btnFontColor);
m_codeBtnErase = _addButton("CODE/ERASE_BTN", theme.btnFont, L"", 20, 400, 200, 48, theme.btnFontColor);
m_codeBtnBack = _addButton("CODE/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 48, theme.btnFontColor);
m_codeBtnAge = _addButton("CODE/AGE_BTN", theme.btnFont, L"", 220, 400, 200, 48, theme.btnFontColor);
m_codeLblAge = _addLabel("CODE/AGE", theme.lblFont, L"", 220, 412, 200, 20, theme.lblFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
for (int i = 0; i < 10; ++i)
for(int i = 0; i < 10; ++i)
{
char *codeText = fmt_malloc("CODE/%i_BTN", i);
if(codeText == NULL) continue;
if (i > 0)
if(i > 0)
{
int x = i - 1;
int y = x / 3;
@ -219,7 +128,6 @@ void CMenu::_initCodeMenu()
}
_setHideAnim(m_codeBtnErase, "CODE/ERASE_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_codeBtnBack, "CODE/BACK_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_codeBtnAge, "CODE/AGE_BTN", 0, 0, -2.f, 0.f);
_hideCode(true);
_textCode();
@ -229,6 +137,5 @@ void CMenu::_textCode(void)
{
m_btnMgr.setText(m_codeBtnBack, _t("cd1", L"Back"));
m_btnMgr.setText(m_codeBtnErase, _t("cd2", L"Erase"));
m_btnMgr.setText(m_codeBtnAge, _t("cd3", L"Age Lock"));
// m_btnMgr.setText(m_codeLblTitle, L"_ _ _ _");
m_btnMgr.setText(m_codeLblTitle, L"_ _ _ _");
}

View File

@ -184,8 +184,31 @@ int CMenu::_config1(void)
_showConfig();
CoverFlow.startCoverLoader();
}
else if ((m_btnMgr.selected(m_configBtnUnlock)) || (m_btnMgr.selected(m_configBtnSetCode)))
_code();
else if (m_btnMgr.selected(m_configBtnUnlock))
{
char code[4];
_hideConfig();
if (_code(code) && memcmp(code, m_cfg.getString("GENERAL", "parent_code", "").c_str(), 4) == 0)
{
_cfNeedsUpdate();
m_locked = false;
}
else
error(_t("cfgg25",L"Password incorrect."));
_showConfig();
}
else if (m_btnMgr.selected(m_configBtnSetCode))
{
char code[4];
_hideConfig();
if (_code(code, true))
{
_cfNeedsUpdate();
m_cfg.setString("GENERAL", "parent_code", string(code, 4).c_str());
m_locked = true;
}
_showConfig();
}
else if ((m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM)) && m_current_view != COVERFLOW_MAX)
{
s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1;