void CustomFileBrowser::AddButton()
{
	int size = fileBtn.size();

	fileSelectionImg.resize(size+1);
	fileSelectionImg[size] = new GuiImage(bgFileSelectionEntry);
	fileSelectionImg[size]->SetScaleX(0.8125);
	fileSelectionImg[size]->SetPosition(-36, 0);

	fileBtnText.resize(size+1);
	fileBtnText[size] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	fileBtnText[size]->SetAlignment(ALIGN_LEFT | ALIGN_MIDDLE);
	fileBtnText[size]->SetPosition(30,0);
	fileBtnText[size]->SetMaxWidth(width - 30, DOTTED);

	fileBtnTextOver.resize(size+1);
	fileBtnTextOver[size] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	fileBtnTextOver[size]->SetAlignment(ALIGN_LEFT | ALIGN_MIDDLE);
	fileBtnTextOver[size]->SetPosition(30,0);
	fileBtnTextOver[size]->SetMaxWidth(width - 40, SCROLL_HORIZONTAL);

	fileBtnIcon.resize(size+1);
	fileBtnIcon[size] = NULL;

	fileBtn.resize(size+1);
	fileBtn[size] = new GuiButton(width,30);
	fileBtn[size]->SetParent(this);
	fileBtn[size]->SetLabel(fileBtnText[size], 0);
	fileBtn[size]->SetLabelOver(fileBtnTextOver[size]);
	fileBtn[size]->SetImageOver(fileSelectionImg[size]);
	fileBtn[size]->SetPosition(0,30*size+1);
	fileBtn[size]->SetTrigger(trigA);
	fileBtn[size]->SetSoundClick(btnSoundClick);
	fileBtn[size]->Clicked.connect(this, &CustomFileBrowser::OnClicked);
}
void ListEmuBrowser::AddButton()
{
	int size = saveBtn.size();

	saveSelectionImg.resize(size+1);
	saveSelectionImg[size] = new GuiImage(bgSaveSelectionEntry);

	saveBtnText.resize(size+1);
	saveBtnText[size] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	saveBtnText[size]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
	saveBtnText[size]->SetPosition(52,0);
	saveBtnText[size]->SetMaxWidth(saveSelectionImg[size]->GetWidth() - 55, DOTTED);

	saveBtnTextOver.resize(size+1);
	saveBtnTextOver[size] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	saveBtnTextOver[size]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
	saveBtnTextOver[size]->SetPosition(52,0);
	saveBtnTextOver[size]->SetMaxWidth(saveSelectionImg[size]->GetWidth() - 55, SCROLL_HORIZONTAL);

	saveBtnIcon.resize(size+1);
	saveBtnIcon[size] = new GuiImage(fileSave);;
	saveBtnIcon[size]->SetScale(0.667);
	saveBtnIcon[size]->SetPosition(21,-7);
	
	saveBtn.resize(size+1);
	saveBtn[size] = new GuiButton(saveSelectionImg[size]->GetWidth(),30);
	saveBtn[size]->SetParent(this);
	saveBtn[size]->SetLabel(saveBtnText[size]);
	saveBtn[size]->SetLabelOver(saveBtnTextOver[size]);
	saveBtn[size]->SetIcon(saveBtnIcon[size]);
	saveBtn[size]->SetImageOver(saveSelectionImg[size]);
	saveBtn[size]->SetPosition(2,30*size+3);
	saveBtn[size]->SetTrigger(trigA);
	saveBtn[size]->SetSoundClick(btnSoundClick);
}
/**
 * Constructor for the GuiOptionBrowser class.
 */
GuiOptionBrowser::GuiOptionBrowser(OptionList * l)
{
	options = l;
	coL2 = 50;
	selectable = true;
	listOffset = 0;
	listChanged = true;
	selectedItem = 0;

	trigA = new GuiTrigger();
	trigA->SetSimpleTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);

	btnSoundClick = Resources::GetSound("button_click.wav");
	btnSoundClick->SetVolume(Settings.SFXVolume);
	
	bgOptions = Resources::GetImageData("browser_options.png");
	bgOptionsImg = new GuiImage(bgOptions);
	bgOptionsImg->SetParent(this);
	bgOptionsImg->SetAlignment(ALIGN_LEFT | ALIGN_MIDDLE);
	
	width = bgOptionsImg->GetWidth();
	height = bgOptionsImg->GetHeight();
	
	bgOptionsEntry = Resources::GetImageData("browser_bg_selection.png");

	scrollbar = new Scrollbar(bgOptionsImg->GetHeight()+20);
	scrollbar->SetParent(this);
	scrollbar->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	scrollbar->SetPosition(6, -10);
	scrollbar->SetScrollSpeed(Settings.ScrollSpeed);
	scrollbar->listChanged.connect(this, &GuiOptionBrowser::OnListChange);
	scrollbar->SetButtonScroll(WiiControls.OneButtonScroll | ClassicControls.OneButtonScroll << 16, GCControls.OneButtonScroll);

	for(int i = 0; i < OPTIONMAX; i++)
	{
		optionTxt[i] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - option browser entry text color"));
		optionTxt[i]->SetAlignment(ALIGN_LEFT | ALIGN_MIDDLE);
		optionTxt[i]->SetPosition(15,0);
		
		optionVal[i] = new GuiText((char*) NULL, 20, thColor("r=0 g=0 b=0 a=255 - option browser entry text color"));
		optionVal[i]->SetAlignment(ALIGN_LEFT | ALIGN_MIDDLE);
		optionVal[i]->SetPosition(250,0);
		optionVal[i]->SetMaxWidth(width-optionTxt[i]->GetLeft()-50,DOTTED);
		
		optionBg[i] = new GuiImage(bgOptionsEntry);
		
		optionBtn[i] = new GuiButton(width-(8+scrollbar->GetWidth()-6),29);
		optionBtn[i]->SetParent(this);
		optionBtn[i]->SetState(STATE_DISABLED);
		optionBtn[i]->SetLabel(optionTxt[i], 0);
		optionBtn[i]->SetLabel(optionVal[i], 1);
		optionBtn[i]->SetImageOver(optionBg[i]);
		optionBtn[i]->SetPosition(8,29*i+9);
		optionBtn[i]->SetTrigger(trigA);
		optionBtn[i]->SetSoundClick(btnSoundClick);
		optionBtn[i]->Clicked.connect(this, &GuiOptionBrowser::OnButtonClick);
	}
}
Exemplo n.º 4
0
/**
GuiOptionBrowser * Constructor for the GuiOptionBrowser class.
 */
GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l, const char * custombg)
	: scrollBar(h-10)
{
	width = w;
	height = h;
	options = l;
	selectable = true;
	selectedItem = 0;
	oldSelectedItem = -1;
	coL2 = 50;
	listOffset = 0;

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);

	bgOptions = Resources::GetImageData(custombg);

	bgOptionsImg = new GuiImage(bgOptions);
	bgOptionsImg->SetParent(this);
	bgOptionsImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);

	bgOptionsEntry = Resources::GetImageData("bg_options_entry.png");

	scrollBar.SetParent(this);
	scrollBar.SetAlignment(thAlign("right - options browser scrollbar align hor"), thAlign("top - options browser scrollbar align ver"));
	scrollBar.SetPosition(thInt("0 - options browser scrollbar pos x"), thInt("5 - options browser scrollbar pos y"));
	scrollBar.listChanged.connect(this, &GuiOptionBrowser::onListChange);

	optionBtn.resize(PAGESIZE);
	optionBg.resize(PAGESIZE);
	optionTxt.resize(PAGESIZE);
	optionVal.resize(PAGESIZE);

	for (int i = 0; i < PAGESIZE; i++)
	{
		optionTxt[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color"));
		optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
		optionTxt[i]->SetPosition(24, 0);
		optionTxt[i]->SetMaxWidth(bgOptionsImg->GetWidth()-scrollBar.GetWidth()-40, DOTTED);

		optionBg[i] = new GuiImage(bgOptionsEntry);

		optionVal[i] = new GuiText((wchar_t *) NULL, 20, thColor("r=0 g=0 b=0 a=255 - settings text color"));
		optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);

		optionBtn[i] = new GuiButton(width - scrollBar.GetWidth(), GAMESELECTSIZE);
		optionBtn[i]->SetParent(this);
		optionBtn[i]->SetLabel(optionTxt[i], 0);
		optionBtn[i]->SetLabel(optionVal[i], 1);
		optionBtn[i]->SetImageOver(optionBg[i]);
		optionBtn[i]->SetPosition(10, GAMESELECTSIZE * i + 4);
		optionBtn[i]->SetRumble(false);
		optionBtn[i]->SetTrigger(trigA);
		optionBtn[i]->SetSoundClick(btnSoundClick);
	}
}
void GCDeleteMenu::browserRefresh(void)
{
	browser->Clear();
	browser->SetMaxTextWidth(200);

	for(u32 i = 0; i < sizeTxtList.size(); ++i)
		delete sizeTxtList[i];

	sizeTxtList.resize(GCGames::Instance()->GetSDHeaders().size());

	for(u32 i = 0; i < GCGames::Instance()->GetSDHeaders().size(); ++i)
	{
		const struct discHdr *gcDiscHdr = &GCGames::Instance()->GetSDHeaders().at(i);
		float fSize = GCGames::Instance()->GetGameSize((char*)gcDiscHdr->id);

		browser->AddEntrie(GameTitles.GetTitle(gcDiscHdr));

		char size_text[20];
		snprintf(size_text, sizeof(size_text), "(%.2fGB)", fSize);

		sizeTxtList[i] = new GuiText(size_text, 18, thColor("r=0 g=0 b=0 a=255 - checkbox browser text color"));
		sizeTxtList[i]->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
		sizeTxtList[i]->SetPosition(-40, 5);
		browser->GetCheckbox(i)->SetLabel(sizeTxtList[i]);
	}
}
Exemplo n.º 6
0
void PromptWindow::AddButton(const char *text)
{
	int size = Button.size();
	if(size > 3)
		return;

	ButtonTxt.resize(size+1);
	ButtonImg.resize(size+1);
	Button.resize(size+1);

	ButtonTxt[size] = new GuiText(text, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	ButtonImg[size] = new GuiImage(btnOutline);
	if (Settings.wsprompt)
	{
		ButtonTxt[size]->SetWidescreen(Settings.widescreen);
		ButtonImg[size]->SetWidescreen(Settings.widescreen);
	}

	Button[size] = new GuiButton(ButtonImg[size], ButtonImg[size], 0, 3, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1);
	Button[size]->SetLabel(ButtonTxt[size]);
	Button[size]->SetState(STATE_SELECTED);
	Button[size]->SetTrigger(1, trigB);
	Append(Button[size]);

	if(size > 0)
		Button[size-1]->SetTrigger(1, NULL);

	PositionButtons();
}
Exemplo n.º 7
0
ThemeMenu::ThemeMenu()
	: FlyingButtonsMenu(tr("Theme Menu"))
{
	delete MainButtonImgData;
	delete MainButtonImgOverData;

	MainButtonImgData = Resources::GetImageData("theme_box.png");
	MainButtonImgOverData = NULL;

	ParentMenu = MENU_SETTINGS;

	for(int i = 0; i < 4; ++i)
		ThemePreviews[i] = NULL;

	defaultBtnTxt = new GuiText(tr( "Default" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	defaultBtnTxt->SetMaxWidth(btnOutline->GetWidth() - 30);
	defaultBtnImg = new GuiImage(btnOutline);
	if (Settings.wsprompt)
	{
		defaultBtnTxt->SetWidescreen(Settings.widescreen);
		defaultBtnImg->SetWidescreen(Settings.widescreen);
	}
	defaultBtn = new GuiButton(btnOutline->GetWidth(), btnOutline->GetHeight());
	defaultBtn->SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	defaultBtn->SetPosition(-20, 400);
	defaultBtn->SetLabel(defaultBtnTxt);
	defaultBtn->SetImage(defaultBtnImg);
	defaultBtn->SetSoundOver(btnSoundOver);
	defaultBtn->SetSoundClick(btnSoundClick2);
	defaultBtn->SetTrigger(trigA);
	defaultBtn->SetEffectGrow();
	Append(defaultBtn);

	backBtn->SetPosition(-205, 400);
}
Exemplo n.º 8
0
PromptWindow::PromptWindow(const char *title, const char *msg)
	: GuiWindow(472, 320)
{
	SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	SetPosition(0, -10);

	btnOutline = Resources::GetImageData("button_dialogue_box.png");
	dialogBox = Resources::GetImageData("dialogue_box.png");

	width = dialogBox->GetWidth();
	height = dialogBox->GetHeight();

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	dialogBoxImg = new GuiImage(dialogBox);
	if(Settings.wsprompt)
		dialogBoxImg->SetWidescreen(Settings.widescreen);
	Append(dialogBoxImg);

	titleTxt = new GuiText(title, 26, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	titleTxt->SetPosition(0, 55);
	if(Settings.wsprompt && Settings.widescreen)
		titleTxt->SetMaxWidth(width-140, DOTTED);
	else
		titleTxt->SetMaxWidth(width-40, DOTTED);
	Append(titleTxt);

	msgTxt = new GuiText(msg, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	msgTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	msgTxt->SetPosition(0, -40);
	if(Settings.wsprompt && Settings.widescreen)
		msgTxt->SetMaxWidth(width-140, WRAP);
	else
		msgTxt->SetMaxWidth(width-40, WRAP);
	Append(msgTxt);

	SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
}
Exemplo n.º 9
0
SettingsMenu::SettingsMenu()
	: GuiFrame(screenwidth, screenheight)
{
	globalSettings = NULL;
	settingsBrowser = NULL;
	
	BtnSoundClick = Resources::GetSound("button_click.wav");
	BtnSoundOver = Resources::GetSound("button_over.wav");
	BtnSoundClick->SetVolume(Settings.SFXVolume);
	BtnSoundOver->SetVolume(Settings.SFXVolume);
	
	trigA.SetSimpleTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);
	trigB.SetButtonOnlyTrigger(-1, WiiControls.BackButton | ClassicControls.BackButton << 16, GCControls.BackButton);
	
	BgImgData = Resources::GetImageData("settings_background.png");
	BgImg = new GuiImage(BgImgData);
	
	Title = new GuiText(tr("Global Settings"), 28, thColor("r=0 g=0 b=0 a=255 - settings menu title text color"));
	Title->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	Title->SetPosition(170, 38);
	Title->SetMaxWidth(310, SCROLL_HORIZONTAL);
	
	BackBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - settings menu back button text color"));
	BackBtn = new PictureButton("settings_menu_button.png", "settings_menu_button.png", BtnSoundClick, BtnSoundOver);
	BackBtn->SetAlignment(thAlign("center - settings menu back button align hor") | thAlign("top - settings menu back button align ver"));
	BackBtn->SetPosition(thInt("-195 - settings menu back button pos x"), thInt("400 - settings menu back button pos y"));
	BackBtn->SetLabel(BackBtnTxt);
	BackBtn->SetTrigger(&trigA);
	BackBtn->SetTrigger(&trigB);
	BackBtn->Clicked.connect(this, &SettingsMenu::OnBackButtonClick);
	
	globalSettings = new GlobalSettings();
	globalSettings->FlyingBtnMenuClicked.connect(this, &SettingsMenu::OnFlyingButtonClick);
	
	Append(BgImg);
	Append(Title);
	Append(BackBtn);
	Append(globalSettings);
	
	SetEffect(EFFECT_FADE, 20);
}
Exemplo n.º 10
0
SettingsMenu::SettingsMenu(const char * title, OptionList * opts, int returnTo)
	: GuiWindow(screenwidth, screenheight)
{
	Options = opts;
	returnToMenu = returnTo;
	trigA = NULL;
	trigB = NULL;
	backBtnTxt = NULL;
	backBtnImg = NULL;
	backBtn = NULL;
	btnOutline = NULL;

	//! Skipping back button if there is no menu defined to go back to
	if(returnToMenu != MENU_NONE)
	{
		btnOutline = Resources::GetImageData("button_dialogue_box.png");

		trigA = new GuiTrigger();
		trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);

		trigB = new GuiTrigger();
		trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

		backBtnTxt = new GuiText(tr("Back"), 22, (GXColor){0, 0, 0, 255});
		backBtnImg = new GuiImage(btnOutline);
		backBtn = new GuiButton(backBtnImg, backBtnImg, 2, 3, -180, 400, trigA, btnSoundOver, btnSoundClick2, 1);
		backBtn->SetLabel(backBtnTxt);
		backBtn->SetTrigger(trigB);
		Append(backBtn);
	}

	optionBrowser = new GuiOptionBrowser(396, 280, Options, "bg_options_settings.png");
	optionBrowser->SetAlignment(thAlign("center - settings option browser align hor"), thAlign("top - settings option browser align ver"));
	optionBrowser->SetPosition(thInt("0 - settings option browser pos x"), thInt("90 - settings option browser pos y"));

	titleTxt = new GuiText(title, 28, thColor("r=0 g=0 b=0 a=255 - settings title text color"));
	titleTxt->SetAlignment(thAlign("center - settings title text align hor"), thAlign("top - settings title text align ver"));
	titleTxt->SetPosition(thInt("0 - settings title text pos x"), thInt("40 - settings title text pos y"));
	titleTxt->SetMaxWidth(thInt("310 - settings title text max width"), SCROLL_HORIZONTAL);

	Append(optionBrowser);
	Append(titleTxt);

	SetEffect(EFFECT_FADE, 50);
}
Exemplo n.º 11
0
/**
 * Constructor for the ListEmuBrowser class.
 */
ListEmuBrowser::ListEmuBrowser(Browser * emubrowser, GuiImageData * browserBg, int w, int h)
	: GuiFileBrowser(emubrowser, w, h)
{
	width = w;
	height = h;
	selectedItem = 0;
	oldSelectedItem = -1;
	oldPageIndex = 0;
	numEntries = 0;
	type = TYPE_UNKNOW;
	browser = emubrowser;
	listChanged = true; //! trigger an initial list update
	triggerupdate = true; //! trigger disable

	trigA = new SimpleGuiTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);

	bgSaveSelectionImg = new GuiImage(browserBg);
	bgSaveSelectionImg->SetParent(this);
	
	browserSeparator = Resources::GetImageData("browser_separator.png");
	browserSeparatorImg = new GuiImage(browserSeparator);
	browserSeparatorImg->SetParent(this);
	browserSeparatorImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	browserSeparatorImg->SetPosition(384, 0);
	
	bgSaveSelectionEntry = Resources::GetImageData("browser_options_entry_bg.png");
	fileSave = Resources::GetImageData("icon_brows_save.png");
	
	type_Wii = Resources::GetImageData("icon_type_wii.png");
	type_Wiiware = Resources::GetImageData("icon_type_wiiware.png");
	type_Gamecube = Resources::GetImageData("icon_type_gamecube.png");
	type_VC_NES = Resources::GetImageData("icon_type_vc_nes.png");
	type_VC_SNES = Resources::GetImageData("icon_type_vc_snes.png");
	type_VC_N64 = Resources::GetImageData("icon_type_vc_n64.png");
	type_VC_SMS = Resources::GetImageData("icon_type_vc_sms.png");
	type_VC_MD = Resources::GetImageData("icon_type_vc_md.png");
	type_VC_PCE = Resources::GetImageData("icon_type_vc_pce.png");
	type_VC_Neogeo = Resources::GetImageData("icon_type_vc_neogeo.png");
	type_VC_Arcade = Resources::GetImageData("icon_type_vc_arcade.png");
	type_VC_C64 = Resources::GetImageData("icon_type_vc_c64.png");
	type_Channel = Resources::GetImageData("icon_type_channel.png");
	type_Unknow = Resources::GetImageData("icon_type_unknow.png");
	
	scrollbar = new Scrollbar(browserBg->GetHeight()+20, OPTIONMODE);
	scrollbar->SetParent(this);
	scrollbar->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	scrollbar->SetPosition(4, -10);
	scrollbar->SetScrollSpeed(5);
	
	infosWindow =  new GuiWindow(width-386-13, height);
	infosWindow->SetParent(this);
	infosWindow->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	infosWindow->SetPosition(-13, 0);	
	
	infoIconImg = new GuiImage(fileSave);
	infoTypeImg = new GuiImage(type_Unknow);
	infoNameTxt = new GuiText((char*) NULL, 17, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoSubnameTxt = new GuiText((char*) NULL, 15, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoIDTxt = new GuiText((char*) NULL, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoSizeTxt = new GuiText((char*) NULL, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	pathTxt = new GuiText((char*) NULL, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoPathTxt = new GuiText((char*) NULL, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
}
Exemplo n.º 12
0
HomebrewPrompt::HomebrewPrompt(const char *name,
							   const char *coder,
							   const char *version,
							   const char *release_date,
							   const char *long_description,
							   GuiImageData * iconImgData,
							   u64 filesize)
		: PromptWindow(NULL, NULL)
{
	SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
	SetPosition(0, 6);

	trigU = new GuiTrigger();
	trigU->SetButtonOnlyTrigger(-1, WiiControls.UpButton | ClassicControls.UpButton << 16, GCControls.UpButton);
	trigD = new GuiTrigger();
	trigD->SetButtonOnlyTrigger(-1, WiiControls.DownButton | ClassicControls.DownButton << 16, GCControls.DownButton);
	trigL = new GuiTrigger();
	trigL->SetButtonOnlyTrigger(-1, WiiControls.LeftButton | ClassicControls.LeftButton << 16, GCControls.LeftButton);
	trigR = new GuiTrigger();
	trigR->SetButtonOnlyTrigger(-1, WiiControls.RightButton | ClassicControls.RightButton << 16, GCControls.RightButton);
	
	btnUp = new GuiButton(0, 0);
	btnUp->SetTrigger(trigU);
	btnDown = new GuiButton(0, 0);
	btnDown->SetTrigger(trigD);
	btnLeft = new GuiButton(0, 0);
	btnLeft->SetTrigger(trigL);
	btnRight = new GuiButton(0, 0);
	btnRight->SetTrigger(trigR);
	
	whiteBox = Resources::GetImageData("browser.png");
	
	iconImg = new GuiImage(iconImgData);
	iconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	iconImg->SetPosition(45, 10);

	dialogBoxImg->SetSkew(0, -80, 0, -80, 0, 50, 0, 50);
	dialogBoxImg->SetWidescreen(false);

	whiteBoxImg = new GuiImage(whiteBox);
	whiteBoxImg->SetPosition(30, 110);
	whiteBoxImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	whiteBoxImg->SetSkew(0, 0, -210, 0, -210, -114, 0, -114);

	nameTxt = new GuiText(name, 30, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	nameTxt->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
	nameTxt->SetPosition(0, -25);
	nameTxt->SetMaxWidth(430, SCROLL_HORIZONTAL);

	coderTxt = new GuiText(fmt(tr( "Coded by: %s" ), coder), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	coderTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	coderTxt->SetPosition(180, 30);
	coderTxt->SetMaxWidth(280);

	versionTxt = new GuiText(fmt(tr( "Version: %s" ), version), 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	versionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	versionTxt->SetPosition(40, 65);
	versionTxt->SetMaxWidth(430);

	release_dateTxt = new GuiText(release_date, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	release_dateTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	release_dateTxt->SetPosition(40, 85);
	release_dateTxt->SetMaxWidth(430);

	const int pagesize = 6;
	long_descriptionTxt = new Text(long_description, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	long_descriptionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	long_descriptionTxt->SetPosition(46, 117);
	long_descriptionTxt->SetMaxWidth(358);
	long_descriptionTxt->SetLinesToDraw(pagesize);
	long_descriptionTxt->Refresh();

	//!convert filesize from u64 to char and put unit of measurement after it
	char filesizeCH[15];
	if (filesize <= 1024.0)
		snprintf(filesizeCH, sizeof(filesizeCH), "%lld B", filesize);
	if (filesize > 1024.0)
		snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f KB", filesize / 1024.0);
	if (filesize > 1048576.0)
		snprintf(filesizeCH, sizeof(filesizeCH), "%0.2f MB", filesize / 1048576.0);

	filesizeTxt = new GuiText(filesizeCH, 16, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	filesizeTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	filesizeTxt->SetPosition(-40, 12);

	int total_lines = long_descriptionTxt->GetTotalLinesCount();
	scrollBar = new Scrollbar(150, LISTMODE);
	scrollBar->SetParent(this);
	scrollBar->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	scrollBar->SetPosition(-28, 115);
	scrollBar->SetEntrieCount(total_lines-pagesize+1);
	scrollBar->SetPageSize(pagesize);
	scrollBar->SetRowSize(0);
	scrollBar->SetScrollSpeed(5);
	if (total_lines)
		scrollBar->SetListChanged(true);
	else
	{
		scrollBar->SetListChanged(false);
		scrollBar->SetState(STATE_DISABLED);
	}
	
	Append(whiteBoxImg);
	Append(scrollBar);
	Append(btnUp);
	Append(btnDown);
	Append(btnLeft);
	Append(btnRight);

	if(strcmp(name, "") != 0) Append(nameTxt);
	if(strcmp(version, "") != 0) Append(versionTxt);
	if(strcmp(coder, "") != 0) Append(coderTxt);
	if(strcmp(release_date, "") != 0) Append(release_dateTxt);
	if(strcmp(long_description, "") != 0) Append(long_descriptionTxt);
	Append(filesizeTxt);
	Append(iconImg);

	AddButton(tr( "Load" ));
	AddButton(tr( "Back" ));

	Button[0]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
	Button[0]->SetPosition(40, 2);
	Button[1]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
	Button[1]->SetPosition(-40, 2);
}
Exemplo n.º 13
0
/********************************************************************************
 * TitleBrowser- opens a browser with a list of installed Titles
 *********************************************************************************/
bool TitleSelector(char output[])
{
	gprintf("TitleSelector()\n");

	s32 num_titles;
	s32 r = -1;
	bool ret = false;
	u64 *titleList = NULL;

	// Get count of titles of the good titles
	num_titles = NandTitles.SetType(0x10001);
	u32 n = num_titles;

	for (u32 i = 0; i < n; i++)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			break;
		}

		//remove ones not actually installed on the nand
		if (!NandTitles.Exists(tid))
		{
			num_titles--;
		}
	}

	//make a list of just the tids we are adding to the titlebrowser
	titleList = (u64*) memalign(32, num_titles * sizeof(u64));
	if (!titleList)
	{
		gprintf("TitleLister(): out of memory!\n");
		return false;
	}
	OptionList options4;
	//write the titles on the option browser

	std::string Filepath = Settings.titlestxt_path;
	Filepath += "wiitdb.xml";

	GameTDB *XML_DB = new GameTDB(Filepath.c_str());
	XML_DB->SetLanguageCode(Settings.db_language);

	s32 i = 0;
	NandTitles.SetType(0x10001);
	while (i < num_titles)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			gprintf("shit happened\n");
			break;
		}

		if (!NandTitles.Exists(tid))
			continue;

		char id[5];
		NandTitles.AsciiTID(tid, (char*) &id);

		const char* name = NULL;
		std::string TitleName;

		if(XML_DB->GetTitle(id, TitleName))
			name = TitleName.c_str();
		else
			name = NandTitles.NameOf(tid);
		//gprintf("%016llx: %s: %s\n%p\t%p\n", tid, id, name, &id, name );

		options4.SetName(i, "%s", id);
		options4.SetValue(i, "%s", name ? name : tr( "Unknown" ));
		titleList[i] = tid;
		i++;
	}

	delete XML_DB;
	XML_DB = NULL;

	options4.SetName(i, " ");
	options4.SetValue(i, "%s", tr( "Clear" ));

	bool exit = false;

	GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
	GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));

	GuiImage settingsbackground(&settingsbg);
	GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
	settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	settingsbackgroundbtn.SetPosition(0, 0);
	settingsbackgroundbtn.SetImage(&settingsbackground);

	GuiTrigger trigA;
	trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	GuiTrigger trigB;
	trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
	GuiImage cancelBtnImg(&btnOutline);
	if (Settings.wsprompt)
	{
		cancelBtnTxt.SetWidescreen(Settings.widescreen);
		cancelBtnImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton cancelBtn(&cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, btnSoundOver, btnSoundClick2, 1);
	cancelBtn.SetLabel(&cancelBtnTxt);
	cancelBtn.SetTrigger(&trigB);

	GuiOptionBrowser optionBrowser4(396, 280, &options4, "bg_options_settings.png");
	optionBrowser4.SetPosition(0, 90);
	optionBrowser4.SetAlignment(ALIGN_CENTER, ALIGN_TOP);

	HaltGui();
	GuiWindow w(screenwidth, screenheight);
	w.Append(&settingsbackgroundbtn);
	w.Append(&cancelBtn);
	w.Append(&optionBrowser4);
	mainWindow->SetState(STATE_DISABLED);
	mainWindow->Append(&w);

	ResumeGui();

	while (!exit)
	{
		VIDEO_WaitVSync();

		if (shutdown == 1) Sys_Shutdown();
		if (reset == 1) Sys_Reboot();

		r = optionBrowser4.GetClickedOption();

		if (r > -1)
		{ //if a click happened
			if (r < num_titles)
			{
				u64 tid = titleList[r];
				sprintf(output, "%08x", TITLE_LOWER( tid ));
			}
			else output[0] = 0;
			ret = true;
			exit = true;
		}

		else if (cancelBtn.GetState() == STATE_CLICKED)
		{
			//break the loop and end the function
			exit = true;
		}
	}

	HaltGui();
	mainWindow->SetState(STATE_DEFAULT);
	mainWindow->Remove(&w);
	free(titleList);
	ResumeGui();

	return ret;
}
Exemplo n.º 14
0
int TitleBrowser()
{
	u32 num_titles;
	u32 num_sys_titles;
	s32 ret = -1;
	u64 *titleList = NULL;

	// Get count of titles of the good titles
	num_titles = NandTitles.SetType(0x10001);
	u32 n = num_titles;
	for (u32 i = 0; i < n; i++)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			break;
		}

		//remove ones not actually installed on the nand
		if (!NandTitles.Exists(tid))
		{
			num_titles--;
		}
	}

	// Get count of system titles
	num_sys_titles = NandTitles.SetType(0x10002);
	n = num_sys_titles;
	for (u32 i = 0; i < n; i++)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			break;
		}
		//these can't be booted anyways
		if (TITLE_LOWER( tid ) == 0x48414741 || TITLE_LOWER( tid ) == 0x48414141 || TITLE_LOWER( tid ) == 0x48414641)
		{
			num_sys_titles--;
			continue;
		}

		//these aren't installed on the nand
		if (!NandTitles.Exists(tid))
		{
			num_sys_titles--;
		}
	}

	//make a list of just the tids we are adding to the titlebrowser
	titleList = (u64*) memalign(32, (num_titles + num_sys_titles) * sizeof(u64));
	if (!titleList)
	{
		gprintf("TitleBrowser(): out of memory!\n");
		return -1;
	}
	OptionList options3;
	//write the titles on the option browser

	std::string Filepath = Settings.titlestxt_path;
	Filepath += "wiitdb.xml";

	GameTDB *XML_DB = new GameTDB(Filepath.c_str());
	XML_DB->SetLanguageCode(Settings.db_language);

	u32 i = 0;
	NandTitles.SetType(0x10001);
	//first add the good stuff
	while (i < num_titles)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			gprintf("shit happened3\n");
			break;
		}
		gprintf("[ %u ] tid: %016llx\t%s\n", i, tid, NandTitles.NameOf(tid));

		if (!NandTitles.Exists(tid))
		{
			continue;
		}

		char id[5];
		NandTitles.AsciiTID(tid, (char*) &id);

		const char* name = NULL;
		std::string TitleName;

		if(XML_DB->GetTitle(id, TitleName))
			name = TitleName.c_str();
		else
			name = NandTitles.NameOf(tid);

		options3.SetName(i, "%s", id);
		options3.SetValue(i, "%s", name ? name : tr( "Unknown" ));
		titleList[i] = tid;
		i++;
	}

	NandTitles.SetType(0x10002);
	while (i < num_sys_titles + num_titles)
	{
		u64 tid = NandTitles.Next();
		if (!tid)
		{
			break;
		}
		if (TITLE_LOWER( tid ) == 0x48414741 || TITLE_LOWER( tid ) == 0x48414141 || TITLE_LOWER( tid ) == 0x48414641) continue;

		if (!NandTitles.Exists(tid))
		{
			continue;
		}

		char id[5];
		NandTitles.AsciiTID(tid, (char*) &id);

		const char* name = NULL;
		std::string TitleName;

		if(XML_DB->GetTitle(id, TitleName))
			name = TitleName.c_str();
		else
			name = NandTitles.NameOf(tid);

		options3.SetName(i, "%s", id);
		options3.SetValue(i, "%s", name ? name : tr( "Unknown" ));
		titleList[i] = tid;
		i++;
	}

	delete XML_DB;
	XML_DB = NULL;

	if (i == num_titles + num_sys_titles)
	{
		options3.SetName(i, " ");
		options3.SetValue(i, "%s", tr( "Wii Settings" ));
	}

	bool exit = false;
	int total = num_titles + num_sys_titles;

	if (IsNetworkInit()) ResumeNetworkWait();

	GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
	GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));

	GuiTrigger trigA;
	trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	GuiTrigger trigHome;
	trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
	GuiTrigger trigB;
	trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	GuiText titleTxt(tr( "Title Launcher" ), 28, ( GXColor )
	{   0, 0, 0, 255});
	titleTxt.SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	titleTxt.SetPosition(12, 40);
	titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);

	GuiImage settingsbackground(&settingsbg);
	GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
	settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	settingsbackgroundbtn.SetPosition(0, 0);
	settingsbackgroundbtn.SetImage(&settingsbackground);

	GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
	GuiImage cancelBtnImg(&btnOutline);
	if (Settings.wsprompt)
	{
		cancelBtnTxt.SetWidescreen(Settings.widescreen);
		cancelBtnImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton cancelBtn(&cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, btnSoundOver, btnSoundClick2, 1);
	cancelBtn.SetScale(0.9);
	cancelBtn.SetLabel(&cancelBtnTxt);
	cancelBtn.SetTrigger(&trigB);

	GuiOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_settings.png");
	optionBrowser3.SetPosition(0, 90);
	optionBrowser3.SetAlignment(ALIGN_CENTER, ALIGN_TOP);

	GuiImageData wifiImgData(Resources::GetFile("wifi_btn.png"), Resources::GetFileSize("wifi_btn.png"));
	GuiImage wifiImg(&wifiImgData);
	if (Settings.wsprompt)
	{
		wifiImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton wifiBtn(wifiImg.GetWidth(), wifiImg.GetHeight());
	wifiBtn.SetImage(&wifiImg);
	wifiBtn.SetPosition(100, 400);
	wifiBtn.SetEffectGrow();
	wifiBtn.SetAlpha(80);
	wifiBtn.SetTrigger(&trigA);

	HaltGui();
	GuiWindow w(screenwidth, screenheight);
	w.Append(&settingsbackgroundbtn);
	w.Append(&titleTxt);
	w.Append(&cancelBtn);
	w.Append(&wifiBtn);
	w.Append(&optionBrowser3);
	mainWindow->Append(&w);

	ResumeGui();

	while (!exit)
	{
		VIDEO_WaitVSync();

		if (shutdown == 1) Sys_Shutdown();
		if (reset == 1)
			Sys_Reboot();

		else if (wifiBtn.GetState() == STATE_CLICKED)
		{
			ResumeNetworkWait();
			wifiBtn.ResetState();
		}

		if (IsNetworkInit())
		{
			wifiBtn.SetAlpha(255);
		}

		ret = optionBrowser3.GetClickedOption();

		if (ret > -1)
		{ //if a click happened

			if (ret < total)
			{
				//set the title's name, number, ID to text
				char text[0x100];
				char id[5];
				NandTitles.AsciiTID(titleList[ret], (char*) &id);

				snprintf(text, sizeof(text), "%s : %s", id, NandTitles.NameOf(titleList[ret]));

				//prompt to boot selected title
				if (WindowPrompt(tr( "Boot?" ), text, tr( "OK" ), tr( "Cancel" )))
				{ //if they say yes
					ExitApp();
					WII_Initialize();
					WII_LaunchTitle(titleList[ret]);
					//this really shouldn't be needed because the title will be booted
					exit = true;
					break;
				}
				else
				{
					//if they said no to booting the title
					ret = -1;
					optionBrowser3.ResetState();
				}

			}
			else if (ret == total)
			{ //if they clicked to go to the wii settings
				ExitApp();
				WII_Initialize();
				WII_ReturnToSettings();
			}
		}
		if (cancelBtn.GetState() == STATE_CLICKED)
		{
			//break the loop and end the function
			exit = true;
			ret = -10;
		}
	}

	CloseConnection();
	if (IsNetworkInit()) HaltNetworkThread();

	HaltGui();
	mainWindow->Remove(&w);
	free(titleList);
	ResumeGui();

	return ret;
}
Exemplo n.º 15
0
BannerWindow::BannerWindow(GameBrowseMenu *m, struct discHdr *header)
	: GuiWindow(screenwidth, screenheight)
	, browserMenu(m)
	, MaxAnimSteps(Settings.BannerZoomDuration)
{
	ScreenProps.x = screenwidth;
	ScreenProps.y = screenheight;

	f32 xOffset = Settings.BannerProjectionOffsetX;
	f32 yOffset = Settings.BannerProjectionOffsetY;

	guMtxIdentity(modelview);
	guMtxTransApply (modelview, modelview, xOffset, yOffset, 0.0F);

	memcpy(&originalProjection, &FSProjection2D, sizeof(Mtx44));

	returnVal = -1;
	gameSelected = 0;
	gameSound = NULL;
	dvdheader = NULL;
	reducedVol = false;

	if(!bannerFrame.IsLoaded())
		bannerFrame.Load(U8Archive(SystemMenuResources::Instance()->GetChanTtlAsh(),
								   SystemMenuResources::Instance()->GetChanTtlAshSize()));

	AnimStep = 0;
	AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
	AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
	AnimZoomIn = true;
	AnimationRunning = false;

	int gameIdx;

	//! get the game index to this header
	for(gameIdx = 0; gameIdx < gameList.size(); ++gameIdx)
	{
		if(gameList[gameIdx] == header)
		{
			gameSelected = gameIdx;
			break;
		}
	}

	//! Set dvd header if the header does not match any of the list games
	if(gameIdx == gameList.size())
		dvdheader = header;

	GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
	if(bannerBrowser)
		bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);

	gameBanner = new Banner;

	imgLeft = Resources::GetImageData("startgame_arrow_left.png");
	imgRight = Resources::GetImageData("startgame_arrow_right.png");

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
	trigL = new GuiTrigger;
	trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
	trigR = new GuiTrigger;
	trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
	trigPlus = new GuiTrigger;
	trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_R);
	trigMinus = new GuiTrigger;
	trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, PAD_TRIGGER_L);

	playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - banner window playcount text color"));
	playcntTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	playcntTxt->SetPosition(thInt("0 - banner window play count pos x"),
							thInt("215 - banner window play count pos y") - Settings.AdjustOverscanY / 2);

	settingsBtn = new GuiButton(215, 75);
	settingsBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	settingsBtn->SetSoundOver(btnSoundOver);
	settingsBtn->SetSoundClick(btnSoundAccept);
	settingsBtn->SetPosition(-120, 175);
	settingsBtn->SetTrigger(trigA);

	startBtn = new GuiButton(215, 75);
	startBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	startBtn->SetSoundOver(btnSoundOver);
	startBtn->SetSoundClick(btnSoundClick3);
	startBtn->SetPosition(110, 175);
	startBtn->SetTrigger(trigA);

	backBtn = new GuiButton(215, 75);
	backBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	backBtn->SetSoundOver(btnSoundOver);
	backBtn->SetSoundClick(btnSoundBack);
	backBtn->SetPosition(-screenwidth, -screenheight); // set out of screen
	backBtn->SetTrigger(0, trigA);
	backBtn->SetTrigger(1, trigB);

	btnLeftImg = new GuiImage(imgLeft);
	if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
	btnLeft = new GuiButton(btnLeftImg, btnLeftImg, ALIGN_LEFT, ALIGN_MIDDLE, 20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnLeft->SetTrigger(trigL);
	btnLeft->SetTrigger(trigMinus);

	btnRightImg = new GuiImage(imgRight);
	if (Settings.wsprompt) btnRightImg->SetWidescreen(Settings.widescreen);
	btnRight = new GuiButton(btnRightImg, btnRightImg, ALIGN_RIGHT, ALIGN_MIDDLE, -20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnRight->SetTrigger(trigR);
	btnRight->SetTrigger(trigPlus);

	if (Settings.ShowPlayCount)
		Append(playcntTxt);
	Append(backBtn);

	if (!dvdheader) //stuff we don't show if it is a DVD mounted
	{
		Append(btnLeft);
		Append(btnRight);
	}

	bannerFrame.SetButtonBText(tr("Start"));

	//check if unlocked
	if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
	{
		bannerFrame.SetButtonAText(tr("Settings"));
		Append(settingsBtn);
	}
	else
	{
		bannerFrame.SetButtonAText(tr("Back"));
		backBtn->SetPosition(-120, 175);
	}

	Append(startBtn); //! Appending the disc on top of all

	ChangeGame(false);
}
Exemplo n.º 16
0
void ListEmuBrowser::SetSelectedInfos()
{
	if((oldSelectedItem == selectedItem) && (oldPageIndex == browser->GetPageIndex()))
		return;
	
	oldSelectedItem = selectedItem;
	oldPageIndex = browser->GetPageIndex();
	
	infosWindow->RemoveAll();
	if (infoIconImg)
		delete infoIconImg;
	if (infoTypeImg)
		delete infoTypeImg;
	if (infoNameTxt)
		delete infoNameTxt;
	if (infoSubnameTxt)
		delete infoSubnameTxt;
	if (infoIDTxt)
		delete infoIDTxt;
	if (infoSizeTxt)
		delete infoSizeTxt;
	if (pathTxt)
		delete pathTxt;
	if (infoPathTxt)
		delete infoPathTxt;
	infoIconImg = NULL;
	infoTypeImg = NULL;
	infoNameTxt = NULL;
	infoSubnameTxt = NULL;
	infoIDTxt = NULL;
	infoSizeTxt = NULL;
	pathTxt = NULL;
	infoPathTxt = NULL;
	
	int y = 18;
	int txtmaxwidth = infosWindow->GetWidth()-25;
	
	FoundSaveType();
	infoTypeImg = new GuiImage(GetTypeIcon());
	infoTypeImg->SetParent(infosWindow);
	infoTypeImg->SetWidescreen(Settings.Widescreen);
	infoTypeImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	infoTypeImg->SetPosition(-20, y);
	y += 2;
	
	infoIconImg = new GuiImage(fileSave);
	infoIconImg->SetParent(infosWindow);
	infoIconImg = GetSaveIcon();
	infoIconImg->SetWidescreen(Settings.Widescreen);
	infoIconImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	infoIconImg->SetPosition(10, y);	
	y += infoIconImg->GetHeight()+10;
	
	infoNameTxt = new GuiText(browser->GetItemEmuName(browser->GetPageIndex()+selectedItem), 17, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoNameTxt->SetParent(infosWindow);
	infoNameTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	infoNameTxt->SetPosition(10, y);
	infoNameTxt->SetMaxWidth(txtmaxwidth, SCROLL_HORIZONTAL);
	y += 21;
	
	infoSubnameTxt = new GuiText(browser->GetItemEmuSubname(browser->GetPageIndex()+selectedItem), 15, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoSubnameTxt->SetParent(infosWindow);
	infoSubnameTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	infoSubnameTxt->SetPosition(10, y);
	infoSubnameTxt->SetMaxWidth(txtmaxwidth, DOTTED);
	y += 28;
	
	std::string ID = tr( "ID:" );
	ID += " ";
	ID += browser->GetItemEmuID(browser->GetPageIndex()+selectedItem);
	infoIDTxt = new GuiText(ID, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoIDTxt->SetParent(infosWindow);
	infoIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	infoIDTxt->SetPosition(10, y);
	infoIDTxt->SetMaxWidth(txtmaxwidth, DOTTED);
	y += 22;
	
	std::string size = tr( "Size:" );
	size += fmt(" %0.f %s", ceil(browser->GetItemEmuBlocks(browser->GetPageIndex()+selectedItem)), tr( "Block(s)" ));
	infoSizeTxt = new GuiText(size, 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoSizeTxt->SetParent(infosWindow);
	infoSizeTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	infoSizeTxt->SetPosition(10, y);
	infoSizeTxt->SetMaxWidth(txtmaxwidth, DOTTED);
	y += 22;
	
	int Y = -40;
	infoPathTxt = new GuiText(GetCurrentPath(), 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	infoPathTxt->SetParent(infosWindow);
	infoPathTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
	infoPathTxt->SetPosition(10, Y);
	infoPathTxt->SetLinesToDraw(3);
	infoPathTxt->SetInterline(2);
	infoPathTxt->SetMaxWidth(txtmaxwidth, WRAP);
	
	Y -= 18;
	pathTxt = new GuiText(tr( "Path:" ), 16, thColor("r=0 g=0 b=0 a=255 - mainbrowser entry text color"));
	pathTxt->SetParent(infosWindow);
	pathTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
	pathTxt->SetPosition(10, Y);
	
	infosWindow->Append(infoIconImg);
	infosWindow->Append(infoTypeImg);
	infosWindow->Append(infoIDTxt);
	infosWindow->Append(infoNameTxt);
	infosWindow->Append(infoSubnameTxt);
	infosWindow->Append(infoSizeTxt);
	infosWindow->Append(pathTxt);
	infosWindow->Append(infoPathTxt);
}
Exemplo n.º 17
0
/********************************************************************************
 *Disk Browser
 *********************************************************************************/
int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_size)
{
	gprintf("\nDiscBrowser() started");
	bool exit = false;
	int ret = -1, choice;

	HaltGui();

	gprintf("WBFS_OpenDisc\n");
	wbfs_disc_t *disc = WBFS_OpenDisc((u8 *) GameID);
	if (!disc)
	{
		ResumeGui();
		WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
		return ret;
	}
	gprintf("wd_open_disc\n");
	wiidisc_t *wdisc = wd_open_disc((int(*)(void *, u32, u32, void *)) wbfs_disc_read, disc);
	if (!wdisc)
	{
		ResumeGui();
		WindowPrompt(tr( "ERROR:" ), tr( "Could not open Disc" ), tr( "OK" ));
		return ret;
	}

	gprintf("wd_get_fst\n");
	FST_ENTRY * fstbuffer = (FST_ENTRY *) wd_extract_file(wdisc, ONLY_GAME_PARTITION, (char *) "FST");
	if (!fstbuffer)
	{
		ResumeGui();
		WindowPrompt(tr( "ERROR:" ), tr( "Not enough free memory." ), tr( "OK" ));
		return -1;
	}

	gprintf("wd_close_disc\n");
	wd_close_disc(wdisc);
	gprintf("WBFS_CloseDisc\n");
	WBFS_CloseDisc(disc);

	gprintf("options\n");
	OptionList options;

	for (u32 i = 0, position = 0; i < fstbuffer[0].filelen; i++)
	{
		//don't add files that aren't .dol to the list
		const char * filename = fstfiles(fstbuffer, i);
		const char * fileext = NULL;

		if(filename)
			fileext = strrchr(filename, '.');

		if (fileext && strcasecmp(fileext, ".dol") == 0)
		{
			options.SetName(position, "%s %03i", tr("Offset"), i);
			options.SetValue(position, filename);
			position++;
		}
	}

	free(fstbuffer);

	gprintf("\n%i alt dols found", options.GetLength()+1);
	if (options.GetLength() <= 0)
	{
		WindowPrompt(tr( "ERROR" ), tr( "No DOL file found on disc." ), tr( "OK" ));
		return ret;
	}

	GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
	GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));

	GuiTrigger trigA;
	trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	GuiTrigger trigHome;
	trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
	GuiTrigger trigB;
	trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	GuiText titleTxt(GameTitles.GetTitle(GameID), 28, ( GXColor ) {0, 0, 0, 255});
	titleTxt.SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	titleTxt.SetPosition(12, 40);
	titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);

	GuiImage settingsbackground(&settingsbg);
	GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
	settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	settingsbackgroundbtn.SetPosition(0, 0);
	settingsbackgroundbtn.SetImage(&settingsbackground);

	GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
	GuiImage cancelBtnImg(&btnOutline);
	if (Settings.wsprompt == ON)
	{
		cancelBtnTxt.SetWidescreen(Settings.widescreen);
		cancelBtnImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton cancelBtn(&cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, btnSoundOver, btnSoundClick2, 1);
	cancelBtn.SetScale(0.9);
	cancelBtn.SetLabel(&cancelBtnTxt);
	cancelBtn.SetTrigger(&trigB);

	GuiOptionBrowser optionBrowser3(396, 280, &options, "bg_options_settings.png");
	optionBrowser3.SetPosition(0, 90);
	optionBrowser3.SetAlignment(ALIGN_CENTER, ALIGN_TOP);

	HaltGui();
	GuiWindow w(screenwidth, screenheight);
	w.Append(&settingsbackgroundbtn);
	w.Append(&titleTxt);
	w.Append(&cancelBtn);
	w.Append(&optionBrowser3);

	mainWindow->Append(&w);

	ResumeGui();
	while (!exit)
	{
		usleep(100);

		if (shutdown)
			Sys_Shutdown();
		if (reset)
			Sys_Reboot();

		ret = optionBrowser3.GetClickedOption();

		if (ret >= 0)
		{
			choice = WindowPrompt(options.GetValue(ret), tr( "Load this DOL as alternate DOL?" ), tr( "OK" ), tr( "Cancel" ));
			if (choice)
			{
				snprintf(alternatedname, alternatedname_size, options.GetValue(ret));
				const char * offset = options.GetName(ret);
				if(offset)
					ret = atoi(offset+strlen("Offset ")); //doloffset
				else
					ret = -1; // weird problem
				exit = true;
			}
		}

		if (cancelBtn.GetState() == STATE_CLICKED)
		{
			exit = true;
		}
	}

	HaltGui();
	mainWindow->Remove(&w);
	ResumeGui();

	return ret;
}
Exemplo n.º 18
0
PathBrowser::PathBrowser(const std::string &path, u8 Filter)
	: GuiFrame(0, 0)
{
	filter = Filter;
	currentDevice = SD;
	
	btnSoundClick = Resources::GetSound("button_click.wav");
	btnSoundOver = Resources::GetSound("button_over.wav");
	btnSoundClick->SetVolume(Settings.SFXVolume);
	btnSoundOver->SetVolume(Settings.SFXVolume);
	
	trigA.SetSimpleTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);
	trigB.SetButtonOnlyTrigger(-1, WiiControls.BackButton | ClassicControls.BackButton << 16, GCControls.BackButton);

	browserImgData = Resources::GetImageData("browser_select.png");
	browserImg = new GuiImage(browserImgData);
	width = browserImgData->GetWidth();
	height = browserImgData->GetHeight();
	
	btnBoxImgData = Resources::GetImageData("browser_select_button_box.png");
	btnCloseBoxImg = new GuiImage(btnBoxImgData);
	btnCloseBoxImg->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	btnCloseBoxImg->SetPosition(-18, 15);
	btnWifiValBoxImg = new GuiImage(btnBoxImgData);
	btnWifiValBoxImg->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	btnWifiValBoxImg->SetPosition(-58, 15);
	
	sdImgData = Resources::GetImageData("storage_sd.png");
	usbImgData = Resources::GetImageData("storage_usb.png");
	folderImgData = Resources::GetImageData("icon_brows_folder.png");
	deviceImg = NULL;
	
	folderImg = new GuiImage(folderImgData);
	folderImg->SetScale(0.667);
	folderImg->SetPosition(0,-7);
	folderBtn = new GuiButton(folderImg->GetWidth()*0.667, folderImg->GetHeight()*0.667);
	folderBtn->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	folderBtn->SetPosition(10, 15);
	folderBtn->SetImage(folderImg);
	folderBtn->SetSoundClick(btnSoundClick);
	folderBtn->SetSoundOver(btnSoundOver);
	folderBtn->SetTrigger(&trigA);
	folderBtn->SetEffectGrow();
	folderBtn->Clicked.connect(this, &PathBrowser::OnFolderButtonClick);
	
	devSwitchBtn = new PictureButton("storage_sd.png", "storage_sd.png", btnSoundClick, btnSoundOver);
	devSwitchBtn->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	devSwitchBtn->SetPosition(58, 17);
	devSwitchBtn->SetTrigger(&trigA);
	devSwitchBtn->Clicked.connect(this, &PathBrowser::OnDevButtonClick);
	
	closeBtn = new PictureButton("button_close.png", "button_close_over.png", btnSoundClick, btnSoundOver);
	closeBtn->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	closeBtn->SetPosition(-21, 17);
	closeBtn->SetTrigger(&trigA);
	closeBtn->Clicked.connect(this, &PathBrowser::OnButtonClick);
	
	wifiBtn = new PictureButton("button_wifi.png", "button_wifi_over.png", btnSoundClick, btnSoundOver);
	wifiBtn->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	wifiBtn->SetPosition(-61, 17);
	wifiBtn->SetTrigger(&trigA);
	wifiBtn->Clicked.connect(this, &PathBrowser::OnWifiButtonClick);
	
	validBtn = new PictureButton("button_valid.png", "button_valid_over.png", btnSoundClick, btnSoundOver);
	validBtn->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	validBtn->SetPosition(-61, 17);
	validBtn->SetTrigger(&trigA);
	validBtn->Clicked.connect(this, &PathBrowser::OnButtonClick);
	
	backInDirBtn = new GuiButton(0, 0);
	backInDirBtn->SetTrigger(&trigB);
	backInDirBtn->Clicked.connect(this, &PathBrowser::OnBackInDirClick);
	
	guiBrowser = NULL;
	curBrowser = NULL;

	fileBrowser = new CustomBrowser();
	curBrowser = fileBrowser;
	guiBrowser = new CustomFileBrowser(curBrowser, 315, 270);
	guiBrowser->SetPosition(30, 56);
	guiBrowser->Clicked.connect(this, &PathBrowser::OnBrowserChanges);

	fileBrowser->SetFilter(filter);
	fileBrowser->BrowsePath(path);
	
	adressText = new GuiText(curBrowser->GetCurrentPath().c_str(), 18, thColor("r=0 g=0 b=0 a=255 - select browser adress text color"));
	adressText->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	adressText->SetPosition(76, 17);
	adressText->SetMaxWidth(237, SCROLL_HORIZONTAL);
	
	Append(browserImg);
	Append(folderBtn);
	Append(devSwitchBtn);
	Append(btnCloseBoxImg);
	Append(closeBtn);
	if (filter != FILTER_FONT)
		Append(btnWifiValBoxImg);
	if (filter == FILTER_LANG)
		Append(wifiBtn);
	else if (filter == FILTER_PATH)
		Append(validBtn);
	Append(adressText);
	Append(guiBrowser);
	Append(backInDirBtn);
	
	this->DimBackground(true);
	SetAlignment(ALIGN_CENTER | ALIGN_MIDDLE);
	SetEffect(EFFECT_FADE, 20);
	
	Application::Instance()->SetUpdateOnly(this);
	Application::Instance()->Append(this);
}
Exemplo n.º 19
0
void ThemeMenu::MainButtonClicked(int button)
{
	//! TODO: Clean me
	const char * title = ThemeList[button].Title.c_str();
	const char * author = ThemeList[button].Team.c_str();
	const char * version = ThemeList[button].Version.c_str();
	GuiImageData *thumbimageData = ThemePreviews[button % 4];

	debughelper_printf("\nTheme_Prompt(%s ,%s)", title, author);
	bool leave = false;

	GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
	GuiImageData dialogBox(Resources::GetFile("theme_dialogue_box.png"), Resources::GetFileSize("theme_dialogue_box.png"));

	GuiImage dialogBoxImg(&dialogBox);

	GuiWindow promptWindow(dialogBox.GetWidth(), dialogBox.GetHeight());
	promptWindow.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	promptWindow.SetPosition(0, -10);

	GuiTrigger trigA;
	trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	GuiTrigger trigB;
	trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	int PositionY = 30;

	GuiText titleTxt(tr( "Theme Title:" ), 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	titleTxt.SetPosition(230, PositionY);
	PositionY += 20;

	GuiText titleTxt2(title, 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	titleTxt2.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	titleTxt2.SetPosition(230, PositionY);
	titleTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, WRAP);

	if(titleTxt2.GetTextWidth() >= dialogBox.GetWidth() - 220)
		PositionY += 50;
	else
		PositionY += 30;

	GuiText authorTxt(tr( "Author(s):" ), 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	authorTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	authorTxt.SetPosition(230, PositionY);
	PositionY += 20;

	GuiText authorTxt2(author, 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	authorTxt2.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	authorTxt2.SetPosition(230, PositionY);
	authorTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, DOTTED);

	if(authorTxt2.GetTextWidth() >= dialogBox.GetWidth() - 220)
		PositionY += 50;
	else
		PositionY += 30;

	GuiText versionTxt(tr( "Version:" ), 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	versionTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	versionTxt.SetPosition(230, PositionY);

	GuiText versionTxt2(version, 18, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	versionTxt2.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	versionTxt2.SetPosition(235+versionTxt.GetTextWidth(), PositionY);
	versionTxt2.SetMaxWidth(dialogBox.GetWidth() - 220, DOTTED);

	GuiText applyBtnTxt(tr( "Apply" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	applyBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
	GuiImage applyBtnImg(&btnOutline);
	if (Settings.wsprompt)
	{
		applyBtnTxt.SetWidescreen(Settings.widescreen);
		applyBtnImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton applyBtn(&applyBtnImg, &applyBtnImg, ALIGN_RIGHT, ALIGN_TOP, -5, 170, &trigA, btnSoundOver, btnSoundClick2, 1);
	applyBtn.SetLabel(&applyBtnTxt);
	applyBtn.SetScale(0.9);

	GuiText backBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
	backBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
	GuiImage backBtnImg(&btnOutline);
	if (Settings.wsprompt)
	{
		backBtnTxt.SetWidescreen(Settings.widescreen);
		backBtnImg.SetWidescreen(Settings.widescreen);
	}
	GuiButton backBtn(&backBtnImg, &backBtnImg, ALIGN_RIGHT, ALIGN_TOP, -5, 220, &trigA, btnSoundOver, btnSoundClick2, 1);
	backBtn.SetLabel(&backBtnTxt);
	backBtn.SetTrigger(&trigB);
	backBtn.SetScale(0.9);

	GuiImage ThemeImage(thumbimageData);
	ThemeImage.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	ThemeImage.SetPosition(20, 10);
	ThemeImage.SetScale(0.8);

	promptWindow.Append(&dialogBoxImg);
	promptWindow.Append(&ThemeImage);
	promptWindow.Append(&titleTxt);
	promptWindow.Append(&titleTxt2);
	promptWindow.Append(&authorTxt);
	promptWindow.Append(&authorTxt2);
	promptWindow.Append(&versionTxt);
	promptWindow.Append(&versionTxt2);
	promptWindow.Append(&applyBtn);
	promptWindow.Append(&backBtn);

	HaltGui();
	promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
	mainWindow->SetState(STATE_DISABLED);
	mainWindow->Append(&promptWindow);
	ResumeGui();

	while (!leave)
	{
		usleep(100);

		if (shutdown)
			Sys_Shutdown();
		else if (reset)
			Sys_Reboot();

		if (applyBtn.GetState() == STATE_CLICKED)
		{
			int choice = WindowPrompt(tr( "Do you want to apply this theme?" ), title, tr( "Yes" ), tr( "Cancel" ));
			if (choice)
			{
				if (Theme::Load(ThemeList[button].Filepath.c_str()))
				{
					snprintf(Settings.theme, sizeof(Settings.theme), ThemeList[button].Filepath.c_str());
					Theme::Reload();
					returnMenu = MENU_THEMEMENU;
					leave = true;
				}
			}
			mainWindow->SetState(STATE_DISABLED);
			promptWindow.SetState(STATE_DEFAULT);
			applyBtn.ResetState();
		}

		else if (backBtn.GetState() == STATE_CLICKED)
		{
			leave = true;
			backBtn.ResetState();
		}
	}

	promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
	while (promptWindow.GetEffect() > 0) usleep(100);
	HaltGui();
	mainWindow->Remove(&promptWindow);
	mainWindow->SetState(STATE_DEFAULT);
	ResumeGui();
}
Exemplo n.º 20
0
BannerWindow::BannerWindow(GameBrowseMenu *m, struct discHdr *header)
	: GuiWindow(screenwidth, screenheight)
	, browserMenu(m)
	, MaxAnimSteps(Settings.BannerZoomDuration)
{
	ScreenProps.x = screenwidth;
	ScreenProps.y = screenheight;

	f32 xOffset = Settings.BannerProjectionOffsetX;
	f32 yOffset = Settings.BannerProjectionOffsetY;

	guMtxIdentity(modelview);
	guMtxTransApply (modelview, modelview, xOffset, yOffset, 0.0F);

	memcpy(&originalProjection, &FSProjection2D, sizeof(Mtx44));

	returnVal = -1;
	gameSelected = 0;
	gameSound = NULL;
	dvdheader = NULL;
	reducedVol = false;

	if(!bannerFrame.IsLoaded())
		bannerFrame.Load(U8Archive(SystemMenuResources::Instance()->GetChanTtlAsh(),
								   SystemMenuResources::Instance()->GetChanTtlAshSize()));

	AnimStep = 0;
	AnimPosX = 0.5f * (ScreenProps.x - fIconWidth);
	AnimPosY = 0.5f * (ScreenProps.y - fIconHeight);
	AnimZoomIn = true;
	AnimationRunning = false;

	int gameIdx;

	//! get the game index to this header
	for(gameIdx = 0; gameIdx < gameList.size(); ++gameIdx)
	{
		if(gameList[gameIdx] == header)
		{
			gameSelected = gameIdx;
			break;
		}
	}

	//! Set dvd header if the header does not match any of the list games
	if(gameIdx == gameList.size())
		dvdheader = header;

	GuiBannerGrid *bannerBrowser = dynamic_cast<GuiBannerGrid *>(browserMenu->GetGameBrowser());
	if(bannerBrowser)
		bannerBrowser->GetIconCoordinates(gameSelected, &AnimPosX, &AnimPosY);

	gameBanner = new Banner;

	imgFavorite = Resources::GetImageData("favorite.png");
	imgNotFavorite = Resources::GetImageData("not_favorite.png");
	imgLeft = Resources::GetImageData("startgame_arrow_left.png");
	imgRight = Resources::GetImageData("startgame_arrow_right.png");

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
	trigL = new GuiTrigger;
	trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
	trigR = new GuiTrigger;
	trigR->SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
	trigPlus = new GuiTrigger;
	trigPlus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_R);
	trigMinus = new GuiTrigger;
	trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, PAD_TRIGGER_L);

	playcntTxt = new GuiText((char*) NULL, 18, thColor("r=0 g=0 b=0 a=255 - banner window playcount text color"));
	playcntTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	playcntTxt->SetPosition(thInt("0 - banner window play count pos x"),
							thInt("215 - banner window play count pos y") - Settings.AdjustOverscanY / 2);

	settingsBtn = new GuiButton(215, 75);
	settingsBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	settingsBtn->SetSoundOver(btnSoundOver);
	settingsBtn->SetSoundClick(btnSoundClick2);
	settingsBtn->SetPosition(-120, 175);
	settingsBtn->SetTrigger(trigA);

	startBtn = new GuiButton(215, 75);
	startBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	startBtn->SetSoundOver(btnSoundOver);
	startBtn->SetSoundClick(btnSoundClick2);
	startBtn->SetPosition(110, 175);
	startBtn->SetTrigger(trigA);

	backBtn = new GuiButton(215, 75);
	backBtn->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	backBtn->SetSoundOver(btnSoundOver);
	backBtn->SetSoundClick(btnSoundClick2);
	backBtn->SetPosition(-screenwidth, -screenheight); // set out of screen
	backBtn->SetTrigger(0, trigA);
	backBtn->SetTrigger(1, trigB);

	// Set favorite button position
	int xPos = -198-(3*27)-14;
	if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEA) // push more to the screen border
		xPos += -14;
	int yPos = 175-27;
	float angle = 3*M_PI/2;	
	for(int i = 0; i < FAVORITE_STARS; ++i)
	{
		
		if(Settings.bannerFavIcon == BANNER_FAVICON_CIRC)
		{
			/*
			Arrangement:
			   0
			  1
			 2
			  3
			   4
			*/
			
			if (i==0 || i == 4){
				xPos = (-180-70 - 40*cos(angle)); //litte adjustment, image looks too far
			}
			else{
				xPos = (-180-65 - 40*cos(angle));
			}
			yPos = (169 + 40*sin(angle));
			angle += M_PI/4;
			
			/*
			if (i == 0){
				xPos += 27+14;
			}else if (i < 3){
				xPos += -14;
				yPos += 27;
			} else if (i >= 3){
				xPos += 14;
				yPos += 27;
			}
			*/
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SIN)
		{
			/*
			Arrangement:
			0 2 4
			 1 3
			*/
			
			xPos += 27;
			xPos += -14;
			if ((i&1)==0)
			{
				yPos += 27;
			}
			else
			{
				yPos -= 27;
			}
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_MULTI_LINE)
		{
			/*
			Sequential arrangement, 3 on top, 2 at bottom:
			1 2 3
			 4 5
			*/
			
			xPos += 27;
			if (i==2){
				xPos += -27-27-14;
				yPos += 27;
			}
		
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEA)
		{
			/* Arrangement : inline above the settings */
			xPos += 27;
			yPos = 95;
		}
		else if(Settings.bannerFavIcon == BANNER_FAVICON_SINGLE_LINEB)
		{
			/* Arrangement : inline below the settings */
			xPos += 27;
			yPos = 210;
		}
		
		FavoriteBtnImg[i] = new GuiImage;
		FavoriteBtnImg[i]->SetWidescreen(Settings.widescreen);
		FavoriteBtn[i] = new GuiButton(imgFavorite->GetWidth(), imgFavorite->GetHeight());
		FavoriteBtn[i]->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
		FavoriteBtn[i]->SetPosition(xPos, yPos);
		FavoriteBtn[i]->SetImage(FavoriteBtnImg[i]);
		FavoriteBtn[i]->SetSoundOver(btnSoundOver);
		FavoriteBtn[i]->SetSoundClick(btnSoundClick2);
		FavoriteBtn[i]->SetTrigger(trigA);
		FavoriteBtn[i]->SetEffectGrow();
	}

	btnLeftImg = new GuiImage(imgLeft);
	if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
	btnLeft = new GuiButton(btnLeftImg, btnLeftImg, ALIGN_LEFT, ALIGN_MIDDLE, 20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnLeft->SetTrigger(trigL);
	btnLeft->SetTrigger(trigMinus);

	btnRightImg = new GuiImage(imgRight);
	if (Settings.wsprompt) btnRightImg->SetWidescreen(Settings.widescreen);
	btnRight = new GuiButton(btnRightImg, btnRightImg, ALIGN_RIGHT, ALIGN_MIDDLE, -20, -50, trigA, btnSoundOver, btnSoundClick2, 1);
	btnRight->SetTrigger(trigR);
	btnRight->SetTrigger(trigPlus);

	if (Settings.ShowPlayCount)
		Append(playcntTxt);
	Append(backBtn);

	if (!dvdheader) //stuff we don't show if it is a DVD mounted
	{
		Append(btnLeft);
		Append(btnRight);
	}

	bannerFrame.SetButtonBText(tr("Start"));

	//check if unlocked
	if (Settings.godmode || !(Settings.ParentalBlocks & BLOCK_GAME_SETTINGS))
	{
		bannerFrame.SetButtonAText(tr("Settings"));
		Append(settingsBtn);
		if(Settings.bannerFavIcon != BANNER_FAVICON_OFF)
			for(int i = 0; i < FAVORITE_STARS; ++i)
				Append(FavoriteBtn[i]);
	}
	else
	{
		bannerFrame.SetButtonAText(tr("Back"));
		backBtn->SetPosition(-120, 175);
	}

	Append(startBtn); //! Appending the disc on top of all

	ChangeGame(false);
}