*Better fix for zero entries (fixes teh problem instead of avoiding it)

*Moved a button
This commit is contained in:
DRayX7 2009-05-21 18:26:01 +00:00
parent 4cb00becda
commit 59905d623d
2 changed files with 27 additions and 27 deletions

View File

@ -643,24 +643,16 @@ void GuiGameBrowser::Update(GuiTrigger * t)
if(updateCB) if(updateCB)
updateCB(this); updateCB(this);
} }
void GuiGameBrowser::Reload(struct discHdr * l, int count) void GuiGameBrowser::Reload(struct discHdr * l, int count)
{ {
LOCK(this); LOCK(this);
gameList = l; gameList = l;
gameCnt = count; gameCnt = count;
if (gameCnt == 0) { scrollbaron = (gameCnt > THEME.pagesize) ? 1 : 0;
focus = 0; pagesize = (gameCnt > THEME.pagesize) ? THEME.pagesize : gameCnt;
dontsetfocus = 1; selectedItem = 0;
} else {
dontsetfocus = 0;
focus = 1;
selectedItem = 0;
}
gameList = l;
scrollbaron = (gameCnt > THEME.pagesize) ? 1 : 0;
pagesize = (gameCnt > THEME.pagesize) ? THEME.pagesize : gameCnt;
listOffset = 0; listOffset = 0;
for(int i=0; i<pagesize; i++) for(int i=0; i<pagesize; i++)

View File

@ -772,7 +772,7 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label,
GuiButton closeBtn(close.GetWidth(), close.GetHeight()); GuiButton closeBtn(close.GetWidth(), close.GetHeight());
closeBtn.SetImage(&closeImg); closeBtn.SetImage(&closeImg);
closeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); closeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
closeBtn.SetPosition(220,48); closeBtn.SetPosition(205,40);
closeBtn.SetLabel(&closeTxt); closeBtn.SetLabel(&closeTxt);
closeBtn.SetRumble(false); closeBtn.SetRumble(false);
closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
@ -2407,36 +2407,44 @@ s32 __Menu_GetEntries(void)
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr)); memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
cnt2++; cnt2++;
} }
}
if (buffer2) {
free(buffer);
buffer = buffer2;
buffer2 = NULL;
} else {
memset(buffer, 0, len);
} }
free(buffer);
buffer = buffer2;
buffer2 = NULL;
cnt = cnt2; cnt = cnt2;
} }
if (CFG.parentalcontrol && !CFG.godmode) if (CFG.parentalcontrol && !CFG.godmode)
{ {
u32 cnt2 = 0; u32 cnt3 = 0;
for (u32 i = 0; i < cnt; i++) for (u32 i = 0; i < cnt; i++)
{ {
if (get_block(header) < CFG.parentalcontrol) if (get_block(header) < CFG.parentalcontrol)
{ {
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr)); buffer2 = (discHdr *) realloc(buffer2, (cnt3+1) * sizeof(struct discHdr));
if (!buffer2) if (!buffer2)
{ {
free(buffer); free(buffer);
return -1; return -1;
} }
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr)); memcpy((buffer2 + cnt3), (buffer + i), sizeof(struct discHdr));
cnt2++; cnt3++;
} }
}
if (buffer2) {
free(buffer);
buffer = buffer2;
buffer2 = NULL;
} else {
memset(buffer, 0, len);
} }
free(buffer); cnt = cnt3;
buffer = buffer2;
buffer2 = NULL;
cnt = cnt2;
} }
if (Settings.sort==pcount) { if (Settings.sort==pcount) {