usbloadergx/source/menu/menu_disclist.cpp

1710 lines
65 KiB
C++
Raw Normal View History

#include "menus.h"
#include "fatmounter.h"
#include "usbloader/wdvd.h"
#include "usbloader/GameList.h"
#include "usbloader/wbfs.h"
#include "patches/fst.h"
#include "network/networkops.h"
#include "prompts/gameinfo.h"
#include "prompts/DiscBrowser.h"
#include "prompts/TitleBrowser.h"
#include "settings/Settings.h"
#include "settings/CGameSettings.h"
#include "settings/CGameStatistics.h"
#include "themes/CTheme.h"
#include "wpad.h"
#include "sys.h"
#include "libwiigui/gui_gamebrowser.h"
#include "libwiigui/gui_gamegrid.h"
#include "libwiigui/gui_gamecarousel.h"
#include "libwiigui/gui_searchbar.h"
#define MAX_CHARACTERS 38
extern u8 * gameScreenTex;
extern struct discHdr *dvdheader;
extern u8 mountMethod;
extern int load_from_fs;
extern s32 gameSelected;
extern GuiText * GameIDTxt;
extern GuiText * GameRegionTxt;
extern const u8 data1;
extern FreeTypeGX *fontClock;
extern bool updateavailable;
extern int cntMissFiles;
extern GuiImageData * cover;
extern GuiImage * coverImg;
extern GuiImageData * pointer[4];
extern bool altdoldefault;
extern GuiImage * bgImg;
GuiButton *Toolbar[9];
int idiotFlag = -1;
char idiotChar[50];
2010-09-24 02:48:03 +02:00
void DiscListWinUpdateCallback(void * e);
void rockout(int f = 0);
static u32 startat = 0;
/****************************************************************************
* MenuDiscList
***************************************************************************/
int MenuDiscList()
{
2010-09-24 02:48:03 +02:00
gprintf("MenuDiscList()\n");
gameList.FilterList();
int offset = MIN( ( int )startat, gameList.size() - 1 );
startat = offset;
int datagB = 0;
int dataed = -1;
int selectImg1 = 0;
char ID[4];
char IDfull[7];
u32 covert = 0;
2010-09-24 02:48:03 +02:00
if (!dvdheader) dvdheader = new struct discHdr;
u8 mountMethodOLD = 0;
2010-09-24 02:48:03 +02:00
WDVD_GetCoverStatus(&covert);
u32 covertOld = covert;
f32 freespace, used, size = 0.0;
wchar_t searchChar;
//SCREENSAVER
int check = 0; //to skip the first cycle when wiimote isn't completely connected
datagB = 0;
int menu = MENU_NONE;
u32 nolist;
char text[MAX_CHARACTERS + 4];
int choice = 0, selectedold = 100;
s32 ret;
//CLOCK
struct tm * timeinfo;
char theTime[80] = "";
time_t lastrawtime = 0;
2010-09-24 02:48:03 +02:00
if (mountMethod != 3 && WBFS_ShowFreeSpace())
{
2010-09-24 02:48:03 +02:00
WBFS_DiskSpace(&used, &freespace);
}
2010-09-24 02:48:03 +02:00
if (!gameList.size()) //if there is no list of games to display
{
nolist = 1;
}
2010-09-24 02:48:03 +02:00
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
2010-09-24 02:48:03 +02:00
if (!btnClick2) btnClick2 = new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
GuiImageData btnInstall(Resources::GetFile("button_install.png"), Resources::GetFileSize("button_install.png"));
GuiImageData btnInstallOver(Resources::GetFile("button_install_over.png"), Resources::GetFileSize("button_install_over.png"));
GuiImageData btnSettings(Resources::GetFile("settings_button.png"), Resources::GetFileSize("settings_button.png"));
GuiImageData btnSettingsOver(Resources::GetFile("settings_button_over.png"), Resources::GetFileSize("settings_button_over.png"));
GuiImageData btnpwroff(Resources::GetFile("wiimote_poweroff.png"), Resources::GetFileSize("wiimote_poweroff.png"));
GuiImageData btnpwroffOver(Resources::GetFile("wiimote_poweroff_over.png"), Resources::GetFileSize("wiimote_poweroff_over.png"));
GuiImageData btnhome(Resources::GetFile("menu_button.png"), Resources::GetFileSize("menu_button.png"));
GuiImageData btnhomeOver(Resources::GetFile("menu_button_over.png"), Resources::GetFileSize("menu_button_over.png"));
GuiImageData btnsdcardOver(Resources::GetFile("sdcard_over.png"), Resources::GetFileSize("sdcard_over.png"));
GuiImageData btnsdcard(Resources::GetFile("sdcard.png"), Resources::GetFileSize("sdcard.png"));
GuiImageData imgfavIcon(Resources::GetFile("favIcon.png"), Resources::GetFileSize("favIcon.png"));
GuiImageData imgfavIcon_gray(Resources::GetFile("favIcon_gray.png"), Resources::GetFileSize("favIcon_gray.png"));
GuiImageData imgsearchIcon(Resources::GetFile("searchIcon.png"), Resources::GetFileSize("searchIcon.png"));
GuiImageData imgsearchIcon_gray(Resources::GetFile("searchIcon_gray.png"), Resources::GetFileSize("searchIcon_gray.png"));
GuiImageData imgabcIcon(Resources::GetFile("abcIcon.png"), Resources::GetFileSize("abcIcon.png"));
GuiImageData imgabcIcon_gray(Resources::GetFile("abcIcon_gray.png"), Resources::GetFileSize("abcIcon_gray.png"));
GuiImageData imgrankIcon(Resources::GetFile("rankIcon.png"), Resources::GetFileSize("rankIcon.png"));
GuiImageData imgrankIcon_gray(Resources::GetFile("rankIcon_gray.png"), Resources::GetFileSize("rankIcon_gray.png"));
GuiImageData imgplayCountIcon(Resources::GetFile("playCountIcon.png"), Resources::GetFileSize("playCountIcon.png"));
GuiImageData imgplayCountIcon_gray(Resources::GetFile("playCountIcon_gray.png"), Resources::GetFileSize("playCountIcon_gray.png"));
GuiImageData imgarrangeGrid(Resources::GetFile("arrangeGrid.png"), Resources::GetFileSize("arrangeGrid.png"));
GuiImageData imgarrangeGrid_gray(Resources::GetFile("arrangeGrid_gray.png"), Resources::GetFileSize("arrangeGrid_gray.png"));
GuiImageData imgarrangeList(Resources::GetFile("arrangeList.png"), Resources::GetFileSize("arrangeList.png"));
GuiImageData imgarrangeList_gray(Resources::GetFile("arrangeList_gray.png"), Resources::GetFileSize("arrangeList_gray.png"));
GuiImageData imgarrangeCarousel(Resources::GetFile("arrangeCarousel.png"), Resources::GetFileSize("arrangeCarousel.png"));
GuiImageData imgarrangeCarousel_gray(Resources::GetFile("arrangeCarousel_gray.png"), Resources::GetFileSize("arrangeCarousel_gray.png"));
GuiImageData imgLock(Resources::GetFile("lock.png"), Resources::GetFileSize("lock.png"));
GuiImageData imgLock_gray(Resources::GetFile("lock_gray.png"), Resources::GetFileSize("lock_gray.png"));
GuiImageData imgUnlock(Resources::GetFile("lock_gray.png"), Resources::GetFileSize("lock_gray.png"));
GuiImageData imgUnlock_gray(Resources::GetFile("unlock_gray.png"), Resources::GetFileSize("unlock_gray.png"));
GuiImageData imgdvd(Resources::GetFile("dvd.png"), Resources::GetFileSize("dvd.png"));
GuiImageData imgdvd_gray(Resources::GetFile("dvd_gray.png"), Resources::GetFileSize("dvd_gray.png"));
GuiImageData homebrewImgData(Resources::GetFile("browser.png"), Resources::GetFileSize("browser.png"));
GuiImageData homebrewImgDataOver(Resources::GetFile("browser_over.png"), Resources::GetFileSize("browser_over.png"));
GuiTrigger trigA;
2010-09-24 02:48:03 +02:00
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigHome;
2010-09-24 02:48:03 +02:00
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START);
GuiTrigger trig2;
2010-09-24 02:48:03 +02:00
trig2.SetButtonOnlyTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_X, 0);
GuiTrigger trig1;
2010-09-24 02:48:03 +02:00
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_Y, 0);
GuiTrigger trigZ;
2010-09-24 02:48:03 +02:00
trigZ.SetButtonOnlyTrigger(-1, WPAD_NUNCHUK_BUTTON_Z | WPAD_CLASSIC_BUTTON_ZL, PAD_TRIGGER_Z);
2010-09-24 02:48:03 +02:00
GuiButton screenShotBtn(0, 0);
screenShotBtn.SetPosition(0, 0);
screenShotBtn.SetTrigger(&trigZ);
char spaceinfo[30];
2010-09-24 02:48:03 +02:00
if (load_from_fs == PART_FS_FAT)
{
2010-09-24 02:48:03 +02:00
memset(spaceinfo, 0, 30);
}
else
{
2010-09-24 02:48:03 +02:00
if (!strcmp(Settings.db_language, "JA"))
{
// needs to be "total...used" for Japanese
2010-09-24 02:48:03 +02:00
sprintf(spaceinfo, (mountMethod != 3 ? "%.2fGB %s %.2fGB %s" : " "), (freespace + used), tr( "of" ),
freespace, tr( "free" ));
}
else
{
2010-09-24 02:48:03 +02:00
sprintf(spaceinfo, (mountMethod != 3 ? "%.2fGB %s %.2fGB %s" : " "), freespace, tr( "of" ), (freespace
+ used), tr( "free" ));
}
}
GuiText usedSpaceTxt(spaceinfo, 18, Theme.info);
usedSpaceTxt.SetAlignment(Theme.hddinfo_align, ALIGN_TOP);
usedSpaceTxt.SetPosition(Theme.hddinfo_x, Theme.hddinfo_y);
char GamesCnt[15];
2010-09-24 02:48:03 +02:00
sprintf(GamesCnt, "%s: %i", (mountMethod != 3 ? tr( "Games" ) : tr( "Channels" )), gameList.size());
GuiText gamecntTxt(GamesCnt, 18, Theme.info);
2010-09-24 02:48:03 +02:00
GuiButton gamecntBtn(100, 18);
gamecntBtn.SetAlignment(Theme.gamecount_align, ALIGN_TOP);
gamecntBtn.SetPosition(Theme.gamecount_x, Theme.gamecount_y);
2010-09-24 02:48:03 +02:00
gamecntBtn.SetLabel(&gamecntTxt);
gamecntBtn.SetEffectGrow();
2010-09-24 02:48:03 +02:00
gamecntBtn.SetTrigger(&trigA);
GuiTooltip installBtnTT(tr( "Install a game" ));
if (Settings.wsprompt == yes) installBtnTT.SetWidescreen(Settings.widescreen);
installBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage installBtnImg(&btnInstall);
GuiImage installBtnImgOver(&btnInstallOver);
installBtnImg.SetWidescreen(Settings.widescreen);
installBtnImgOver.SetWidescreen(Settings.widescreen);
GuiButton installBtn(&installBtnImg, &installBtnImgOver, ALIGN_LEFT, ALIGN_TOP, Theme.install_x, Theme.install_y,
2010-09-24 02:48:03 +02:00
&trigA, &btnSoundOver, btnClick2, 1, &installBtnTT, 24, -30, 0, 5);
GuiTooltip settingsBtnTT(tr( "Settings" ));
if (Settings.wsprompt == yes) settingsBtnTT.SetWidescreen(Settings.widescreen);
settingsBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage settingsBtnImg(&btnSettings);
settingsBtnImg.SetWidescreen(Settings.widescreen);
GuiImage settingsBtnImgOver(&btnSettingsOver);
settingsBtnImgOver.SetWidescreen(Settings.widescreen);
GuiButton settingsBtn(&settingsBtnImg, &settingsBtnImgOver, 0, 3, Theme.setting_x, Theme.setting_y, &trigA,
2010-09-24 02:48:03 +02:00
&btnSoundOver, btnClick2, 1, &settingsBtnTT, 65, -30, 0, 5);
GuiTooltip homeBtnTT(tr( "Back to HBC or Wii Menu" ));
if (Settings.wsprompt == yes) homeBtnTT.SetWidescreen(Settings.widescreen);
settingsBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage homeBtnImg(&btnhome);
homeBtnImg.SetWidescreen(Settings.widescreen);
GuiImage homeBtnImgOver(&btnhomeOver);
homeBtnImgOver.SetWidescreen(Settings.widescreen);
GuiButton homeBtn(&homeBtnImg, &homeBtnImgOver, 0, 3, Theme.home_x, Theme.home_y, &trigA, &btnSoundOver, btnClick2,
2010-09-24 02:48:03 +02:00
1, &homeBtnTT, 15, -30, 1, 5);
homeBtn.RemoveSoundClick();
2010-09-24 02:48:03 +02:00
homeBtn.SetTrigger(&trigHome);
GuiTooltip poweroffBtnTT(tr( "Power off the Wii" ));
if (Settings.wsprompt == yes) poweroffBtnTT.SetWidescreen(Settings.widescreen);
poweroffBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage poweroffBtnImg(&btnpwroff);
GuiImage poweroffBtnImgOver(&btnpwroffOver);
poweroffBtnImg.SetWidescreen(Settings.widescreen);
poweroffBtnImgOver.SetWidescreen(Settings.widescreen);
GuiButton poweroffBtn(&poweroffBtnImg, &poweroffBtnImgOver, 0, 3, Theme.power_x, Theme.power_y, &trigA,
2010-09-24 02:48:03 +02:00
&btnSoundOver, btnClick2, 1, &poweroffBtnTT, -10, -30, 1, 5);
GuiTooltip sdcardBtnTT(tr( "Reload SD" ));
if (Settings.wsprompt == yes) sdcardBtnTT.SetWidescreen(Settings.widescreen);
sdcardBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage sdcardImg(&btnsdcard);
GuiImage sdcardImgOver(&btnsdcardOver);
sdcardImg.SetWidescreen(Settings.widescreen);
sdcardImgOver.SetWidescreen(Settings.widescreen);
GuiButton sdcardBtn(&sdcardImg, &sdcardImgOver, 0, 3, Theme.sdcard_x, Theme.sdcard_y, &trigA, &btnSoundOver,
2010-09-24 02:48:03 +02:00
btnClick2, 1, &sdcardBtnTT, 15, -30, 0, 5);
GuiButton gameInfo(0, 0);
gameInfo.SetTrigger(&trig2);
gameInfo.SetSoundClick(btnClick2);
GuiTooltip favoriteBtnTT(tr( "Display favorites" ));
if (Settings.wsprompt == yes) favoriteBtnTT.SetWidescreen(Settings.widescreen);
favoriteBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage favoriteBtnImg(&imgfavIcon);
favoriteBtnImg.SetWidescreen(Settings.widescreen);
GuiImage favoriteBtnImg_g(&imgfavIcon_gray);
favoriteBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton favoriteBtn(&favoriteBtnImg_g, &favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_favorite_x,
Theme.gamelist_favorite_y, &trigA, &btnSoundOver, btnClick2, 1, &favoriteBtnTT, -15, 52, 0, 3);
2010-09-24 02:48:03 +02:00
favoriteBtn.SetAlpha(180);
GuiTooltip searchBtnTT(tr( "Set Search-Filter" ));
if (Settings.wsprompt == yes) searchBtnTT.SetWidescreen(Settings.widescreen);
searchBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage searchBtnImg(&imgsearchIcon);
searchBtnImg.SetWidescreen(Settings.widescreen);
GuiImage searchBtnImg_g(&imgsearchIcon_gray);
searchBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton searchBtn(&searchBtnImg_g, &searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_search_x,
Theme.gamelist_search_y, &trigA, &btnSoundOver, btnClick2, 1, &searchBtnTT, -15, 52, 0, 3);
2010-09-24 02:48:03 +02:00
searchBtn.SetAlpha(180);
GuiTooltip abcBtnTT(Settings.fave ? tr( "Sort by rank" ) : tr( "Sort alphabetically" ));
if (Settings.wsprompt == yes) abcBtnTT.SetWidescreen(Settings.widescreen);
abcBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage abcBtnImg(Settings.fave ? &imgrankIcon : &imgabcIcon);
abcBtnImg.SetWidescreen(Settings.widescreen);
GuiImage abcBtnImg_g(Settings.fave ? &imgrankIcon_gray : &imgabcIcon_gray);
abcBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton abcBtn(&abcBtnImg_g, &abcBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_abc_x, Theme.gamelist_abc_y,
2010-09-24 02:48:03 +02:00
&trigA, &btnSoundOver, btnClick2, 1, &abcBtnTT, -15, 52, 0, 3);
abcBtn.SetAlpha(180);
GuiTooltip countBtnTT(tr( "Sort order by most played" ));
if (Settings.wsprompt == yes) countBtnTT.SetWidescreen(Settings.widescreen);
countBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage countBtnImg(&imgplayCountIcon);
countBtnImg.SetWidescreen(Settings.widescreen);
GuiImage countBtnImg_g(&imgplayCountIcon_gray);
countBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton countBtn(&countBtnImg_g, &countBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_count_x,
Theme.gamelist_count_y, &trigA, &btnSoundOver, btnClick2, 1, &countBtnTT, -15, 52, 0, 3);
2010-09-24 02:48:03 +02:00
countBtn.SetAlpha(180);
GuiTooltip listBtnTT(tr( "Display as a list" ));
if (Settings.wsprompt == yes) listBtnTT.SetWidescreen(Settings.widescreen);
listBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage listBtnImg(&imgarrangeList);
listBtnImg.SetWidescreen(Settings.widescreen);
GuiImage listBtnImg_g(&imgarrangeList_gray);
listBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton listBtn(&listBtnImg_g, &listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_list_x,
Theme.gamelist_list_y, &trigA, &btnSoundOver, btnClick2, 1, &listBtnTT, 15, 52, 1, 3);
2010-09-24 02:48:03 +02:00
listBtn.SetAlpha(180);
GuiTooltip gridBtnTT(tr( "Display as a grid" ));
if (Settings.wsprompt == yes) gridBtnTT.SetWidescreen(Settings.widescreen);
gridBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage gridBtnImg(&imgarrangeGrid);
gridBtnImg.SetWidescreen(Settings.widescreen);
GuiImage gridBtnImg_g(&imgarrangeGrid_gray);
gridBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton gridBtn(&gridBtnImg_g, &gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_grid_x,
Theme.gamelist_grid_y, &trigA, &btnSoundOver, btnClick2, 1, &gridBtnTT, 15, 52, 1, 3);
2010-09-24 02:48:03 +02:00
gridBtn.SetAlpha(180);
GuiTooltip carouselBtnTT(tr( "Display as a carousel" ));
if (Settings.wsprompt == yes) carouselBtnTT.SetWidescreen(Settings.widescreen);
carouselBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage carouselBtnImg(&imgarrangeCarousel);
carouselBtnImg.SetWidescreen(Settings.widescreen);
GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
carouselBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton carouselBtn(&carouselBtnImg_g, &carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_carousel_x,
Theme.gamelist_carousel_y, &trigA, &btnSoundOver, btnClick2, 1, &carouselBtnTT, 15, 52, 1, 3);
2010-09-24 02:48:03 +02:00
carouselBtn.SetAlpha(180);
bool canUnlock = (Settings.parentalcontrol == 0 && Settings.Parental.enabled == 1);
GuiTooltip lockBtnTT(canUnlock ? tr( "Unlock Parental Control" ) : tr( "Parental Control disabled" ));
if (Settings.wsprompt == yes) lockBtnTT.SetWidescreen(Settings.widescreen);
lockBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage lockBtnImg(&imgLock);
lockBtnImg.SetWidescreen(Settings.widescreen);
GuiImage lockBtnImg_g(&imgLock_gray);
lockBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton lockBtn(&lockBtnImg_g, &lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x,
Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2, 1, &lockBtnTT, 15, 52, 1, 3);
2010-09-24 02:48:03 +02:00
lockBtn.SetAlpha(180);
GuiTooltip unlockBtnTT(tr( "Enable Parental Control" ));
if (Settings.wsprompt == yes) unlockBtnTT.SetWidescreen(Settings.widescreen);
unlockBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage unlockBtnImg(&imgUnlock);
unlockBtnImg.SetWidescreen(Settings.widescreen);
GuiImage unlockBtnImg_g(&imgUnlock_gray);
unlockBtnImg_g.SetWidescreen(Settings.widescreen);
if (canUnlock && Settings.godmode)
{
lockBtn.SetImage(&unlockBtnImg_g);
lockBtn.SetImageOver(&unlockBtnImg_g);
lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
}
/*
GuiButton unlockBtn(&unlockBtnImg_g, &unlockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_lock_x, Theme.gamelist_lock_y, &trigA, &btnSoundOver, btnClick2,1, &lockBtnTT, 15, 52, 1, 3);
2010-09-24 02:48:03 +02:00
unlockBtn.SetAlpha(180);
*/
GuiTooltip dvdBtnTT(tr( "Mount DVD drive" ));
if (Settings.wsprompt == yes) dvdBtnTT.SetWidescreen(Settings.widescreen);
dvdBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage dvdBtnImg(&imgdvd);
dvdBtnImg.SetWidescreen(Settings.widescreen);
GuiImage dvdBtnImg_g(dvdBtnImg);
dvdBtnImg_g.SetWidescreen(Settings.widescreen);
GuiButton dvdBtn(&dvdBtnImg_g, &dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, Theme.gamelist_dvd_x, Theme.gamelist_dvd_y,
2010-09-24 02:48:03 +02:00
&trigA, &btnSoundOver, btnClick2, 1, &dvdBtnTT, 15, 52, 1, 3);
dvdBtn.SetAlpha(180);
GuiTooltip homebrewBtnTT(tr( "Homebrew Launcher" ));
if (Settings.wsprompt == yes) homebrewBtnTT.SetWidescreen(Settings.widescreen);
homebrewBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiImage homebrewImg(&homebrewImgData);
GuiImage homebrewImgOver(&homebrewImgDataOver);
homebrewImg.SetWidescreen(Settings.widescreen);
homebrewImgOver.SetWidescreen(Settings.widescreen);
GuiButton homebrewBtn(&homebrewImg, &homebrewImgOver, ALIGN_LEFT, ALIGN_TOP, Theme.homebrew_x, Theme.homebrew_y,
2010-09-24 02:48:03 +02:00
&trigA, &btnSoundOver, btnClick2, 1, &homebrewBtnTT, 15, -30, 1, 5);
if (Settings.fave)
{
2010-09-24 02:48:03 +02:00
favoriteBtn.SetImage(&favoriteBtnImg);
favoriteBtn.SetImageOver(&favoriteBtnImg);
favoriteBtn.SetAlpha(255);
}
static bool show_searchwindow = false;
2010-09-24 02:48:03 +02:00
if (*gameList.GetCurrentFilter())
{
2010-09-24 02:48:03 +02:00
if (show_searchwindow && gameList.size() == 1) show_searchwindow = false;
if (!show_searchwindow) searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
searchBtn.SetImage(&searchBtnImg);
searchBtn.SetImageOver(&searchBtnImg);
searchBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
if (Settings.sort == ALL)
{
2010-09-24 02:48:03 +02:00
abcBtn.SetImage(&abcBtnImg);
abcBtn.SetImageOver(&abcBtnImg);
abcBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
else if (Settings.sort == PLAYCOUNT)
{
2010-09-24 02:48:03 +02:00
countBtn.SetImage(&countBtnImg);
countBtn.SetImageOver(&countBtnImg);
countBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
listBtn.SetImage(&listBtnImg);
listBtn.SetImageOver(&listBtnImg);
listBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gridBtn.SetImage(&gridBtnImg);
gridBtn.SetImageOver(&gridBtnImg);
gridBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
carouselBtn.SetImage(&carouselBtnImg);
carouselBtn.SetImageOver(&carouselBtnImg);
carouselBtn.SetAlpha(255);
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
favoriteBtn.SetPosition(Theme.gamelist_favorite_x, Theme.gamelist_favorite_y);
searchBtn.SetPosition(Theme.gamelist_search_x, Theme.gamelist_search_y);
abcBtn.SetPosition(Theme.gamelist_abc_x, Theme.gamelist_abc_y);
countBtn.SetPosition(Theme.gamelist_count_x, Theme.gamelist_count_y);
listBtn.SetPosition(Theme.gamelist_list_x, Theme.gamelist_list_y);
gridBtn.SetPosition(Theme.gamelist_grid_x, Theme.gamelist_grid_y);
carouselBtn.SetPosition(Theme.gamelist_carousel_x, Theme.gamelist_carousel_y);
lockBtn.SetPosition(Theme.gamelist_lock_x, Theme.gamelist_lock_y);
dvdBtn.SetPosition(Theme.gamelist_dvd_x, Theme.gamelist_dvd_y);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
favoriteBtn.SetPosition(Theme.gamegrid_favorite_x, Theme.gamegrid_favorite_y);
searchBtn.SetPosition(Theme.gamegrid_search_x, Theme.gamegrid_search_y);
abcBtn.SetPosition(Theme.gamegrid_abc_x, Theme.gamegrid_abc_y);
countBtn.SetPosition(Theme.gamegrid_count_x, Theme.gamegrid_count_y);
listBtn.SetPosition(Theme.gamegrid_list_x, Theme.gamegrid_list_y);
gridBtn.SetPosition(Theme.gamegrid_grid_x, Theme.gamegrid_grid_y);
carouselBtn.SetPosition(Theme.gamegrid_carousel_x, Theme.gamegrid_carousel_y);
lockBtn.SetPosition(Theme.gamegrid_lock_x, Theme.gamegrid_lock_y);
dvdBtn.SetPosition(Theme.gamegrid_dvd_x, Theme.gamegrid_dvd_y);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
favoriteBtn.SetPosition(Theme.gamecarousel_favorite_x, Theme.gamecarousel_favorite_y);
searchBtn.SetPosition(Theme.gamecarousel_search_x, Theme.gamecarousel_favorite_y);
abcBtn.SetPosition(Theme.gamecarousel_abc_x, Theme.gamecarousel_abc_y);
countBtn.SetPosition(Theme.gamecarousel_count_x, Theme.gamecarousel_count_y);
listBtn.SetPosition(Theme.gamecarousel_list_x, Theme.gamecarousel_list_y);
gridBtn.SetPosition(Theme.gamecarousel_grid_x, Theme.gamecarousel_grid_y);
carouselBtn.SetPosition(Theme.gamecarousel_carousel_x, Theme.gamecarousel_carousel_y);
lockBtn.SetPosition(Theme.gamecarousel_lock_x, Theme.gamecarousel_lock_y);
dvdBtn.SetPosition(Theme.gamecarousel_dvd_x, Theme.gamecarousel_dvd_y);
}
//Downloading Covers
2010-09-24 02:48:03 +02:00
GuiTooltip DownloadBtnTT(tr( "Click to Download Covers" ));
if (Settings.wsprompt == yes) DownloadBtnTT.SetWidescreen(Settings.widescreen);
DownloadBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiButton DownloadBtn(0, 0);
DownloadBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
DownloadBtn.SetPosition(Theme.covers_x, Theme.covers_y);
2010-09-24 02:48:03 +02:00
GuiTooltip IDBtnTT(tr( "Click to change game ID" ));
if (Settings.wsprompt == yes) IDBtnTT.SetWidescreen(Settings.widescreen);
IDBtnTT.SetAlpha(Theme.tooltipAlpha);
2010-09-24 02:48:03 +02:00
GuiButton idBtn(0, 0);
idBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
idBtn.SetPosition(Theme.id_x, Theme.id_y);
2010-09-24 02:48:03 +02:00
if (Settings.godmode == 1 && mountMethod != 3) //only make the button have trigger & tooltip if in godmode
{
2010-09-24 02:48:03 +02:00
DownloadBtn.SetSoundOver(&btnSoundOver);
DownloadBtn.SetTrigger(&trigA);
DownloadBtn.SetTrigger(&trig1);
DownloadBtn.SetToolTip(&DownloadBtnTT, 205, -30);
2010-09-24 02:48:03 +02:00
idBtn.SetSoundOver(&btnSoundOver);
idBtn.SetTrigger(&trigA);
idBtn.SetToolTip(&IDBtnTT, 205, -30);
}
else
{
2010-09-24 02:48:03 +02:00
DownloadBtn.SetRumble(false);
idBtn.SetRumble(false);
}
GuiGameBrowser * gameBrowser = NULL;
GuiGameGrid * gameGrid = NULL;
GuiGameCarousel * gameCarousel = NULL;
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
gameBrowser = new GuiGameBrowser(Theme.gamelist_w, Theme.gamelist_h, startat, offset);
gameBrowser->SetPosition(Theme.gamelist_x, Theme.gamelist_y);
2010-09-24 02:48:03 +02:00
gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
gameGrid = new GuiGameGrid(Theme.gamegrid_w, Theme.gamegrid_h, Settings.theme_path, bg_options_png, 0, 0);
gameGrid->SetPosition(Theme.gamegrid_x, Theme.gamegrid_y);
2010-09-24 02:48:03 +02:00
gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
//GuiGameCarousel gameCarousel(Theme.gamecarousel_w, Theme.gamecarousel_h, gameList, gameList.size(), Settings.theme_path, bg_options_png, startat, offset);
2010-09-24 02:48:03 +02:00
gameCarousel = new GuiGameCarousel(640, 400, Settings.theme_path, bg_options_png, startat, offset);
gameCarousel->SetPosition(Theme.gamecarousel_x, Theme.gamecarousel_y);
2010-09-24 02:48:03 +02:00
gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
2010-09-24 02:48:03 +02:00
GuiText clockTimeBack("88:88", 40, ( GXColor )
{ Theme.clock.r, Theme.clock.g, Theme.clock.b, Theme.clock.a / 6});
clockTimeBack.SetAlignment(Theme.clock_align, ALIGN_TOP);
clockTimeBack.SetPosition(Theme.clock_x, Theme.clock_y);
2010-09-24 02:48:03 +02:00
clockTimeBack.SetFont(clock_ttf, clock_ttf_size);
GuiText clockTime(theTime, 40, Theme.clock);
clockTime.SetAlignment(Theme.clock_align, ALIGN_TOP);
clockTime.SetPosition(Theme.clock_x, Theme.clock_y);
2010-09-24 02:48:03 +02:00
clockTime.SetFont(clock_ttf, clock_ttf_size);
HaltGui();
2010-09-24 02:48:03 +02:00
GuiWindow w(screenwidth, screenheight);
if (Theme.show_hddinfo == -1 || Theme.show_hddinfo == 1) //force show hdd info
{
2010-09-24 02:48:03 +02:00
w.Append(&usedSpaceTxt);
}
if (Theme.show_gamecount == -1 || Theme.show_gamecount == 1) //force show game cnt info
{
2010-09-24 02:48:03 +02:00
w.Append(&gamecntBtn);
}
2010-09-24 02:48:03 +02:00
w.Append(&sdcardBtn);
w.Append(&poweroffBtn);
w.Append(&gameInfo);
if (Settings.godmode) w.Append(&installBtn);
w.Append(&homeBtn);
w.Append(&settingsBtn);
w.Append(&DownloadBtn);
w.Append(&idBtn);
w.Append(&screenShotBtn);
// Begin Toolbar
2010-09-24 02:48:03 +02:00
w.Append(&favoriteBtn);
Toolbar[0] = &favoriteBtn;
2010-09-24 02:48:03 +02:00
w.Append(&searchBtn);
Toolbar[1] = &searchBtn;
2010-09-24 02:48:03 +02:00
w.Append(&abcBtn);
Toolbar[2] = &abcBtn;
2010-09-24 02:48:03 +02:00
w.Append(&countBtn);
Toolbar[3] = &countBtn;
2010-09-24 02:48:03 +02:00
w.Append(&listBtn);
Toolbar[4] = &listBtn;
2010-09-24 02:48:03 +02:00
w.Append(&gridBtn);
Toolbar[5] = &gridBtn;
2010-09-24 02:48:03 +02:00
w.Append(&carouselBtn);
Toolbar[6] = &carouselBtn;
2010-09-24 02:48:03 +02:00
w.Append(&lockBtn);
Toolbar[7] = &lockBtn;
2010-09-24 02:48:03 +02:00
w.Append(&dvdBtn);
Toolbar[8] = &dvdBtn;
2010-09-24 02:48:03 +02:00
w.SetUpdateCallback(DiscListWinUpdateCallback);
// End Toolbar
2010-09-24 02:48:03 +02:00
if (Settings.godmode == 1) w.Append(&homebrewBtn);
2010-09-24 02:48:03 +02:00
if ((Settings.hddinfo == hr12) || (Settings.hddinfo == hr24))
{
2010-09-24 02:48:03 +02:00
w.Append(&clockTimeBack);
w.Append(&clockTime);
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
mainWindow->Append(gameBrowser);
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
mainWindow->Append(gameGrid);
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
mainWindow->Append(gameCarousel);
}
2010-09-24 02:48:03 +02:00
mainWindow->Append(&w);
GuiSearchBar *searchBar = NULL;
2010-09-24 02:48:03 +02:00
if (show_searchwindow)
{
2010-09-24 02:48:03 +02:00
searchBar = new GuiSearchBar(gameList.GetAvailableSearchChars());
if (searchBar) mainWindow->Append(searchBar);
}
ResumeGui();
2010-09-24 02:48:03 +02:00
// ShowMemInfo();
2010-09-24 02:48:03 +02:00
while (menu == MENU_NONE)
{
2010-09-24 02:48:03 +02:00
if (idiotFlag == 1)
{
2010-09-24 02:48:03 +02:00
gprintf("\tIdiot flag\n");
char idiotBuffer[200];
2010-09-24 02:48:03 +02:00
snprintf(idiotBuffer, sizeof(idiotBuffer), "%s (%s). %s", tr( "You have attempted to load a bad image" ),
idiotChar, tr( "Most likely it has dimensions that are not evenly divisible by 4." ));
2010-09-24 02:48:03 +02:00
int deleteImg = WindowPrompt(0, idiotBuffer, tr( "OK" ), tr( "Delete" ));
if (deleteImg == 0)
{
2010-09-24 02:48:03 +02:00
snprintf(idiotBuffer, sizeof(idiotBuffer), "%s %s.", tr( "You are about to delete " ), idiotChar);
deleteImg = WindowPrompt(tr( "Confirm" ), idiotBuffer, tr( "Delete" ), tr( "Cancel" ));
if (deleteImg == 1)
{
2010-09-24 02:48:03 +02:00
remove(idiotChar);
}
}
idiotFlag = -1;
}
2010-09-24 02:48:03 +02:00
WDVD_GetCoverStatus(&covert);//for detecting if i disc has been inserted
// if the idiot is showing favorites and don't have any
2010-09-24 02:48:03 +02:00
if (Settings.fave && !gameList.size())
{
2010-09-24 02:48:03 +02:00
WindowPrompt(tr( "No Favorites" ),
tr( "You are choosing to display favorites and you do not have any selected." ), tr( "Back" ));
Settings.fave = !Settings.fave;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
gameList.FilterList();
menu = MENU_DISCLIST;
break;
}
//CLOCK
2010-09-24 02:48:03 +02:00
time_t rawtime = time(0);
if (((Settings.hddinfo == hr12) || (Settings.hddinfo == hr24)) && rawtime != lastrawtime)
{
lastrawtime = rawtime;
2010-09-24 02:48:03 +02:00
timeinfo = localtime(&rawtime);
if (dataed < 1)
{
2010-09-24 02:48:03 +02:00
if (Settings.hddinfo == hr12)
{
2010-09-24 02:48:03 +02:00
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
else strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
}
2010-09-24 02:48:03 +02:00
if (Settings.hddinfo == hr24)
{
2010-09-24 02:48:03 +02:00
if (rawtime & 1)
strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
else strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
}
2010-09-24 02:48:03 +02:00
clockTime.SetText(theTime);
}
2010-09-24 02:48:03 +02:00
else if (dataed > 0)
{
2010-09-24 02:48:03 +02:00
clockTime.SetTextf("%i", (dataed - 1));
}
}
// respond to button presses
2010-09-24 02:48:03 +02:00
if (shutdown == 1)
{
2010-09-24 02:48:03 +02:00
gprintf("\n\tshutdown");
Sys_Shutdown();
}
2010-09-24 02:48:03 +02:00
if (reset == 1) Sys_Reboot();
2010-09-24 02:48:03 +02:00
if (updateavailable == true)
{
2010-09-24 02:48:03 +02:00
gprintf("\tUpdate Available\n");
HaltGui();
2010-09-24 02:48:03 +02:00
GuiWindow ww(640, 480);
w.SetState(STATE_DISABLED);
mainWindow->Append(&ww);
ResumeGui();
ProgressUpdateWindow();
updateavailable = false;
2010-09-24 02:48:03 +02:00
mainWindow->Remove(&ww);
w.SetState(STATE_DEFAULT);
menu = MENU_DISCLIST;
}
2010-09-24 02:48:03 +02:00
if (poweroffBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tpoweroffBtn clicked\n");
choice = WindowPrompt(tr( "How to Shutdown?" ), 0, tr( "Full Shutdown" ), tr( "Shutdown to Idle" ),
tr( "Cancel" ));
if (choice == 2)
{
Sys_ShutdownToIdel();
}
2010-09-24 02:48:03 +02:00
else if (choice == 1)
{
Sys_ShutdownToStandby();
}
else
{
poweroffBtn.ResetState();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}
}
2010-09-24 02:48:03 +02:00
else if (gamecntBtn.GetState() == STATE_CLICKED && mountMethod != 3)
{
2010-09-24 02:48:03 +02:00
gprintf("\tgameCntBtn clicked\n");
gamecntBtn.ResetState();
char linebuf[150];
2010-09-24 02:48:03 +02:00
snprintf(linebuf, sizeof(linebuf), "%s %sGameList ?", tr( "Save Game List to" ), Settings.update_path);
choice = WindowPrompt(0, linebuf, "TXT", "CSV", tr( "Back" ));
if (choice)
{
2010-09-24 02:48:03 +02:00
if (save_gamelist(choice - 1))
WindowPrompt(0, tr( "Saved" ), tr( "OK" ));
else WindowPrompt(tr( "Error" ), tr( "Could not save." ), tr( "OK" ));
}
menu = MENU_DISCLIST;
break;
}
2010-09-24 02:48:03 +02:00
else if (screenShotBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tscreenShotBtn clicked\n");
screenShotBtn.ResetState();
2010-09-24 02:48:03 +02:00
ScreenShot();
}
2010-09-24 02:48:03 +02:00
else if (homeBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\thomeBtn clicked\n");
bgMusic->Pause();
choice = WindowExitPrompt();
bgMusic->Resume();
2010-09-24 02:48:03 +02:00
if (choice == 3)
{
Sys_LoadMenu(); // Back to System Menu
}
2010-09-24 02:48:03 +02:00
else if (choice == 2)
{
Sys_BackToLoader();
}
else
{
homeBtn.ResetState();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}
}
2010-09-24 02:48:03 +02:00
else if (installBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
choice = WindowPrompt(tr( "Install a game" ), 0, tr( "Yes" ), tr( "No" ));
if (choice == 1)
{
menu = MENU_INSTALL;
break;
}
else
{
installBtn.ResetState();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}
}
2010-09-24 02:48:03 +02:00
else if ((covert & 0x2) && (covert != covertOld))
{
2010-09-24 02:48:03 +02:00
gprintf("\tNew Disc Detected\n");
choice
= WindowPrompt(tr( "New Disc Detected" ), 0, tr( "Install" ), tr( "Mount DVD drive" ),
tr( "Cancel" ));
if (choice == 1)
{
menu = MENU_INSTALL;
break;
}
2010-09-24 02:48:03 +02:00
else if (choice == 2)
{
2010-09-24 02:48:03 +02:00
dvdBtn.SetState(STATE_CLICKED);
}
else
{
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}
}
2010-09-24 02:48:03 +02:00
else if (sdcardBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tsdCardBtn Clicked\n");
SDCard_deInit();
SDCard_Init();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
startat = gameBrowser->GetSelectedOption();
offset = gameBrowser->GetOffset();
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
startat = gameGrid->GetSelectedOption();
offset = gameGrid->GetOffset();
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
startat = gameCarousel->GetSelectedOption();
offset = gameCarousel->GetOffset();
}
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default()
Settings.Load();
ResumeGui();
}
sdcardBtn.ResetState();
menu = MENU_DISCLIST;
break;
}
2010-09-24 02:48:03 +02:00
else if (DownloadBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tDownloadBtn Clicked\n");
if (isInserted(bootDevice))
{
2010-09-24 02:48:03 +02:00
choice = WindowPrompt(tr( "Cover Download" ), 0, tr( "Normal Covers" ), tr( "3D Covers" ),
tr( "Disc Images" ), tr( "Back" )); // ask for download choice
if (choice != 0)
{
int choice2 = choice;
bool missing;
2010-09-24 02:48:03 +02:00
missing = SearchMissingImages(choice2);
if (IsNetworkInit() == false && missing == true)
{
2010-09-24 02:48:03 +02:00
WindowPrompt(tr( "Network init error" ), 0, tr( "OK" ));
}
else
{
2010-09-24 02:48:03 +02:00
if (GetMissingFiles() != NULL && cntMissFiles > 0)
{
char tempCnt[40];
2010-09-24 02:48:03 +02:00
sprintf(tempCnt, "%i %s", cntMissFiles, tr( "Missing files" ));
if (choice != 3)
choice = WindowPrompt(tr( "Download Boxart image?" ), tempCnt, tr( "Yes" ), tr( "No" ));
else if (choice == 3) choice = WindowPrompt(tr( "Download Discart image?" ), tempCnt,
tr( "Yes" ), tr( "No" ));
if (choice == 1)
{
2010-09-24 02:48:03 +02:00
ret = ProgressDownloadWindow(choice2);
if (ret == 0)
{
2010-09-24 02:48:03 +02:00
WindowPrompt(tr( "Download finished" ), 0, tr( "OK" ));
}
else
{
2010-09-24 02:48:03 +02:00
sprintf(tempCnt, "%i %s", ret, tr( "files not found on the server!" ));
WindowPrompt(tr( "Download finished" ), tempCnt, tr( "OK" ));
}
}
}
}
}
}
else
{
2010-09-24 02:48:03 +02:00
WindowPrompt(tr( "No SD-Card inserted!" ), tr( "Insert an SD-Card to download images." ), tr( "OK" ));
}
menu = MENU_DISCLIST;
DownloadBtn.ResetState();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}//end download
2010-09-24 02:48:03 +02:00
else if (settingsBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tsettingsBtn Clicked\n");
if (Settings.gameDisplay == list)
{
startat = gameBrowser->GetSelectedOption();
offset = gameBrowser->GetOffset();
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
startat = gameGrid->GetSelectedOption();
offset = gameGrid->GetOffset();
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
startat = gameCarousel->GetSelectedOption();
offset = gameCarousel->GetOffset();
}
menu = MENU_SETTINGS;
break;
}
2010-09-24 02:48:03 +02:00
else if (favoriteBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tfavoriteBtn Clicked\n");
Settings.fave = !Settings.fave;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
gameList.FilterList();
menu = MENU_DISCLIST;
break;
}
2010-09-24 02:48:03 +02:00
else if (searchBtn.GetState() == STATE_CLICKED && mountMethod != 3)
{
2010-09-24 02:48:03 +02:00
gprintf("\tsearchBtn Clicked\n");
show_searchwindow = !show_searchwindow;
HaltGui();
2010-09-24 02:48:03 +02:00
if (searchBar)
{
2010-09-24 02:48:03 +02:00
mainWindow->Remove(searchBar);
delete searchBar;
searchBar = NULL;
}
2010-09-24 02:48:03 +02:00
if (show_searchwindow)
{
2010-09-24 02:48:03 +02:00
if (*gameList.GetCurrentFilter())
{
searchBtn.StopEffect();
searchBtn.SetEffectGrow();
}
2010-09-24 02:48:03 +02:00
searchBar = new GuiSearchBar(gameList.GetAvailableSearchChars());
if (searchBar) mainWindow->Append(searchBar);
}
else
{
2010-09-24 02:48:03 +02:00
if (*gameList.GetCurrentFilter()) searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
}
searchBtn.ResetState();
ResumeGui();
}
2010-09-24 02:48:03 +02:00
else if (searchBar && (searchChar = searchBar->GetClicked()))
{
2010-09-24 02:48:03 +02:00
if (searchChar > 27)
{
2010-09-24 02:48:03 +02:00
int len = gameList.GetCurrentFilter() ? wcslen(gameList.GetCurrentFilter()) : 0;
wchar_t newFilter[len + 2];
if (gameList.GetCurrentFilter()) wcscpy(newFilter, gameList.GetCurrentFilter());
newFilter[len] = searchChar;
2010-09-24 02:48:03 +02:00
newFilter[len + 1] = 0;
2010-09-24 02:48:03 +02:00
gameList.FilterList(newFilter);
menu = MENU_DISCLIST;
break;
}
2010-09-24 02:48:03 +02:00
else if (searchChar == 7) // Close
{
show_searchwindow = false;
HaltGui();
2010-09-24 02:48:03 +02:00
if (searchBar)
{
2010-09-24 02:48:03 +02:00
mainWindow->Remove(searchBar);
delete searchBar;
searchBar = NULL;
}
2010-09-24 02:48:03 +02:00
if (*gameList.GetCurrentFilter())
{
2010-09-24 02:48:03 +02:00
searchBtn.SetEffect(EFFECT_PULSE, 10, 105);
searchBtn.SetImage(&searchBtnImg);
searchBtn.SetImageOver(&searchBtnImg);
searchBtn.SetAlpha(255);
}
else
{
searchBtn.StopEffect();
searchBtn.SetEffectGrow();
2010-09-24 02:48:03 +02:00
searchBtn.SetImage(&searchBtnImg_g);
searchBtn.SetImageOver(&searchBtnImg_g);
searchBtn.SetAlpha(180);
}
ResumeGui();
}
2010-09-24 02:48:03 +02:00
else if (searchChar == 8) // Backspace
{
2010-09-24 02:48:03 +02:00
int len = wcslen(gameList.GetCurrentFilter());
wchar_t newFilter[len + 1];
if (gameList.GetCurrentFilter()) wcscpy(newFilter, gameList.GetCurrentFilter());
newFilter[len > 0 ? len - 1 : 0] = 0;
gameList.FilterList(newFilter);
menu = MENU_DISCLIST;
break;
}
}
2010-09-24 02:48:03 +02:00
else if (abcBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tabcBtn clicked\n");
if (Settings.sort != ALL)
{
Settings.sort = ALL;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
gameList.FilterList();
menu = MENU_DISCLIST;
break;
}
abcBtn.ResetState();
}
2010-09-24 02:48:03 +02:00
else if (countBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tcountBtn Clicked\n");
if (Settings.sort != PLAYCOUNT)
{
2010-09-24 02:48:03 +02:00
Settings.sort = PLAYCOUNT;
if (isInserted(bootDevice))
{
Settings.Save();
}
gameList.FilterList();
menu = MENU_DISCLIST;
break;
}
countBtn.ResetState();
}
2010-09-24 02:48:03 +02:00
else if (listBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tlistBtn Clicked\n");
if (Settings.gameDisplay != list)
{
Settings.gameDisplay = list;
menu = MENU_DISCLIST;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
listBtn.ResetState();
break;
}
else
{
listBtn.ResetState();
}
}
2010-09-24 02:48:03 +02:00
else if (gridBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tgridBtn Clicked\n");
if (Settings.gameDisplay != grid)
{
Settings.gameDisplay = grid;
menu = MENU_DISCLIST;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
gridBtn.ResetState();
break;
}
else
{
gridBtn.ResetState();
}
}
2010-09-24 02:48:03 +02:00
else if (carouselBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tcarouselBtn Clicked\n");
if (Settings.gameDisplay != carousel)
{
Settings.gameDisplay = carousel;
menu = MENU_DISCLIST;
2010-09-24 02:48:03 +02:00
if (isInserted(bootDevice))
{
Settings.Save();
}
carouselBtn.ResetState();
break;
}
else
{
carouselBtn.ResetState();
}
}
2010-09-24 02:48:03 +02:00
else if (homebrewBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\thomebrewBtn Clicked\n");
menu = MENU_HOMEBREWBROWSE;
break;
}
2010-09-24 02:48:03 +02:00
else if (gameInfo.GetState() == STATE_CLICKED && mountMethod != 3)
{
2010-09-24 02:48:03 +02:00
gprintf("\tgameinfo Clicked\n");
gameInfo.ResetState();
2010-09-24 02:48:03 +02:00
if (selectImg1 >= 0 && selectImg1 < (s32) gameList.size())
{
gameSelected = selectImg1;
rockout();
struct discHdr *header = gameList[selectImg1];
2010-09-24 02:48:03 +02:00
snprintf(IDfull, sizeof(IDfull), "%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],
header->id[3], header->id[4], header->id[5]);
choice = showGameInfo(IDfull);
rockout(2);
if (choice == 2) homeBtn.SetState(STATE_CLICKED);
if (choice == 3)
{
menu = MENU_DISCLIST;
break;
}
}
}
2010-09-24 02:48:03 +02:00
else if (lockBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tlockBtn clicked\n");
lockBtn.ResetState();
2010-09-24 02:48:03 +02:00
if (!canUnlock)
{
2010-09-24 02:48:03 +02:00
WindowPrompt(
tr( "Parental Control" ),
tr( "You don't have Parental Control enabled. If you wish to use Parental Control, enable it in the Wii Settings." ),
tr( "OK" ));
}
else
{
2010-09-24 02:48:03 +02:00
if (Settings.godmode)
{
2010-09-24 02:48:03 +02:00
if (WindowPrompt(tr( "Parental Control" ), tr( "Are you sure you want to enable Parent Control?" ),
tr( "Yes" ), tr( "No" )) == 1)
{
Settings.godmode = 0;
2010-09-24 02:48:03 +02:00
lockBtn.SetImage(&lockBtnImg_g);
lockBtn.SetImageOver(&lockBtnImg_g);
lockBtn.SetToolTip(&lockBtnTT, 15, 52, 1, 3);
// Retrieve the gamelist again
menu = MENU_DISCLIST;
break;
}
}
else
{
// Require the user to enter the PIN code
char pin[5];
2010-09-24 02:48:03 +02:00
memset(&pin, 0, 5);
int ret = OnScreenNumpad((char *) &pin, 5);
2010-09-24 02:48:03 +02:00
if (ret == 1)
{
2010-09-24 02:48:03 +02:00
if (memcmp(pin, Settings.Parental.pin, 4) == 0)
{
Settings.godmode = 1;
2010-09-24 02:48:03 +02:00
lockBtn.SetImage(&unlockBtnImg_g);
lockBtn.SetImageOver(&unlockBtnImg_g);
lockBtn.SetToolTip(&unlockBtnTT, 15, 52, 1, 3);
// Retrieve the gamelist again
menu = MENU_DISCLIST;
break;
}
else
{
2010-09-24 02:48:03 +02:00
WindowPrompt(tr( "Parental Control" ), tr( "Invalid PIN code" ), tr( "OK" ));
}
}
}
}
}
2010-09-24 02:48:03 +02:00
else if (dvdBtn.GetState() == STATE_CLICKED)
{
2010-09-24 02:48:03 +02:00
gprintf("\tdvdBtn Clicked\n");
mountMethodOLD = (mountMethod == 3 ? mountMethod : 0);
2010-09-24 02:48:03 +02:00
mountMethod = DiscMount(dvdheader);
dvdBtn.ResetState();
rockout();
//break;
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == grid)
{
int selectimg;
2010-09-24 02:48:03 +02:00
DownloadBtn.SetSize(0, 0);
selectimg = gameGrid->GetSelectedOption();
gameSelected = gameGrid->GetClickedOption();
selectImg1 = selectimg;
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == carousel)
{
int selectimg;
2010-09-24 02:48:03 +02:00
DownloadBtn.SetSize(0, 0);
selectimg = gameCarousel->GetSelectedOption();
gameSelected = gameCarousel->GetClickedOption();
selectImg1 = selectimg;
}
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
{
//Get selected game under cursor
int selectimg;
2010-09-24 02:48:03 +02:00
DownloadBtn.SetSize(160, 224);
idBtn.SetSize(100, 40);
selectimg = gameBrowser->GetSelectedOption();
gameSelected = gameBrowser->GetClickedOption();
selectImg1 = selectimg;
2010-09-24 02:48:03 +02:00
if (gameSelected > 0) //if click occured
selectimg = gameSelected;
char gameregion[7];
2010-09-24 02:48:03 +02:00
if ((selectimg >= 0) && (selectimg < (s32) gameList.size()))
{
2010-09-24 02:48:03 +02:00
if (selectimg != selectedold)
{
selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
struct discHdr *header = gameList[selectimg];
2010-09-24 02:48:03 +02:00
snprintf(ID, sizeof(ID), "%c%c%c", header->id[0], header->id[1], header->id[2]);
snprintf(IDfull, sizeof(IDfull), "%s%c%c%c", ID, header->id[3], header->id[4], header->id[5]);
w.Remove(&DownloadBtn);
2010-09-24 02:48:03 +02:00
if (GameIDTxt)
{
2010-09-24 02:48:03 +02:00
w.Remove(&idBtn);
delete GameIDTxt;
GameIDTxt = NULL;
}
2010-09-24 02:48:03 +02:00
if (GameRegionTxt)
{
2010-09-24 02:48:03 +02:00
w.Remove(GameRegionTxt);
delete GameRegionTxt;
GameRegionTxt = NULL;
}
2010-09-24 02:48:03 +02:00
switch (header->id[3])
{
case 'E':
2010-09-24 02:48:03 +02:00
sprintf(gameregion, "NTSC U");
break;
case 'J':
2010-09-24 02:48:03 +02:00
sprintf(gameregion, "NTSC J");
break;
case 'W':
2010-09-24 02:48:03 +02:00
sprintf(gameregion, "NTSC T");
break;
default:
case 'K':
2010-09-24 02:48:03 +02:00
sprintf(gameregion, "NTSC K");
break;
case 'P':
case 'D':
case 'F':
case 'I':
case 'S':
case 'H':
case 'U':
case 'X':
case 'Y':
case 'Z':
2010-09-24 02:48:03 +02:00
sprintf(gameregion, " PAL ");
break;
}
//load game cover
2010-09-24 02:48:03 +02:00
if (cover)
{
delete cover;
cover = NULL;
}
2010-09-24 02:48:03 +02:00
cover = LoadCoverImage(header);
2010-09-24 02:48:03 +02:00
if (coverImg)
{
delete coverImg;
coverImg = NULL;
}
2010-09-24 02:48:03 +02:00
coverImg = new GuiImage(cover);
coverImg->SetWidescreen(Settings.widescreen);
2010-09-24 02:48:03 +02:00
DownloadBtn.SetImage(coverImg);// put the new image on the download button
w.Append(&DownloadBtn);
2010-09-24 02:48:03 +02:00
if ((Settings.sinfo == GameID) || (Settings.sinfo == Both))
{
GameIDTxt = new GuiText(IDfull, 22, Theme.info);
2010-09-24 02:48:03 +02:00
GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
//GameIDTxt->SetPosition(Theme.id_x,Theme.id_y);
2010-09-24 02:48:03 +02:00
idBtn.SetEffect(EFFECT_FADE, 20);
idBtn.SetLabel(GameIDTxt);
w.Append(&idBtn);
}
//don't try to show region for channels because all the custom channels wont follow the rules
2010-09-24 02:48:03 +02:00
if (((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)) && mountMethod != 3)
{
GameRegionTxt = new GuiText(gameregion, 22, Theme.info);
2010-09-24 02:48:03 +02:00
GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameRegionTxt->SetPosition(Theme.region_x, Theme.region_y);
2010-09-24 02:48:03 +02:00
GameRegionTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameRegionTxt);
}
}
}
2010-09-24 02:48:03 +02:00
if (idBtn.GetState() == STATE_CLICKED && mountMethod != 3)
{
2010-09-24 02:48:03 +02:00
gprintf("\n\tidBtn Clicked");
struct discHdr * header = gameList[gameBrowser->GetSelectedOption()];
//enter new game ID
char entered[10];
2010-09-24 02:48:03 +02:00
snprintf(entered, sizeof(entered), "%s", IDfull);
//entered[9] = '\0';
2010-09-24 02:48:03 +02:00
int result = OnScreenKeyboard(entered, 7, 0);
if (result == 1)
{
2010-09-24 02:48:03 +02:00
WBFS_ReIDGame(header->id, entered);
//__Menu_GetEntries();
menu = MENU_DISCLIST;
}
idBtn.ResetState();
}
startat = gameBrowser->GetOffset(), offset = startat;
}
2010-09-24 02:48:03 +02:00
if (((gameSelected >= 0) && (gameSelected < (s32) gameList.size())) || mountMethod == 1 || mountMethod == 2)
{
2010-09-24 02:48:03 +02:00
if (searchBar)
{
HaltGui();
2010-09-24 02:48:03 +02:00
mainWindow->Remove(searchBar);
ResumeGui();
}
rockout();
2010-09-24 02:48:03 +02:00
struct discHdr *header = (mountMethod == 1 || mountMethod == 2 ? dvdheader : gameList[gameSelected]);
// struct discHdr *header = dvdheader:gameList[gameSelected]);
2010-09-24 02:48:03 +02:00
if (!mountMethod)//only get this stuff it we are booting a game from USB
{
2010-09-24 02:48:03 +02:00
WBFS_GameSize(header->id, &size);
if (strlen(get_title(header)) < (MAX_CHARACTERS + 3))
{
2010-09-24 02:48:03 +02:00
sprintf(text, "%s", get_title(header));
}
else
{
2010-09-24 02:48:03 +02:00
strncpy(text, get_title(header), MAX_CHARACTERS);
text[MAX_CHARACTERS] = '\0';
2010-09-24 02:48:03 +02:00
strncat(text, "...", 3);
}
}
//check if alt Dol and gct file is present
FILE *exeFile = NULL;
char nipple[100];
2010-09-24 02:48:03 +02:00
header = (mountMethod == 1 || mountMethod == 2 ? dvdheader : gameList[gameSelected]); //reset header
snprintf(IDfull, sizeof(IDfull), "%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],
header->id[3], header->id[4], header->id[5]);
GameCFG* game_cfg = GameSettings.GetGameCFG(header->id);
u8 alternatedol;
u8 ocarinaChoice;
2010-09-24 02:48:03 +02:00
if (game_cfg)
{
alternatedol = game_cfg->loadalternatedol;
ocarinaChoice = game_cfg->ocarina;
}
else
{
alternatedol = off;
ocarinaChoice = Settings.ocarina;
}
2010-09-24 02:48:03 +02:00
if (Settings.quickboot == yes) //quickboot game
{
2010-09-24 02:48:03 +02:00
if (alternatedol == on)
{
/* Open dol File and check exist */
2010-09-24 02:48:03 +02:00
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
exeFile = fopen(nipple, "rb");
if (exeFile == NULL)
{
2010-09-24 02:48:03 +02:00
sprintf(nipple, "%s %s", nipple, tr( "does not exist!" ));
WindowPrompt(tr( "Error" ), nipple, tr( "OK" ));
menu = MENU_CHECK;
2010-09-24 02:48:03 +02:00
wiilight(0);
break;
}
else
{
2010-09-24 02:48:03 +02:00
fclose(exeFile);
}
}
2010-09-24 02:48:03 +02:00
if (ocarinaChoice != off)
{
/* Open gct File and check exist */
2010-09-24 02:48:03 +02:00
sprintf(nipple, "%s%s.gct", Settings.Cheatcodespath, IDfull);
exeFile = fopen(nipple, "rb");
if (exeFile == NULL)
{
2010-09-24 02:48:03 +02:00
gprintf("\ttried to load missing gct.\n");
sprintf(nipple, "%s %s", nipple, tr( "does not exist! Loading game without cheats." ));
WindowPrompt(tr( "Error" ), nipple, NULL, NULL, NULL, NULL, 170);
}
else
{
2010-09-24 02:48:03 +02:00
fclose(exeFile);
}
}
2010-09-24 02:48:03 +02:00
wiilight(0);
if (isInserted(bootDevice))
{
//////////save game play count////////////////
GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
GameStatistics.Save();
2010-09-24 02:48:03 +02:00
gprintf("\n\tplaycount for %c%c%c%c%c%c raised to %i", header->id[0], header->id[1], header->id[2],
header->id[3], header->id[4], header->id[5], GameStatistics.GetPlayCount(header->id));
}
menu = MENU_EXIT;
break;
}
bool returnHere = true;// prompt to start game
2010-09-24 02:48:03 +02:00
while (returnHere)
{
returnHere = false;
2010-09-24 02:48:03 +02:00
if (Settings.wiilight != wiilight_forInstall) wiilight(1);
choice = GameWindowPrompt();
// header = gameList[gameSelected]; //reset header
2010-09-24 02:48:03 +02:00
if (choice == 1)
{
2010-09-24 02:48:03 +02:00
if (alternatedol == on)
{
/* Open dol File and check exist */
2010-09-24 02:48:03 +02:00
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
exeFile = fopen(nipple, "rb");
if (exeFile == NULL)
{
2010-09-24 02:48:03 +02:00
gprintf("\n\tTried to load alt dol that isn't there");
sprintf(nipple, "%s %s", nipple, tr( "does not exist! You Messed something up, Idiot." ));
WindowPrompt(tr( "Error" ), nipple, tr( "OK" ));
menu = MENU_CHECK;
2010-09-24 02:48:03 +02:00
wiilight(0);
break;
}
else
{
2010-09-24 02:48:03 +02:00
fclose(exeFile);
}
}
2010-09-24 02:48:03 +02:00
if (ocarinaChoice != off)
{
/* Open gct File and check exist */
2010-09-24 02:48:03 +02:00
sprintf(nipple, "%s%s.gct", Settings.Cheatcodespath, IDfull);
exeFile = fopen(nipple, "rb");
if (exeFile == NULL)
{
2010-09-24 02:48:03 +02:00
gprintf("\ttried to load gct file that isn't there\n");
sprintf(nipple, "%s %s", nipple, tr( "does not exist! Loading game without cheats." ));
WindowPrompt(tr( "Error" ), nipple, NULL, NULL, NULL, NULL, 170);
}
else
{
2010-09-24 02:48:03 +02:00
fclose(exeFile);
}
}
2010-09-24 02:48:03 +02:00
wiilight(0);
returnHere = false;
menu = MENU_EXIT;
}
2010-09-24 02:48:03 +02:00
else if (choice == 2)
{
2010-09-24 02:48:03 +02:00
wiilight(0);
HaltGui();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
mainWindow->Remove(gameBrowser);
else if (Settings.gameDisplay == grid)
mainWindow->Remove(gameGrid);
else if (Settings.gameDisplay == carousel) mainWindow->Remove(gameCarousel);
mainWindow->Remove(&w);
ResumeGui();
//re-evaluate header now in case they changed games while on the game prompt
2010-09-24 02:48:03 +02:00
header = (mountMethod == 1 || mountMethod == 2 ? dvdheader : gameList[gameSelected]);
int settret = MenuGameSettings(header);
/* unneeded for now, kept in case database gets a separate language setting
2010-09-24 02:48:03 +02:00
//menu = MENU_DISCLIST; // refresh titles (needed if the language setting has changed)
*/
HaltGui();
2010-09-24 02:48:03 +02:00
if (Settings.gameDisplay == list)
mainWindow->Append(gameBrowser);
else if (Settings.gameDisplay == grid)
mainWindow->Append(gameGrid);
else if (Settings.gameDisplay == carousel) mainWindow->Append(gameCarousel);
mainWindow->Append(&w);
ResumeGui();
2010-09-24 02:48:03 +02:00
if (settret == 1) //if deleted
{
menu = MENU_DISCLIST;
break;
}
returnHere = true;
2010-09-24 02:48:03 +02:00
rockout(2);
}
2010-09-24 02:48:03 +02:00
else if (choice == 3 && !mountMethod) //WBFS renaming
{
2010-09-24 02:48:03 +02:00
wiilight(0);
//re-evaluate header now in case they changed games while on the game prompt
header = gameList[gameSelected];
//enter new game title
char entered[60];
2010-09-24 02:48:03 +02:00
snprintf(entered, sizeof(entered), "%s", get_title(header));
entered[59] = '\0';
2010-09-24 02:48:03 +02:00
int result = OnScreenKeyboard(entered, 60, 0);
if (result == 1)
{
2010-09-24 02:48:03 +02:00
WBFS_RenameGame(header->id, entered);
gameList.ReadGameList();
gameList.FilterList();
menu = MENU_DISCLIST;
}
}
2010-09-24 02:48:03 +02:00
else if (choice == 0)
{
2010-09-24 02:48:03 +02:00
rockout(2);
if (mountMethod == 1 || mountMethod == 2) mountMethod = mountMethodOLD;
if (Settings.gameDisplay == list)
{
2010-09-24 02:48:03 +02:00
gameBrowser->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == grid)
{
2010-09-24 02:48:03 +02:00
gameGrid->SetFocus(1);
}
2010-09-24 02:48:03 +02:00
else if (Settings.gameDisplay == carousel)
{
2010-09-24 02:48:03 +02:00
gameCarousel->SetFocus(1);
}
}
}
2010-09-24 02:48:03 +02:00
if (searchBar)
{
HaltGui();
2010-09-24 02:48:03 +02:00
mainWindow->Append(searchBar);
ResumeGui();
}
}
// to skip the first call of windowScreensaver at startup when wiimote is not connected
2010-09-24 02:48:03 +02:00
if (IsWpadConnected())
{
check = 1;
}
// screensaver is called when wiimote shuts down, depending on the wiimotet idletime
2010-09-24 02:48:03 +02:00
if (!IsWpadConnected() && check != 0 && Settings.screensaver != 0)
{
check++;
int screensaverIsOn = 0;
2010-09-24 02:48:03 +02:00
if (check == 11500) //to allow time for the wii to turn off and not show the screensaver
{
screensaverIsOn = WindowScreensaver();
}
2010-09-24 02:48:03 +02:00
if (screensaverIsOn == 1) check = 0;
}
covertOld = covert;
}
HaltGui();
mainWindow->RemoveAll();
2010-09-24 02:48:03 +02:00
mainWindow->Append(bgImg);
delete searchBar;
searchBar = NULL;
delete gameBrowser;
gameBrowser = NULL;
delete gameGrid;
gameGrid = NULL;
delete gameCarousel;
gameCarousel = NULL;
ResumeGui();
return menu;
}
2010-09-24 02:48:03 +02:00
void DiscListWinUpdateCallback(void * e)
{
2010-09-24 02:48:03 +02:00
GuiWindow *w = (GuiWindow *) e;
for (int i = 0; i < 8; ++i)
{
2010-09-24 02:48:03 +02:00
if (Toolbar[i]->GetState() == STATE_SELECTED)
{
2010-09-24 02:48:03 +02:00
w->Remove(Toolbar[i]);
w->Append(Toolbar[i]); // draw the selected Icon allways on top
break;
}
}
}
2010-09-24 02:48:03 +02:00
void rockout(int f)
{
HaltGui();
2010-09-24 02:48:03 +02:00
if (gameSelected >= 0 && gameSelected < gameList.size() && (strcasestr(get_title(gameList[gameSelected]), "guitar")
|| strcasestr(get_title(gameList[gameSelected]), "band") || strcasestr(get_title(gameList[gameSelected]),
"rock")))
{
2010-09-24 02:48:03 +02:00
for (int i = 0; i < 4; i++)
delete pointer[i];
pointer[0] = Resources::GetImageData("rplayer1_point.png");
pointer[1] = Resources::GetImageData("rplayer2_point.png");
pointer[2] = Resources::GetImageData("rplayer3_point.png");
pointer[3] = Resources::GetImageData("rplayer4_point.png");
}
else
{
2010-09-24 02:48:03 +02:00
for (int i = 0; i < 4; i++)
delete pointer[i];
pointer[0] = Resources::GetImageData("player1_point.png");
pointer[1] = Resources::GetImageData("player2_point.png");
pointer[2] = Resources::GetImageData("player3_point.png");
pointer[3] = Resources::GetImageData("player4_point.png");
}
ResumeGui();
}