*Seperated browsers

NOTE: This is a temporary and fast solution till DrayX7 is back since he started it already and i don't have the time right now to do it. This should fix most of the codedumps at starting up games (if not loaded from carousel).
This commit is contained in:
dimok321 2009-06-08 17:23:35 +00:00
parent 63414dffd7
commit d2ef529545

View File

@ -469,18 +469,25 @@ static int MenuDiscList()
else else
DownloadBtn.SetRumble(false); DownloadBtn.SetRumble(false);
GuiGameBrowser gameBrowser(THEME.selection_w, THEME.selection_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); GuiGameBrowser * gameBrowser = NULL;
gameBrowser.SetPosition(THEME.selection_x, THEME.selection_y); GuiGameGrid * gameGrid = NULL;
gameBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); GuiGameCarousel * gameCarousel = NULL;
if (Settings.gameDisplay==list) {
GuiGameGrid gameGrid(THEME.gamegrid_w,THEME.gamegrid_h, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0); gameBrowser = new GuiGameBrowser(THEME.selection_w, THEME.selection_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
gameGrid.SetPosition(THEME.gamegrid_x,THEME.gamegrid_y); gameBrowser->SetPosition(THEME.selection_x, THEME.selection_y);
gameGrid.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); gameBrowser->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
else if (Settings.gameDisplay==grid) {
gameGrid = new GuiGameGrid(THEME.gamegrid_w,THEME.gamegrid_h, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0);
gameGrid->SetPosition(THEME.gamegrid_x,THEME.gamegrid_y);
gameGrid->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
else if (Settings.gameDisplay==carousel) {
//GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); //GuiGameCarousel gameCarousel(THEME.gamecarousel_w, THEME.gamecarousel_h, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
GuiGameCarousel gameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); gameCarousel = new GuiGameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
gameCarousel.SetPosition(THEME.gamecarousel_x,THEME.gamecarousel_y); gameCarousel->SetPosition(THEME.gamecarousel_x,THEME.gamecarousel_y);
gameCarousel.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); gameCarousel->SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
}
GuiText clockTimeBack("88:88", 40, (GXColor){THEME.clock_r, THEME.clock_g, THEME.clock_b, 40}); GuiText clockTimeBack("88:88", 40, (GXColor){THEME.clock_r, THEME.clock_g, THEME.clock_b, 40});
clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP); clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP);
@ -531,9 +538,9 @@ static int MenuDiscList()
w.Append(&clockTime); w.Append(&clockTime);
} }
if (Settings.gameDisplay==list){mainWindow->Append(&gameBrowser);} if (Settings.gameDisplay==list){mainWindow->Append(gameBrowser);}
if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} if (Settings.gameDisplay==grid){mainWindow->Append(gameGrid);}
if (Settings.gameDisplay==carousel){mainWindow->Append(&gameCarousel);} if (Settings.gameDisplay==carousel){mainWindow->Append(gameCarousel);}
mainWindow->Append(&w); mainWindow->Append(&w);
ResumeGui(); ResumeGui();
@ -590,9 +597,9 @@ static int MenuDiscList()
Sys_ShutdownToStandby(); Sys_ShutdownToStandby();
} else { } else {
poweroffBtn.ResetState(); poweroffBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
} }
} }
@ -618,18 +625,18 @@ static int MenuDiscList()
Sys_BackToLoader(); Sys_BackToLoader();
} else { } else {
homeBtn.ResetState(); homeBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
} }
} }
else if(wiiBtn.GetState() == STATE_CLICKED) else if(wiiBtn.GetState() == STATE_CLICKED)
{ dataed++; { dataed++;
wiiBtn.ResetState(); wiiBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
} }
else if(installBtn.GetState() == STATE_CLICKED) else if(installBtn.GetState() == STATE_CLICKED)
{ {
@ -642,9 +649,9 @@ static int MenuDiscList()
else else
{ {
installBtn.ResetState(); installBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
} }
} }
@ -653,14 +660,14 @@ static int MenuDiscList()
SDCard_deInit(); SDCard_deInit();
SDCard_Init(); SDCard_Init();
if (Settings.gameDisplay==list){ if (Settings.gameDisplay==list){
startat = gameBrowser.GetSelectedOption(); startat = gameBrowser->GetSelectedOption();
offset = gameBrowser.GetOffset();} offset = gameBrowser->GetOffset();}
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
startat = gameGrid.GetSelectedOption(); startat = gameGrid->GetSelectedOption();
offset = gameGrid.GetOffset();} offset = gameGrid->GetOffset();}
else if (Settings.gameDisplay==carousel){ else if (Settings.gameDisplay==carousel){
startat = gameCarousel.GetSelectedOption(); startat = gameCarousel->GetSelectedOption();
offset = gameCarousel.GetOffset();} offset = gameCarousel->GetOffset();}
if(isSdInserted()) { if(isSdInserted()) {
CFG_Load(); CFG_Load();
} }
@ -721,21 +728,21 @@ static int MenuDiscList()
WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtodownloadimages, LANGUAGE.ok, 0,0,0); WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtodownloadimages, LANGUAGE.ok, 0,0,0);
} }
DownloadBtn.ResetState(); DownloadBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
}//end download }//end download
else if(settingsBtn.GetState() == STATE_CLICKED) else if(settingsBtn.GetState() == STATE_CLICKED)
{ if (Settings.gameDisplay==list){ { if (Settings.gameDisplay==list){
startat = gameBrowser.GetSelectedOption(); startat = gameBrowser->GetSelectedOption();
offset = gameBrowser.GetOffset();} offset = gameBrowser->GetOffset();}
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
startat = gameGrid.GetSelectedOption(); startat = gameGrid->GetSelectedOption();
offset = gameGrid.GetOffset();} offset = gameGrid->GetOffset();}
else if (Settings.gameDisplay==carousel){ else if (Settings.gameDisplay==carousel){
startat = gameCarousel.GetSelectedOption(); startat = gameCarousel->GetSelectedOption();
offset = gameCarousel.GetOffset();} offset = gameCarousel->GetOffset();}
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
break; break;
@ -748,6 +755,9 @@ static int MenuDiscList()
cfg_save_global(); cfg_save_global();
} }
__Menu_GetEntries(); __Menu_GetEntries();
menu = MENU_DISCLIST;
break;
/*
if (Settings.gameDisplay==list){ if (Settings.gameDisplay==list){
gameBrowser.Reload(gameList, gameCnt);} gameBrowser.Reload(gameList, gameCnt);}
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
@ -760,6 +770,7 @@ static int MenuDiscList()
Settings.fave ? (favoriteBtn.SetImage(&favoriteBtnImg),favoriteBtn.SetImageOver(&favoriteBtnImg), Settings.fave ? (favoriteBtn.SetImage(&favoriteBtnImg),favoriteBtn.SetImageOver(&favoriteBtnImg),
favoriteBtn.SetAlpha(255)) : (favoriteBtn.SetImage(&favoriteBtnImg_g), favoriteBtn.SetAlpha(255)) : (favoriteBtn.SetImage(&favoriteBtnImg_g),
favoriteBtn.SetImageOver(&favoriteBtnImg_g), favoriteBtn.SetAlpha(180)); favoriteBtn.SetImageOver(&favoriteBtnImg_g), favoriteBtn.SetAlpha(180));
*/
} }
else if(abcBtn.GetState() == STATE_CLICKED) else if(abcBtn.GetState() == STATE_CLICKED)
@ -770,6 +781,7 @@ static int MenuDiscList()
cfg_save_global(); cfg_save_global();
} }
__Menu_GetEntries(); __Menu_GetEntries();
/*
if (Settings.gameDisplay==list){ if (Settings.gameDisplay==list){
gameBrowser.Reload(gameList, gameCnt);} gameBrowser.Reload(gameList, gameCnt);}
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
@ -783,6 +795,9 @@ static int MenuDiscList()
countBtn.SetImage(&countBtnImg_g); countBtn.SetImage(&countBtnImg_g);
countBtn.SetImageOver(&countBtnImg_g); countBtn.SetImageOver(&countBtnImg_g);
countBtn.SetAlpha(180); countBtn.SetAlpha(180);
*/
menu = MENU_DISCLIST;
break;
} }
abcBtn.ResetState(); abcBtn.ResetState();
} }
@ -795,6 +810,7 @@ static int MenuDiscList()
cfg_save_global(); cfg_save_global();
} }
__Menu_GetEntries(); __Menu_GetEntries();
/*
if (Settings.gameDisplay==list){ if (Settings.gameDisplay==list){
gameBrowser.Reload(gameList, gameCnt);} gameBrowser.Reload(gameList, gameCnt);}
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
@ -808,13 +824,16 @@ static int MenuDiscList()
countBtn.SetImage(&countBtnImg); countBtn.SetImage(&countBtnImg);
countBtn.SetImageOver(&countBtnImg); countBtn.SetImageOver(&countBtnImg);
countBtn.SetAlpha(255); countBtn.SetAlpha(255);
*/
menu = MENU_DISCLIST;
break;
} }
countBtn.ResetState(); countBtn.ResetState();
} }
else if(listBtn.GetState() == STATE_CLICKED) { else if(listBtn.GetState() == STATE_CLICKED) {
if (Settings.gameDisplay!=list){ if (Settings.gameDisplay!=list){/*
if (Settings.gameDisplay==grid) { if (Settings.gameDisplay==grid) {
mainWindow->Remove(&gameGrid); mainWindow->Remove(&gameGrid);
gridBtn.SetImage(&gridBtnImg_g); gridBtn.SetImage(&gridBtnImg_g);
@ -829,8 +848,13 @@ static int MenuDiscList()
} }
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
*/
Settings.gameDisplay=list; Settings.gameDisplay=list;
gameBrowser.Reload(gameList, gameCnt); // initialize before append menu = MENU_DISCLIST;
listBtn.ResetState();
break;
} else {
/*gameBrowser.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameBrowser); mainWindow->Append(&gameBrowser);
mainWindow->Append(&w); mainWindow->Append(&w);
ResumeGui(); ResumeGui();
@ -870,11 +894,14 @@ static int MenuDiscList()
cfg_save_global(); cfg_save_global();
} }
} }
*/
listBtn.ResetState(); listBtn.ResetState();
}
} }
else if (gridBtn.GetState() == STATE_CLICKED) { else if (gridBtn.GetState() == STATE_CLICKED) {
if (Settings.gameDisplay!=grid){ if (Settings.gameDisplay!=grid){
/*
if (Settings.gameDisplay==list) { if (Settings.gameDisplay==list) {
mainWindow->Remove(&gameBrowser); mainWindow->Remove(&gameBrowser);
if (GameIDTxt) w.Remove(GameIDTxt); if (GameIDTxt) w.Remove(GameIDTxt);
@ -892,7 +919,13 @@ static int MenuDiscList()
} }
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
*/
Settings.gameDisplay=grid; Settings.gameDisplay=grid;
menu = MENU_DISCLIST;
gridBtn.ResetState();
break;
} else {
/*
gameGrid.Reload(gameList, gameCnt); // initialize before append gameGrid.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameGrid); mainWindow->Append(&gameGrid);
mainWindow->Append(&w); mainWindow->Append(&w);
@ -931,12 +964,14 @@ static int MenuDiscList()
if(isSdInserted()) { if(isSdInserted()) {
cfg_save_global(); cfg_save_global();
} }
} }*/
gridBtn.ResetState(); gridBtn.ResetState();
} }
}
else if (carouselBtn.GetState() == STATE_CLICKED) { else if (carouselBtn.GetState() == STATE_CLICKED) {
if (Settings.gameDisplay!=carousel) { if (Settings.gameDisplay!=carousel) {
/*
if (Settings.gameDisplay==list) if (Settings.gameDisplay==list)
mainWindow->Remove(&gameBrowser); mainWindow->Remove(&gameBrowser);
if (GameIDTxt) w.Remove(GameIDTxt); if (GameIDTxt) w.Remove(GameIDTxt);
@ -952,7 +987,13 @@ static int MenuDiscList()
gridBtn.SetAlpha(180); gridBtn.SetAlpha(180);
HaltGui(); HaltGui();
mainWindow->Remove(&w); mainWindow->Remove(&w);
*/
Settings.gameDisplay=carousel; Settings.gameDisplay=carousel;
menu = MENU_DISCLIST;
carouselBtn.ResetState();
break;
} else {
/*
gameCarousel.Reload(gameList, gameCnt); // initialize before append gameCarousel.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameCarousel); mainWindow->Append(&gameCarousel);
mainWindow->Append(&w); mainWindow->Append(&w);
@ -992,19 +1033,21 @@ static int MenuDiscList()
cfg_save_global(); cfg_save_global();
} }
} }
*/
carouselBtn.ResetState(); carouselBtn.ResetState();
}
} }
if (Settings.gameDisplay==grid){ if (Settings.gameDisplay==grid){
int selectimg; int selectimg;
selectimg = gameGrid.GetSelectedOption(); selectimg = gameGrid->GetSelectedOption();
gameSelected = gameGrid.GetClickedOption(); gameSelected = gameGrid->GetClickedOption();
} }
if (Settings.gameDisplay==carousel){ if (Settings.gameDisplay==carousel){
int selectimg; int selectimg;
selectimg = gameCarousel.GetSelectedOption(); selectimg = gameCarousel->GetSelectedOption();
gameSelected = gameCarousel.GetClickedOption(); gameSelected = gameCarousel->GetClickedOption();
} }
if (Settings.gameDisplay==list) { if (Settings.gameDisplay==list) {
@ -1012,8 +1055,8 @@ static int MenuDiscList()
int selectimg;//, promptnumber; int selectimg;//, promptnumber;
char ID[4]; char ID[4];
char IDfull[7]; char IDfull[7];
selectimg = gameBrowser.GetSelectedOption(); selectimg = gameBrowser->GetSelectedOption();
gameSelected = gameBrowser.GetClickedOption(); gameSelected = gameBrowser->GetClickedOption();
if (gameSelected > 0) //if click occured if (gameSelected > 0) //if click occured
@ -1328,16 +1371,16 @@ static int MenuDiscList()
{ {
wiilight(0); wiilight(0);
HaltGui(); HaltGui();
if (Settings.gameDisplay==list) mainWindow->Remove(&gameBrowser); if (Settings.gameDisplay==list) mainWindow->Remove(gameBrowser);
else if (Settings.gameDisplay==grid) mainWindow->Remove(&gameGrid); else if (Settings.gameDisplay==grid) mainWindow->Remove(gameGrid);
else if (Settings.gameDisplay==carousel) mainWindow->Remove(&gameCarousel); else if (Settings.gameDisplay==carousel) mainWindow->Remove(gameCarousel);
mainWindow->Remove(&w); mainWindow->Remove(&w);
ResumeGui(); ResumeGui();
int settret = GameSettings(header); int settret = GameSettings(header);
HaltGui(); HaltGui();
if (Settings.gameDisplay==list) mainWindow->Append(&gameBrowser); if (Settings.gameDisplay==list) mainWindow->Append(gameBrowser);
else if (Settings.gameDisplay==grid) mainWindow->Append(&gameGrid); else if (Settings.gameDisplay==grid) mainWindow->Append(gameGrid);
else if (Settings.gameDisplay==carousel) mainWindow->Append(&gameCarousel); else if (Settings.gameDisplay==carousel) mainWindow->Append(gameCarousel);
mainWindow->Append(&w); mainWindow->Append(&w);
ResumeGui(); ResumeGui();
if (settret == 1) //if deleted if (settret == 1) //if deleted
@ -1365,18 +1408,22 @@ static int MenuDiscList()
else if(choice == 0) else if(choice == 0)
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser->SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid->SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} else if (Settings.gameDisplay==carousel){gameCarousel->SetFocus(1);}
} }
} }
} }
HaltGui(); HaltGui();
if (Settings.gameDisplay==list)mainWindow->Remove(&gameBrowser); mainWindow->RemoveAll();
else if (Settings.gameDisplay==grid)mainWindow->Remove(&gameGrid); mainWindow->Append(bgImg);
else if (Settings.gameDisplay==carousel)mainWindow->Remove(&gameCarousel); delete gameBrowser;
mainWindow->Remove(&w); gameBrowser = NULL;
delete gameGrid;
gameGrid = NULL;
delete gameCarousel;
gameCarousel = NULL;
ResumeGui(); ResumeGui();
return menu; return menu;
} }