**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

@ -50,7 +50,8 @@ u8 viChoice = 0;
u8 iosChoice = 0; u8 iosChoice = 0;
u8 parentalcontrolChoice = 0; u8 parentalcontrolChoice = 0;
u8 xflip = 0; u8 xflip = 0;
u8 sort = 0; u8 sort = 0;
u8 fave = 0;
u8 qboot = 0; u8 qboot = 0;
u8 wsprompt = 0; u8 wsprompt = 0;
u8 keyset = 0; u8 keyset = 0;
@ -765,7 +766,13 @@ void global_cfg_set(char *name, char *val)
} }
return; 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) { else if (strcmp(name, "keyset") == 0) {
int i; int i;
if (sscanf(val, "%d", &i) == 1) { if (sscanf(val, "%d", &i) == 1) {
@ -1038,7 +1045,8 @@ bool cfg_save_global()// save global settings
fprintf(f, "volume = %d\n ", Settings.volume); fprintf(f, "volume = %d\n ", Settings.volume);
fprintf(f, "tooltips = %d\n ", Settings.tooltips); fprintf(f, "tooltips = %d\n ", Settings.tooltips);
fprintf(f, "password = %s\n ", Settings.unlockCode); fprintf(f, "password = %s\n ", Settings.unlockCode);
fprintf(f, "sort = %d\n ", Settings.sort); fprintf(f, "sort = %d\n ", Settings.sort);
fprintf(f, "fave = %d\n ", Settings.fave);
fprintf(f, "cios = %d\n ", Settings.cios); fprintf(f, "cios = %d\n ", Settings.cios);
fprintf(f, "keyset = %d\n ", Settings.keyset); fprintf(f, "keyset = %d\n ", Settings.keyset);
fprintf(f, "xflip = %d\n ", Settings.xflip); fprintf(f, "xflip = %d\n ", Settings.xflip);

View File

@ -144,7 +144,6 @@ struct THEME
extern struct CFG CFG; extern struct CFG CFG;
extern struct THEME THEME; extern struct THEME THEME;
extern u8 ocarinaChoice; extern u8 ocarinaChoice;
extern u8 sort;
extern u16 playcnt; extern u16 playcnt;
extern u8 videoChoice; extern u8 videoChoice;
extern u8 languageChoice; extern u8 languageChoice;
@ -154,7 +153,8 @@ extern u8 faveChoice;
extern u8 parentalcontrolChoice; extern u8 parentalcontrolChoice;
extern u8 xflip; extern u8 xflip;
extern u8 qboot; extern u8 qboot;
extern u8 sort; extern u8 sort;
extern u8 fave;
extern u8 wsprompt; extern u8 wsprompt;
extern u8 keyset; extern u8 keyset;
@ -239,7 +239,6 @@ enum {
}; };
enum { enum {
all, all,
fave,
pcount, pcount,
}; };
@ -288,25 +287,26 @@ enum {
};*/ };*/
struct SSettings { struct SSettings {
int video; int video;
int language; int language;
int ocarina; int ocarina;
int vpatch; int vpatch;
int ios; int ios;
int sinfo; int sinfo;
int hddinfo; int hddinfo;
int rumble; int rumble;
int xflip; int xflip;
int volume; int volume;
int tooltips; int tooltips;
char unlockCode[20]; char unlockCode[20];
int parentalcontrol; int parentalcontrol;
int cios; int cios;
int qboot; int qboot;
int wsprompt; int wsprompt;
int keyset; int keyset;
int unicodefix; int unicodefix;
int sort; int sort;
int fave;
}; };
void CFG_LoadGlobal(void); void CFG_LoadGlobal(void);

View File

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