*Fix of favorite crash with zero entries.

*Added some missing languages.
This commit is contained in:
dimok321 2009-05-21 18:13:37 +00:00
parent 63fb18d87f
commit 4cb00becda
6 changed files with 50 additions and 109 deletions

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,7 @@ snprintf(LANGUAGE.Cantbeformated, sizeof(LANGUAGE.Cantbeformated), "Can't be for
snprintf(LANGUAGE.Cantdelete, sizeof(LANGUAGE.Cantdelete), "Can't delete:");
snprintf(LANGUAGE.ClicktoDownloadCovers, sizeof(LANGUAGE.ClicktoDownloadCovers), "Click to Download Covers");
snprintf(LANGUAGE.Clock, sizeof(LANGUAGE.Clock), "Clock");
snprintf(LANGUAGE.Close, sizeof(LANGUAGE.Close), "Close");
snprintf(LANGUAGE.Continueinstallgame, sizeof(LANGUAGE.Continueinstallgame), "Continue to install game?");
snprintf(LANGUAGE.ConsoleDefault, sizeof(LANGUAGE.ConsoleDefault), "Console Default");
snprintf(LANGUAGE.Consoleshouldbeunlockedtomodifyit, sizeof(LANGUAGE.Consoleshouldbeunlockedtomodifyit), "Console should be unlocked to modify it.");
@ -78,6 +79,7 @@ snprintf(LANGUAGE.DownloadBoxartimage, sizeof(LANGUAGE.DownloadBoxartimage), "Do
snprintf(LANGUAGE.Downloadfinished, sizeof(LANGUAGE.Downloadfinished), "Download finished");
snprintf(LANGUAGE.Error, sizeof(LANGUAGE.Error), "Error !");
snprintf(LANGUAGE.hour, sizeof(LANGUAGE.hour), "Hour");
snprintf(LANGUAGE.Homemenu, sizeof(LANGUAGE.Homemenu), "HOME Menu");
snprintf(LANGUAGE.BOOTERROR, sizeof(LANGUAGE.BOOTERROR), "BOOT ERROR");
snprintf(LANGUAGE.ErrorreadingDisc, sizeof(LANGUAGE.ErrorreadingDisc), "Error reading Disc");
snprintf(LANGUAGE.ExitUSBISOLoader, sizeof(LANGUAGE.ExitUSBISOLoader), "Exit USB Loader GX?");
@ -317,6 +319,10 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.Clock, val, sizeof(LANGUAGE.Clock));
return;
}
if (strcmp(name, "Close") == 0) {
strcopy(LANGUAGE.Close, val, sizeof(LANGUAGE.Close));
return;
}
if (strcmp(name, "Continueinstallgame") == 0) {
strcopy(LANGUAGE.Continueinstallgame, val, sizeof(LANGUAGE.Continueinstallgame));
return;
@ -581,6 +587,10 @@ void language_set(char *name, char *val)
strcopy(LANGUAGE.GotoPage, val, sizeof(LANGUAGE.GotoPage));
return;
}
if (strcmp(name, "Homemenu") == 0) {
strcopy(LANGUAGE.Homemenu, val, sizeof(LANGUAGE.Homemenu));
return;
}
if (strcmp(name, "HowtoShutdown") == 0) {
strcopy(LANGUAGE.HowtoShutdown, val, sizeof(LANGUAGE.HowtoShutdown));
return;

View File

@ -13,11 +13,11 @@ struct LANGUAGE
{
char t3Covers[50];
char addToFavorite[20];
char all[10];
char addToFavorite[50];
char all[30];
char AppLanguage[50];
char Areyousure[50];
char AutoPatch[20];
char AutoPatch[30];
char Back[20];
char Backgroundmusic[80];
char Backgroundmusicpath[100];
@ -25,13 +25,14 @@ struct LANGUAGE
char BacktoLoader[50];
char BacktoWiiMenu[50];
char BootStandard[50];
char Both[15];
char Both[35];
char Cantcreatedirectory[50];
char Cancel[20];
char Cantbeformated[50];
char Cantdelete[50];
char ClicktoDownloadCovers[50];
char Clock[20];
char Close[20];
char Continueinstallgame[50];
char ConsoleDefault[50];
char Consoleshouldbeunlockedtomodifyit[100];
@ -97,13 +98,14 @@ struct LANGUAGE
char GoBack[50];
char GotoPage[50];///////
char HowtoShutdown[50];
char hour[10];
char Homemenu[30];
char hour[30];
char keyboard[50];
char Language[50];
char Langchange[50];
char Left[50];
char LikeSysMenu[50];
char ListSort[20];
char ListSort[30];
char LoadingincIOS[50];
char Loadingstandardlanguage[80];
char Loadingstandardmusic[80];

View File

@ -392,6 +392,7 @@ class GuiElement
//int position2; //! B Scrollbariable
bool visible; //!< Visibility of the element. If false, Draw() is skipped
int focus; //!< Element focus (-1 = focus disabled, 0 = not focused, 1 = focused)
int dontsetfocus; //!<If 0 games dont set the focus
int width; //!< Element width
int height; //!< Element height
int xoffset; //!< Element X offset

View File

@ -26,15 +26,22 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co
{
width = w;
height = h;
if (gameCnt == 0) gameCnt = 1;
if (gameCnt == 0) {
focus = 0;
dontsetfocus = 1;
} else {
gameList = l;
dontsetfocus = 0;
focus = 1;
}
this->gameCnt = gameCnt;
gameList = l;
pagesize = (gameCnt > THEME.pagesize) ? THEME.pagesize : gameCnt;
scrollbaron = (gameCnt > THEME.pagesize) ? 1 : 0;
selectable = true;
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
selectedItem = selected - offset;
focus = 1; // allow focus
// allow focus
char imgPath[100];
trigA = new GuiTrigger;
@ -204,6 +211,7 @@ GuiGameBrowser::~GuiGameBrowser()
void GuiGameBrowser::SetFocus(int f)
{
LOCK(this);
if(!dontsetfocus)
focus = f;
for(int i=0; i<pagesize; i++)
@ -373,7 +381,7 @@ void GuiGameBrowser::Update(GuiTrigger * t)
game[i]->SetState(STATE_DISABLED);
}
if(focus)
if(focus || !dontsetfocus)
{
if(i != selectedItem && game[i]->GetState() == STATE_SELECTED)
game[i]->ResetState();
@ -390,7 +398,7 @@ void GuiGameBrowser::Update(GuiTrigger * t)
}
// pad/joystick navigation
if(!focus)
if(!focus || dontsetfocus)
return; // skip navigation
if (scrollbaron == 1) {
@ -642,10 +650,17 @@ void GuiGameBrowser::Reload(struct discHdr * l, int count)
LOCK(this);
gameList = l;
gameCnt = count;
if (gameCnt == 0) gameCnt = 1;
if (gameCnt == 0) {
focus = 0;
dontsetfocus = 1;
} else {
dontsetfocus = 0;
focus = 1;
selectedItem = 0;
}
gameList = l;
scrollbaron = (gameCnt > THEME.pagesize) ? 1 : 0;
pagesize = (gameCnt > THEME.pagesize) ? THEME.pagesize : gameCnt;
selectedItem = 0;
listOffset = 0;
for(int i=0; i<pagesize; i++)

View File

@ -759,12 +759,12 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiTrigger trigHome;
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
GuiText titleTxt("HOME Menu", 36, (GXColor){255, 255, 255, 255});
GuiText titleTxt(LANGUAGE.Homemenu, 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(" Close", 28, (GXColor){0, 0, 0, 255});
GuiText closeTxt(LANGUAGE.Close, 28, (GXColor){0, 0, 0, 255});
GuiImage closeImg(&close);
if (Settings.wsprompt == yes){
closeTxt.SetWidescreen(CFG.widescreen);
@ -772,7 +772,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiButton closeBtn(close.GetWidth(), close.GetHeight());
closeBtn.SetImage(&closeImg);
closeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
closeBtn.SetPosition(205,42);
closeBtn.SetPosition(220,48);
closeBtn.SetLabel(&closeTxt);
closeBtn.SetRumble(false);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
@ -1358,7 +1358,7 @@ int GameWindowPrompt()
}
}
////////////end save play count//////////////
choice = 1;
SDCard_deInit();
}
@ -2344,7 +2344,7 @@ s32 __Menu_EntryCmpCount(const void *a, const void *b)
ret = (s32) (count2-count1);
if (ret == 0) return stricmp(get_title(hdr1), get_title(hdr2));
return ret;
}
@ -2353,7 +2353,7 @@ s32 __Menu_EntryCmpCount(const void *a, const void *b)
***************************************************************************/
s32 __Menu_GetEntries(void)
{
{
struct discHdr *buffer = NULL;
struct discHdr *buffer2 = NULL;
struct discHdr *header = NULL;
@ -2383,7 +2383,7 @@ s32 __Menu_GetEntries(void)
if(buffer) free(buffer);
return ret;
}
/* Filters */
if (Settings.sort==fave || dispFave) {
u32 cnt2 = 0;
@ -2412,7 +2412,7 @@ s32 __Menu_GetEntries(void)
buffer = buffer2;
buffer2 = NULL;
cnt = cnt2;
}
}
if (CFG.parentalcontrol && !CFG.godmode)
{
@ -2585,61 +2585,9 @@ static int MenuInstall()
snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path);
GuiImageData batteryBar(imgPath, battery_bar_png);
#ifdef HW_RVL
int i = 0, level;
char txt[3];
GuiText * batteryTxt[4];
GuiImage * batteryImg[4];
GuiImage * batteryBarImg[4];
GuiButton * batteryBtn[4];
for(i=0; i < 4; i++)
{
if(i == 0)
sprintf(txt, "P%d", i+1);
else
sprintf(txt, "P%d", i+1);
batteryTxt[i] = new GuiText(txt, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
batteryTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
batteryImg[i] = new GuiImage(&battery);
batteryImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
batteryImg[i]->SetPosition(36, 0);
batteryImg[i]->SetTile(0);
batteryBarImg[i] = new GuiImage(&batteryBar);
batteryBarImg[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
batteryBarImg[i]->SetPosition(33, 0);
batteryBtn[i] = new GuiButton(40, 20);
batteryBtn[i]->SetLabel(batteryTxt[i]);
batteryBtn[i]->SetImage(batteryBarImg[i]);
batteryBtn[i]->SetIcon(batteryImg[i]);
batteryBtn[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
batteryBtn[i]->SetRumble(false);
batteryBtn[i]->SetAlpha(70);
}
batteryBtn[0]->SetPosition(THEME.battery1_x, THEME.battery1_y);
batteryBtn[1]->SetPosition(THEME.battery2_x, THEME.battery2_y);
batteryBtn[2]->SetPosition(THEME.battery3_x, THEME.battery3_y);
batteryBtn[3]->SetPosition(THEME.battery4_x, THEME.battery4_y);
#endif
HaltGui();
GuiWindow w(screenwidth, screenheight);
if (THEME.showBattery)
{
#ifdef HW_RVL
w.Append(batteryBtn[0]);
w.Append(batteryBtn[1]);
w.Append(batteryBtn[2]);
w.Append(batteryBtn[3]);
#endif
}
mainWindow->Append(&w);
ResumeGui();
@ -2648,31 +2596,6 @@ static int MenuInstall()
{
VIDEO_WaitVSync ();
#ifdef HW_RVL
for(i=0; i < 4; i++)
{
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE) // controller connected
{
level = (userInput[i].wpad.battery_level / 100.0) * 4;
if(level > 4) level = 4;
batteryImg[i]->SetTile(level);
if(level == 0)
batteryBarImg[i]->SetImage(&batteryRed);
else
batteryBarImg[i]->SetImage(&batteryBar);
batteryBtn[i]->SetAlpha(255);
}
else // controller not connected
{
batteryImg[i]->SetTile(0);
batteryImg[i]->SetImage(&battery);
batteryBtn[i]->SetAlpha(70);
}
}
#endif
ret = DiscWait(LANGUAGE.InsertDisk,LANGUAGE.Waiting,LANGUAGE.Cancel,0,0);
if (ret < 0) {
WindowPrompt (LANGUAGE.ErrorreadingDisc,0,LANGUAGE.Back,0,0,0);
@ -2792,16 +2715,6 @@ static int MenuInstall()
HaltGui();
#ifdef HW_RVL
for(i=0; i < 4; i++)
{
delete batteryTxt[i];
delete batteryImg[i];
delete batteryBarImg[i];
delete batteryBtn[i];
}
#endif
mainWindow->Remove(&w);
ResumeGui();
return menu;