**Changes:

*Seperated the functionality of show favorites and sorting (so you can show only favorites and sort however you want).
*Fixed some bugs with sorting.

**Known Bugs:
*If the loader is started with show favorites on, and it is then turned off, it code dumps (if you have less than 10 games favorited).
*If you change the favorite status of a game it resets the play count.
Please do not create issues about these, they will be fixed soon.

**Note:
*There is a new libogc package in the downloads section, you don't have to update, but it is recommended.
This commit is contained in:
DRayX7 2009-05-22 17:51:28 +00:00
parent 2f1e1dfd77
commit 94cac74a3a
3 changed files with 63 additions and 64 deletions

View File

@ -51,6 +51,7 @@ u8 iosChoice = 0;
u8 parentalcontrolChoice = 0;
u8 xflip = 0;
u8 sort = 0;
u8 fave = 0;
u8 qboot = 0;
u8 wsprompt = 0;
u8 keyset = 0;
@ -765,7 +766,13 @@ void global_cfg_set(char *name, char *val)
}
return;
}
else if (strcmp(name, "fave") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
Settings.fave = i;
}
return;
}
else if (strcmp(name, "keyset") == 0) {
int i;
if (sscanf(val, "%d", &i) == 1) {
@ -1039,6 +1046,7 @@ bool cfg_save_global()// save global settings
fprintf(f, "tooltips = %d\n ", Settings.tooltips);
fprintf(f, "password = %s\n ", Settings.unlockCode);
fprintf(f, "sort = %d\n ", Settings.sort);
fprintf(f, "fave = %d\n ", Settings.fave);
fprintf(f, "cios = %d\n ", Settings.cios);
fprintf(f, "keyset = %d\n ", Settings.keyset);
fprintf(f, "xflip = %d\n ", Settings.xflip);

View File

@ -144,7 +144,6 @@ struct THEME
extern struct CFG CFG;
extern struct THEME THEME;
extern u8 ocarinaChoice;
extern u8 sort;
extern u16 playcnt;
extern u8 videoChoice;
extern u8 languageChoice;
@ -155,6 +154,7 @@ extern u8 parentalcontrolChoice;
extern u8 xflip;
extern u8 qboot;
extern u8 sort;
extern u8 fave;
extern u8 wsprompt;
extern u8 keyset;
@ -239,7 +239,6 @@ enum {
};
enum {
all,
fave,
pcount,
};
@ -307,6 +306,7 @@ struct SSettings {
int keyset;
int unicodefix;
int sort;
int fave;
};
void CFG_LoadGlobal(void);

View File

@ -1367,9 +1367,11 @@ int GameWindowPrompt()
faveChoice = !faveChoice;
btnFavoriteImg.SetImage(faveChoice ? &imgFavorite : &imgNotFavorite);
extern u8 favorite;
extern u8 count;
struct Game_NUM* game_num = CFG_get_game_num(header->id);
if (game_num) {
favorite = game_num->favorite;
count = game_num->count;
}
favorite = faveChoice;
CFG_save_game_num(header->id);
@ -2367,7 +2369,7 @@ s32 __Menu_GetEntries(void)
}
/* Filters */
if (Settings.sort==fave || dispFave) {
if (Settings.fave) {
u32 cnt2 = 0;
for (u32 i = 0; i < cnt; i++)
@ -2909,7 +2911,6 @@ static int MenuDiscList()
wiiBtn.SetSoundClick(&btnClick);
wiiBtn.SetTrigger(&trigA);
//GuiImage favoriteBtnImg((Settings.sort==fave) ? &imgFavoriteOn : &imgFavoriteOff);;
GuiImage favoriteBtnImg(&imgfavIcon);
favoriteBtnImg.SetWidescreen(CFG.widescreen);
GuiButton favoriteBtn(imgfavIcon.GetWidth(), imgfavIcon.GetHeight());
@ -2926,7 +2927,7 @@ static int MenuDiscList()
abcBtnImg.SetWidescreen(CFG.widescreen);
GuiButton abcBtn(abcBtnImg.GetWidth(), abcBtnImg.GetHeight());
abcBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);//(ALIGN_CENTRE, ALIGN_MIDDLE);
abcBtn.SetPosition(-40, 15);
abcBtn.SetPosition(-30, 15);
abcBtn.SetImage(&abcBtnImg);
abcBtn.SetSoundOver(&btnSoundOver);
abcBtn.SetSoundClick(&btnClick);
@ -2939,7 +2940,7 @@ static int MenuDiscList()
countBtnImg.SetWidescreen(CFG.widescreen);
GuiButton countBtn(countBtnImg.GetWidth(), countBtnImg.GetHeight());
countBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);//(ALIGN_CENTRE, ALIGN_MIDDLE);
countBtn.SetPosition(0, 15);
countBtn.SetPosition(10, 15);
countBtn.SetImage(&countBtnImg);
countBtn.SetSoundOver(&btnSoundOver);
countBtn.SetSoundClick(&btnClick);
@ -2947,8 +2948,8 @@ static int MenuDiscList()
countBtn.SetEffectGrow();
countBtn.SetAlpha(70);
if (Settings.sort==fave)favoriteBtn.SetAlpha(255);
else if (Settings.sort==all)abcBtn.SetAlpha(255);
if (Settings.fave)favoriteBtn.SetAlpha(255);
if (Settings.sort==all)abcBtn.SetAlpha(255);
else if (Settings.sort==pcount)countBtn.SetAlpha(255);
//Downloading Covers
@ -3212,8 +3213,7 @@ static int MenuDiscList()
else if(favoriteBtn.GetState() == STATE_CLICKED)
{
//dispFave = !dispFave;
Settings.sort=fave;
Settings.fave=!Settings.fave;
if(isSdInserted() == 1) {
cfg_save_global();
}
@ -3222,50 +3222,41 @@ static int MenuDiscList()
sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt);
gamecntTxt.SetText(GamesCnt);
selectedold = 1;
//favoriteBtnImg.SetImage((Settings.sort==fave) ? &imgFavoriteOn : &imgFavoriteOff);
favoriteBtn.ResetState();
favoriteBtn.SetAlpha(255);
abcBtn.SetAlpha(70);
countBtn.SetAlpha(70);
favoriteBtn.SetAlpha(Settings.fave ? 255 : 70);
}
else if(abcBtn.GetState() == STATE_CLICKED)
{
//dispFave = !dispFave;
if(Settings.sort != all) {
Settings.sort=all;
if(isSdInserted() == 1) {
cfg_save_global();
}
__Menu_GetEntries();
gameBrowser.Reload(gameList, gameCnt);
sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt);
gamecntTxt.SetText(GamesCnt);
selectedold = 1;
//favoriteBtnImg.SetImage((Settings.sort==fave) ? &imgFavoriteOn : &imgFavoriteOff);
abcBtn.ResetState();
favoriteBtn.SetAlpha(70);
abcBtn.SetAlpha(255);
countBtn.SetAlpha(70);
}
abcBtn.ResetState();
}
else if(countBtn.GetState() == STATE_CLICKED)
{
//dispFave = !dispFave;
if(Settings.sort != pcount) {
Settings.sort=pcount;
if(isSdInserted() == 1) {
cfg_save_global();
}
Settings.sort=pcount;
__Menu_GetEntries();
gameBrowser.Reload(gameList, gameCnt);
sprintf(GamesCnt,"%s: %i",LANGUAGE.Games, gameCnt);
gamecntTxt.SetText(GamesCnt);
selectedold = 1;
//favoriteBtnImg.SetImage((Settings.sort==fave) ? &imgFavoriteOn : &imgFavoriteOff);
countBtn.ResetState();
favoriteBtn.SetAlpha(70);
abcBtn.SetAlpha(70);
countBtn.SetAlpha(255);
}
countBtn.ResetState();
}
//Get selected game under cursor
int selectimg;//, promptnumber;