Exemplo n.º 1
0
// CheatMenu
// check for cheat txt file
// if it exists, load it and show cheat texts on screen
// if it does not exist, show download button
void CMenu::_showCheatSettings(void)
{
	_setBg(m_cheatBg, m_cheatBg);
	m_btnMgr.show(m_cheatBtnBack);
	m_btnMgr.show(m_cheatLblTitle);

	for (u32 i = 0; i < ARRAY_SIZE(m_cheatLblUser); ++i)
		if (m_cheatLblUser[i] != -1u)
			m_btnMgr.show(m_cheatLblUser[i]);

	if (m_cheatfile.getCnt() > 0) {

		// cheat found, show apply
		m_btnMgr.show(m_cheatBtnApply);
		m_btnMgr.show(m_cheatLblPage);
		m_btnMgr.show(m_cheatBtnPageM);
		m_btnMgr.show(m_cheatBtnPageP);
		m_btnMgr.setText(m_cheatLblPage, wfmt(L"%i / %i", m_cheatSettingsPage, (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE)); 
		
		// Show cheats if available, else hide
		for (u32 i=0; i < CHEATSPERPAGE; ++i) {
			// cheat in range?
			if (((m_cheatSettingsPage-1)*CHEATSPERPAGE + i + 1) <= m_cheatfile.getCnt()) 
			{
				//Limit to 70 characters otherwise the Cheatnames overlap
				char tempcheatname[71];
				strncpy(tempcheatname, m_cheatfile.getCheatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i).c_str(),70);
				tempcheatname[70] = '\0';
				
				// cheat avaiable, show elements and text
				m_btnMgr.setText(m_cheatLblItem[i], wstringEx(tempcheatname));
				//m_btnMgr.setText(m_cheatLblItem[i], m_cheatfile.getCheseleatName((m_cheatSettingsPage-1)*CHEATSPERPAGE + i));
				m_btnMgr.setText(m_cheatBtnItem[i], _optBoolToString(m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i]));
				
				m_btnMgr.show(m_cheatLblItem[i]);
				m_btnMgr.show(m_cheatBtnItem[i]);
			}
			else
			{
				// cheat out of range, hide elements
				m_btnMgr.hide(m_cheatLblItem[i]);
				m_btnMgr.hide(m_cheatBtnItem[i]);
			}
		}


	}
	else
	{
		// no cheat found, allow downloading
		m_btnMgr.show(m_cheatBtnDownload);
		m_btnMgr.setText(m_cheatLblItem[0], _t("cheat3", L"Cheat file for game not found."));
		m_btnMgr.show(m_cheatLblItem[0]);
		
	}
}
Exemplo n.º 2
0
void CMenu::_refreshBoot()
{
	hideBoot(true, false);
	m_btnMgr.setText(m_bootLblPage, wfmt(L"%i / %i", boot_curPage, boot_Pages));
	if(boot_curPage == 1)
	{
		m_btnMgr.setText(m_bootBtnLoadCIOS, _optBoolToString(cur_load));
		m_btnMgr.setText(m_bootBtnUSBPort, wfmt(L"%i", set_port));
		if(cur_ios > 0)
			m_btnMgr.setText(m_bootLblCurCIOSrev, wfmt(L"%i", cur_ios));
		else
			m_btnMgr.setText(m_bootLblCurCIOSrev, L"AUTO");
		
		m_btnMgr.show(m_bootLblLoadCIOS);
		m_btnMgr.show(m_bootBtnLoadCIOS);

		m_btnMgr.show(m_bootLblCIOSrev);
		m_btnMgr.show(m_bootLblCurCIOSrev);
		m_btnMgr.show(m_bootLblCIOSrevM);
		m_btnMgr.show(m_bootLblCIOSrevP);

		m_btnMgr.show(m_bootLblUSBPort);
		m_btnMgr.show(m_bootBtnUSBPort);
		
		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_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_bootLblFtpOnBoot);
		m_btnMgr.show(m_bootBtnFtpOnBoot);
	}
}
Exemplo n.º 3
0
bool CMenu::_Boot(void)
{
	boot_curPage = 1;
	SetupInput();
	set_port = currentPort;
	bool prev_load = cur_load;
	u8 prev_ios = cur_ios;
	showBoot();
	_refreshBoot();

	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_bootBtnPageM)))
		{
			boot_curPage--;
			if(boot_curPage == 0) boot_curPage = boot_Pages;
			if(BTN_LEFT_PRESSED || BTN_MINUS_PRESSED)
				m_btnMgr.click(m_bootBtnPageM);
			_refreshBoot();
		}
		else if(((BTN_PLUS_PRESSED || BTN_RIGHT_PRESSED)) || (BTN_A_PRESSED && m_btnMgr.selected(m_bootBtnPageP)))
		{
			boot_curPage++;
			if(boot_curPage > boot_Pages) boot_curPage = 1;
			if(BTN_RIGHT_PRESSED || BTN_PLUS_PRESSED)
				m_btnMgr.click(m_bootBtnPageP);
			_refreshBoot();
		}
		else if(BTN_A_PRESSED)
		{
			if(m_btnMgr.selected(m_bootBtnBack))
				break;
			else if(m_btnMgr.selected(m_bootBtnLoadCIOS))
			{
				cur_load = !cur_load;
				m_btnMgr.setText(m_bootBtnLoadCIOS, _optBoolToString(cur_load));
			}
			else if(m_btnMgr.selected(m_bootLblCIOSrevM) || m_btnMgr.selected(m_bootLblCIOSrevP))
			{
				bool increase = m_btnMgr.selected(m_bootLblCIOSrevP);
				CIOSItr itr = _installed_cios.find(cur_ios);
				if(increase)
				{
					itr++;
					if(itr == _installed_cios.end())
						itr = _installed_cios.begin();
				}
				else
				{
					if(itr == _installed_cios.begin())
						itr = _installed_cios.end();
					itr--;
				}
				cur_ios = itr->first;
				if(cur_ios > 0)
					m_btnMgr.setText(m_bootLblCurCIOSrev, wfmt(L"%i", cur_ios));
				else
					m_btnMgr.setText(m_bootLblCurCIOSrev, L"AUTO");
			}
			else if(m_btnMgr.selected(m_bootBtnUSBPort))
			{
				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));
				m_btnMgr.setText(m_bootBtnAsyncNet, m_cfg.getBool("GENERAL", "async_network", false) ? _t("on", L"On") : _t("off", L"Off"));
			}
			else if (m_btnMgr.selected(m_bootBtnCategoryOnBoot))
			{
				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_bootBtnFtpOnBoot))
			{
				m_cfg.setBool(FTP_DOMAIN, "auto_start", !m_cfg.getBool(FTP_DOMAIN, "auto_start", false));
				m_btnMgr.setText(m_bootBtnFtpOnBoot, m_cfg.getBool(FTP_DOMAIN, "auto_start") ? _t("on", L"On") : _t("off", L"Off"));
			}
		}
	}
	if(prev_load != cur_load || prev_ios != cur_ios)
		InternalSave.SaveIOS();
	if(set_port != currentPort)
		InternalSave.SavePort(set_port);
	hideBoot(false, true);

	if(prev_load != cur_load || prev_ios != cur_ios || set_port != currentPort)
	{
		m_exit = true;
		m_reload = true;
		return 1;
	}
	return 0;
}