mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-19 17:59:16 +01:00
*Some fixes and cleanups for the GRID (still has a lot of issues dont make new issues about it. going to go on fixing later)
This commit is contained in:
parent
94df404175
commit
305dc85fc3
File diff suppressed because one or more lines are too long
@ -31,13 +31,13 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
|
|||||||
this->gameCnt = gameCnt;
|
this->gameCnt = gameCnt;
|
||||||
gameList = l;
|
gameList = l;
|
||||||
pagesize = 8;
|
pagesize = 8;
|
||||||
|
changed = 0;
|
||||||
scrollbaron = (gameCnt > pagesize) ? 1 : 0;
|
scrollbaron = (gameCnt > pagesize) ? 1 : 0;
|
||||||
selectable = true;
|
selectable = true;
|
||||||
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
|
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
|
||||||
selectedItem = selected - offset;
|
selectedItem = selected - offset;
|
||||||
focus = 1; // allow focus
|
focus = 1; // allow focus
|
||||||
char imgPath[100];
|
char imgPath[100];
|
||||||
tooMuch=(gameCnt-(gameCnt%8));
|
|
||||||
|
|
||||||
trigA = new GuiTrigger;
|
trigA = new GuiTrigger;
|
||||||
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
@ -60,8 +60,6 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
|
|||||||
|
|
||||||
btnLeftImg = new GuiImage(imgLeft);
|
btnLeftImg = new GuiImage(imgLeft);
|
||||||
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
btnLeft = new GuiButton(imgLeft->GetWidth(), imgLeft->GetHeight());
|
||||||
//GuiImage btnLeftImg(&imgLeft);
|
|
||||||
//GuiButton btnLeft(imgLeft.GetWidth(), imgLeft.GetHeight());
|
|
||||||
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
btnLeft->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
btnLeft->SetPosition(20, -30);
|
btnLeft->SetPosition(20, -30);
|
||||||
btnLeft->SetParent(this);
|
btnLeft->SetParent(this);
|
||||||
@ -74,7 +72,6 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
|
|||||||
|
|
||||||
btnRightImg = new GuiImage(imgRight);
|
btnRightImg = new GuiImage(imgRight);
|
||||||
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
btnRight = new GuiButton(imgRight->GetWidth(), imgRight->GetHeight());
|
||||||
//GuiButton btnRight(imgRight.GetWidth(), imgRight.GetHeight());
|
|
||||||
btnRight->SetParent(this);
|
btnRight->SetParent(this);
|
||||||
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
btnRight->SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||||
btnRight->SetPosition(-20, -30);
|
btnRight->SetPosition(-20, -30);
|
||||||
@ -87,91 +84,55 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
|
|||||||
|
|
||||||
gameIndex = new int[pagesize];
|
gameIndex = new int[pagesize];
|
||||||
game = new GuiButton * [pagesize];
|
game = new GuiButton * [pagesize];
|
||||||
//gameTxt = new GuiText * [pagesize];
|
|
||||||
//gameBg = new GuiImage * [pagesize];
|
|
||||||
coverImg = new GuiImage * [pagesize];
|
coverImg = new GuiImage * [pagesize];
|
||||||
cover = new GuiImageData * [pagesize];
|
cover = new GuiImageData * [pagesize];
|
||||||
|
|
||||||
//char buffer[THEME.maxcharacters + 4];
|
|
||||||
char ID[4];
|
char ID[4];
|
||||||
char IDfull[7];
|
char IDfull[7];
|
||||||
|
|
||||||
for(int i=0; i < pagesize; i++)
|
for(int i=0; i < pagesize; i++)
|
||||||
{
|
{
|
||||||
/*if (strlen(get_title(&gameList[i])) < (u32)(THEME.maxcharacters + 3))
|
|
||||||
{
|
|
||||||
sprintf(buffer, "%s", get_title(&gameList[i]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(buffer, get_title(&gameList[i]), THEME.maxcharacters);
|
|
||||||
buffer[THEME.maxcharacters] = '\0';
|
|
||||||
strncat(buffer, "...", 3);
|
|
||||||
}
|
|
||||||
*/////////////////////////////////////////////////
|
|
||||||
|
|
||||||
struct discHdr *header = &gameList[i];
|
struct discHdr *header = &gameList[i];
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
//w.Remove(&DownloadBtn);
|
|
||||||
|
|
||||||
//load game cover
|
|
||||||
//if (cover)
|
|
||||||
//{
|
|
||||||
// delete cover;
|
|
||||||
// cover = NULL;
|
|
||||||
//}
|
|
||||||
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
||||||
cover[i] = new GuiImageData(imgPath,0); //load short id
|
cover[i] = new GuiImageData(imgPath,0); //load short id
|
||||||
if (!cover[i]->GetImage()) //if could not load the short id image
|
if (!cover[i]->GetImage()) //if could not load the short id image
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
||||||
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
||||||
if (!cover[i]->GetImage())
|
if (!cover[i]->GetImage())
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
||||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (coverImg)
|
|
||||||
//{
|
|
||||||
// delete coverImg;
|
|
||||||
// coverImg = NULL;
|
|
||||||
//}
|
|
||||||
coverImg[i] = new GuiImage(cover[i]);
|
coverImg[i] = new GuiImage(cover[i]);
|
||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetScale(0.6);
|
coverImg[i]->SetScale(0.6);
|
||||||
|
|
||||||
//DownloadBtn.SetImage(coverImg);// put the new image on the download button
|
|
||||||
//w.Append(&DownloadBtn);
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
|
|
||||||
//gameTxt[i] = new GuiText(buffer, 20, (GXColor){THEME.gameText_r, THEME.gameText_g, THEME.gameText_b, 0xff});
|
|
||||||
//gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
|
||||||
//gameTxt[i]->SetPosition(24,0);
|
|
||||||
|
|
||||||
//gameBg[i] = new GuiImage(bgGamesEntry);
|
|
||||||
|
|
||||||
game[i] = new GuiButton(coverImg[i]->GetWidth()*.45,coverImg[i]->GetHeight()*.7);
|
game[i] = new GuiButton(coverImg[i]->GetWidth()*.45,coverImg[i]->GetHeight()*.7);
|
||||||
game[i]->SetParent(this);
|
game[i]->SetParent(this);
|
||||||
game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT);
|
game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT);
|
||||||
//game[i]->SetLabel(gameTxt[i]);
|
|
||||||
//game[i]->SetImageOver(gameBg[i]);
|
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetImage(coverImg[i]);
|
||||||
coverImg[i]->SetParent(game[i]);
|
coverImg[i]->SetParent(game[i]);
|
||||||
//coverImg[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
|
||||||
coverImg[i]->SetPosition(-10,-35);
|
coverImg[i]->SetPosition(-10,-35);
|
||||||
//game[i]->SetPosition(5,GAMESELECTSIZE*i+4);
|
|
||||||
if (i<4)game[i]->SetPosition(117+i*110,25);
|
if (i<4)game[i]->SetPosition(117+i*110,25);
|
||||||
if (i>3)game[i]->SetPosition(117+(i-4)*110,185);
|
if (i>3)game[i]->SetPosition(117+(i-4)*110,185);
|
||||||
game[i]->SetRumble(false);
|
game[i]->SetRumble(false);
|
||||||
game[i]->SetTrigger(trigA);
|
game[i]->SetTrigger(trigA);
|
||||||
game[i]->SetSoundClick(btnSoundClick);
|
game[i]->SetSoundClick(btnSoundClick);
|
||||||
game[i]->SetEffectGrow();
|
game[i]->SetEffectGrow();
|
||||||
|
game[i]->SetVisible(true);
|
||||||
|
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
||||||
|
game[i]->SetVisible(false);
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +140,6 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
|
|||||||
/**
|
/**
|
||||||
* Destructor for the GuiGameGrid class.
|
* Destructor for the GuiGameGrid class.
|
||||||
*/
|
*/
|
||||||
//GuiGameGrid::~GuiGameGrid()
|
|
||||||
GuiGameGrid::~GuiGameGrid()
|
GuiGameGrid::~GuiGameGrid()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -202,7 +162,6 @@ GuiGameGrid::~GuiGameGrid()
|
|||||||
}
|
}
|
||||||
delete [] gameIndex;
|
delete [] gameIndex;
|
||||||
delete [] game;
|
delete [] game;
|
||||||
//delete [] gameTxt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiGameGrid::SetFocus(int f)
|
void GuiGameGrid::SetFocus(int f)
|
||||||
@ -294,9 +253,6 @@ void GuiGameGrid::Draw()
|
|||||||
if(!this->IsVisible())
|
if(!this->IsVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//bgGameImg->Draw();
|
|
||||||
|
|
||||||
|
|
||||||
int next = listOffset;
|
int next = listOffset;
|
||||||
|
|
||||||
for(int i=0; i<pagesize; i++)
|
for(int i=0; i<pagesize; i++)
|
||||||
@ -322,23 +278,12 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int next; //prev;
|
int next; //prev;
|
||||||
//static int position2;
|
|
||||||
u8 over=0;
|
|
||||||
//if (changed>gameCnt){changed=tooMuch;over=1;}
|
|
||||||
|
|
||||||
//int extra=(gameCnt-changed-1);
|
|
||||||
|
|
||||||
|
|
||||||
// scrolldelay affects how fast the list scrolls
|
|
||||||
// when the arrows are clicked
|
|
||||||
//float scrolldelay = 3.5;
|
|
||||||
|
|
||||||
|
|
||||||
btnRight->Update(t);
|
btnRight->Update(t);
|
||||||
btnLeft->Update(t);
|
btnLeft->Update(t);
|
||||||
|
|
||||||
next = listOffset;
|
next = listOffset;
|
||||||
//char buffer[THEME.maxcharacters + 4];
|
|
||||||
char ID[4];
|
char ID[4];
|
||||||
char IDfull[7];
|
char IDfull[7];
|
||||||
char imgPath[100];
|
char imgPath[100];
|
||||||
@ -353,21 +298,6 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
game[i]->SetState(STATE_DEFAULT);
|
game[i]->SetState(STATE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*if (strlen(get_title(&gameList[next])) < (u32)(THEME.maxcharacters + 3))
|
|
||||||
{
|
|
||||||
sprintf(buffer, "%s", get_title(&gameList[next]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(buffer, get_title(&gameList[next]), THEME.maxcharacters);
|
|
||||||
buffer[THEME.maxcharacters] = '\0';
|
|
||||||
strncat(buffer, "...", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
gameTxt[i]->SetText(buffer);
|
|
||||||
gameTxt[i]->SetPosition(24, 0);*/
|
|
||||||
|
|
||||||
gameIndex[i] = next;
|
gameIndex[i] = next;
|
||||||
next = this->FindMenuItem(next, 1);
|
next = this->FindMenuItem(next, 1);
|
||||||
}
|
}
|
||||||
@ -382,7 +312,7 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
if(i != selectedItem && game[i]->GetState() == STATE_SELECTED)
|
if(i != selectedItem && game[i]->GetState() == STATE_SELECTED)
|
||||||
game[i]->ResetState();
|
game[i]->ResetState();
|
||||||
else if(i == selectedItem && game[i]->GetState() == STATE_DEFAULT)
|
else if(i == selectedItem && game[i]->GetState() == STATE_DEFAULT)
|
||||||
game[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
game[selectedItem]->SetState(STATE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
game[i]->Update(t);
|
game[i]->Update(t);
|
||||||
@ -397,40 +327,38 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
if(!focus)
|
if(!focus)
|
||||||
return; // skip navigation
|
return; // skip navigation
|
||||||
|
|
||||||
if (scrollbaron == 1) {
|
if ((t->Right() || btnRight->GetState() == STATE_CLICKED) ) {
|
||||||
|
|
||||||
if ((t->Right() ||
|
|
||||||
btnRight->GetState() == STATE_CLICKED) )
|
|
||||||
//&&(changed<(tooMuch+1)))
|
|
||||||
{
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
changed += pagesize;
|
changed += pagesize;
|
||||||
if (changed>gameCnt)changed=0;
|
if (changed>gameCnt-1)
|
||||||
|
changed=0;
|
||||||
|
|
||||||
|
for(int i=0; i<pagesize; i++) {
|
||||||
|
|
||||||
for(int i=0; i<pagesize; i++)
|
if(coverImg[i]) {
|
||||||
{
|
delete coverImg[i];
|
||||||
|
coverImg[i] = NULL;
|
||||||
|
}
|
||||||
|
if(cover[i]) {
|
||||||
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
|
}
|
||||||
|
struct discHdr *header = &gameList[i+changed];
|
||||||
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
||||||
//if (changed<gameCnt){
|
cover[i] = new GuiImageData(imgPath,0); //load short id
|
||||||
//if (i<tooMuch){
|
|
||||||
if(coverImg[i])delete coverImg[i];
|
|
||||||
if(cover[i])delete cover[i];
|
|
||||||
struct discHdr *header = &gameList[i+changed];
|
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
|
||||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
|
||||||
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
|
||||||
cover[i] = new GuiImageData(imgPath,0); //load short id
|
|
||||||
if (!cover[i]->GetImage()) //if could not load the short id image
|
if (!cover[i]->GetImage()) //if could not load the short id image
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
||||||
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
||||||
if (!cover[i]->GetImage())
|
if (!cover[i]->GetImage())
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
||||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||||
}
|
}
|
||||||
@ -440,69 +368,32 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetScale(0.6);
|
coverImg[i]->SetScale(0.6);
|
||||||
coverImg[i]->SetParent(game[i]);
|
coverImg[i]->SetParent(game[i]);
|
||||||
//coverImg[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
coverImg[i]->SetPosition(-10,-35);
|
||||||
coverImg[i]->SetPosition(-10,-35);
|
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetImage(coverImg[i]);
|
||||||
|
game[i]->SetVisible(true);
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 65);
|
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 65);
|
||||||
//if ((extra<8)&&(i>extra)){
|
|
||||||
//if ((changed>gameCnt)){//&& (i>((changed-gameCnt)-1))){
|
|
||||||
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
||||||
coverImg[i]->SetVisible(false);//}
|
game[i]->SetVisible(false);//}
|
||||||
//delete coverImg[i];}
|
|
||||||
|
|
||||||
//}
|
|
||||||
//else { delete game[i];
|
|
||||||
// delete coverImg[i];
|
|
||||||
//delete cover[i];}
|
|
||||||
//}
|
|
||||||
//usleep(500000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//game[i] = new GuiButton(coverImg[i]->GetWidth(),coverImg[i]->GetHeight());
|
|
||||||
//game[i]->SetParent(this);
|
|
||||||
//game[i]->SetImage(coverImg[i]);
|
|
||||||
//game[i]->SetPosition(5,GAMESELECTSIZE*i+4);
|
|
||||||
//game[i]->SetRumble(false);
|
|
||||||
//game[i]->SetTrigger(trigA);
|
|
||||||
//game[i]->SetSoundClick(btnSoundClick);
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WPAD_ScanPads();
|
|
||||||
u8 cnt, buttons = NULL;
|
|
||||||
/* Get pressed buttons */
|
|
||||||
for (cnt = 0; cnt < 4; cnt++)
|
|
||||||
buttons |= WPAD_ButtonsHeld(cnt);
|
|
||||||
if (buttons == WPAD_BUTTON_A) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
btnRight->ResetState();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
btnRight->ResetState();
|
||||||
|
|
||||||
}
|
} else if((t->Left() || btnLeft->GetState() == STATE_CLICKED)){
|
||||||
else if((t->Left() ||
|
|
||||||
btnLeft->GetState() == STATE_CLICKED))
|
|
||||||
//&& (changed>7)) ////////////////////////////////////////////up
|
|
||||||
//arrowUpBtn->GetState() == STATE_HELD)
|
|
||||||
{changed -= pagesize;if (changed<0)changed=tooMuch+pagesize;
|
|
||||||
over=0;
|
|
||||||
//if (changed<9)changed=0;
|
|
||||||
|
|
||||||
|
changed -= pagesize;
|
||||||
|
if (changed < 0)
|
||||||
|
changed=gameCnt-(gameCnt%8);
|
||||||
|
|
||||||
|
for(int i=0; i<pagesize; i++) {
|
||||||
|
|
||||||
for(int i=0; i<pagesize; i++)
|
|
||||||
{
|
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 65);
|
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 65);
|
||||||
|
|
||||||
//usleep(500000);
|
if(coverImg[i]) {
|
||||||
|
delete coverImg[i];
|
||||||
//if (changed<gameCnt){
|
coverImg[i] = NULL;
|
||||||
if(coverImg[i])delete coverImg[i];
|
}
|
||||||
if(cover[i])delete cover[i];
|
if(cover[i]) {
|
||||||
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct discHdr *header = &gameList[i+changed];
|
struct discHdr *header = &gameList[i+changed];
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
@ -513,11 +404,13 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
if (!cover[i]->GetImage()) //if could not load the short id image
|
if (!cover[i]->GetImage()) //if could not load the short id image
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
||||||
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
||||||
if (!cover[i]->GetImage())
|
if (!cover[i]->GetImage())
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
||||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||||
}
|
}
|
||||||
@ -527,39 +420,18 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetScale(0.6);
|
coverImg[i]->SetScale(0.6);
|
||||||
coverImg[i]->SetParent(game[i]);
|
coverImg[i]->SetParent(game[i]);
|
||||||
//coverImg[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
coverImg[i]->SetPosition(-10,-35);
|
||||||
coverImg[i]->SetPosition(-10,-35);
|
game[i]->ResetState();
|
||||||
game[i]->ResetState();
|
game[i]->SetVisible(true);
|
||||||
game[i]->SetVisible(true);
|
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetImage(coverImg[i]);
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 65);//}
|
coverImg[i]->SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 65);//}
|
||||||
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
||||||
coverImg[i]->SetVisible(false);
|
game[i]->SetVisible(false);
|
||||||
//usleep(500000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//prev = this->FindMenuItem(gameIndex[selectedItem], -1);
|
|
||||||
|
|
||||||
//if(prev >= 0)
|
|
||||||
|
|
||||||
|
|
||||||
WPAD_ScanPads();
|
|
||||||
u8 cnt, buttons = NULL;
|
|
||||||
/* Get pressed buttons */
|
|
||||||
for (cnt = 0; cnt < 4; cnt++)
|
|
||||||
buttons |= WPAD_ButtonsHeld(cnt);
|
|
||||||
if (buttons == WPAD_BUTTON_A) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
btnLeft->ResetState();
|
btnLeft->ResetState();
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(updateCB)
|
if(updateCB)
|
||||||
updateCB(this);
|
updateCB(this);
|
||||||
}
|
}
|
||||||
@ -582,26 +454,31 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
|||||||
{
|
{
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
|
||||||
|
|
||||||
//usleep(500000);
|
if(coverImg[i]) {
|
||||||
|
delete coverImg[i];
|
||||||
//if (changed<gameCnt){
|
coverImg[i] = NULL;
|
||||||
if(coverImg[i])delete coverImg[i];
|
}
|
||||||
if(cover[i])delete cover[i];
|
if(cover[i]) {
|
||||||
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
struct discHdr *header = &gameList[i+changed];
|
struct discHdr *header = &gameList[i+changed];
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||||
|
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
|
||||||
cover[i] = new GuiImageData(imgPath,0); //load short id
|
cover[i] = new GuiImageData(imgPath,0); //load short id
|
||||||
if (!cover[i]->GetImage()) //if could not load the short id image
|
if (!cover[i]->GetImage()) //if could not load the short id image
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
|
||||||
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
cover[i] = new GuiImageData(imgPath, 0); //load full id image
|
||||||
if (!cover[i]->GetImage())
|
if (!cover[i]->GetImage())
|
||||||
{
|
{
|
||||||
delete cover[i];
|
delete cover[i];
|
||||||
|
cover[i] = NULL;
|
||||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
|
||||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||||
}
|
}
|
||||||
@ -611,15 +488,13 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
|||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetScale(0.6);
|
coverImg[i]->SetScale(0.6);
|
||||||
coverImg[i]->SetParent(game[i]);
|
coverImg[i]->SetParent(game[i]);
|
||||||
//coverImg[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
|
coverImg[i]->SetPosition(-10,-35);
|
||||||
coverImg[i]->SetPosition(-10,-35);
|
game[i]->ResetState();
|
||||||
game[i]->ResetState();
|
game[i]->SetVisible(true);
|
||||||
game[i]->SetVisible(true);
|
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetImage(coverImg[i]);
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);//}
|
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);//}
|
||||||
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
|
||||||
coverImg[i]->SetVisible(false);
|
game[i]->SetVisible(false);
|
||||||
//usleep(500000);
|
|
||||||
|
|
||||||
game[i]->ResetState();}
|
game[i]->ResetState();}
|
||||||
}
|
}
|
||||||
|
@ -3088,7 +3088,7 @@ static int MenuDiscList()
|
|||||||
gameBrowser.SetPosition(THEME.selection_x, THEME.selection_y);
|
gameBrowser.SetPosition(THEME.selection_x, THEME.selection_y);
|
||||||
gameBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
gameBrowser.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
||||||
|
|
||||||
GuiGameGrid gameGrid(640,400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
|
GuiGameGrid gameGrid(640,400, gameList, gameCnt, CFG.theme_path, bg_options_png, 0, 0);
|
||||||
gameGrid.SetPosition(0,20);
|
gameGrid.SetPosition(0,20);
|
||||||
gameGrid.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
gameGrid.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
|
||||||
|
|
||||||
@ -3362,7 +3362,7 @@ static int MenuDiscList()
|
|||||||
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){
|
||||||
gameGrid.Reload(gameList, gameCnt);}
|
gameGrid.Reload(gameList, gameCnt);}
|
||||||
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);
|
||||||
@ -3429,10 +3429,14 @@ static int MenuDiscList()
|
|||||||
countBtn.SetPosition(-16,13);
|
countBtn.SetPosition(-16,13);
|
||||||
gridBtn.SetPosition(16,13);
|
gridBtn.SetPosition(16,13);
|
||||||
carosselleBtn.SetPosition(48,13);
|
carosselleBtn.SetPosition(48,13);
|
||||||
|
|
||||||
|
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
|
||||||
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
|
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
|
||||||
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
|
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
|
||||||
w.Append(&clockTime);
|
w.Append(&clockTime);
|
||||||
w.Append(&clockTimeBack);
|
w.Append(&clockTimeBack);
|
||||||
|
}
|
||||||
|
|
||||||
w.Append(&favoriteBtn);
|
w.Append(&favoriteBtn);
|
||||||
w.Append(&abcBtn);
|
w.Append(&abcBtn);
|
||||||
w.Append(&countBtn);
|
w.Append(&countBtn);
|
||||||
@ -3450,10 +3454,13 @@ static int MenuDiscList()
|
|||||||
countBtn.SetPosition(84,15);
|
countBtn.SetPosition(84,15);
|
||||||
gridBtn.SetPosition(116,15);
|
gridBtn.SetPosition(116,15);
|
||||||
carosselleBtn.SetPosition(148,15);
|
carosselleBtn.SetPosition(148,15);
|
||||||
|
|
||||||
|
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
|
||||||
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
|
||||||
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
|
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
|
||||||
w.Append(&clockTime);
|
w.Append(&clockTime);
|
||||||
w.Append(&clockTimeBack);
|
w.Append(&clockTimeBack);
|
||||||
|
}
|
||||||
w.Append(&favoriteBtn);
|
w.Append(&favoriteBtn);
|
||||||
w.Append(&abcBtn);
|
w.Append(&abcBtn);
|
||||||
w.Append(&countBtn);
|
w.Append(&countBtn);
|
||||||
|
Loading…
Reference in New Issue
Block a user