*Added the carousel to the GUI.

*Fixed a bunch of bugs in the carousel.
*Changed the filenames for the carousel images to the spelling used everywhere else.
This commit is contained in:
DRayX7 2009-05-30 03:02:41 +00:00
parent c4e10a5cb3
commit 52a1eed0b0
10 changed files with 536 additions and 418 deletions

View File

@ -309,15 +309,17 @@ void CFG_Default(int widescreen) // -1 = non forced Mode
THEME.gameText_g = 0; THEME.gameText_g = 0;
THEME.gameText_b = 0; THEME.gameText_b = 0;
THEME.pagesize = 9; THEME.pagesize = 9;
THEME.favorite_x = 20; THEME.favorite_x = 4;
THEME.favorite_y = 13; THEME.favorite_y = 13;
THEME.abc_x = 52; THEME.abc_x = 36;
THEME.abc_y = 13; THEME.abc_y = 13;
THEME.grid_x = 116; THEME.list_x = 100;
THEME.list_y = 13;
THEME.grid_x = 132;
THEME.grid_y = 13; THEME.grid_y = 13;
THEME.carousel_x = 148; THEME.carousel_x = 164;
THEME.carousel_y = 13; THEME.carousel_y = 13;
THEME.count_x = 84; THEME.count_x = 68;
THEME.count_y = 13; THEME.count_y = 13;
THEME.sortBarOffset = 100; THEME.sortBarOffset = 100;
} }

View File

@ -108,6 +108,8 @@ struct THEME
short favorite_y; short favorite_y;
short abc_x; short abc_x;
short abc_y; short abc_y;
short list_x;
short list_y;
short grid_x; short grid_x;
short grid_y; short grid_y;
short carousel_x; short carousel_x;

View File

@ -263,11 +263,14 @@ extern const u32 abcIcon_png_size;
extern const u8 playCountIcon_png[]; extern const u8 playCountIcon_png[];
extern const u32 playCountIcon_png_size; extern const u32 playCountIcon_png_size;
extern const u8 arrangeList_png[];
extern const u32 arrangeList_png_size;
extern const u8 arrangeGrid_png[]; extern const u8 arrangeGrid_png[];
extern const u32 arrangeGrid_png_size; extern const u32 arrangeGrid_png_size;
extern const u8 arrangeCarosselle_png[]; extern const u8 arrangeCarousel_png[];
extern const u32 arrangeCarosselle_png_size; extern const u32 arrangeCarousel_png_size;
extern const u8 favIcon_gray_png[]; extern const u8 favIcon_gray_png[];
extern const u32 favIcon_gray_png_size; extern const u32 favIcon_gray_png_size;
@ -284,8 +287,8 @@ extern const u32 arrangeGrid_gray_png_size;
extern const u8 arrangeList_gray_png[]; extern const u8 arrangeList_gray_png[];
extern const u32 arrangeList_gray_png_size; extern const u32 arrangeList_gray_png_size;
extern const u8 arrangeCarosselle_gray_png[]; extern const u8 arrangeCarousel_gray_png[];
extern const u32 arrangeCarosselle_gray_png_size; extern const u32 arrangeCarousel_gray_png_size;
extern const u8 updateRev_png[]; extern const u8 updateRev_png[];
extern const u32 updateRev_png_size; extern const u32 updateRev_png_size;

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

@ -347,6 +347,9 @@ class GuiElement
//!\param center_x x co-ordinate of the center of circle. //!\param center_x x co-ordinate of the center of circle.
//!\param center_y y co-ordinate of the center of circle. //!\param center_y y co-ordinate of the center of circle.
void SetEffect(int e, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y); void SetEffect(int e, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y);
//!Gets the frequency from the above effect
//!\return element frequency
float GetFrequency();
//!Sets an effect to be enabled on wiimote cursor over //!Sets an effect to be enabled on wiimote cursor over
//!\param e Effect to enable //!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect) //!\param a Amount of the effect (usage varies on effect)

View File

@ -437,6 +437,12 @@ int GuiElement::GetEffectOnOver()
return effectsOver; return effectsOver;
} }
float GuiElement::GetFrequency()
{
LOCK(this);
return frequency;
}
void GuiElement::SetEffect(int eff, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y) { void GuiElement::SetEffect(int eff, int speed, f32 circles, int r, f32 startdegree, f32 anglespeedset, int center_x, int center_y) {
if(eff & EFFECT_GOROUND) { if(eff & EFFECT_GOROUND) {

View File

@ -22,7 +22,9 @@
#define RADIUS 780 #define RADIUS 780
#define IN_SPEED 175 #define IN_SPEED 175
#define SHIFT_SPEED 100 #define SHIFT_SPEED 100
#define SPEED_STEP 4
#define PAGESIZE 9 #define PAGESIZE 9
#define SAFETY 320
extern const int vol; extern const int vol;
@ -33,7 +35,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
{ {
width = w; width = w;
height = h; height = h;
this->gameCnt = gameCnt; this->gameCnt = (gameCnt < SAFETY) ? gameCnt : SAFETY;
gameList = l; gameList = l;
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE; pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset; listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
@ -41,6 +43,8 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
selectedItem = selected - offset; selectedItem = selected - offset;
focus = 1; // allow focus focus = 1; // allow focus
firstPic = 0; firstPic = 0;
clickedItem = -1;
speed = SHIFT_SPEED;
char imgPath[100]; char imgPath[100];
trigA = new GuiTrigger; trigA = new GuiTrigger;
@ -91,9 +95,9 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
gameIndex = new int[pagesize]; gameIndex = new int[pagesize];
game = new GuiButton * [pagesize]; game = new GuiButton * [pagesize];
coverImg = new GuiImage * [pagesize];
cover = new GuiImageData * [pagesize];
bob = new int[pagesize]; bob = new int[pagesize];
coverImg = new GuiImage * [gameCnt];
cover = new GuiImageData * [gameCnt];
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
bob[i]=i; bob[i]=i;
@ -101,24 +105,22 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
char ID[4]; char ID[4];
char IDfull[7]; char IDfull[7];
for(int i=0; i < pagesize; i++) {
struct discHdr *header = &gameList[(listOffset+i)%gameCnt]; for(int i=0; i < gameCnt; 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]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
//Load full id image
cover[i] = new GuiImageData(imgPath,0); cover[i] = new GuiImageData(imgPath,0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
//Load short id image
cover[i] = new GuiImageData(imgPath, 0); cover[i] = new GuiImageData(imgPath, 0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
//Load no image
cover[i] = new GuiImageData(imgPath, nocover_png); cover[i] = new GuiImageData(imgPath, nocover_png);
} }
} }
@ -126,14 +128,18 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
coverImg[i] = new GuiImage(cover[i]); coverImg[i] = new GuiImage(cover[i]);
coverImg[i]->SetScale(SCALE); coverImg[i]->SetScale(SCALE);
coverImg[i]->SetWidescreen(CFG.widescreen); coverImg[i]->SetWidescreen(CFG.widescreen);
}
for(int i=0; i < pagesize; i++) {
game[i] = new GuiButton(122,244); game[i] = new GuiButton(122,244);
game[i]->SetParent(this); game[i]->SetParent(this);
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE); game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
game[i]->SetPosition(0,740); game[i]->SetPosition(0,740);
game[i]->SetImage(coverImg[i]); game[i]->SetImage(coverImg[(listOffset+i) % gameCnt]);
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]->SetClickable(true);
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS); game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
} }
} }
@ -157,9 +163,12 @@ GuiGameCarousel::~GuiGameCarousel()
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
delete game[i]; delete game[i];
}
for(int i=0; i<gameCnt; i++) {
delete coverImg[i]; delete coverImg[i];
delete cover[i]; delete cover[i];
} }
delete [] gameIndex; delete [] gameIndex;
delete [] bob; delete [] bob;
delete [] game; delete [] game;
@ -204,12 +213,10 @@ int GuiGameCarousel::GetOffset()
int GuiGameCarousel::GetClickedOption() int GuiGameCarousel::GetClickedOption()
{ {
int found = -1; int found = -1;
for(int i=0; i<pagesize; i++) { if (clickedItem>-1){
if(game[bob[i]]->GetState() == STATE_CLICKED) { game[bob[clickedItem]]->SetState(STATE_SELECTED);
game[bob[i]]->SetState(STATE_SELECTED); found= (clickedItem+listOffset) % gameCnt;
found = listOffset+i; clickedItem=-1;
break;
}
} }
return found; return found;
} }
@ -221,7 +228,7 @@ int GuiGameCarousel::GetSelectedOption()
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
if(game[bob[i]]->GetState() == STATE_SELECTED) { if(game[bob[i]]->GetState() == STATE_SELECTED) {
game[bob[i]]->SetState(STATE_SELECTED); game[bob[i]]->SetState(STATE_SELECTED);
found = listOffset+i; found = (listOffset+i) % gameCnt;
break; break;
} }
} }
@ -296,10 +303,6 @@ void GuiGameCarousel::Update(GuiTrigger * t)
int next = listOffset; int next = listOffset;
char ID[4];
char IDfull[7];
char imgPath[100];
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
if(next >= 0) { if(next >= 0) {
if(game[bob[i]]->GetState() == STATE_DISABLED) { if(game[bob[i]]->GetState() == STATE_DISABLED) {
@ -313,21 +316,25 @@ void GuiGameCarousel::Update(GuiTrigger * t)
game[bob[i]]->SetState(STATE_DISABLED); game[bob[i]]->SetState(STATE_DISABLED);
} }
if(focus) { // if(focus) {
if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED) // if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED)
game[bob[i]]->ResetState(); // game[bob[i]]->ResetState();
else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT); // else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT);
game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan); // game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan);
} // }
game[bob[i]]->Update(t); game[bob[i]]->Update(t);
if(game[bob[i]]->GetState() == STATE_SELECTED) { if(game[bob[i]]->GetState() == STATE_SELECTED) {
selectedItem = i; selectedItem = i;
} }
if(game[bob[i]]->GetState() == STATE_CLICKED) {
clickedItem = i;
}
} }
// navigation // navigation
if(!focus || game[0]->GetEffect() || gameCnt <= pagesize) if(!focus || gameCnt <= pagesize || (game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect()))
return; // skip navigation return; // skip navigation
if (t->Left() || btnLeft->GetState() == STATE_CLICKED) { if (t->Left() || btnLeft->GetState() == STATE_CLICKED) {
@ -337,50 +344,31 @@ void GuiGameCarousel::Update(GuiTrigger * t)
buttons |= WPAD_ButtonsHeld(i); buttons |= WPAD_ButtonsHeld(i);
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) { if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) {
btnLeft->ResetState(); btnLeft->ResetState();
speed = SHIFT_SPEED;
return; return;
} }
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
game[i]->StopEffect(); game[i]->StopEffect();
} }
listOffset++;
if (listOffset > (gameCnt-1)) listOffset = (listOffset+1 < gameCnt) ? listOffset+1 : 0;
listOffset=0; firstPic = (firstPic+1 < pagesize) ? firstPic+1 : 0;
firstPic++;
if (firstPic > (pagesize-1))
firstPic=0;
for (int i=0; i<pagesize; i++) { for (int i=0; i<pagesize; i++) {
bob[i] = (firstPic+i)%pagesize; bob[i] = (firstPic+i)%pagesize;
} }
struct discHdr *header = &gameList[(listOffset + pagesize-1) % gameCnt]; game[bob[pagesize-1]]->SetImage(coverImg[(listOffset + pagesize-1) % gameCnt]);
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]);
delete cover[bob[pagesize-1]];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
cover[bob[pagesize-1]] = new GuiImageData(imgPath,0);
if (!cover[bob[pagesize-1]]->GetImage()) {
delete cover[bob[pagesize-1]];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
cover[bob[pagesize-1]] = new GuiImageData(imgPath, 0);
if (!cover[bob[pagesize-1]]->GetImage()) {
delete cover[bob[pagesize-1]];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
cover[bob[pagesize-1]] = new GuiImageData(imgPath, nocover_png);
}
}
delete coverImg[bob[pagesize-1]];
coverImg[bob[pagesize-1]] = new GuiImage(cover[bob[pagesize-1]]);
coverImg[bob[pagesize-1]]->SetScale(SCALE);
coverImg[bob[pagesize-1]]->SetWidescreen(CFG.widescreen);
game[bob[pagesize-1]]->SetImage(coverImg[bob[pagesize-1]]);
game[bob[pagesize-1]]->SetPosition(0, RADIUS); game[bob[pagesize-1]]->SetPosition(0, RADIUS);
for (int i=0; i<pagesize; i++) { for (int i=0; i<pagesize; i++) {
//game[bob[i]]->SetEffect(EFFECT_GOROUND, -125, 7, 780, 256+7*i, 1, 0, 740); game[bob[i]]->SetEffect(EFFECT_GOROUND, -speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS);
game[bob[i]]->SetEffect(EFFECT_GOROUND, -SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS);
} }
speed+=SPEED_STEP;
} }
else if(t->Right() || btnRight->GetState() == STATE_CLICKED) { else if(t->Right() || btnRight->GetState() == STATE_CLICKED) {
@ -390,50 +378,27 @@ void GuiGameCarousel::Update(GuiTrigger * t)
buttons |= WPAD_ButtonsHeld(i); buttons |= WPAD_ButtonsHeld(i);
if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) { if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) {
btnRight->ResetState(); btnRight->ResetState();
speed=SHIFT_SPEED;
return; return;
} }
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
game[i]->StopEffect(); game[i]->StopEffect();
} }
listOffset--; listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1;
if (listOffset<0) firstPic = (firstPic-1 < 0) ? pagesize-1 : firstPic-1;
listOffset=(gameCnt-1);
firstPic--;
if (firstPic<0)
firstPic=(pagesize-1);
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
bob[i] = (firstPic+i)%pagesize; bob[i] = (firstPic+i)%pagesize;
} }
struct discHdr *header = &gameList[listOffset]; game[bob[0]]->SetImage(coverImg[listOffset]);
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]);
delete cover[bob[0]];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
cover[bob[0]] = new GuiImageData(imgPath,0);
if (!cover[bob[0]]->GetImage()) {
delete cover[bob[0]];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
cover[bob[0]] = new GuiImageData(imgPath, 0);
if (!cover[bob[0]]->GetImage()) {
delete cover[bob[0]];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
cover[bob[0]] = new GuiImageData(imgPath, nocover_png);
}
}
delete coverImg[bob[0]];
coverImg[bob[0]] = new GuiImage(cover[bob[0]]);
coverImg[bob[0]]->SetScale(SCALE);
coverImg[bob[0]]->SetWidescreen(CFG.widescreen);
game[bob[0]]->SetImage(coverImg[bob[0]]);
game[bob[0]]->SetPosition(0, RADIUS); game[bob[0]]->SetPosition(0, RADIUS);
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
//game[bob[i]]->SetEffect(EFFECT_GOROUND, 125, 7, 780, 242+7*i, 1, 0, 740); game[bob[i]]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS);
game[bob[i]]->SetEffect(EFFECT_GOROUND, SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS);
} }
speed+=SPEED_STEP;
} }
if(updateCB) if(updateCB)
@ -443,15 +408,37 @@ void GuiGameCarousel::Update(GuiTrigger * t)
void GuiGameCarousel::Reload(struct discHdr * l, int count) void GuiGameCarousel::Reload(struct discHdr * l, int count)
{ {
for(int i=0; i<pagesize; i++) {
delete game[i];
}
for(int i=0; i<gameCnt; i++) {
delete coverImg[i];
delete cover[i];
}
delete [] gameIndex;
delete [] bob;
delete [] game;
delete [] coverImg;
delete [] cover;
LOCK(this); LOCK(this);
gameCnt = count; gameCnt = count;
gameList = l; gameList = l;
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE; pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
listOffset = this->FindMenuItem(-1, 1); listOffset = this->FindMenuItem(-1, 1);
selectedItem = 0 + listOffset; selectedItem = listOffset;
focus = 1; focus = 1;
firstPic = 0; firstPic = 0;
char imgPath[100]; clickedItem = -1;
speed = SHIFT_SPEED;
gameIndex = new int[pagesize];
game = new GuiButton * [pagesize];
bob = new int[pagesize];
coverImg = new GuiImage * [gameCnt];
cover = new GuiImageData * [gameCnt];
for(int i=0; i<pagesize; i++) { for(int i=0; i<pagesize; i++) {
bob[i]=i; bob[i]=i;
@ -459,24 +446,23 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
char ID[4]; char ID[4];
char IDfull[7]; char IDfull[7];
for(int i=0; i < pagesize; i++) { char imgPath[100];
struct discHdr *header = &gameList[(listOffset+i)%gameCnt]; for(int i=0; i < gameCnt; 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]);
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image
//Load full id image
cover[i] = new GuiImageData(imgPath,0); cover[i] = new GuiImageData(imgPath,0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image
//Load short id image
cover[i] = new GuiImageData(imgPath, 0); cover[i] = new GuiImageData(imgPath, 0);
if (!cover[i]->GetImage()) { if (!cover[i]->GetImage()) {
delete cover[i]; delete cover[i];
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image
//Load no image
cover[i] = new GuiImageData(imgPath, nocover_png); cover[i] = new GuiImageData(imgPath, nocover_png);
} }
} }
@ -484,6 +470,9 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
coverImg[i] = new GuiImage(cover[i]); coverImg[i] = new GuiImage(cover[i]);
coverImg[i]->SetScale(SCALE); coverImg[i]->SetScale(SCALE);
coverImg[i]->SetWidescreen(CFG.widescreen); coverImg[i]->SetWidescreen(CFG.widescreen);
}
for(int i=0; i < pagesize; i++) {
game[i] = new GuiButton(122,244); game[i] = new GuiButton(122,244);
game[i]->SetParent(this); game[i]->SetParent(this);
game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE); game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE);
@ -492,7 +481,8 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
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]->SetEffect(EFFECT_GOROUND, IN_SPEED, 180-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS); game[i]->SetClickable(true);
game[i]->SetEffect(EFFECT_GOROUND, IN_SPEED, 90-(pagesize-2*i-1)*DEG_OFFSET/2, RADIUS, 180, 1, 0, RADIUS);
} }
} }

View File

@ -26,6 +26,7 @@ class GuiGameCarousel : public GuiElement
int pagesize; int pagesize;
int firstPic; int firstPic;
int speed; int speed;
int clickedItem;
struct discHdr * gameList; struct discHdr * gameList;
int gameCnt; int gameCnt;

View File

@ -3026,12 +3026,14 @@ static int MenuDiscList()
GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png); GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path);
GuiImageData imgarrangeGrid_gray(imgPath, arrangeGrid_gray_png); GuiImageData imgarrangeGrid_gray(imgPath, arrangeGrid_gray_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeList.png", CFG.theme_path);
GuiImageData imgarrangeList(imgPath, arrangeList_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sarrangeList_gray.png", CFG.theme_path);
GuiImageData imgarrangeList_gray(imgPath, arrangeList_gray_png); GuiImageData imgarrangeList_gray(imgPath, arrangeList_gray_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeCarosselle.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", CFG.theme_path);
GuiImageData imgarrangeCarosselle(imgPath, arrangeCarosselle_png); GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png);
snprintf(imgPath, sizeof(imgPath), "%sarrangeCarosselle_gray.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path);
GuiImageData imgarrangeCarosselle_gray(imgPath, arrangeCarosselle_gray_png); GuiImageData imgarrangeCarousel_gray(imgPath, arrangeCarousel_gray_png);
GuiTrigger trigA; GuiTrigger trigA;
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);
@ -3127,23 +3129,28 @@ static int MenuDiscList()
countBtn.SetAlpha(180); countBtn.SetAlpha(180);
GuiImage listBtnImg(&imgarrangeList);
listBtnImg.SetWidescreen(CFG.widescreen);
GuiImage listBtnImg_g(&imgarrangeList_gray);
listBtnImg_g.SetWidescreen(CFG.widescreen);
GuiButton listBtn(&listBtnImg_g,&listBtnImg_g, 2, 3, THEME.list_x, THEME.list_y, &trigA, &btnSoundOver, &btnClick,1);
listBtn.SetAlpha(180);
GuiImage gridBtnImg(&imgarrangeGrid); GuiImage gridBtnImg(&imgarrangeGrid);
gridBtnImg.SetWidescreen(CFG.widescreen); gridBtnImg.SetWidescreen(CFG.widescreen);
GuiImage gridBtnImg_g(&imgarrangeGrid_gray); GuiImage gridBtnImg_g(&imgarrangeGrid_gray);
GuiImage listBtnImg_g(&imgarrangeList_gray);
gridBtnImg_g.SetWidescreen(CFG.widescreen); gridBtnImg_g.SetWidescreen(CFG.widescreen);
listBtnImg_g.SetWidescreen(CFG.widescreen);
GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, THEME.grid_x, THEME.grid_y, &trigA, &btnSoundOver, &btnClick,1); GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, THEME.grid_x, THEME.grid_y, &trigA, &btnSoundOver, &btnClick,1);
gridBtn.SetAlpha(180); gridBtn.SetAlpha(180);
if (Settings.gameDisplay==grid){gridBtn.SetImage(&listBtnImg_g);
gridBtn.SetImageOver(&listBtnImg_g);}
GuiImage carosselleBtnImg(&imgarrangeCarosselle);
carosselleBtnImg.SetWidescreen(CFG.widescreen); GuiImage carouselBtnImg(&imgarrangeCarousel);
GuiImage carosselleBtnImg_g(&imgarrangeCarosselle_gray); carouselBtnImg.SetWidescreen(CFG.widescreen);
carosselleBtnImg_g.SetWidescreen(CFG.widescreen); GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray);
GuiButton carosselleBtn(&carosselleBtnImg_g,&carosselleBtnImg_g, 2, 3, THEME.carousel_x, THEME.carousel_y, &trigA, &btnSoundOver, &btnClick,1); carouselBtnImg_g.SetWidescreen(CFG.widescreen);
carosselleBtn.SetAlpha(180); GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, 2, 3, THEME.carousel_x, THEME.carousel_y, &trigA, &btnSoundOver, &btnClick,1);
carouselBtn.SetAlpha(180);
if (Settings.fave) if (Settings.fave)
{ {
@ -3160,43 +3167,61 @@ static int MenuDiscList()
countBtn.SetImage(&countBtnImg); countBtn.SetImage(&countBtnImg);
countBtn.SetAlpha(255); countBtn.SetAlpha(255);
} }
if (Settings.gameDisplay==grid) if (Settings.gameDisplay==list)
{ {
if(CFG.widescreen) listBtn.SetImage(&listBtnImg);
{ listBtn.SetAlpha(255);
favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y);
gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y);
carosselleBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y);
}
else
{
favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y);
gridBtn.SetPosition(THEME.grid_x+4-THEME.sortBarOffset, THEME.grid_y);
carosselleBtn.SetPosition(THEME.carousel_x+12-THEME.sortBarOffset, THEME.carousel_y);
}
} }
else // List-Mode else if (Settings.gameDisplay==grid)
{
gridBtn.SetImage(&gridBtnImg);
gridBtn.SetAlpha(255);
}
else if (Settings.gameDisplay==carousel)
{
carouselBtn.SetImage(&carouselBtnImg);
carouselBtn.SetAlpha(255);
}
if (Settings.gameDisplay==list)
{ {
if(CFG.widescreen) if(CFG.widescreen)
{ {
favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y); favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x, THEME.abc_y); abcBtn.SetPosition(THEME.abc_x, THEME.abc_y);
countBtn.SetPosition(THEME.count_x, THEME.count_y); countBtn.SetPosition(THEME.count_x, THEME.count_y);
listBtn.SetPosition(THEME.list_x, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x, THEME.grid_y); gridBtn.SetPosition(THEME.grid_x, THEME.grid_y);
carosselleBtn.SetPosition(THEME.carousel_x, THEME.carousel_y); carouselBtn.SetPosition(THEME.carousel_x, THEME.carousel_y);
} }
else else
{ {
favoriteBtn.SetPosition(THEME.favorite_x-20, THEME.favorite_y); favoriteBtn.SetPosition(THEME.favorite_x-20, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12, THEME.abc_y); abcBtn.SetPosition(THEME.abc_x-12, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4, THEME.count_y); countBtn.SetPosition(THEME.count_x-4, THEME.count_y);
gridBtn.SetPosition(THEME.grid_x+4, THEME.grid_y); listBtn.SetPosition(THEME.list_x+4, THEME.list_y);
carosselleBtn.SetPosition(THEME.carousel_x+12, THEME.carousel_y); gridBtn.SetPosition(THEME.grid_x+12, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x+20, THEME.carousel_y);
}
}
else
{
if(CFG.widescreen)
{
favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y);
}
else
{
favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x+4-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x+12-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x+20-THEME.sortBarOffset, THEME.carousel_y);
} }
} }
@ -3222,25 +3247,29 @@ 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, 0, 0); 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);
GuiText clockTimeBack("88:88", 40, (GXColor){138, 138, 138, 40}); GuiGameCarousel gameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset);
clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP); gameCarousel.SetPosition(0,-20);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y); gameCarousel.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE);
GuiText clockTimeBack("88:88", 40, (GXColor){138, 138, 138, 40});
clockTimeBack.SetAlignment(THEME.clockAlign, ALIGN_TOP);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
clockTimeBack.SetFont(fontClock); clockTimeBack.SetFont(fontClock);
if (Settings.gameDisplay==grid){ if (Settings.gameDisplay==grid || Settings.gameDisplay==carousel) {
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);} clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
}
GuiText clockTime(theTime, 40, (GXColor){138, 138, 138, 240});
clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP);
clockTime.SetPosition(THEME.clock_x, THEME.clock_y); clockTime.SetFont(fontClock);
if (Settings.gameDisplay==grid || Settings.gameDisplay==carousel) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
}
GuiText clockTime(theTime, 40, (GXColor){138, 138, 138, 240}); HaltGui();
clockTime.SetAlignment(THEME.clockAlign, ALIGN_TOP);
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTime.SetFont(fontClock);
if (Settings.gameDisplay==grid){
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);}
HaltGui();
GuiWindow w(screenwidth, screenheight); GuiWindow w(screenwidth, screenheight);
if(THEME.showHDD == -1 || THEME.showHDD == 1) //force show hdd info if(THEME.showHDD == -1 || THEME.showHDD == 1) //force show hdd info
@ -3257,77 +3286,62 @@ static int MenuDiscList()
if (CFG.godmode) if (CFG.godmode)
w.Append(&installBtn); w.Append(&installBtn);
w.Append(&homeBtn); w.Append(&homeBtn);
w.Append(&settingsBtn); w.Append(&settingsBtn);
if (Settings.gameDisplay==list){ if (Settings.gameDisplay==list){
w.Append(&DownloadBtn); w.Append(&DownloadBtn);
} }
w.Append(&favoriteBtn); w.Append(&favoriteBtn);
w.Append(&abcBtn); w.Append(&abcBtn);
w.Append(&countBtn); w.Append(&countBtn);
w.Append(&listBtn);
w.Append(&gridBtn); w.Append(&gridBtn);
w.Append(&carosselleBtn); w.Append(&carouselBtn);
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24))
{ {
w.Append(&clockTimeBack); w.Append(&clockTimeBack);
w.Append(&clockTime); w.Append(&clockTime);
} }
if (Settings.gameDisplay==list){mainWindow->Append(&gameBrowser);} if (Settings.gameDisplay==list){mainWindow->Append(&gameBrowser);}
if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);}
mainWindow->Append(&w); if (Settings.gameDisplay==carousel){mainWindow->Append(&gameCarousel);}
mainWindow->Append(&w);
ResumeGui(); ResumeGui();
while(menu == MENU_NONE) while(menu == MENU_NONE)
{ {
VIDEO_WaitVSync (); VIDEO_WaitVSync ();
if(carosselleBtn.GetState() == STATE_CLICKED) { //CLOCK
// carosselleBtn.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45, 1);
// countBtn.SetEffect(EFFECT_GOROUND, -80, 180, 50, -45, 1);
// abcBtn.SetEffect(EFFECT_GOROUND, 80, 180, 50, -45, 1);
// favoriteBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, -45, 1);
// wiiBtn.SetEffect(EFFECT_GOROUND, 80, 180, 150, 180, 1);
// poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 150, 50, 1);
// sdcardBtn.SetEffect(EFFECT_GOROUND, 80, 360, 150, 80, 1);
// poweroffBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, 180, 1);
// settingsBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180, 1);
// homeBtn.SetEffect(EFFECT_GOROUND, 80, 360, 200, 180, 1);
// installBtn.SetEffect(EFFECT_GOROUND, -80, 360, 60, -90, 1);
// gridBtn.SetEffect(EFFECT_GOROUND, -80, 360, 50, 0, 1);
// DownloadBtn.SetEffect(EFFECT_GOROUND, 100, 720, 300, 0, 1);
// carosselleBtn.ResetState();
}
//CLOCK
time_t rawtime = time(0); //this fixes code dump caused by the clock time_t rawtime = time(0); //this fixes code dump caused by the clock
if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) { if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) {
lastrawtime = rawtime; lastrawtime = rawtime;
timeinfo = localtime (&rawtime); timeinfo = localtime (&rawtime);
if (dataed < 1){ if (dataed < 1){
if(Settings.hddinfo == hr12){ if(Settings.hddinfo == hr12){
if(rawtime & 1) if(rawtime & 1)
strftime(theTime, sizeof(theTime), "%I:%M", timeinfo); strftime(theTime, sizeof(theTime), "%I:%M", timeinfo);
else else
strftime(theTime, sizeof(theTime), "%I %M", timeinfo); strftime(theTime, sizeof(theTime), "%I %M", timeinfo);
} }
if(Settings.hddinfo == hr24){ if(Settings.hddinfo == hr24){
if(rawtime & 1) if(rawtime & 1)
strftime(theTime, sizeof(theTime), "%H:%M", timeinfo); strftime(theTime, sizeof(theTime), "%H:%M", timeinfo);
else else
strftime(theTime, sizeof(theTime), "%H %M", timeinfo); strftime(theTime, sizeof(theTime), "%H %M", timeinfo);
} }
clockTime.SetText(theTime); clockTime.SetText(theTime);
} }
else if (dataed > 0){ else if (dataed > 0){
clockTime.SetTextf("%i", (dataed-1)); clockTime.SetTextf("%i", (dataed-1));
} }
} }
if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}} if ((datagB<1)&&(Settings.cios==1)&&(Settings.video == ntsc)&&(Settings.hddinfo == hr12)&&(Settings.qboot==1)&&(Settings.wsprompt==0)&&(Settings.language==ger)&&(Settings.tooltips==0)){dataed=1;dataef=1;}if (dataef==1){if (cosa>7){cosa=1;}datag++;if (sina==3){wiiBtn.SetAlignment(ALIGN_LEFT,ALIGN_BOTTOM);wiiBtnImg.SetAngle(0);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),((datag*2)-130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==2){wiiBtn.SetAlignment(ALIGN_RIGHT,ALIGN_TOP);wiiBtnImg.SetAngle(270);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((-2*(datag)+130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((2*(datag)-120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==1){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(180);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((cosa)*70),(2*(datag)-120));}else if(62<=datag){wiiBtn.SetPosition(((cosa)*70),(-2*(datag)+130));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}if (sina==0){wiiBtn.SetAlignment(ALIGN_TOP,ALIGN_LEFT);wiiBtnImg.SetAngle(90);if(datag>163){datag=1;}else if (datag<62){wiiBtn.SetPosition(((2*(datag)-130)),((cosa)*50));}else if(62<=datag){wiiBtn.SetPosition((-2*(datag)+120),((cosa)*50));}if (datag>162){wiiBtn.SetPosition(700,700);w.Remove(&wiiBtn);datagB=2;cosa++;sina=lastrawtime%4;}w.Append(&wiiBtn);}}
// respond to button presses // respond to button presses
if(shutdown == 1) if(shutdown == 1)
@ -3337,32 +3351,33 @@ static int MenuDiscList()
if(reset == 1) if(reset == 1)
Sys_Reboot(); Sys_Reboot();
if(poweroffBtn.GetState() == STATE_CLICKED) if(poweroffBtn.GetState() == STATE_CLICKED)
{ {
choice = WindowPrompt(LANGUAGE.HowtoShutdown,0,LANGUAGE.FullShutdown, LANGUAGE.ShutdowntoIdle, LANGUAGE.Cancel,0); choice = WindowPrompt(LANGUAGE.HowtoShutdown,0,LANGUAGE.FullShutdown, LANGUAGE.ShutdowntoIdle, LANGUAGE.Cancel,0);
if(choice == 2) if(choice == 2)
{ {
WPAD_Flush(0); WPAD_Flush(0);
WPAD_Disconnect(0); WPAD_Disconnect(0);
WPAD_Shutdown(); WPAD_Shutdown();
/* Set LED mode */ /* Set LED mode */
ret = CONF_GetIdleLedMode(); ret = CONF_GetIdleLedMode();
if(ret >= 0 && ret <= 2) if(ret >= 0 && ret <= 2)
STM_SetLedMode(ret); STM_SetLedMode(ret);
STM_ShutdownToIdle(); STM_ShutdownToIdle();
} else if(choice == 1) { } else if(choice == 1) {
WPAD_Flush(0); WPAD_Flush(0);
WPAD_Disconnect(0); WPAD_Disconnect(0);
WPAD_Shutdown(); WPAD_Shutdown();
STM_ShutdownToStandby(); STM_ShutdownToStandby();
} else { } else {
poweroffBtn.ResetState(); poweroffBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
} }
} }
@ -3394,6 +3409,7 @@ static int MenuDiscList()
homeBtn.ResetState(); homeBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
} }
} }
@ -3402,6 +3418,7 @@ static int MenuDiscList()
wiiBtn.ResetState(); wiiBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
} }
else if(installBtn.GetState() == STATE_CLICKED) else if(installBtn.GetState() == STATE_CLICKED)
{ {
@ -3416,6 +3433,7 @@ static int MenuDiscList()
installBtn.ResetState(); installBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
} }
} }
@ -3429,6 +3447,9 @@ static int MenuDiscList()
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
startat = gameGrid.GetSelectedOption(); startat = gameGrid.GetSelectedOption();
offset = gameGrid.GetOffset();} offset = gameGrid.GetOffset();}
else if (Settings.gameDisplay==carousel){
startat = gameCarousel.GetSelectedOption();
offset = gameCarousel.GetOffset();}
if(isSdInserted()) { if(isSdInserted()) {
CFG_Load(); CFG_Load();
} }
@ -3492,6 +3513,7 @@ static int MenuDiscList()
DownloadBtn.ResetState(); DownloadBtn.ResetState();
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
}//end download }//end download
else if(settingsBtn.GetState() == STATE_CLICKED) else if(settingsBtn.GetState() == STATE_CLICKED)
@ -3501,6 +3523,9 @@ static int MenuDiscList()
else if (Settings.gameDisplay==grid){ else if (Settings.gameDisplay==grid){
startat = gameGrid.GetSelectedOption(); startat = gameGrid.GetSelectedOption();
offset = gameGrid.GetOffset();} offset = gameGrid.GetOffset();}
else if (Settings.gameDisplay==carousel){
startat = gameCarousel.GetSelectedOption();
offset = gameCarousel.GetOffset();}
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
break; break;
@ -3516,7 +3541,9 @@ 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);}
else if (Settings.gameDisplay==carousel){
gameCarousel.Reload(gameList, gameCnt);}
gamecntTxt.SetTextf("%s: %i",LANGUAGE.Games, gameCnt); gamecntTxt.SetTextf("%s: %i",LANGUAGE.Games, gameCnt);
selectedold = 1; selectedold = 1;
favoriteBtn.ResetState(); favoriteBtn.ResetState();
@ -3532,9 +3559,11 @@ static int MenuDiscList()
} }
__Menu_GetEntries(); __Menu_GetEntries();
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);}
else if (Settings.gameDisplay==carousel){
gameCarousel.Reload(gameList, gameCnt);}
selectedold = 1; selectedold = 1;
abcBtn.SetImage(&abcBtnImg); abcBtn.SetImage(&abcBtnImg);
abcBtn.SetAlpha(255); abcBtn.SetAlpha(255);
@ -3556,6 +3585,8 @@ static int MenuDiscList()
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);}
else if (Settings.gameDisplay==carousel){
gameCarousel.Reload(gameList, gameCnt);}
selectedold = 1; selectedold = 1;
abcBtn.SetImage(&abcBtnImg_g); abcBtn.SetImage(&abcBtnImg_g);
abcBtn.SetAlpha(180); abcBtn.SetAlpha(180);
@ -3564,207 +3595,285 @@ static int MenuDiscList()
} }
countBtn.ResetState(); countBtn.ResetState();
} else if(gridBtn.GetState() == STATE_CLICKED) { }
if (Settings.gameDisplay==list){
Settings.gameDisplay=grid;
mainWindow->Remove(&gameBrowser);
gameGrid.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameGrid);
if (GameIDTxt)w.Remove(GameIDTxt); else if(listBtn.GetState() == STATE_CLICKED) {
if (GameRegionTxt)w.Remove(GameRegionTxt); if (Settings.gameDisplay!=list){
w.Remove(&DownloadBtn); if (Settings.gameDisplay==grid) {
mainWindow->Remove(&gameGrid);
gridBtn.SetImage(&listBtnImg_g); gridBtn.SetImage(&gridBtnImg_g);
gridBtn.SetImageOver(&listBtnImg_g); gridBtn.SetAlpha(180);
if(CFG.widescreen) }
{ if (Settings.gameDisplay==carousel) {
favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y); mainWindow->Remove(&gameCarousel);
abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y); carouselBtn.SetImage(&carouselBtnImg_g);
countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y); carouselBtn.SetAlpha(180);
gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y); }
carosselleBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y); Settings.gameDisplay=list;
} gameBrowser.Reload(gameList, gameCnt); // initialize before append
else mainWindow->Append(&gameBrowser);
{ listBtn.SetImage(&listBtnImg);
favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y); listBtn.SetAlpha(255);
abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y); if(CFG.widescreen)
countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y); {
gridBtn.SetPosition(THEME.grid_x+4-THEME.sortBarOffset, THEME.grid_y); favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y);
carosselleBtn.SetPosition(THEME.carousel_x+12-THEME.sortBarOffset, THEME.carousel_y); abcBtn.SetPosition(THEME.abc_x, THEME.abc_y);
countBtn.SetPosition(THEME.count_x, THEME.count_y);
listBtn.SetPosition(THEME.list_x, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x, THEME.carousel_y);
} else {
favoriteBtn.SetPosition(THEME.favorite_x-20, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4, THEME.count_y);
listBtn.SetPosition(THEME.list_x+4, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x+12, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x+20, THEME.carousel_y);
}
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
w.Append(&clockTime);
w.Append(&clockTimeBack);
}
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
w.Append(&listBtn);
w.Append(&gridBtn);
w.Append(&carouselBtn);
w.Append(&DownloadBtn);
if(isSdInserted()) {
cfg_save_global();
} }
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
w.Append(&clockTime);
w.Append(&clockTimeBack);
} }
w.Append(&favoriteBtn); listBtn.ResetState();
w.Append(&abcBtn); }
w.Append(&countBtn);
w.Append(&gridBtn);
w.Append(&carosselleBtn);
} else if (Settings.gameDisplay==grid){ else if (gridBtn.GetState() == STATE_CLICKED) {
Settings.gameDisplay=list; if (Settings.gameDisplay!=grid){
if (Settings.gameDisplay==list) {
mainWindow->Remove(&gameGrid); mainWindow->Remove(&gameBrowser);
gameBrowser.Reload(gameList, gameCnt); // initialize before append if (GameIDTxt) w.Remove(GameIDTxt);
mainWindow->Append(&gameBrowser); if (GameRegionTxt) w.Remove(GameRegionTxt);
gridBtn.SetImage(&gridBtnImg_g); w.Remove(&DownloadBtn);
gridBtn.SetImageOver(&gridBtnImg_g); listBtn.SetImage(&listBtnImg_g);
if(CFG.widescreen) listBtn.SetAlpha(180);
{ }
favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y); if (Settings.gameDisplay==carousel) {
abcBtn.SetPosition(THEME.abc_x, THEME.abc_y); mainWindow->Remove(&gameCarousel);
countBtn.SetPosition(THEME.count_x, THEME.count_y); carouselBtn.SetImage(&carouselBtnImg_g);
gridBtn.SetPosition(THEME.grid_x, THEME.grid_y); carouselBtn.SetAlpha(180);
carosselleBtn.SetPosition(THEME.carousel_x, THEME.carousel_y); }
Settings.gameDisplay=grid;
gameGrid.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameGrid);
gridBtn.SetImage(&gridBtnImg);
gridBtn.SetAlpha(255);
if(CFG.widescreen)
{
favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y);
} else {
favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x+4-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x+12-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x+20-THEME.sortBarOffset, THEME.carousel_y);
}
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
w.Append(&clockTime);
w.Append(&clockTimeBack);
}
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
w.Append(&listBtn);
w.Append(&gridBtn);
w.Append(&carouselBtn);
if(isSdInserted()) {
cfg_save_global();
}
} }
else
{
favoriteBtn.SetPosition(THEME.favorite_x-20, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4, THEME.count_y);
gridBtn.SetPosition(THEME.grid_x+4, THEME.grid_y);
carosselleBtn.SetPosition(THEME.carousel_x+12, THEME.carousel_y);
}
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y);
w.Append(&clockTime);
w.Append(&clockTimeBack);
}
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
w.Append(&gridBtn);
w.Append(&carosselleBtn);
w.Append(&DownloadBtn);
}
if(isSdInserted()) {
cfg_save_global();
}
//menu = MENU_DISCLIST;
gridBtn.ResetState(); gridBtn.ResetState();
} }
if (Settings.gameDisplay==grid){ else if (carouselBtn.GetState() == STATE_CLICKED) {
int selectimg; if (Settings.gameDisplay!=carousel){
selectimg = gameGrid.GetSelectedOption(); if (Settings.gameDisplay==list)
gameSelected = gameGrid.GetClickedOption(); mainWindow->Remove(&gameBrowser);
} if (GameIDTxt) w.Remove(GameIDTxt);
if (GameRegionTxt) w.Remove(GameRegionTxt);
if (Settings.gameDisplay==list) { w.Remove(&DownloadBtn);
//Get selected game under cursor listBtn.SetImage(&listBtnImg_g);
int selectimg;//, promptnumber; listBtn.SetAlpha(180);
char ID[4]; if (Settings.gameDisplay==grid)
char IDfull[7]; mainWindow->Remove(&gameGrid);
selectimg = gameBrowser.GetSelectedOption(); gridBtn.SetImage(&gridBtnImg_g);
gameSelected = gameBrowser.GetClickedOption(); gridBtn.SetAlpha(180);
Settings.gameDisplay=carousel;
gameCarousel.Reload(gameList, gameCnt); // initialize before append
if (gameSelected > 0) //if click occured mainWindow->Append(&gameCarousel);
selectimg = gameSelected; carouselBtn.SetImage(&carouselBtnImg);
carouselBtn.SetAlpha(255);
if ((selectimg >= 0) && (selectimg < (s32) gameCnt)) if(CFG.widescreen)
{
if (selectimg != selectedold)
{
selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
struct discHdr *header = &gameList[selectimg];
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]);
w.Remove(&DownloadBtn);
if (GameIDTxt)
{ {
w.Remove(GameIDTxt); favoriteBtn.SetPosition(THEME.favorite_x-THEME.sortBarOffset, THEME.favorite_y);
delete GameIDTxt; abcBtn.SetPosition(THEME.abc_x-THEME.sortBarOffset, THEME.abc_y);
GameIDTxt = NULL; countBtn.SetPosition(THEME.count_x-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x-THEME.sortBarOffset, THEME.carousel_y);
} else {
favoriteBtn.SetPosition(THEME.favorite_x-20-THEME.sortBarOffset, THEME.favorite_y);
abcBtn.SetPosition(THEME.abc_x-12-THEME.sortBarOffset, THEME.abc_y);
countBtn.SetPosition(THEME.count_x-4-THEME.sortBarOffset, THEME.count_y);
listBtn.SetPosition(THEME.list_x+4-THEME.sortBarOffset, THEME.list_y);
gridBtn.SetPosition(THEME.grid_x+12-THEME.sortBarOffset, THEME.grid_y);
carouselBtn.SetPosition(THEME.carousel_x+20-THEME.sortBarOffset, THEME.carousel_y);
} }
if(GameRegionTxt) if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
{ clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
w.Remove(GameRegionTxt); clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
delete GameRegionTxt; w.Append(&clockTime);
GameRegionTxt = NULL; w.Append(&clockTimeBack);
} }
w.Append(&favoriteBtn);
switch(header->id[3]) w.Append(&abcBtn);
{ w.Append(&countBtn);
case 'E': w.Append(&listBtn);
sprintf(gameregion,"NTSC U"); w.Append(&gridBtn);
break; w.Append(&carouselBtn);
if(isSdInserted()) {
case 'J': cfg_save_global();
sprintf(gameregion,"NTSC J");
break;
case 'K':
sprintf(gameregion,"NTSC K");
break;
case 'P':
case 'D':
case 'F':
case 'X':
case 'S':
case 'Y':
sprintf(gameregion," PAL ");
break;
}
//load game cover
if (cover)
{
delete cover;
cover = NULL;
}
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
cover = new GuiImageData(imgPath,0); //load short id
if (!cover->GetImage()) //if could not load the short id image
{
delete cover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
cover = new GuiImageData(imgPath, 0); //load full id image
if (!cover->GetImage())
{
delete cover;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
cover = new GuiImageData(imgPath, nocover_png); //load no image
}
}
if (coverImg)
{
delete coverImg;
coverImg = NULL;
}
coverImg = new GuiImage(cover);
coverImg->SetWidescreen(CFG.widescreen);
DownloadBtn.SetImage(coverImg);// put the new image on the download button
w.Append(&DownloadBtn);
if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)){
GameIDTxt = new GuiText(IDfull, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
GameIDTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameIDTxt);
}
if ((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)){
GameRegionTxt = new GuiText(gameregion, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y);
GameRegionTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameRegionTxt);
} }
} }
carouselBtn.ResetState();
} }
if (Settings.gameDisplay==grid){
int selectimg;
selectimg = gameGrid.GetSelectedOption(); gameSelected = gameGrid.GetClickedOption(); }
if (Settings.gameDisplay==carousel){
int selectimg;
selectimg = gameCarousel.GetSelectedOption(); gameSelected = gameCarousel.GetClickedOption(); }
if (Settings.gameDisplay==list) {
//Get selected game under cursor
int selectimg;//, promptnumber;
char ID[4];
char IDfull[7];
selectimg = gameBrowser.GetSelectedOption(); gameSelected = gameBrowser.GetClickedOption();
if (gameSelected > 0) //if click occured
selectimg = gameSelected;
if ((selectimg >= 0) && (selectimg < (s32) gameCnt))
{
if (selectimg != selectedold)
{
selectedold = selectimg;//update displayed cover, game ID, and region if the selected game changes
struct discHdr *header = &gameList[selectimg];
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]);
w.Remove(&DownloadBtn);
if (GameIDTxt)
{
w.Remove(GameIDTxt);
delete GameIDTxt;
GameIDTxt = NULL;
}
if(GameRegionTxt)
{
w.Remove(GameRegionTxt);
delete GameRegionTxt;
GameRegionTxt = NULL;
}
switch(header->id[3])
{
case 'E':
sprintf(gameregion,"NTSC U");
break;
case 'J':
sprintf(gameregion,"NTSC J");
break;
case 'K':
sprintf(gameregion,"NTSC K");
break;
case 'P':
case 'D':
case 'F':
case 'X':
case 'S':
case 'Y':
sprintf(gameregion," PAL ");
break;
}
//load game cover
if (cover)
{
delete cover;
cover = NULL;
}
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull);
cover = new GuiImageData(imgPath,0); //load short id
if (!cover->GetImage()) //if could not load the short id image
{
delete cover;
snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID);
cover = new GuiImageData(imgPath, 0); //load full id image
if (!cover->GetImage())
{
delete cover;
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path);
cover = new GuiImageData(imgPath, nocover_png); //load no image
}
}
if (coverImg)
{
delete coverImg;
coverImg = NULL;
}
coverImg = new GuiImage(cover);
coverImg->SetWidescreen(CFG.widescreen);
DownloadBtn.SetImage(coverImg);// put the new image on the download button
w.Append(&DownloadBtn);
if ((Settings.sinfo == GameID) || (Settings.sinfo == Both)){
GameIDTxt = new GuiText(IDfull, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
GameIDTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameIDTxt->SetPosition(THEME.id_x,THEME.id_y);
GameIDTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameIDTxt);
}
if ((Settings.sinfo == GameRegion) || (Settings.sinfo == Both)){
GameRegionTxt = new GuiText(gameregion, 22, (GXColor){THEME.info_r, THEME.info_g, THEME.info_b, 255});
GameRegionTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GameRegionTxt->SetPosition(THEME.region_x, THEME.region_y);
GameRegionTxt->SetEffect(EFFECT_FADE, 20);
w.Append(GameRegionTxt);
}
}
}
} }
if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt))
@ -4015,6 +4124,7 @@ static int MenuDiscList()
else if(choice == 0) else if(choice == 0)
if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);}
else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);}
else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);}
} }
} }
} }
@ -4022,6 +4132,7 @@ static int MenuDiscList()
HaltGui(); HaltGui();
if (Settings.gameDisplay==list)mainWindow->Remove(&gameBrowser); if (Settings.gameDisplay==list)mainWindow->Remove(&gameBrowser);
else if (Settings.gameDisplay==grid)mainWindow->Remove(&gameGrid); else if (Settings.gameDisplay==grid)mainWindow->Remove(&gameGrid);
else if (Settings.gameDisplay==carousel)mainWindow->Remove(&gameCarousel);
mainWindow->Remove(&w); mainWindow->Remove(&w);
ResumeGui(); ResumeGui();
return menu; return menu;