コード例 #1
0
void CMenu::_showConfigScreen(void)
{
	_showConfigCommon(m_configScreenBg, g_curPage);

	m_btnMgr.show(m_configScreenLblTVHeight);
	m_btnMgr.show(m_configScreenLblTVHeightVal);
	m_btnMgr.show(m_configScreenBtnTVHeightP);
	m_btnMgr.show(m_configScreenBtnTVHeightM);
	m_btnMgr.show(m_configScreenLblTVWidth);
	m_btnMgr.show(m_configScreenLblTVWidthVal);
	m_btnMgr.show(m_configScreenBtnTVWidthP);
	m_btnMgr.show(m_configScreenBtnTVWidthM);
	m_btnMgr.show(m_configScreenLblTVX);
	m_btnMgr.show(m_configScreenLblTVXVal);
	m_btnMgr.show(m_configScreenBtnTVXM);
	m_btnMgr.show(m_configScreenBtnTVXP);
	m_btnMgr.show(m_configScreenLblTVY);
	m_btnMgr.show(m_configScreenLblTVYVal);
	m_btnMgr.show(m_configScreenBtnTVYM);
	m_btnMgr.show(m_configScreenBtnTVYP);
	for(u8 i = 0; i < ARRAY_SIZE(m_configScreenLblUser); ++i)
		if(m_configScreenLblUser[i] != -1)
			m_btnMgr.show(m_configScreenLblUser[i]);

	m_btnMgr.setText(m_configScreenLblTVWidthVal, wfmt(L"%i", 640 * 640 / max(1, m_cfg.getInt("GENERAL", "tv_width", 640))));
	m_btnMgr.setText(m_configScreenLblTVHeightVal, wfmt(L"%i", 480 * 480 / max(1, m_cfg.getInt("GENERAL", "tv_height", 480))));
	m_btnMgr.setText(m_configScreenLblTVXVal, wfmt(L"%i", -m_cfg.getInt("GENERAL", "tv_x", 0)));
	m_btnMgr.setText(m_configScreenLblTVYVal, wfmt(L"%i", m_cfg.getInt("GENERAL", "tv_y", 0)));
}
コード例 #2
0
void CMenu::_initCodeMenu()
{
	_addUserLabels(m_codeLblUser, ARRAY_SIZE(m_codeLblUser), "CODE");
	m_codeBg = _texture("CODE/BG", "texture", theme.bg, false);
	m_codeLblTitle = _addLabel("CODE/CODE", theme.titleFont, L"_ _ _ _", 0, 10, 640, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
	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)
	{
		char *codeText = fmt_malloc("CODE/%i_BTN", i);
		if(codeText == NULL) continue;
		if (i > 0)
		{
			int x = i - 1;
			int y = x / 3;
			x %= 3;
			x = 160 + x * 110;
			y = 240 - y * 80;
			m_codeBtnKey[i] = _addButton(codeText, theme.btnFont, wfmt(L"%i", i), x, y, 100, 50, theme.btnFontColor);
		}
		_setHideAnim(m_codeBtnKey[i], codeText, 0, 0, 0.f, 0.f);
		MEM2_free(codeText);
	}
	_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();
}
コード例 #3
0
void CMenu::_updatePluginCheckboxes(void)
{
	if(m_max_plugins > 10)
	{
		m_btnMgr.setText(m_pluginLblPage, wfmt(L"%i / %i", Plugin_curPage, Plugin_Pages));
		m_btnMgr.show(m_pluginLblPage);
		m_btnMgr.show(m_pluginBtnPageM);
		m_btnMgr.show(m_pluginBtnPageP);
	}
	for(int i = 0; i < 11; ++i)
	{
		m_btnMgr.hide(m_pluginBtn[i]);
		m_btnMgr.hide(m_pluginLblCat[i]);
	}
	const vector<bool> &EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg, &enabledPluginsCount);
	/* ALL Button */
	if(EnabledPlugins.size() == 0)
		m_pluginBtn[0] = m_pluginBtnCats[0];
	else
		m_pluginBtn[0] = m_pluginBtnCat[0];
	m_btnMgr.show(m_pluginBtn[0]);
	m_btnMgr.show(m_pluginLblCat[0]);
	/* Single Plugins */
	u32 IteratorHelp = (Plugin_curPage - 1) * 10;
	for(u8 i = 1; i < min(IteratorHelp+10, (u32)m_max_plugins)-IteratorHelp+1; ++i)
	{
		if(EnabledPlugins.size() == 0 || EnabledPlugins.at(i+IteratorHelp-1) == true)
			m_pluginBtn[i] = m_pluginBtnCats[i];
		else
			m_pluginBtn[i] = m_pluginBtnCat[i];
		m_btnMgr.show(m_pluginBtn[i]);
		m_btnMgr.show(m_pluginLblCat[i]);
	}
}
コード例 #4
0
ファイル: cheat.cpp プロジェクト: Captnoord/Wodeflow
// 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]);
		
	}
}
コード例 #5
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);
	}
}
コード例 #6
0
bool CMenu::_Home(void)
{
	SetupInput();
	_showHome();

	string prevTheme = m_cfg.getString("GENERAL", "theme", "default");
	while(!m_exit)
	{
		/* battery gets refreshed in here... */
		_mainLoopCommon();
		/* and it always changes so... */
		m_btnMgr.setText(m_homeLblBattery, wfmt(PLAYER_BATTERY_LABEL, min((float)wd[0]->battery_level, 100.f), 
			min((float)wd[1]->battery_level, 100.f), min((float)wd[2]->battery_level, 100.f), min((float)wd[3]->battery_level, 100.f)));
		if(BTN_A_PRESSED)
		{
			if(m_btnMgr.selected(m_homeBtnSettings))
			{
				_hideHome();
				_config(1);
				if(prevTheme != m_cfg.getString("GENERAL", "theme") || m_reload == true)
				{
					m_exit = true;
					m_reload = true;
					break;
				}
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnReloadCache))
			{
				//m_gameList.SetLanguage(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());
				UpdateCache(m_current_view);
				LoadView();
				break;
			}
			else if(m_btnMgr.selected(m_homeBtnUpdate) && !m_locked)
			{
				CoverFlow.stopCoverLoader(true);
				_hideHome();
				_system();
				remove(m_ver.c_str());
				if(m_exit)
					_launchHomebrew(m_dol.c_str(), m_homebrewArgs);
				else
				{
					_showHome();
					CoverFlow.startCoverLoader();
				}
			}
			else if(m_btnMgr.selected(m_homeBtnInstall))
			{
				_hideHome();
				_wbfsOp(WO_ADD_GAME);
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnAbout))
			{
				_hideHome();
				_about();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnExitTo))
			{
				_hideHome();
				if(m_locked)
					exitHandler(WIIFLOW_DEF);
				else 
					_ExitTo();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnExplorer))
			{
				_hideHome();
				_Explorer();
				_showHome();
			}
			else if(m_btnMgr.selected(m_homeBtnFTP))
			{
				_hideHome();
				_FTP();
				_showHome();
			}
		}
		else if(BTN_HOME_PRESSED)
		{
			exitHandler(WIIFLOW_DEF);
			break;
		}
		else if(BTN_B_PRESSED)
			break;
	}

	_hideHome();
	return m_exit;
}
コード例 #7
0
void CMenu::_gameinfo(void)
{
	bool first = true;
	SetupInput();
	_showGameInfo();

	u8 page = 0;

	int amount_of_skips = 0;

	int synopsis_x = 0, synopsis_y = 0;
	u32 synopsis_w = 0, synopsis_h = 0;

	do
	{
		_mainLoopCommon();

		if (amount_of_skips == 0)
		{
			// Check dimensions in the loop, because the animation can have an effect
			m_btnMgr.getDimensions(m_gameinfoLblSynopsis, synopsis_x, synopsis_y, synopsis_w, synopsis_h); // Get original dimensions
		}
		if(first)
		{
			m_btnMgr.moveBy(m_gameinfoLblSynopsis, 0, -1);
			amount_of_skips++;
			first = false;
		}
		if ((BTN_DOWN_PRESSED || BTN_DOWN_HELD) && !(m_thrdWorking && m_thrdStop) && page == 1)
		{
			if (synopsis_h - (amount_of_skips * pixels_to_skip) > (m_vid.height2D() - (35 + synopsis_y)))
			  {
				m_btnMgr.moveBy(m_gameinfoLblSynopsis, 0, -pixels_to_skip);
				amount_of_skips++;
			}
		}
		else if ((BTN_UP_PRESSED || BTN_UP_HELD) && !(m_thrdWorking && m_thrdStop) && page == 1)
		{
			if (amount_of_skips > 1)
			{
				m_btnMgr.moveBy(m_gameinfoLblSynopsis, 0, pixels_to_skip);
				amount_of_skips--;
			}
		}
		else if (BTN_RIGHT_PRESSED && !(m_thrdWorking && m_thrdStop) && page == 0 && gameinfo.Synopsis.size() > 0)
		{
			page = 1;
			amount_of_skips = 0;
			first = true;
			m_btnMgr.reset(m_gameinfoLblSynopsis);
			m_btnMgr.setText(m_gameinfoLblSynopsis, wfmt(L"%s", gameinfo.Synopsis.c_str()));

			m_btnMgr.hide(m_gameinfoLblDev, true);
			m_btnMgr.hide(m_gameinfoLblRegion, true);
			m_btnMgr.hide(m_gameinfoLblPublisher, true);
			m_btnMgr.hide(m_gameinfoLblRlsdate, true);
			m_btnMgr.hide(m_gameinfoLblGenre, true);
			m_btnMgr.hide(m_gameinfoLblRating, true);
			m_btnMgr.hide(m_gameinfoLblWifiplayers, true);

			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControlsReq); ++i)
				if (m_gameinfoLblControlsReq[i] != -1u)
					m_btnMgr.hide(m_gameinfoLblControlsReq[i], true);

			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControls); ++i)
				if (m_gameinfoLblControls[i] != -1u)
					m_btnMgr.hide(m_gameinfoLblControls[i], true);

			// When showing synopsis, only show user labels 2 and 3
			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblUser); ++i)
				if (i < ARRAY_SIZE(m_gameinfoLblUser) / 2)
					m_btnMgr.hide(m_gameinfoLblUser[i], true);
				else
					m_btnMgr.show(m_gameinfoLblUser[i]);

			m_btnMgr.show(m_gameinfoLblID);
			m_btnMgr.show(m_gameinfoLblSynopsis);
		}
		else if (BTN_LEFT_PRESSED && !(m_thrdWorking && m_thrdStop))
		{
			page = 0;
			m_btnMgr.show(m_gameinfoLblID);
			m_btnMgr.show(m_gameinfoLblDev);
			m_btnMgr.show(m_gameinfoLblRegion);
			m_btnMgr.show(m_gameinfoLblPublisher);
			m_btnMgr.show(m_gameinfoLblRlsdate);
			m_btnMgr.show(m_gameinfoLblGenre);
			m_btnMgr.show(m_gameinfoLblRating);
			m_btnMgr.show(m_gameinfoLblWifiplayers);

			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControlsReq); ++i)
				if (m_gameinfoLblControlsReq[i] != -1u && i < cnt_controlsreq)
					m_btnMgr.show(m_gameinfoLblControlsReq[i]);

			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblControls); ++i)
				if (m_gameinfoLblControls[i] != -1u && i < cnt_controls)
					m_btnMgr.show(m_gameinfoLblControls[i]);

			// When showing synopsis, only show user labels 2 and 3
			for (u8 i = 0; i < ARRAY_SIZE(m_gameinfoLblUser); ++i)
				if (i < ARRAY_SIZE(m_gameinfoLblUser) / 2)
					m_btnMgr.show(m_gameinfoLblUser[i]);
				else
					m_btnMgr.hide(m_gameinfoLblUser[i], true);

			m_btnMgr.hide(m_gameinfoLblSynopsis,true);
		}

	} while (!BTN_HOME_PRESSED && !BTN_B_PRESSED);

	_hideGameInfo(false);
}
コード例 #8
0
void CMenu::_textGameInfo(void)
{
	cnt_controlsreq = 0;
	cnt_controls = 0;

	GameTDB m_gametdb;
	m_gametdb.OpenFile(sfmt("%s/wiitdb.xml", m_settingsDir.c_str()).c_str());
	m_gametdb.SetLanguageCode(m_loc.getString(m_curLanguage, "gametdb_code", "EN").c_str());

	titlecheck = m_gametdb.IsLoaded() && m_gametdb.GetGameXMLInfo(m_cf.getId().c_str(), &gameinfo);
	if(titlecheck)
	{
		gprintf("ID: %s\nTitle: %s\n", gameinfo.GameID.c_str(), gameinfo.Title.c_str());
		m_btnMgr.setText(m_gameinfoLblID, wfmt(L"%s", gameinfo.GameID.c_str()), true);
		m_btnMgr.setText(m_gameinfoLblTitle, wfmt(L"%s", gameinfo.Title.c_str()), true);
		m_btnMgr.setText(m_gameinfoLblSynopsis, wfmt(L"%s", gameinfo.Synopsis.c_str()));
		m_btnMgr.setText(m_gameinfoLblDev, wfmt(_fmt("gameinfo1",L"Developer: %s"), gameinfo.Developer.c_str()), true);
		m_btnMgr.setText(m_gameinfoLblPublisher, wfmt(_fmt("gameinfo2",L"Publisher: %s"), gameinfo.Publisher.c_str()), true);
		m_btnMgr.setText(m_gameinfoLblRegion, wfmt(_fmt("gameinfo3",L"Region: %s"), gameinfo.Region.c_str()), true);

		m_btnMgr.setText(m_gameinfoLblGenre, wfmt(_fmt("gameinfo5",L"Genre: %s"), gameinfo.Genres.c_str()), true);

		int year = gameinfo.PublishDate >> 16;
		int day = gameinfo.PublishDate & 0xFF;
		int month = (gameinfo.PublishDate >> 8) & 0xFF;

		switch(CONF_GetRegion())
		{
			case 0:
			case 4:
			case 5:
				m_btnMgr.setText(m_gameinfoLblRlsdate, wfmt(_fmt("gameinfo4",L"Release Date: %i-%i-%i"), year, month, day), true);
				break;
			case 1:
				m_btnMgr.setText(m_gameinfoLblRlsdate, wfmt(_fmt("gameinfo4",L"Release Date: %i-%i-%i"), month, day, year), true);
				break;
			case 2:
				m_btnMgr.setText(m_gameinfoLblRlsdate, wfmt(_fmt("gameinfo4",L"Release Date: %i-%i-%i"), day, month, year), true);
				break;
		}

		//Ratings
		switch(gameinfo.RatingType)
		{
			case 0:
				//CERO
				if (gameinfo.RatingValue == "A")
					m_rating.fromPNG(cero_a_png);
				else if (gameinfo.RatingValue == "B")
					m_rating.fromPNG(cero_b_png);
				else if (gameinfo.RatingValue == "D")
					m_rating.fromPNG(cero_d_png);
				else if (gameinfo.RatingValue == "C")
					m_rating.fromPNG(cero_c_png);
				else if (gameinfo.RatingValue == "Z")
					m_rating.fromPNG(cero_z_png);
				else
					m_rating.fromPNG(norating_png);
				break;
			case 1:
				//ESRB
				if (gameinfo.RatingValue == "AO")
					m_rating.fromPNG(esrb_ao_png);
				else if (gameinfo.RatingValue == "E")
					m_rating.fromPNG(esrb_e_png);
				else if (gameinfo.RatingValue == "EC")
					m_rating.fromPNG(esrb_ec_png);
				else if (gameinfo.RatingValue == "E10+")
					m_rating.fromPNG(esrb_eten_png);
				else if (gameinfo.RatingValue == "T")
					m_rating.fromPNG(esrb_t_png);
				else if (gameinfo.RatingValue == "M")
					m_rating.fromPNG(esrb_m_png);
				else
					m_rating.fromPNG(norating_png);
				break;
			case 2:
				//PEGI
				if (gameinfo.RatingValue == "3")
					m_rating.fromPNG(pegi_3_png);
				else if (gameinfo.RatingValue == "7")
					m_rating.fromPNG(pegi_7_png);
				else if (gameinfo.RatingValue == "12")
					m_rating.fromPNG(pegi_12_png);
				else if (gameinfo.RatingValue == "16")
					m_rating.fromPNG(pegi_16_png);
				else if (gameinfo.RatingValue == "18")
					m_rating.fromPNG(pegi_18_png);
				else
					m_rating.fromPNG(norating_png);
				break;
			default:
				break;
		}

		m_btnMgr.setTexture(m_gameinfoLblRating, m_rating);

		//Wifi players
		STexture emptyTex;
		if (gameinfo.WifiPlayers == 1)
			m_wifi.fromPNG(wifi1_png);
		else if (gameinfo.WifiPlayers == 2)
			m_wifi.fromPNG(wifi2_png);
		else if (gameinfo.WifiPlayers == 4)
			m_wifi.fromPNG(wifi4_png);
		else if (gameinfo.WifiPlayers == 8)
			m_wifi.fromPNG(wifi8_png);
		else if (gameinfo.WifiPlayers == 10)
			m_wifi.fromPNG(wifi10_png);
		else if (gameinfo.WifiPlayers == 12)
			m_wifi.fromPNG(wifi12_png);
		else if (gameinfo.WifiPlayers == 16)
			m_wifi.fromPNG(wifi16_png);
		else if (gameinfo.WifiPlayers == 18)
			m_wifi.fromPNG(wifi18_png);
		else if (gameinfo.WifiPlayers == 32)
			m_wifi.fromPNG(wifi32_png);

		m_btnMgr.setTexture(m_gameinfoLblWifiplayers, gameinfo.WifiPlayers > 0 ? m_wifi : emptyTex);

		u8	wiimote = 0,
			nunchuk = 0,
			classiccontroller = 0,
			balanceboard = 0,
			dancepad = 0,
			guitar = 0,
			gamecube = 0,
			motionplus = 0,
			drums = 0,
			microphone = 0,
			wheel = 0,
			keyboard = 0,
			zapper = 0,
			x = 0;

		//check required controlls
		for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
		{
			if (!acc_itr->Required) continue;

			if (strcmp((acc_itr->Name).c_str(), "wiimote") == 0)
				wiimote = 1;
			else if (strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
				nunchuk = 1;
			else if (strcmp((acc_itr->Name).c_str(), "guitar") == 0)
				guitar = 1;
			else if (strcmp((acc_itr->Name).c_str(), "drums") == 0)
				drums = 1;
			else if (strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
				dancepad = 1;
			else if (strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
				motionplus = 1;
			else if (strcmp((acc_itr->Name).c_str(), "microphone") == 0)
				microphone = 1;
			else if (strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
				balanceboard = 1;
			else if (strcmp((acc_itr->Name).c_str(), "keyboard") == 0)
				keyboard = 1;
		}

		u8 max_controlsReq = ARRAY_SIZE(m_gameinfoLblControlsReq);

		if(wiimote && x < max_controlsReq)
		{
			u8 players = gameinfo.Players;
			if (gameinfo.Players >= 10)
				players = players/10;

			if (players == 1)
				m_controlsreq[x].fromPNG(wiimote1_png);
			else if (players == 2)
				m_controlsreq[x].fromPNG(wiimote2_png);
			else if (players == 3)
				m_controlsreq[x].fromPNG(wiimote3_png);
			else if (players == 4)
				m_controlsreq[x].fromPNG(wiimote4_png);
			else if (players == 8)
				m_controlsreq[x].fromPNG(wiimote8_png);

			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
			x++;
		}
		if(nunchuk && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(nunchukR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(guitar && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(guitarR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(drums && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(drumsR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(motionplus && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(motionplusR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 20, 60);
			x++;
		}
		if(dancepad && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(dancepadR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(microphone && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(microphoneR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(balanceboard && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(balanceboardR_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}
		if(keyboard && x < max_controlsReq)
		{
			m_controlsreq[x].fromPNG(keyboard_png);
			m_btnMgr.setTexture(m_gameinfoLblControlsReq[x] ,m_controlsreq[x], 52, 60);
			x++;
		}

		cnt_controlsreq = x;

		//for(unsigned int i = 0;i<ARRAY_SIZE(m_gameinfoLblControlsReq);i++)
			//m_btnMgr.setTexture(m_gameinfoLblControlsReq[i] ,m_controlsreq[i]);

		//check optional controlls
		wiimote=0,
		nunchuk=0,
		classiccontroller = 0,
		balanceboard = 0,
		dancepad = 0,
		guitar = 0,
		gamecube = 0,
		motionplus = 0,
		drums = 0,
		microphone = 0,
		wheel = 0,
		keyboard = 0,
		zapper = 0,
		x = 0;

		for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
		{
			if (acc_itr->Required) continue;

			if (strcmp((acc_itr->Name).c_str(), "classiccontroller") == 0)
				classiccontroller = 1;
			else if (strcmp((acc_itr->Name).c_str(), "nunchuk") == 0)
				nunchuk = 1;
			else if (strcmp((acc_itr->Name).c_str(), "guitar") == 0)
				guitar = 1;
			else if (strcmp((acc_itr->Name).c_str(), "drums") == 0)
				drums = 1;
			else if (strcmp((acc_itr->Name).c_str(), "dancepad") == 0)
				dancepad = 1;
			else if (strcmp((acc_itr->Name).c_str(), "motionplus") == 0)
				motionplus = 1;
			else if (strcmp((acc_itr->Name).c_str(), "balanceboard") == 0)
				balanceboard = 1;
			else if (strcmp((acc_itr->Name).c_str(), "microphone") == 0)
				microphone = 1;
			else if (strcmp((acc_itr->Name).c_str(), "gamecube") == 0)
				gamecube = 1;
			else if (strcmp((acc_itr->Name).c_str(), "zapper") == 0)
				zapper = 1;
			else if (strcmp((acc_itr->Name).c_str(), "wheel") == 0)
				wheel = 1;
			else if (strcmp((acc_itr->Name).c_str(), "keyboard") == 0)
				keyboard = 1;
 		}

		x = 0;
		u8 max_controls = ARRAY_SIZE(m_gameinfoLblControls);

		if(classiccontroller && x < max_controls)
		{
			m_controls[x].fromPNG(classiccontroller_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(nunchuk && x < max_controls)
		{
			m_controls[x].fromPNG(nunchuk_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(guitar && x < max_controls)
		{
			m_controls[x].fromPNG(guitar_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(drums && x < max_controls)
		{
			m_controls[x].fromPNG(drums_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(dancepad && x < max_controls)
		{
			m_controls[x].fromPNG(dancepad_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(motionplus && x < max_controls)
		{
			m_controls[x].fromPNG(motionplus_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 20, 60);
			x++;
		}
		if(balanceboard && x < max_controls)
		{
			m_controls[x].fromPNG(balanceboard_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(microphone && x < max_controls)
		{
			m_controls[x].fromPNG(microphone_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 48, 60);
			x++;
		}
		if(gamecube && x < max_controls)
		{
			m_controls[x].fromPNG(gcncontroller_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 48, 60);
			x++;
		}
		if(wheel && x < max_controls)
		{
			m_controls[x].fromPNG(wheel_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(keyboard && x < max_controls)
		{
			m_controls[x].fromPNG(keyboard_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(zapper && x < max_controls)
		{
			m_controls[x].fromPNG(zapper_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 70);
			x++;
		}
		if(microphone && x < max_controls)
		{
			m_controls[x].fromPNG(microphone_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}

		cnt_controls = x;
		//for(unsigned int i = 0;i<ARRAY_SIZE(m_gameinfoLblControls);i++)
			//m_btnMgr.setTexture(m_gameinfoLblControls[i] ,m_controls[i]);
	}
	else
コード例 #9
0
			x++;
		}
		if(keyboard && x < max_controls)
		{
			m_controls[x].fromPNG(keyboard_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}
		if(zapper && x < max_controls)
		{
			m_controls[x].fromPNG(zapper_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 70);
			x++;
		}
		if(microphone && x < max_controls)
		{
			m_controls[x].fromPNG(microphone_png);
			m_btnMgr.setTexture(m_gameinfoLblControls[x] ,m_controls[x], 52, 60);
			x++;
		}

		cnt_controls = x;
		//for(unsigned int i = 0;i<ARRAY_SIZE(m_gameinfoLblControls);i++)
			//m_btnMgr.setTexture(m_gameinfoLblControls[i] ,m_controls[i]);
	}
	else
		m_btnMgr.setText(m_gameinfoLblTitle, wfmt(L"%s", "No Gameinfo"), true);

	m_gametdb.CloseFile();

}
コード例 #10
0
ファイル: cheat.cpp プロジェクト: Captnoord/Wodeflow
void CMenu::_CheatSettings() {
	s32 padsState;
	WPADData *wd;
	u32 btn;
	WPAD_Rumble(WPAD_CHAN_0, 0);

	// try to load cheat file
	int txtavailable=0;
	m_cheatSettingsPage = 1; // init page
	
	txtavailable = m_cheatfile.openTxtfile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); 
	
	_showCheatSettings();
	_textCheatSettings();
	
	if (txtavailable)
		m_btnMgr.setText(m_cheatLblTitle,wfmt(L"%s",m_cheatfile.getGameName().c_str()));
	else 
		m_btnMgr.setText(m_cheatLblTitle,L"");
	
	while (true)
	{
		WPAD_ScanPads();
		padsState = WPAD_ButtonsDown(0);
		wd = WPAD_Data(0);
		btn = _btnRepeat(wd->btns_h);
		if ((padsState & (WPAD_BUTTON_HOME | WPAD_BUTTON_B)) != 0)
			break;
		if (wd->ir.valid)
			m_btnMgr.mouse(wd->ir.x - m_cur.width() / 2, wd->ir.y - m_cur.height() / 2);
		else if ((padsState & WPAD_BUTTON_UP) != 0)
			m_btnMgr.up();
		else if ((padsState & WPAD_BUTTON_DOWN) != 0)
			m_btnMgr.down();
		if ((padsState & WPAD_BUTTON_MINUS) != 0)
		{
			if (m_cheatSettingsPage > 1)
				--m_cheatSettingsPage;
			_hideCheatSettings();
			_showCheatSettings();
			m_btnMgr.click(m_cheatBtnPageM);
		}
		else if ((padsState & WPAD_BUTTON_PLUS) != 0)
		{
			_hideCheatSettings();
			if (m_cheatSettingsPage < (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE)
				++m_cheatSettingsPage;
			_showCheatSettings();
			m_btnMgr.click(m_cheatBtnPageP);
		}		
		if ((padsState & WPAD_BUTTON_A) != 0)
		{
			m_btnMgr.click();
			if (m_btnMgr.selected() == m_cheatBtnBack)
				break;
			else if (m_btnMgr.selected() == m_cheatBtnPageM)
			{
				_hideCheatSettings();
				if (m_cheatSettingsPage > 1)
					--m_cheatSettingsPage;
				_showCheatSettings();
			}
			else if (m_btnMgr.selected() == m_cheatBtnPageP)
			{
				_hideCheatSettings();
				if (m_cheatSettingsPage < (m_cheatfile.getCnt()+CHEATSPERPAGE-1)/CHEATSPERPAGE)
					++m_cheatSettingsPage;
				_showCheatSettings();
			}
				
			for (int i = 0; i < CHEATSPERPAGE; ++i)
				if (m_btnMgr.selected() == m_cheatBtnItem[i]) {
					// handling code for clicked cheat
					m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i] = !m_cheatfile.sCheatSelected[(m_cheatSettingsPage-1)*CHEATSPERPAGE + i];
					_showCheatSettings();
				}
			
			if (m_btnMgr.selected() == m_cheatBtnApply)
			{
				int operation_ok,check = 0;
				//checks if at least one cheat is selected
				for (unsigned int i=0; i < m_cheatfile.getCnt(); ++i) {
					if (m_cheatfile.sCheatSelected[i] == true) 
						{
						check = 1;
						break;
						}
					
					}
					
				if (check)
				{
					operation_ok = m_cheatfile.createGCT(fmt("%s/%s.gct", m_cheatDir.c_str(), m_cf.getId().c_str())); 
					operation_ok = m_cheatfile.createTXT(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str())); 
					
				}
					
				m_cfg.setOptBool(m_cf.getId(), "cheat",1);
				if (operation_ok)
					break;
			}

			if (m_btnMgr.selected() == m_cheatBtnDownload)
			{
				// Download cheat code
				m_btnMgr.hide(m_cheatLblTitle);
				
				u32 bufferSize = 0x100000;	// Maximum download size 1 MB
				SmartBuf buffer;
				block cheatfile;
				FILE *file;
				char ip[16];
				
				if (!m_networkInit && _initNetwork(ip) < 0) {
					m_btnMgr.hide(m_cheatLblTitle);
					break;
				}
				m_networkInit = true;

				buffer = smartCoverAlloc(bufferSize);
				cheatfile = downloadfile(buffer.get(), bufferSize, sfmt(GECKOURL, m_cf.getId().c_str()).c_str(),CMenu::_downloadProgress, this);

				if (cheatfile.data != NULL && cheatfile.size > 65 && cheatfile.data[0] != '<') {
					// cheat file was downloaded and presumably no 404
					file = fopen(fmt("%s/%s.txt", m_txtCheatDir.c_str(), m_cf.getId().c_str()), "wb");
							
					if (file != NULL)
					{
						fwrite(cheatfile.data, 1, cheatfile.size, file);
						fclose(file);
						break;
					}
				}
				else
				{
					// cheat code not found, show result
					m_btnMgr.setText(m_cheatLblItem[0], _t("cheat4", L"Download not found."));
					m_btnMgr.setText(m_cheatLblItem[1], wfmt(L"http://www.geckocodes.org/codes/R/%s.txt",m_cf.getId().c_str()));
					m_btnMgr.show(m_cheatLblItem[1]);
				}
			}
		}
		_mainLoopCommon(wd);
	}
	_hideCheatSettings();
}
コード例 #11
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;
}