From 52a1eed0b0ae6c9f8d38110e7840dca0d98e7b62 Mon Sep 17 00:00:00 2001 From: DRayX7 Date: Sat, 30 May 2009 03:02:41 +0000 Subject: [PATCH] *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. --- source/cfg.c | 14 +- source/cfg.h | 4 +- source/filelist.h | 13 +- ...angeCarosselle.png => arrangeCarousel.png} | Bin ...elle_gray.png => arrangeCarousel_gray.png} | Bin source/libwiigui/gui.h | 3 + source/libwiigui/gui_element.cpp | 14 +- source/libwiigui/gui_gamecarousel.cpp | 188 +++-- source/libwiigui/gui_gamecarousel.h | 1 + source/menu.cpp | 717 ++++++++++-------- 10 files changed, 536 insertions(+), 418 deletions(-) rename source/images/{arrangeCarosselle.png => arrangeCarousel.png} (100%) rename source/images/{arrangeCarosselle_gray.png => arrangeCarousel_gray.png} (100%) diff --git a/source/cfg.c b/source/cfg.c index 9a0de2b2..0e5daf22 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -309,15 +309,17 @@ void CFG_Default(int widescreen) // -1 = non forced Mode THEME.gameText_g = 0; THEME.gameText_b = 0; THEME.pagesize = 9; - THEME.favorite_x = 20; + THEME.favorite_x = 4; THEME.favorite_y = 13; - THEME.abc_x = 52; - THEME.abc_y = 13; - THEME.grid_x = 116; + THEME.abc_x = 36; + THEME.abc_y = 13; + THEME.list_x = 100; + THEME.list_y = 13; + THEME.grid_x = 132; THEME.grid_y = 13; - THEME.carousel_x = 148; + THEME.carousel_x = 164; THEME.carousel_y = 13; - THEME.count_x = 84; + THEME.count_x = 68; THEME.count_y = 13; THEME.sortBarOffset = 100; } diff --git a/source/cfg.h b/source/cfg.h index ae430380..5d5c8a0f 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -107,7 +107,9 @@ struct THEME short favorite_x; short favorite_y; short abc_x; - short abc_y; + short abc_y; + short list_x; + short list_y; short grid_x; short grid_y; short carousel_x; diff --git a/source/filelist.h b/source/filelist.h index 81d09ee0..127eab67 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -261,13 +261,16 @@ extern const u8 abcIcon_png[]; extern const u32 abcIcon_png_size; 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 u32 arrangeGrid_png_size; -extern const u8 arrangeCarosselle_png[]; -extern const u32 arrangeCarosselle_png_size; +extern const u8 arrangeCarousel_png[]; +extern const u32 arrangeCarousel_png_size; extern const u8 favIcon_gray_png[]; 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 u32 arrangeList_gray_png_size; -extern const u8 arrangeCarosselle_gray_png[]; -extern const u32 arrangeCarosselle_gray_png_size; +extern const u8 arrangeCarousel_gray_png[]; +extern const u32 arrangeCarousel_gray_png_size; extern const u8 updateRev_png[]; extern const u32 updateRev_png_size; diff --git a/source/images/arrangeCarosselle.png b/source/images/arrangeCarousel.png similarity index 100% rename from source/images/arrangeCarosselle.png rename to source/images/arrangeCarousel.png diff --git a/source/images/arrangeCarosselle_gray.png b/source/images/arrangeCarousel_gray.png similarity index 100% rename from source/images/arrangeCarosselle_gray.png rename to source/images/arrangeCarousel_gray.png diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 2d060576..7565756d 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -347,6 +347,9 @@ class GuiElement //!\param center_x x 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); + //!Gets the frequency from the above effect + //!\return element frequency + float GetFrequency(); //!Sets an effect to be enabled on wiimote cursor over //!\param e Effect to enable //!\param a Amount of the effect (usage varies on effect) diff --git a/source/libwiigui/gui_element.cpp b/source/libwiigui/gui_element.cpp index bef84e54..6b53f277 100644 --- a/source/libwiigui/gui_element.cpp +++ b/source/libwiigui/gui_element.cpp @@ -431,10 +431,16 @@ int GuiElement::GetEffect() return effects; } -int GuiElement::GetEffectOnOver() -{ - LOCK(this); - return effectsOver; +int GuiElement::GetEffectOnOver() +{ + LOCK(this); + 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) { diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/libwiigui/gui_gamecarousel.cpp index 06e17b14..6e831962 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/libwiigui/gui_gamecarousel.cpp @@ -22,7 +22,9 @@ #define RADIUS 780 #define IN_SPEED 175 #define SHIFT_SPEED 100 +#define SPEED_STEP 4 #define PAGESIZE 9 +#define SAFETY 320 extern const int vol; @@ -33,7 +35,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt, { width = w; height = h; - this->gameCnt = gameCnt; + this->gameCnt = (gameCnt < SAFETY) ? gameCnt : SAFETY; gameList = l; pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE; 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; focus = 1; // allow focus firstPic = 0; + clickedItem = -1; + speed = SHIFT_SPEED; char imgPath[100]; trigA = new GuiTrigger; @@ -91,9 +95,9 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt, gameIndex = new int[pagesize]; game = new GuiButton * [pagesize]; - coverImg = new GuiImage * [pagesize]; - cover = new GuiImageData * [pagesize]; bob = new int[pagesize]; + coverImg = new GuiImage * [gameCnt]; + cover = new GuiImageData * [gameCnt]; for(int i=0; iid[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); - //Load full id image + snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image cover[i] = new GuiImageData(imgPath,0); if (!cover[i]->GetImage()) { delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); - //Load short id image + snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image cover[i] = new GuiImageData(imgPath, 0); if (!cover[i]->GetImage()) { delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); - //Load no image + snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image 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]->SetScale(SCALE); coverImg[i]->SetWidescreen(CFG.widescreen); + } + + for(int i=0; i < pagesize; i++) { game[i] = new GuiButton(122,244); game[i]->SetParent(this); game[i]->SetAlignment(ALIGN_CENTRE,ALIGN_MIDDLE); game[i]->SetPosition(0,740); - game[i]->SetImage(coverImg[i]); + game[i]->SetImage(coverImg[(listOffset+i) % gameCnt]); game[i]->SetRumble(false); game[i]->SetTrigger(trigA); 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); } } @@ -157,9 +163,12 @@ GuiGameCarousel::~GuiGameCarousel() for(int i=0; iGetState() == STATE_CLICKED) { - game[bob[i]]->SetState(STATE_SELECTED); - found = listOffset+i; - break; - } + if (clickedItem>-1){ + game[bob[clickedItem]]->SetState(STATE_SELECTED); + found= (clickedItem+listOffset) % gameCnt; + clickedItem=-1; } return found; } @@ -221,7 +228,7 @@ int GuiGameCarousel::GetSelectedOption() for(int i=0; iGetState() == STATE_SELECTED) { game[bob[i]]->SetState(STATE_SELECTED); - found = listOffset+i; + found = (listOffset+i) % gameCnt; break; } } @@ -296,10 +303,6 @@ void GuiGameCarousel::Update(GuiTrigger * t) int next = listOffset; - char ID[4]; - char IDfull[7]; - char imgPath[100]; - for(int i=0; i= 0) { if(game[bob[i]]->GetState() == STATE_DISABLED) { @@ -313,21 +316,25 @@ void GuiGameCarousel::Update(GuiTrigger * t) game[bob[i]]->SetState(STATE_DISABLED); } - if(focus) { - if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED) - game[bob[i]]->ResetState(); - else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT); - game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan); - } +// if(focus) { +// if(i != selectedItem && game[bob[i]]->GetState() == STATE_SELECTED) +// game[bob[i]]->ResetState(); +// else if(i == selectedItem && game[bob[i]]->GetState() == STATE_DEFAULT); +// game[bob[selectedItem]]->SetState(STATE_SELECTED, t->chan); +// } game[bob[i]]->Update(t); if(game[bob[i]]->GetState() == STATE_SELECTED) { selectedItem = i; } + if(game[bob[i]]->GetState() == STATE_CLICKED) { + clickedItem = i; + } + } // navigation - if(!focus || game[0]->GetEffect() || gameCnt <= pagesize) + if(!focus || gameCnt <= pagesize || (game[bob[0]]->GetEffect() && game[bob[pagesize-1]]->GetEffect())) return; // skip navigation if (t->Left() || btnLeft->GetState() == STATE_CLICKED) { @@ -337,50 +344,31 @@ void GuiGameCarousel::Update(GuiTrigger * t) buttons |= WPAD_ButtonsHeld(i); if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) || t->Left())) { btnLeft->ResetState(); + speed = SHIFT_SPEED; return; } for(int i=0; iStopEffect(); } - listOffset++; - if (listOffset > (gameCnt-1)) - listOffset=0; - firstPic++; - if (firstPic > (pagesize-1)) - firstPic=0; + + listOffset = (listOffset+1 < gameCnt) ? listOffset+1 : 0; + firstPic = (firstPic+1 < pagesize) ? firstPic+1 : 0; for (int i=0; iid[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]]->SetImage(coverImg[(listOffset + pagesize-1) % gameCnt]); game[bob[pagesize-1]]->SetPosition(0, RADIUS); + for (int i=0; iSetEffect(EFFECT_GOROUND, -125, 7, 780, 256+7*i, 1, 0, 740); - game[bob[i]]->SetEffect(EFFECT_GOROUND, -SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS); + game[bob[i]]->SetEffect(EFFECT_GOROUND, -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) { @@ -390,50 +378,27 @@ void GuiGameCarousel::Update(GuiTrigger * t) buttons |= WPAD_ButtonsHeld(i); if(!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) || t->Right())) { btnRight->ResetState(); + speed=SHIFT_SPEED; return; } for(int i=0; iStopEffect(); } - listOffset--; - if (listOffset<0) - listOffset=(gameCnt-1); - firstPic--; - if (firstPic<0) - firstPic=(pagesize-1); + listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1; + firstPic = (firstPic-1 < 0) ? pagesize-1 : firstPic-1; for(int i=0; iid[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]]->SetImage(coverImg[listOffset]); game[bob[0]]->SetPosition(0, RADIUS); for(int i=0; iSetEffect(EFFECT_GOROUND, 125, 7, 780, 242+7*i, 1, 0, 740); - game[bob[i]]->SetEffect(EFFECT_GOROUND, SHIFT_SPEED, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS); + game[bob[i]]->SetEffect(EFFECT_GOROUND, speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i+1)*DEG_OFFSET/2, 1, 0, RADIUS); } + speed+=SPEED_STEP; } if(updateCB) @@ -443,15 +408,37 @@ void GuiGameCarousel::Update(GuiTrigger * t) void GuiGameCarousel::Reload(struct discHdr * l, int count) { + for(int i=0; iFindMenuItem(-1, 1); - selectedItem = 0 + listOffset; + selectedItem = listOffset; focus = 1; 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; iid[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); - //Load full id image + snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, IDfull); //Load full id image cover[i] = new GuiImageData(imgPath,0); if (!cover[i]->GetImage()) { delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); - //Load short id image + snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.covers_path, ID); //Load short id image cover[i] = new GuiImageData(imgPath, 0); if (!cover[i]->GetImage()) { delete cover[i]; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); - //Load no image + snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); //Load no image 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]->SetScale(SCALE); coverImg[i]->SetWidescreen(CFG.widescreen); + } + + for(int i=0; i < pagesize; i++) { game[i] = new GuiButton(122,244); game[i]->SetParent(this); 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]->SetTrigger(trigA); 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); } } diff --git a/source/libwiigui/gui_gamecarousel.h b/source/libwiigui/gui_gamecarousel.h index ed393cb6..0a6df18c 100644 --- a/source/libwiigui/gui_gamecarousel.h +++ b/source/libwiigui/gui_gamecarousel.h @@ -26,6 +26,7 @@ class GuiGameCarousel : public GuiElement int pagesize; int firstPic; int speed; + int clickedItem; struct discHdr * gameList; int gameCnt; diff --git a/source/menu.cpp b/source/menu.cpp index 3696c8cc..4f41ef0f 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3026,12 +3026,14 @@ static int MenuDiscList() GuiImageData imgarrangeGrid(imgPath, arrangeGrid_png); snprintf(imgPath, sizeof(imgPath), "%sarrangeGrid_gray.png", CFG.theme_path); 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); GuiImageData imgarrangeList_gray(imgPath, arrangeList_gray_png); - snprintf(imgPath, sizeof(imgPath), "%sarrangeCarosselle.png", CFG.theme_path); - GuiImageData imgarrangeCarosselle(imgPath, arrangeCarosselle_png); - snprintf(imgPath, sizeof(imgPath), "%sarrangeCarosselle_gray.png", CFG.theme_path); - GuiImageData imgarrangeCarosselle_gray(imgPath, arrangeCarosselle_gray_png); + snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel.png", CFG.theme_path); + GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png); + snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path); + GuiImageData imgarrangeCarousel_gray(imgPath, arrangeCarousel_gray_png); GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); @@ -3126,24 +3128,29 @@ static int MenuDiscList() GuiButton countBtn(&countBtnImg_g,&countBtnImg_g, 2, 3, THEME.count_x, THEME.count_y, &trigA, &btnSoundOver, &btnClick,1); 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); gridBtnImg.SetWidescreen(CFG.widescreen); GuiImage gridBtnImg_g(&imgarrangeGrid_gray); - GuiImage listBtnImg_g(&imgarrangeList_gray); 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); gridBtn.SetAlpha(180); - if (Settings.gameDisplay==grid){gridBtn.SetImage(&listBtnImg_g); - gridBtn.SetImageOver(&listBtnImg_g);} + - GuiImage carosselleBtnImg(&imgarrangeCarosselle); - carosselleBtnImg.SetWidescreen(CFG.widescreen); - GuiImage carosselleBtnImg_g(&imgarrangeCarosselle_gray); - carosselleBtnImg_g.SetWidescreen(CFG.widescreen); - GuiButton carosselleBtn(&carosselleBtnImg_g,&carosselleBtnImg_g, 2, 3, THEME.carousel_x, THEME.carousel_y, &trigA, &btnSoundOver, &btnClick,1); - carosselleBtn.SetAlpha(180); + GuiImage carouselBtnImg(&imgarrangeCarousel); + carouselBtnImg.SetWidescreen(CFG.widescreen); + GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); + carouselBtnImg_g.SetWidescreen(CFG.widescreen); + GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, 2, 3, THEME.carousel_x, THEME.carousel_y, &trigA, &btnSoundOver, &btnClick,1); + carouselBtn.SetAlpha(180); if (Settings.fave) { @@ -3159,44 +3166,62 @@ static int MenuDiscList() { countBtn.SetImage(&countBtnImg); countBtn.SetAlpha(255); + } + if (Settings.gameDisplay==list) + { + listBtn.SetImage(&listBtnImg); + listBtn.SetAlpha(255); + } + 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==grid) - { - 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); - 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 + if (Settings.gameDisplay==list) { if(CFG.widescreen) { favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_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); - carosselleBtn.SetPosition(THEME.carousel_x, THEME.carousel_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); - gridBtn.SetPosition(THEME.grid_x+4, THEME.grid_y); - carosselleBtn.SetPosition(THEME.carousel_x+12, THEME.carousel_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); + } + } + 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.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.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); + gameGrid.SetAlignment(ALIGN_LEFT, ALIGN_CENTRE); + + GuiGameCarousel gameCarousel(640, 400, gameList, gameCnt, CFG.theme_path, bg_options_png, startat, offset); + gameCarousel.SetPosition(0,-20); + 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); + 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); - if (Settings.gameDisplay==grid){ - clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);} + if (Settings.gameDisplay==grid || Settings.gameDisplay==carousel) { + 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}); - 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(); + HaltGui(); GuiWindow w(screenwidth, screenheight); if(THEME.showHDD == -1 || THEME.showHDD == 1) //force show hdd info @@ -3257,77 +3286,62 @@ static int MenuDiscList() if (CFG.godmode) w.Append(&installBtn); w.Append(&homeBtn); - w.Append(&settingsBtn); - if (Settings.gameDisplay==list){ - w.Append(&DownloadBtn); - } + w.Append(&settingsBtn); + if (Settings.gameDisplay==list){ + w.Append(&DownloadBtn); + } w.Append(&favoriteBtn); w.Append(&abcBtn); - w.Append(&countBtn); + w.Append(&countBtn); + w.Append(&listBtn); 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(&clockTime); - } + } - if (Settings.gameDisplay==list){mainWindow->Append(&gameBrowser);} - if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} - mainWindow->Append(&w); + if (Settings.gameDisplay==list){mainWindow->Append(&gameBrowser);} + if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} + if (Settings.gameDisplay==carousel){mainWindow->Append(&gameCarousel);} + mainWindow->Append(&w); ResumeGui(); while(menu == MENU_NONE) { - VIDEO_WaitVSync (); + VIDEO_WaitVSync (); - if(carosselleBtn.GetState() == STATE_CLICKED) { -// 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 + //CLOCK time_t rawtime = time(0); //this fixes code dump caused by the clock - if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) { - lastrawtime = rawtime; + if (((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) && rawtime != lastrawtime) { + lastrawtime = rawtime; timeinfo = localtime (&rawtime); if (dataed < 1){ if(Settings.hddinfo == hr12){ if(rawtime & 1) - strftime(theTime, sizeof(theTime), "%I:%M", timeinfo); + strftime(theTime, sizeof(theTime), "%I:%M", timeinfo); else - strftime(theTime, sizeof(theTime), "%I %M", timeinfo); - } + strftime(theTime, sizeof(theTime), "%I %M", timeinfo); + } if(Settings.hddinfo == hr24){ if(rawtime & 1) - strftime(theTime, sizeof(theTime), "%H:%M", timeinfo); + strftime(theTime, sizeof(theTime), "%H:%M", timeinfo); else - strftime(theTime, sizeof(theTime), "%H %M", timeinfo); - } + strftime(theTime, sizeof(theTime), "%H %M", timeinfo); + } clockTime.SetText(theTime); - } + } else if (dataed > 0){ 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);}} // respond to button presses if(shutdown == 1) @@ -3337,32 +3351,33 @@ static int MenuDiscList() if(reset == 1) 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) { - WPAD_Flush(0); - WPAD_Disconnect(0); - WPAD_Shutdown(); + WPAD_Flush(0); + WPAD_Disconnect(0); + WPAD_Shutdown(); - /* Set LED mode */ - ret = CONF_GetIdleLedMode(); - if(ret >= 0 && ret <= 2) - STM_SetLedMode(ret); + /* Set LED mode */ + ret = CONF_GetIdleLedMode(); + if(ret >= 0 && ret <= 2) + STM_SetLedMode(ret); STM_ShutdownToIdle(); } else if(choice == 1) { - WPAD_Flush(0); - WPAD_Disconnect(0); - WPAD_Shutdown(); - STM_ShutdownToStandby(); + WPAD_Flush(0); + WPAD_Disconnect(0); + WPAD_Shutdown(); + STM_ShutdownToStandby(); } else { - poweroffBtn.ResetState(); - if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} - else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + poweroffBtn.ResetState(); + if (Settings.gameDisplay==list){gameBrowser.SetFocus(1);} + else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} } } @@ -3393,7 +3408,8 @@ static int MenuDiscList() } else { homeBtn.ResetState(); 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);} } } @@ -3401,7 +3417,8 @@ static int MenuDiscList() { dataed++; wiiBtn.ResetState(); 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) { @@ -3415,7 +3432,8 @@ static int MenuDiscList() { installBtn.ResetState(); 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);} } } @@ -3428,7 +3446,10 @@ static int MenuDiscList() offset = gameBrowser.GetOffset();} else if (Settings.gameDisplay==grid){ startat = gameGrid.GetSelectedOption(); - offset = gameGrid.GetOffset();} + offset = gameGrid.GetOffset();} + else if (Settings.gameDisplay==carousel){ + startat = gameCarousel.GetSelectedOption(); + offset = gameCarousel.GetOffset();} if(isSdInserted()) { CFG_Load(); } @@ -3491,7 +3512,8 @@ static int MenuDiscList() } DownloadBtn.ResetState(); 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 else if(settingsBtn.GetState() == STATE_CLICKED) @@ -3500,7 +3522,10 @@ static int MenuDiscList() offset = gameBrowser.GetOffset();} else if (Settings.gameDisplay==grid){ startat = gameGrid.GetSelectedOption(); - offset = gameGrid.GetOffset();} + offset = gameGrid.GetOffset();} + else if (Settings.gameDisplay==carousel){ + startat = gameCarousel.GetSelectedOption(); + offset = gameCarousel.GetOffset();} menu = MENU_SETTINGS; break; @@ -3516,7 +3541,9 @@ static int MenuDiscList() if (Settings.gameDisplay==list){ gameBrowser.Reload(gameList, gameCnt);} 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); selectedold = 1; favoriteBtn.ResetState(); @@ -3532,9 +3559,11 @@ static int MenuDiscList() } __Menu_GetEntries(); if (Settings.gameDisplay==list){ - gameBrowser.Reload(gameList, gameCnt);} + gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ - gameGrid.Reload(gameList, gameCnt);} + gameGrid.Reload(gameList, gameCnt);} + else if (Settings.gameDisplay==carousel){ + gameCarousel.Reload(gameList, gameCnt);} selectedold = 1; abcBtn.SetImage(&abcBtnImg); abcBtn.SetAlpha(255); @@ -3555,7 +3584,9 @@ static int MenuDiscList() if (Settings.gameDisplay==list){ gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ - gameGrid.Reload(gameList, gameCnt);} + gameGrid.Reload(gameList, gameCnt);} + else if (Settings.gameDisplay==carousel){ + gameCarousel.Reload(gameList, gameCnt);} selectedold = 1; abcBtn.SetImage(&abcBtnImg_g); abcBtn.SetAlpha(180); @@ -3564,208 +3595,286 @@ static int MenuDiscList() } 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); - if (GameRegionTxt)w.Remove(GameRegionTxt); - w.Remove(&DownloadBtn); - - gridBtn.SetImage(&listBtnImg_g); - gridBtn.SetImageOver(&listBtnImg_g); - 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); - 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 if(listBtn.GetState() == STATE_CLICKED) { + if (Settings.gameDisplay!=list){ + if (Settings.gameDisplay==grid) { + mainWindow->Remove(&gameGrid); + gridBtn.SetImage(&gridBtnImg_g); + gridBtn.SetAlpha(180); + } + if (Settings.gameDisplay==carousel) { + mainWindow->Remove(&gameCarousel); + carouselBtn.SetImage(&carouselBtnImg_g); + carouselBtn.SetAlpha(180); } - 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); + Settings.gameDisplay=list; + gameBrowser.Reload(gameList, gameCnt); // initialize before append + mainWindow->Append(&gameBrowser); + listBtn.SetImage(&listBtnImg); + listBtn.SetAlpha(255); + if(CFG.widescreen) + { + favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_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(); + } } - w.Append(&favoriteBtn); - w.Append(&abcBtn); - w.Append(&countBtn); - w.Append(&gridBtn); - w.Append(&carosselleBtn); - - } else if (Settings.gameDisplay==grid){ - Settings.gameDisplay=list; - - mainWindow->Remove(&gameGrid); - gameBrowser.Reload(gameList, gameCnt); // initialize before append - mainWindow->Append(&gameBrowser); - gridBtn.SetImage(&gridBtnImg_g); - gridBtn.SetImageOver(&gridBtnImg_g); - if(CFG.widescreen) - { - favoriteBtn.SetPosition(THEME.favorite_x, THEME.favorite_y); - abcBtn.SetPosition(THEME.abc_x, THEME.abc_y); - countBtn.SetPosition(THEME.count_x, THEME.count_y); - gridBtn.SetPosition(THEME.grid_x, THEME.grid_y); - carosselleBtn.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); - 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(); + listBtn.ResetState(); + } + + else if (gridBtn.GetState() == STATE_CLICKED) { + if (Settings.gameDisplay!=grid){ + if (Settings.gameDisplay==list) { + mainWindow->Remove(&gameBrowser); + if (GameIDTxt) w.Remove(GameIDTxt); + if (GameRegionTxt) w.Remove(GameRegionTxt); + w.Remove(&DownloadBtn); + listBtn.SetImage(&listBtnImg_g); + listBtn.SetAlpha(180); + } + if (Settings.gameDisplay==carousel) { + mainWindow->Remove(&gameCarousel); + carouselBtn.SetImage(&carouselBtnImg_g); + carouselBtn.SetAlpha(180); + } + 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(); + } + } + gridBtn.ResetState(); + } + + else if (carouselBtn.GetState() == STATE_CLICKED) { + if (Settings.gameDisplay!=carousel){ + if (Settings.gameDisplay==list) + mainWindow->Remove(&gameBrowser); + if (GameIDTxt) w.Remove(GameIDTxt); + if (GameRegionTxt) w.Remove(GameRegionTxt); + w.Remove(&DownloadBtn); + listBtn.SetImage(&listBtnImg_g); + listBtn.SetAlpha(180); + if (Settings.gameDisplay==grid) + mainWindow->Remove(&gameGrid); + gridBtn.SetImage(&gridBtnImg_g); + gridBtn.SetAlpha(180); + Settings.gameDisplay=carousel; + gameCarousel.Reload(gameList, gameCnt); // initialize before append + mainWindow->Append(&gameCarousel); + carouselBtn.SetImage(&carouselBtnImg); + carouselBtn.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(); + } + } + carouselBtn.ResetState(); } if (Settings.gameDisplay==grid){ - int selectimg; - selectimg = gameGrid.GetSelectedOption(); - gameSelected = gameGrid.GetClickedOption(); - } + 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(); + //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 (gameSelected > 0) //if click occured + selectimg = gameSelected; - if ((selectimg >= 0) && (selectimg < (s32) gameCnt)) - { - if (selectimg != selectedold) + if ((selectimg >= 0) && (selectimg < (s32) gameCnt)) { - 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) + if (selectimg != selectedold) { - w.Remove(GameIDTxt); - delete GameIDTxt; - GameIDTxt = NULL; - } - if(GameRegionTxt) - { - w.Remove(GameRegionTxt); - delete GameRegionTxt; - GameRegionTxt = NULL; - } + 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); - switch(header->id[3]) - { - case 'E': - sprintf(gameregion,"NTSC U"); - break; + if (GameIDTxt) + { + w.Remove(GameIDTxt); + delete GameIDTxt; + GameIDTxt = NULL; + } + if(GameRegionTxt) + { + w.Remove(GameRegionTxt); + delete GameRegionTxt; + GameRegionTxt = NULL; + } - case 'J': - sprintf(gameregion,"NTSC J"); - break; + switch(header->id[3]) + { + case 'E': + sprintf(gameregion,"NTSC U"); + break; - case 'K': - sprintf(gameregion,"NTSC K"); - break; + case 'J': + sprintf(gameregion,"NTSC J"); + break; - case 'P': - case 'D': - case 'F': - case 'X': - case 'S': - case 'Y': - sprintf(gameregion," PAL "); - break; - } + case 'K': + sprintf(gameregion,"NTSC K"); + break; - //load game cover - if (cover) - { - delete cover; - cover = NULL; - } + case 'P': + case 'D': + case 'F': + case 'X': + case 'S': + case 'Y': + sprintf(gameregion," PAL "); + break; + } - 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()) + //load game cover + if (cover) { delete cover; - snprintf(imgPath, sizeof(imgPath), "%snoimage.png", CFG.covers_path); - cover = new GuiImageData(imgPath, nocover_png); //load no image + 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 (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)) { @@ -4014,14 +4123,16 @@ static int MenuDiscList() else if(choice == 0) 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);} } } } HaltGui(); 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); ResumeGui(); return menu;