diff --git a/gui.pnproj b/gui.pnproj
index 1e690d9b..71ff4cc7 100644
--- a/gui.pnproj
+++ b/gui.pnproj
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/source/menu/GameBrowseMenu.cpp b/source/menu/GameBrowseMenu.cpp
index 9dca35b1..e1bcbd49 100644
--- a/source/menu/GameBrowseMenu.cpp
+++ b/source/menu/GameBrowseMenu.cpp
@@ -4,6 +4,7 @@
#include "prompts/PromptWindows.h"
#include "prompts/gameinfo.h"
#include "prompts/DiscBrowser.h"
+#include "prompts/GameWindow.hpp"
#include "themes/CTheme.h"
#include "language/gettext.h"
#include "usbloader/wbfs.h"
@@ -1243,7 +1244,11 @@ int GameBrowseMenu::OpenClickedGame()
else
{
SetState(STATE_DISABLED);
- choice = GameWindowPrompt(gameSelected);
+ GameWindow * GamePrompt = new GameWindow(gameSelected);
+ mainWindow->Append(GamePrompt);
+ choice = GamePrompt->Show();
+ gameSelected = GamePrompt->GetSelectedGame();
+ delete GamePrompt;
SetState(STATE_DEFAULT);
//update header and id if it was changed
header = (mountMethod ? dvdheader : gameList[gameSelected]);
@@ -1267,21 +1272,9 @@ int GameBrowseMenu::OpenClickedGame()
}
else if (choice == 2)
{
- wiilight(0);
-
- header = (mountMethod ? dvdheader : gameList[gameSelected]);
- SetState(STATE_DISABLED);
- int settret = MenuGameSettings(header);
- SetState(STATE_DEFAULT);
- if (settret != MENU_DISCLIST)
- returnHere = true;
- else
- ReloadBrowser();
-
+ ReloadBrowser();
rockout(2, GetSelectedGame());
}
- else if(choice == 3)
- returnHere = true;
}
mountMethod = 0;
diff --git a/source/prompts/GameWindow.cpp b/source/prompts/GameWindow.cpp
new file mode 100644
index 00000000..9bd8ff4f
--- /dev/null
+++ b/source/prompts/GameWindow.cpp
@@ -0,0 +1,592 @@
+#include
+#include "GameWindow.hpp"
+#include "usbloader/disc.h"
+#include "usbloader/wbfs.h"
+#include "usbloader/GameList.h"
+#include "themes/CTheme.h"
+#include "settings/CSettings.h"
+#include "settings/CGameSettings.h"
+#include "settings/CGameStatistics.h"
+#include "settings/GameTitles.h"
+#include "settings/Settings.h"
+#include "prompts/PromptWindows.h"
+#include "language/gettext.h"
+#include "menu/menus.h"
+#include "bannersound.h"
+
+#define NONE 0
+#define LEFT 1
+#define RIGHT 2
+#define IN 3
+#define OUT 4
+
+extern int mountMethod;
+extern struct discHdr *dvdheader;
+
+GameWindow::GameWindow(int Selected)
+ : GuiWindow(472, 320)
+{
+ returnVal = -1;
+ gameSelected = Selected;
+ gameSound = NULL;
+ diskImgData = NULL;
+ diskImgData2 = NULL;
+ reducedVol = false;
+ SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ SetPosition(0, -10);
+
+ dialogBox = Resources::GetImageData(Settings.widescreen ? "wdialogue_box_startgame.png" : "dialogue_box_startgame.png");
+ btnOutline = Resources::GetImageData("button_dialogue_box.png");
+ 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, 0);
+ trigMinus = new GuiTrigger;
+ trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
+
+ dialogBoxImg = new GuiImage(dialogBox);
+
+ nameBtnTT = new GuiTooltip(tr( "Rename Game on WBFS" ));
+ if (Settings.wsprompt) nameBtnTT->SetWidescreen(Settings.widescreen);
+ nameTxt = new GuiText("", 22, Theme.prompttext);
+ if (Settings.wsprompt) nameTxt->SetWidescreen(Settings.widescreen);
+ nameTxt->SetMaxWidth(350, SCROLL_HORIZONTAL);
+ nameBtn = new GuiButton(120, 50);
+ nameBtn->SetLabel(nameTxt);
+ nameBtn->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ nameBtn->SetPosition(0, -122);
+ nameBtn->SetSoundOver(btnSoundOver);
+ nameBtn->SetSoundClick(btnSoundClick2);
+ if (!mountMethod) nameBtn->SetToolTip(nameBtnTT, 24, -30, ALIGN_LEFT);
+
+ if (Settings.godmode == 1 && !mountMethod)
+ {
+ nameBtn->SetTrigger(trigA);
+ nameBtn->SetEffectGrow();
+ }
+
+ sizeTxt = new GuiText((char*) NULL, 22, Theme.prompttext);
+ sizeTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
+ sizeTxt->SetPosition(-60, 70);
+
+ diskImg = new GuiDiskCover;
+ diskImg->SetWidescreen(Settings.widescreen);
+ diskImg->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
+ diskImg->SetAngle(0);
+ diskImg2 = new GuiDiskCover;
+ diskImg2->SetWidescreen(Settings.widescreen);
+ diskImg2->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ diskImg2->SetPosition(0, -20);
+ diskImg2->SetAngle(0);
+ diskImg2->SetBeta(180);
+
+ playcntTxt = new GuiText((char*) NULL, 18, Theme.info);
+ playcntTxt->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ playcntTxt->SetPosition(-115, 45);
+
+ gameBtn = new GuiButton(160, 160);
+ gameBtn->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ gameBtn->SetPosition(0, -20);
+ gameBtn->SetImage(diskImg);
+ gameBtn->SetSoundOver(btnSoundOver);
+ gameBtn->SetSoundClick(btnSoundClick2);
+ gameBtn->SetTrigger(trigA);
+ gameBtn->SetState(STATE_SELECTED);
+
+ backBtnTxt = new GuiText(tr( "Back" ), 22, Theme.prompttext);
+ backBtnImg = new GuiImage(btnOutline);
+ if (Settings.wsprompt)
+ {
+ backBtnTxt->SetWidescreen(Settings.widescreen);
+ backBtnImg->SetWidescreen(Settings.widescreen);
+ }
+ backBtn = new GuiButton(backBtnImg, backBtnImg, 1, 5, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1);
+ backBtn->SetLabel(backBtnTxt);
+ backBtn->SetTrigger(trigB);
+ if (Settings.godmode == 1 && mountMethod != 2)
+ {
+ backBtn->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
+ backBtn->SetPosition(-50, -40);
+ }
+ else
+ {
+ backBtn->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
+ backBtn->SetPosition(0, -40);
+ }
+
+ settingsBtnTxt = new GuiText(tr( "Settings" ), 22, Theme.prompttext);
+ settingsBtnImg = new GuiImage(btnOutline);
+ if (Settings.wsprompt)
+ {
+ settingsBtnTxt->SetWidescreen(Settings.widescreen);
+ settingsBtnImg->SetWidescreen(Settings.widescreen);
+ }
+ settingsBtn = new GuiButton(settingsBtnImg, settingsBtnImg, 0, 4, 50, -40, trigA, btnSoundOver, btnSoundClick2, 1);
+ settingsBtn->SetLabel(settingsBtnTxt);
+
+ int xPos = -198;
+ for(int i = 0; i < FAVORITE_STARS; ++i)
+ {
+ FavoriteBtnImg[i] = new GuiImage;
+ FavoriteBtnImg[i]->SetWidescreen(Settings.widescreen);
+ FavoriteBtn[i] = new GuiButton(imgFavorite->GetWidth(), imgFavorite->GetHeight());
+ FavoriteBtn[i]->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
+ FavoriteBtn[i]->SetPosition(xPos, -60);
+ FavoriteBtn[i]->SetImage(FavoriteBtnImg[i]);
+ FavoriteBtn[i]->SetSoundOver(btnSoundOver);
+ FavoriteBtn[i]->SetSoundClick(btnSoundClick2);
+ FavoriteBtn[i]->SetTrigger(trigA);
+ FavoriteBtn[i]->SetEffectGrow();
+
+ xPos += 27;
+ }
+
+ btnLeftImg = new GuiImage(imgLeft);
+ if (Settings.wsprompt) btnLeftImg->SetWidescreen(Settings.widescreen);
+ btnLeft = new GuiButton(btnLeftImg, btnLeftImg, 0, 5, 20, 0, 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, 1, 5, -20, 0, trigA, btnSoundOver, btnSoundClick2, 1);
+ btnRight->SetTrigger(trigR);
+ btnRight->SetTrigger(trigPlus);
+
+ Append(dialogBoxImg);
+ Append(playcntTxt);
+ Append(backBtn);
+ if (!mountMethod)//stuff we don't show if it is a DVD mounted
+ {
+ Append(nameBtn);
+ Append(sizeTxt);
+ Append(btnLeft);
+ Append(btnRight);
+ for(int i = 0; i < FAVORITE_STARS; ++i)
+ Append(FavoriteBtn[i]);
+ }
+ //check if unlocked
+ if (Settings.godmode == 1 && mountMethod != 2)
+ {
+ Append(settingsBtn);
+ }
+
+ Append(diskImg2);
+ Append(gameBtn); //! Appending the disc on top of all
+
+ ChangeGame(NONE);
+ diskImg->SetImage(diskImgData);
+
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
+}
+
+GameWindow::~GameWindow()
+{
+ StopEffect();
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
+ ResumeGui();
+
+ while(parentElement && this->GetEffect() > 0) usleep(100);
+
+ HaltGui();
+
+ if(parentElement)
+ ((GuiWindow * ) parentElement)->Remove(this);
+
+ RemoveAll();
+
+ delete trigA;
+ delete trigB;
+ delete trigL;
+ delete trigR;
+ delete trigPlus;
+ delete trigMinus;
+
+ delete diskImgData;
+ delete diskImgData2;
+ delete dialogBox;
+ delete btnOutline;
+ delete imgFavorite;
+ delete imgNotFavorite;
+ delete imgLeft;
+ delete imgRight;
+
+ delete diskImg;
+ delete diskImg2;
+
+ delete dialogBoxImg;
+ delete backBtnImg;
+ delete settingsBtnImg;
+ delete btnLeftImg;
+ delete btnRightImg;
+
+ delete nameBtnTT;
+
+ delete sizeTxt;
+ delete playcntTxt;
+ delete nameTxt;
+ delete backBtnTxt;
+ delete settingsBtnTxt;
+
+ delete nameBtn;
+ delete gameBtn;
+ delete backBtn;
+ delete settingsBtn;
+ delete btnLeft;
+ delete btnRight;
+
+ for(int i = 0; i < FAVORITE_STARS; ++i)
+ {
+ delete FavoriteBtnImg[i];
+ delete FavoriteBtn[i];
+ }
+
+ if(gameSound) gameSound->Stop();
+ delete gameSound;
+ bgMusic->SetVolume(Settings.volume);
+
+ ResumeGui();
+}
+
+void GameWindow::LoadGameSound(const u8 * id)
+{
+ if (Settings.gamesoundvolume == 0)
+ return;
+
+ if (gameSound)
+ {
+ gameSound->Stop();
+ delete gameSound;
+ gameSound = NULL;
+ }
+
+ u32 gameSoundDataLen;
+ const u8 *gameSoundData = LoadBannerSound(id, &gameSoundDataLen);
+ if (gameSoundData)
+ {
+ gameSound = new GuiSound(gameSoundData, gameSoundDataLen, Settings.gamesoundvolume, true);
+ bgMusic->SetVolume(0);
+ reducedVol = true;
+ if (Settings.gamesound == 2)
+ gameSound->SetLoop(1);
+ gameSound->Play();
+ }
+}
+
+void GameWindow::LoadDiscImage(const u8 * id)
+{
+ HaltGui();
+ delete diskImgData2;
+ diskImgData2 = diskImgData;
+ diskImgData = NULL;
+
+ char imgPath[150];
+ char IDFull[7];
+ char ID3[4];
+ char ID4[5];
+ snprintf(IDFull, sizeof(IDFull), "%s", (char*) id);
+ snprintf(ID3, sizeof(ID3), "%s", IDFull);
+ snprintf(ID4, sizeof(ID4), "%s", IDFull);
+
+ snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, IDFull); //changed to current full id
+ diskImgData = new GuiImageData(imgPath);
+
+ if (!diskImgData->GetImage())
+ {
+ delete diskImgData;
+ snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID3); //changed to current id
+ diskImgData = new GuiImageData(imgPath);
+ }
+ if (!diskImgData->GetImage())
+ {
+ delete diskImgData;
+ snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID4); //changed to current id
+ diskImgData = new GuiImageData(imgPath);
+ }
+ if (!diskImgData->GetImage())
+ {
+ delete diskImgData;
+ diskImgData = Resources::GetImageData("nodisc.png");
+ }
+}
+
+void GameWindow::SetWindowEffect(int direction, int in_out)
+{
+ if(direction == LEFT && Settings.xflip == XFLIP_DISK3D)
+ {
+ if(in_out == IN)
+ {
+ diskImg->SetImage(diskImgData);
+ diskImg->SetBeta(90);
+ diskImg->SetBetaRotateEffect(-90, 15);
+ diskImg2->SetImage(diskImgData2);
+ diskImg2->SetBeta(270);
+ diskImg2->SetBetaRotateEffect(-90, 15);
+ sizeTxt->SetEffect(EFFECT_FADE, 17);
+ nameTxt->SetEffect(EFFECT_FADE, 17);
+ }
+ else
+ {
+ diskImg->SetImage(diskImgData2);
+ diskImg->SetBeta(0);
+ diskImg->SetBetaRotateEffect(90, 15);
+ diskImg2->SetImage(diskImgData);
+ diskImg2->SetAngle(diskImg->GetAngle());
+ diskImg2->SetBeta(180);
+ diskImg2->SetBetaRotateEffect(90, 15);
+ sizeTxt->SetEffect(EFFECT_FADE, -17);
+ nameTxt->SetEffect(EFFECT_FADE, -17);
+ }
+ }
+ else if(direction == RIGHT && Settings.xflip == XFLIP_DISK3D)
+ {
+ if(in_out == IN)
+ {
+ diskImg->SetImage(diskImgData);
+ diskImg->SetBeta(270);
+ diskImg->SetBetaRotateEffect(90, 15);
+ diskImg2->SetImage(diskImgData2);
+ diskImg2->SetBeta(90);
+ diskImg2->SetBetaRotateEffect(90, 15);
+ sizeTxt->SetEffect(EFFECT_FADE, 17);
+ nameTxt->SetEffect(EFFECT_FADE, 17);
+
+ }
+ else
+ {
+ diskImg->SetImage(diskImgData2);
+ diskImg->SetBeta(0);
+ diskImg->SetBetaRotateEffect(-90, 15);
+ diskImg2->SetImage(diskImgData);
+ diskImg2->SetAngle(diskImg->GetAngle());
+ diskImg2->SetBeta(180);
+ diskImg2->SetBetaRotateEffect(-90, 15);
+ sizeTxt->SetEffect(EFFECT_FADE, -17);
+ nameTxt->SetEffect(EFFECT_FADE, -17);
+ }
+ }
+ else if(direction == LEFT)
+ {
+ if(in_out == IN)
+ SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
+ else
+ SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
+ }
+ else if(direction == RIGHT)
+ {
+ if(in_out == IN)
+ SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 50);
+ else
+ SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
+ }
+
+ ResumeGui();
+ while(parentElement && (this->GetEffect() > 0 ||
+ nameTxt->GetEffect() > 0 || diskImg->GetBetaRotateEffect()))
+ {
+ usleep(100);
+ }
+}
+
+void GameWindow::ChangeGame(int EffectDirection)
+{
+ struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
+ LoadGameSound(header->id);
+ LoadDiscImage(header->id);
+ SetWindowEffect(EffectDirection, OUT);
+
+ HaltGui();
+
+ if (!mountMethod)
+ {
+ float size = 0.0f;
+ WBFS_GameSize(header->id, &size);
+ sizeTxt->SetTextf("%.2fGB", size); //set size text;
+ }
+
+ diskImg->SetImage(diskImgData);
+ nameTxt->SetText(GameTitles.GetTitle(header));
+ playcntTxt->SetTextf("%s: %i", tr( "Play Count" ), GameStatistics.GetPlayCount(header));
+
+ int favoritevar = GameStatistics.GetFavoriteRank(header->id);
+ for(int i = 0; i < FAVORITE_STARS; ++i)
+ FavoriteBtnImg[i]->SetImage(favoritevar >= i+1 ? imgFavorite : imgNotFavorite);
+
+ EffectDirection = EffectDirection == LEFT ? RIGHT : EffectDirection == RIGHT ? LEFT : NONE;
+ SetWindowEffect(EffectDirection, IN);
+}
+
+int GameWindow::Show()
+{
+ int choice = -1;
+
+ while(choice == -1)
+ {
+ VIDEO_WaitVSync();
+
+ choice = MainLoop();
+ }
+
+ return choice;
+}
+
+int GameWindow::MainLoop()
+{
+ diskImg->SetSpin(gameBtn->GetState() == STATE_SELECTED);
+ diskImg2->SetSpin(gameBtn->GetState() == STATE_SELECTED);
+
+ if (shutdown) //for power button
+ {
+ wiilight(0);
+ Sys_Shutdown();
+ }
+ else if (reset == 1) //for reset button
+ {
+ wiilight(0);
+ Sys_Reboot();
+ }
+ else if (reducedVol)
+ {
+ if (gameSound)
+ {
+ if (Settings.gamesound == 1 && !gameSound->IsPlaying())
+ bgMusic->SetVolume(Settings.volume);
+ }
+ else
+ {
+ bgMusic->SetVolume(Settings.volume);
+ }
+
+ reducedVol = false;
+ }
+ else if (gameBtn->GetState() == STATE_CLICKED)
+ {
+ struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
+ GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
+ GameStatistics.Save();
+ returnVal = 1;
+ }
+ else if (backBtn->GetState() == STATE_CLICKED) //back
+ {
+ mainWindow->SetState(STATE_DEFAULT);
+ wiilight(0);
+ returnVal = 0;
+ }
+
+ else if(settingsBtn->GetState() == STATE_CLICKED) //settings
+ {
+ settingsBtn->ResetState();
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
+ while(parentElement && this->GetEffect() > 0) usleep(100);
+ HaltGui();
+ if(parentElement) ((GuiWindow *) parentElement)->Remove(this);
+ ResumeGui();
+
+ wiilight(0);
+ int settret = MenuGameSettings(mountMethod ? dvdheader : gameList[gameSelected]);
+
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
+ if(parentElement)
+ {
+ ((GuiWindow *) parentElement)->SetState(STATE_DISABLED);
+ ((GuiWindow *) parentElement)->Append(this);
+ }
+
+ if (settret == MENU_DISCLIST)
+ returnVal = 2;
+ else
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
+
+ }
+ else if (nameBtn->GetState() == STATE_CLICKED) //rename
+ {
+ nameBtn->ResetState();
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
+ while(parentElement && this->GetEffect() > 0) usleep(100);
+ HaltGui();
+ if(parentElement) ((GuiWindow *) parentElement)->Remove(this);
+ ResumeGui();
+ wiilight(0);
+ //re-evaluate header now in case they changed games while on the game prompt
+ struct discHdr *header = gameList[gameSelected];
+
+ //enter new game title
+ char entered[60];
+ snprintf(entered, sizeof(entered), "%s", GameTitles.GetTitle(header));
+ int result = OnScreenKeyboard(entered, 60, 0);
+ if (result == 1)
+ {
+ WBFS_RenameGame(header->id, entered);
+ wString oldFilter(gameList.GetCurrentFilter());
+ gameList.ReadGameList();
+ gameList.FilterList(oldFilter.c_str());
+ }
+ SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
+ if(parentElement)
+ {
+ ((GuiWindow *) parentElement)->SetState(STATE_DISABLED);
+ ((GuiWindow *) parentElement)->Append(this);
+ }
+ }
+
+ else if (btnRight->GetState() == STATE_CLICKED) //next game
+ {
+ if(Settings.xflip == XFLIP_YES || Settings.xflip == XFLIP_SYSMENU)
+ {
+ gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
+ ChangeGame(LEFT);
+ }
+ else
+ {
+ gameSelected = (gameSelected + 1) % gameList.size();
+ ChangeGame(RIGHT);
+ }
+
+ btnRight->ResetState();
+ }
+
+ else if (btnLeft->GetState() == STATE_CLICKED) //next game
+ {
+ if(Settings.xflip == XFLIP_YES || Settings.xflip == XFLIP_SYSMENU)
+ {
+ gameSelected = (gameSelected + 1) % gameList.size();
+ ChangeGame(RIGHT);
+ }
+ else
+ {
+ gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
+ ChangeGame(LEFT);
+ }
+
+ btnLeft->ResetState();
+ }
+
+ for(int i = 0; i < FAVORITE_STARS; ++i)
+ {
+ if(FavoriteBtn[i]->GetState() == STATE_CLICKED)
+ {
+ struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
+ int FavoriteRank = (i+1 == GameStatistics.GetFavoriteRank(header->id)) ? 0 : i+1; // Press the current rank to reset the rank
+
+ GameStatistics.SetFavoriteRank(header->id, FavoriteRank);
+ GameStatistics.Save();
+ for(int j = 0; j < FAVORITE_STARS; ++j)
+ FavoriteBtnImg[j]->SetImage(FavoriteRank >= j+1 ? imgFavorite : imgNotFavorite);
+
+ FavoriteBtn[i]->ResetState();
+ }
+ }
+
+ return returnVal;
+}
diff --git a/source/prompts/GameWindow.hpp b/source/prompts/GameWindow.hpp
new file mode 100644
index 00000000..a7051e6b
--- /dev/null
+++ b/source/prompts/GameWindow.hpp
@@ -0,0 +1,72 @@
+#ifndef GAMEWINDOW_HPP_
+#define GAMEWINDOW_HPP_
+
+#include "libwiigui/gui.h"
+#include "libwiigui/gui_diskcover.h"
+
+#define FAVORITE_STARS 5
+
+class GameWindow : public GuiWindow
+{
+ public:
+ GameWindow(int GameSelected);
+ ~GameWindow();
+ int Show();
+ int GetSelectedGame() { return gameSelected; };
+ protected:
+ int MainLoop();
+ void LoadGameSound(const u8 * id);
+ void LoadDiscImage(const u8 * id);
+ void SetWindowEffect(int direction, int in_out);
+ void ChangeGame(int EffectDirection);
+
+ bool reducedVol;
+ int returnVal;
+ int gameSelected;
+
+ GuiTrigger * trigA;
+ GuiTrigger * trigB;
+ GuiTrigger * trigL;
+ GuiTrigger * trigR;
+ GuiTrigger * trigPlus;
+ GuiTrigger * trigMinus;
+
+ GuiImageData * diskImgData;
+ GuiImageData * diskImgData2;
+ GuiImageData * dialogBox;
+ GuiImageData * btnOutline;
+ GuiImageData * imgFavorite;
+ GuiImageData * imgNotFavorite;
+ GuiImageData * imgLeft;
+ GuiImageData * imgRight;
+
+ GuiDiskCover * diskImg;
+ GuiDiskCover * diskImg2;
+
+ GuiImage * dialogBoxImg;
+ GuiImage * backBtnImg;
+ GuiImage * settingsBtnImg;
+ GuiImage * btnLeftImg;
+ GuiImage * btnRightImg;
+ GuiImage * FavoriteBtnImg[FAVORITE_STARS];
+
+ GuiTooltip * nameBtnTT;
+
+ GuiText * sizeTxt;
+ GuiText * playcntTxt;
+ GuiText * nameTxt;
+ GuiText * backBtnTxt;
+ GuiText * settingsBtnTxt;
+
+ GuiButton * nameBtn;
+ GuiButton * gameBtn;
+ GuiButton * backBtn;
+ GuiButton * settingsBtn;
+ GuiButton * btnLeft;
+ GuiButton * btnRight;
+ GuiButton * FavoriteBtn[FAVORITE_STARS];
+
+ GuiSound * gameSound;
+};
+
+#endif
diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp
index 824a81b7..40e47f95 100644
--- a/source/prompts/PromptWindows.cpp
+++ b/source/prompts/PromptWindows.cpp
@@ -282,8 +282,7 @@ void WindowCredits()
i++;
y += 26;
- GuiText::SetPresets(22, ( GXColor )
- { 255, 255, 255, 255}, 3000, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
+ GuiText::SetPresets(22, ( GXColor ) {255, 255, 255, 255}, 3000, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_TOP, ALIGN_LEFT, ALIGN_TOP);
txt[i] = new GuiText(tr( "Coding:" ));
txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
@@ -450,8 +449,7 @@ int WindowScreensaver()
GXlogoImg.SetPosition(172, 152);
GXlogoImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- GuiImage BackgroundImg(640, 480, ( GXColor )
- { 0, 0, 0, 255});
+ GuiImage BackgroundImg(640, 480, ( GXColor ) {0, 0, 0, 255});
BackgroundImg.SetPosition(0, 0);
BackgroundImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
@@ -824,11 +822,9 @@ int WindowExitPrompt()
for (i = 0; i < 4; i++)
{
-
sprintf(txt, "P%d", i + 1);
- batteryTxt[i] = new GuiText(txt, 22, ( GXColor )
- { 255, 255, 255, 255});
+ batteryTxt[i] = new GuiText(txt, 22, ( GXColor ) {255, 255, 255, 255});
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
batteryImg[i] = new GuiImage(&battery);
batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
@@ -860,14 +856,12 @@ int WindowExitPrompt()
GuiTrigger trigHome;
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
- GuiText titleTxt(tr( "HOME Menu" ), 36, ( GXColor )
- { 255, 255, 255, 255});
+ GuiText titleTxt(tr( "HOME Menu" ), 36, ( GXColor ) {255, 255, 255, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(-180, 40);
titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
- GuiText closeTxt(tr( "Close" ), 28, ( GXColor )
- { 0, 0, 0, 255});
+ GuiText closeTxt(tr( "Close" ), 28, ( GXColor ) {0, 0, 0, 255});
closeTxt.SetPosition(10, 3);
GuiImage closeImg(&close);
if (Settings.wsprompt)
@@ -888,8 +882,7 @@ int WindowExitPrompt()
GuiButton btn1(&btn1Img, &btn1OverImg, 0, 3, 0, 0, &trigA, btnSoundOver, btnSoundClick2, 0);
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
- GuiText btn2Txt(tr( "Back to Loader" ), 28, ( GXColor )
- { 0, 0, 0, 255});
+ GuiText btn2Txt(tr( "Back to Loader" ), 28, ( GXColor ) {0, 0, 0, 255});
GuiImage btn2Img(&button);
if (Settings.wsprompt)
{
@@ -902,8 +895,7 @@ int WindowExitPrompt()
btn2.SetRumble(false);
btn2.SetPosition(-150, 0);
- GuiText btn3Txt(tr( "Wii Menu" ), 28, ( GXColor )
- { 0, 0, 0, 255});
+ GuiText btn3Txt(tr( "Wii Menu" ), 28, ( GXColor ) {0, 0, 0, 255});
GuiImage btn3Img(&button);
if (Settings.wsprompt)
{
@@ -1067,663 +1059,19 @@ int WindowExitPrompt()
usleep(100);
homeout->Stop();
delete homeout;
+
+ for(int i = 0; i < 4; ++i)
+ {
+ delete batteryTxt[i];
+ delete batteryImg[i];
+ delete batteryBarImg[i];
+ delete batteryBtn[i];
+ }
+
ResumeGui();
return choice;
}
-void SetupFavoriteButton(GuiButton *btnFavorite, int xPos, GuiImage *img, GuiSound *sndOver, GuiSound *sndClick,
- GuiTrigger *trig)
-{
- btnFavorite->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- btnFavorite->SetPosition(xPos, -60);
- btnFavorite->SetImage(img);
- btnFavorite->SetSoundOver(sndOver);
- btnFavorite->SetSoundClick(sndClick);
- btnFavorite->SetTrigger(trig);
- btnFavorite->SetEffectGrow();
-}
-
-u8 SetFavorite(GuiButton *fav1, GuiButton *fav2, GuiButton *fav3, GuiButton *fav4, GuiButton *fav5, u8* gameId,
- u8 favorite)
-{
- int FavoriteRank = (favorite == GameStatistics.GetFavoriteRank(gameId)) ? 0 : favorite; // Press the current rank to reset the rank
-
- GameStatistics.SetFavoriteRank(gameId, FavoriteRank);
- GameStatistics.Save();
-
- return FavoriteRank;
-}
-
-void SetFavoriteImages(const u8 * gameid, GuiImage *b1, GuiImage *b2, GuiImage *b3, GuiImage *b4, GuiImage *b5, GuiImageData *on,
- GuiImageData *off)
-{
- int favoritevar = GameStatistics.GetFavoriteRank(gameid);
-
- b1->SetImage(favoritevar >= 1 ? on : off);
- b2->SetImage(favoritevar >= 2 ? on : off);
- b3->SetImage(favoritevar >= 3 ? on : off);
- b4->SetImage(favoritevar >= 4 ? on : off);
- b5->SetImage(favoritevar >= 5 ? on : off);
-}
-
-/****************************************************************************
- * GameWindowPrompt
- *
- * Displays a prompt window to user, with information, an error message, or
- * presenting a user with a choice
- ***************************************************************************/
-int GameWindowPrompt(int & gameSelected)
-{
- int choice = -1, angle = 0;
- f32 size = 0.0;
- char ID3[4];
- char ID4[5];
- char IDFull[7];
-
- GuiSound * gameSound = NULL;
-
- gprintf("GameWindowPrompt()\n");
- GuiWindow promptWindow(472, 320);
- promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- promptWindow.SetPosition(0, -10);
-
- GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
-
- GuiImageData imgLocked(Resources::GetFile("lock.png"), Resources::GetFileSize("lock.png"));
- GuiImageData imgNotLocked(Resources::GetFile("unlock.png"), Resources::GetFileSize("unlock.png"));
-
- GuiImageData imgFavorite(Resources::GetFile("favorite.png"), Resources::GetFileSize("favorite.png"));
- GuiImageData imgNotFavorite(Resources::GetFile("not_favorite.png"), Resources::GetFileSize("not_favorite.png"));
-
- GuiImageData imgLeft(Resources::GetFile("startgame_arrow_left.png"), Resources::GetFileSize("startgame_arrow_left.png"));
- GuiImageData imgRight(Resources::GetFile("startgame_arrow_right.png"), Resources::GetFileSize("startgame_arrow_right.png"));
-
- 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);
- GuiTrigger trigL;
- trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
- GuiTrigger trigR;
- trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
- GuiTrigger trigPlus;
- trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
- GuiTrigger trigMinus;
- trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
- GuiTrigger trigZ;
- trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
-
- GuiButton screenShotBtn(0, 0);
- screenShotBtn.SetPosition(0, 0);
- screenShotBtn.SetTrigger(&trigZ);
-
- const char * image = "dialogue_box_startgame.png";
-
- if (Settings.widescreen)
- image = "wdialogue_box_startgame.png";
-
- GuiImageData dialogBox(Resources::GetFile(image), Resources::GetFileSize(image));
- GuiImage dialogBoxImg(&dialogBox);
-
- GuiTooltip nameBtnTT(tr( "Rename Game on WBFS" ));
- if (Settings.wsprompt) nameBtnTT.SetWidescreen(Settings.widescreen);
- GuiText nameTxt("", 22, Theme.prompttext);
- if (Settings.wsprompt) nameTxt.SetWidescreen(Settings.widescreen);
- nameTxt.SetMaxWidth(350, SCROLL_HORIZONTAL);
- GuiButton nameBtn(120, 50);
- nameBtn.SetLabel(&nameTxt);
- // nameBtn.SetLabelOver(&nameTxt);
- nameBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- nameBtn.SetPosition(0, -122);
- nameBtn.SetSoundOver(btnSoundOver);
- nameBtn.SetSoundClick(btnSoundClick2);
- if (!mountMethod) nameBtn.SetToolTip(&nameBtnTT, 24, -30, ALIGN_LEFT);
-
- if (Settings.godmode == 1 && !mountMethod)
- {
- nameBtn.SetTrigger(&trigA);
- nameBtn.SetEffectGrow();
- }
-
- GuiText sizeTxt((char*) NULL, 22, Theme.prompttext); //TODO: get the size here
- sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
- sizeTxt.SetPosition(-60, 70);
-
- // GuiImage diskImg;
- GuiDiskCover diskImg;
- diskImg.SetWidescreen(Settings.widescreen);
- diskImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
- diskImg.SetAngle(angle);
- GuiDiskCover diskImg2;
- diskImg2.SetWidescreen(Settings.widescreen);
- diskImg2.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- diskImg2.SetPosition(0, -20);
- diskImg2.SetAngle(angle);
- diskImg2.SetBeta(180);
-
- GuiText playcntTxt((char*) NULL, 18, Theme.info);
- playcntTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- playcntTxt.SetPosition(-115, 45);
-
- GuiButton btn1(160, 160);
- btn1.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
- btn1.SetPosition(0, -20);
- btn1.SetImage(&diskImg);
-
- btn1.SetSoundOver(btnSoundOver);
- btn1.SetSoundClick(btnSoundClick2);
- btn1.SetTrigger(&trigA);
- btn1.SetState(STATE_SELECTED);
-
- GuiText btn2Txt(tr( "Back" ), 22, Theme.prompttext);
- GuiImage btn2Img(&btnOutline);
- if (Settings.wsprompt)
- {
- btn2Txt.SetWidescreen(Settings.widescreen);
- btn2Img.SetWidescreen(Settings.widescreen);
- }
- GuiButton btn2(&btn2Img, &btn2Img, 1, 5, 0, 0, &trigA, btnSoundOver, btnSoundClick2, 1);
- if (Settings.godmode == 1 && mountMethod != 2)
- {
- btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
- btn2.SetPosition(-50, -40);
- }
- else
- {
- btn2.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
- btn2.SetPosition(0, -40);
- }
-
- btn2.SetLabel(&btn2Txt);
- btn2.SetTrigger(&trigB);
-
- GuiText btn3Txt(tr( "Settings" ), 22, Theme.prompttext);
- GuiImage btn3Img(&btnOutline);
- if (Settings.wsprompt)
- {
- btn3Txt.SetWidescreen(Settings.widescreen);
- btn3Img.SetWidescreen(Settings.widescreen);
- }
- GuiButton btn3(&btn3Img, &btn3Img, 0, 4, 50, -40, &trigA, btnSoundOver, btnSoundClick2, 1);
- btn3.SetLabel(&btn3Txt);
-
- GuiImage btnFavoriteImg1;
- btnFavoriteImg1.SetWidescreen(Settings.widescreen);
- GuiImage btnFavoriteImg2;
- btnFavoriteImg2.SetWidescreen(Settings.widescreen);
- GuiImage btnFavoriteImg3;
- btnFavoriteImg3.SetWidescreen(Settings.widescreen);
- GuiImage btnFavoriteImg4;
- btnFavoriteImg4.SetWidescreen(Settings.widescreen);
- GuiImage btnFavoriteImg5;
- btnFavoriteImg5.SetWidescreen(Settings.widescreen);
-
- //GuiButton btnFavorite(&btnFavoriteImg,&btnFavoriteImg, 2, 5, -125, -60, &trigA, btnSoundOver, &btnClick,1);
- GuiButton btnFavorite1(imgFavorite.GetWidth(), imgFavorite.GetHeight());
- GuiButton btnFavorite2(imgFavorite.GetWidth(), imgFavorite.GetHeight());
- GuiButton btnFavorite3(imgFavorite.GetWidth(), imgFavorite.GetHeight());
- GuiButton btnFavorite4(imgFavorite.GetWidth(), imgFavorite.GetHeight());
- GuiButton btnFavorite5(imgFavorite.GetWidth(), imgFavorite.GetHeight());
-
- SetupFavoriteButton(&btnFavorite1, -198, &btnFavoriteImg1, btnSoundOver, btnSoundClick2, &trigA);
- SetupFavoriteButton(&btnFavorite2, -171, &btnFavoriteImg2, btnSoundOver, btnSoundClick2, &trigA);
- SetupFavoriteButton(&btnFavorite3, -144, &btnFavoriteImg3, btnSoundOver, btnSoundClick2, &trigA);
- SetupFavoriteButton(&btnFavorite4, -117, &btnFavoriteImg4, btnSoundOver, btnSoundClick2, &trigA);
- SetupFavoriteButton(&btnFavorite5, -90, &btnFavoriteImg5, btnSoundOver, btnSoundClick2, &trigA);
-
- GuiImage btnLeftImg(&imgLeft);
- if (Settings.wsprompt)
- {
- btnLeftImg.SetWidescreen(Settings.widescreen);
- }
- GuiButton btnLeft(&btnLeftImg, &btnLeftImg, 0, 5, 20, 0, &trigA, btnSoundOver, btnSoundClick2, 1);
- btnLeft.SetTrigger(&trigL);
- btnLeft.SetTrigger(&trigMinus);
-
- GuiImage btnRightImg(&imgRight);
- if (Settings.wsprompt)
- {
- btnRightImg.SetWidescreen(Settings.widescreen);
- }
- GuiButton btnRight(&btnRightImg, &btnRightImg, 1, 5, -20, 0, &trigA, btnSoundOver, btnSoundClick2, 1);
- btnRight.SetTrigger(&trigR);
- btnRight.SetTrigger(&trigPlus);
-
- promptWindow.Append(&dialogBoxImg);
- promptWindow.Append(&nameBtn);
- promptWindow.Append(&playcntTxt);
- promptWindow.Append(&screenShotBtn);
- promptWindow.Append(&btn2);
- if (!mountMethod)//stuff we don't show if it is a DVD mounted
- {
- promptWindow.Append(&sizeTxt);
- promptWindow.Append(&btnLeft);
- promptWindow.Append(&btnRight);
- promptWindow.Append(&btnFavorite1);
- promptWindow.Append(&btnFavorite2);
- promptWindow.Append(&btnFavorite3);
- promptWindow.Append(&btnFavorite4);
- promptWindow.Append(&btnFavorite5);
- }
-
- //check if unlocked
- if (Settings.godmode == 1 && mountMethod != 2)
- {
- promptWindow.Append(&btn3);
- }
-
- promptWindow.Append(&diskImg2);
- promptWindow.Append(&btn1);
-
- short changed = -1;
- GuiImageData * diskCover = NULL;
- GuiImageData * diskCover2 = NULL;
-
- promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
-
- while (changed)
- {
- if (changed == 1)
- {
- promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50);
- }
- else if (changed == 2)
- {
- promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 50);
- }
- else if (changed == 3 || changed == 4)
- {
- if (diskCover2) delete diskCover2;
- diskCover2 = NULL;
- if (diskCover) diskCover2 = diskCover;
- diskCover = NULL;
- }
-
- //load disc image based or what game is seleted
- struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
- if (Settings.gamesoundvolume > 0)
- {
- if (gameSound)
- {
- gameSound->Stop();
- delete gameSound;
- gameSound = NULL;
- }
- u32 gameSoundDataLen;
- const u8 *gameSoundData = LoadBannerSound(header->id, &gameSoundDataLen);
- if (gameSoundData)
- {
- gameSound = new GuiSound(gameSoundData, gameSoundDataLen, Settings.gamesoundvolume, true);
- bgMusic->SetVolume(0);
- if (Settings.gamesound == 2) gameSound->SetLoop(1);
- gameSound->Play();
- }
- }
- snprintf(IDFull, sizeof(IDFull), "%s", (char*) header->id);
- snprintf(ID3, sizeof(ID3), "%s", IDFull);
- snprintf(ID4, sizeof(ID4), "%s", IDFull);
-
- gprintf("\t%s\n", IDFull);
- if (diskCover) delete diskCover;
- char imgPath[150];
- snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, IDFull); //changed to current full id
- diskCover = new GuiImageData(imgPath);
-
- if (!diskCover->GetImage())
- {
- delete diskCover;
- snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID3); //changed to current id
- diskCover = new GuiImageData(imgPath);
-
- if (!diskCover->GetImage())
- {
- delete diskCover;
- snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.disc_path, ID4); //changed to current id
- diskCover = new GuiImageData(imgPath);
- if (!diskCover->GetImage())
- {
- delete diskCover;
- diskCover = Resources::GetImageData("nodisc.png");
- }
- }
- }
-
- if (changed == 3)
- {
- diskImg.SetImage(diskCover2);
- diskImg.SetBeta(0);
- diskImg.SetBetaRotateEffect(-90, 15);
- diskImg2.SetImage(diskCover);
- diskImg2.SetAngle(diskImg.GetAngle());
- diskImg2.SetBeta(180);
- diskImg2.SetBetaRotateEffect(-90, 15);
- sizeTxt.SetEffect(EFFECT_FADE, -17);
- nameTxt.SetEffect(EFFECT_FADE, -17);
- ResumeGui();
- while (nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect())
- usleep(100);
- HaltGui();
- diskImg.SetImage(diskCover);
- diskImg.SetBeta(90);
- diskImg.SetBetaRotateEffect(-90, 15);
- diskImg2.SetImage(diskCover2);
- diskImg2.SetBeta(270);
- diskImg2.SetBetaRotateEffect(-90, 15);
- sizeTxt.SetEffect(EFFECT_FADE, 17);
- nameTxt.SetEffect(EFFECT_FADE, 17);
- }
- else if (changed == 4)
- {
- diskImg.SetImage(diskCover2);
- diskImg.SetBeta(0);
- diskImg.SetBetaRotateEffect(90, 15);
- diskImg2.SetImage(diskCover);
- diskImg2.SetAngle(diskImg.GetAngle());
- diskImg2.SetBeta(180);
- diskImg2.SetBetaRotateEffect(90, 15);
- sizeTxt.SetEffect(EFFECT_FADE, -17);
- nameTxt.SetEffect(EFFECT_FADE, -17);
- ResumeGui();
- while (nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect())
- usleep(100);
- HaltGui();
- diskImg.SetImage(diskCover);
- diskImg.SetBeta(270);
- diskImg.SetBetaRotateEffect(90, 15);
- diskImg2.SetImage(diskCover2);
- diskImg2.SetBeta(90);
- diskImg2.SetBetaRotateEffect(90, 15);
- sizeTxt.SetEffect(EFFECT_FADE, 17);
- nameTxt.SetEffect(EFFECT_FADE, 17);
- }
- else diskImg.SetImage(diskCover);
-
- if (!mountMethod)
- {
- WBFS_GameSize(header->id, &size);
- sizeTxt.SetTextf("%.2fGB", size); //set size text;
- }
-
- nameTxt.SetText(GameTitles.GetTitle(header));
- playcntTxt.SetTextf("%s: %i", tr( "Play Count" ), GameStatistics.GetPlayCount(header));
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5,
- &imgFavorite, &imgNotFavorite);
-
- nameTxt.SetPosition(0, 1);
-
- if (changed != 3 && changed != 4) // changed==3 or changed==4 --> only Resume the GUI
- {
- HaltGui();
- mainWindow->SetState(STATE_DISABLED);
- mainWindow->Append(&promptWindow);
- mainWindow->ChangeFocus(&promptWindow);
- }
- ResumeGui();
-
- changed = 0;
- while (choice == -1)
- {
- VIDEO_WaitVSync();
-
- diskImg.SetSpin(btn1.GetState() == STATE_SELECTED);
- diskImg2.SetSpin(btn1.GetState() == STATE_SELECTED);
- if (shutdown == 1) //for power button
- {
- promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
- mainWindow->SetState(STATE_DEFAULT);
- while (promptWindow.GetEffect() > 0)
- usleep(100);
- HaltGui();
- mainWindow->Remove(&promptWindow);
- ResumeGui();
- wiilight(0);
- Sys_Shutdown();
- }
-
- if (reset == 1) //for reset button
- Sys_Reboot();
-
- if (gameSound)
- {
- if (!gameSound->IsPlaying())
- {
- if (Settings.gamesound == 1) bgMusic->SetVolume(Settings.volume);
- }
- }
-
- if (btn1.GetState() == STATE_CLICKED)
- {
- GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
- GameStatistics.Save();
-
- choice = 1;
- }
-
- else if (btn2.GetState() == STATE_CLICKED) //back
- {
- choice = 0;
- promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
- mainWindow->SetState(STATE_DEFAULT);
- wiilight(0);
- }
-
- else if (btn3.GetState() == STATE_CLICKED) //settings
- {
- choice = 2;
- promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
- }
-
- else if (nameBtn.GetState() == STATE_CLICKED) //rename
- {
- nameBtn.ResetState();
-
- choice = 3;
- promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
- while(promptWindow.GetEffect() > 0) usleep(100);
-
- wiilight(0);
- //re-evaluate header now in case they changed games while on the game prompt
- struct discHdr *header = gameList[gameSelected];
-
- //enter new game title
- char entered[60];
- snprintf(entered, sizeof(entered), "%s", GameTitles.GetTitle(header));
- int result = OnScreenKeyboard(entered, 60, 0);
- if (result == 1)
- {
- WBFS_RenameGame(header->id, entered);
- wString oldFilter(gameList.GetCurrentFilter());
- gameList.ReadGameList();
- gameList.FilterList(oldFilter.c_str());
- }
- }
- else if (btnFavorite1.GetState() == STATE_CLICKED) //switch favorite
- {
- if (isInserted(Settings.BootDevice))
- {
- SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id,
- 1);
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4,
- &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
- }
- btnFavorite1.ResetState();
- }
- else if (btnFavorite2.GetState() == STATE_CLICKED) //switch favorite
- {
- if (isInserted(Settings.BootDevice))
- {
- SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id,
- 2);
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4,
- &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
- }
- btnFavorite2.ResetState();
- }
- else if (btnFavorite3.GetState() == STATE_CLICKED) //switch favorite
- {
- if (isInserted(Settings.BootDevice))
- {
- SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id,
- 3);
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4,
- &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
- }
- btnFavorite3.ResetState();
- }
- else if (btnFavorite4.GetState() == STATE_CLICKED) //switch favorite
- {
- if (isInserted(Settings.BootDevice))
- {
- SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id,
- 4);
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4,
- &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
- }
- btnFavorite4.ResetState();
- }
- else if (btnFavorite5.GetState() == STATE_CLICKED) //switch favorite
- {
- if (isInserted(Settings.BootDevice))
- {
- SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id,
- 5);
- SetFavoriteImages(header->id, &btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4,
- &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
- }
- btnFavorite5.ResetState();
- }
- else if (screenShotBtn.GetState() == STATE_CLICKED)
- {
- screenShotBtn.ResetState();
- ScreenShot();
- }
- // this next part is long because nobody could agree on what the left/right buttons should do
- else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_NO)) //next game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
- changed = 1;
- btnSoundClick2->Play();
- gameSelected = (gameSelected + 1) % gameList.size();
- btnRight.ResetState();
- break;
- }
-
- else if ((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_NO)) //previous game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
- changed = 2;
- btnSoundClick2->Play();
- gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
- btnLeft.ResetState();
- break;
- }
-
- else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_YES)) //previous game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
- changed = 2;
- btnSoundClick2->Play();
- gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
- btnRight.ResetState();
- break;
- }
-
- else if ((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_YES)) //next game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
- changed = 1;
- btnSoundClick2->Play();
- gameSelected = (gameSelected + 1) % gameList.size();
- btnLeft.ResetState();
- break;
- }
-
- else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_SYSMENU)) //previous game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
- changed = 2;
- btnSoundClick2->Play();
- gameSelected = (gameSelected + 1) % gameList.size();
- btnRight.ResetState();
- break;
- }
-
- else if ((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_SYSMENU)) //next game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
- changed = 1;
- btnSoundClick2->Play();
- gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
- btnLeft.ResetState();
- break;
- }
-
- else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_WTF)) //previous game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
- changed = 1;
- btnSoundClick2->Play();
- gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
- btnRight.ResetState();
- break;
- }
-
- else if ((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_WTF)) //next game
- {
- promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
- changed = 2;
- btnSoundClick2->Play();
- gameSelected = (gameSelected + 1) % gameList.size();
- btnLeft.ResetState();
- break;
- }
-
- else if ((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_DISK3D)) //next game
- {
- // diskImg.SetBetaRotateEffect(45, 90);
- changed = 3;
- btnSoundClick2->Play();
- gameSelected = (gameSelected + 1) % gameList.size();
- btnRight.ResetState();
- break;
- }
-
- else if ((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == XFLIP_DISK3D)) //previous game
- {
- // diskImg.SetBetaRotateEffect(-45, 90);
- // promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 1/*50*/);
- changed = 4;
- btnSoundClick2->Play();
- gameSelected = (gameSelected - 1 + gameList.size()) % gameList.size();
- btnLeft.ResetState();
- break;
- }
- }
-
- while (promptWindow.GetEffect() > 0)
- usleep(100);
- HaltGui();
- if (changed != 3 && changed != 4) // changed==3 or changed==4 --> only Halt the GUI
- {
- mainWindow->Remove(&promptWindow);
- ResumeGui();
- }
- }
- delete diskCover;
- delete diskCover2;
-
- if (gameSound)
- {
- gameSound->Stop();
- delete gameSound;
- gameSound = NULL;
- }
- bgMusic->SetVolume(Settings.volume);
-
- gprintf("\tret: %i\n", choice);
- return choice;
-}
-
/****************************************************************************
* DiscWait
***************************************************************************/
diff --git a/source/prompts/PromptWindows.h b/source/prompts/PromptWindows.h
index 4e8984bb..32d93aa6 100644
--- a/source/prompts/PromptWindows.h
+++ b/source/prompts/PromptWindows.h
@@ -18,7 +18,6 @@ void WindowCredits();
int OnScreenKeyboard(char * var, u32 maxlen, int min);
int OnScreenNumpad(char * var, u32 maxlen);
int WindowExitPrompt();
-int GameWindowPrompt(int & gameSelected);
int DiscWait(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, int IsDeviceWait);
int FormatingPartition(const char *title, partitionEntry *entry);
bool NetworkInitPrompt();