From 1ffee5a484ce758d8b26de3d0bb3d5ede02cdaf6 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Sun, 31 May 2009 21:40:22 +0000 Subject: [PATCH] *Found and fixed bug with Memory for Carousel (also was one in Grid) *Added Carousel back in *Changed UMS Heapsize which increases compatibility for some HDD Devices with cIOS38 Rev12 **NOTE: If anyone encounters any HDD detection problems which start from this rev on, make an issue and we can revert that thing. --- source/libwiigui/gui_gamecarousel.cpp | 22 +-- source/libwiigui/gui_gamecarousel.h | 1 - source/libwiigui/gui_gamegrid.cpp | 10 +- source/menu.cpp | 251 +++++++++++++------------- source/usbstorage.c | 8 +- 5 files changed, 151 insertions(+), 141 deletions(-) diff --git a/source/libwiigui/gui_gamecarousel.cpp b/source/libwiigui/gui_gamecarousel.cpp index 9bf82c2f..378b584d 100644 --- a/source/libwiigui/gui_gamecarousel.cpp +++ b/source/libwiigui/gui_gamecarousel.cpp @@ -24,7 +24,7 @@ #define SHIFT_SPEED 100 #define SPEED_STEP 4 #define PAGESIZE 9 -#define SAFETY 320 +#define SAFETY 9 extern const int vol; @@ -97,7 +97,7 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt, game = new GuiButton * [pagesize]; bob = new int[pagesize]; coverImg = new GuiImage * [gameCnt]; - cover = new GuiImageData * [gameCnt]; + cover = new GuiImageData * [gameCnt]; for(int i=0; iSetScale(SCALE); coverImg[i]->SetWidescreen(CFG.widescreen); } - + for(int i=0; i < pagesize; i++) { game[i] = new GuiButton(122,244); game[i]->SetParent(this); @@ -330,7 +330,7 @@ void GuiGameCarousel::Update(GuiTrigger * t) if(game[bob[i]]->GetState() == STATE_CLICKED) { clickedItem = i; } - + } // navigation @@ -354,19 +354,19 @@ void GuiGameCarousel::Update(GuiTrigger * t) listOffset = (listOffset+1 < gameCnt) ? listOffset+1 : 0; firstPic = (firstPic+1 < pagesize) ? firstPic+1 : 0; - + for (int i=0; iSetImage(coverImg[(listOffset + pagesize-1) % gameCnt]); game[bob[pagesize-1]]->SetPosition(0, RADIUS); - + for (int i=0; iSetEffect(EFFECT_GOROUND, -speed, DEG_OFFSET, RADIUS, 270-(pagesize-2*i-3)*DEG_OFFSET/2, 1, 0, RADIUS); - - + + } speed+=SPEED_STEP; } @@ -385,7 +385,7 @@ void GuiGameCarousel::Update(GuiTrigger * t) for(int i=0; iStopEffect(); } - listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1; + listOffset = (listOffset-1 < 0) ? gameCnt-1 : listOffset-1; firstPic = (firstPic-1 < 0) ? pagesize-1 : firstPic-1; for(int i=0; iSetScale(SCALE); coverImg[i]->SetWidescreen(CFG.widescreen); } - + for(int i=0; i < pagesize; i++) { game[i] = new GuiButton(122,244); game[i]->SetParent(this); diff --git a/source/libwiigui/gui_gamecarousel.h b/source/libwiigui/gui_gamecarousel.h index 0a6df18c..a19acff8 100644 --- a/source/libwiigui/gui_gamecarousel.h +++ b/source/libwiigui/gui_gamecarousel.h @@ -35,7 +35,6 @@ class GuiGameCarousel : public GuiElement int * bob; GuiButton ** game; - GuiText ** gameTxt; GuiImage ** coverImg; GuiImageData ** cover; diff --git a/source/libwiigui/gui_gamegrid.cpp b/source/libwiigui/gui_gamegrid.cpp index 55c22125..071c2247 100644 --- a/source/libwiigui/gui_gamegrid.cpp +++ b/source/libwiigui/gui_gamegrid.cpp @@ -16,7 +16,7 @@ #include #include -#define GAMESELECTSIZE 30 + extern const int vol; /** @@ -157,7 +157,13 @@ GuiGameGrid::~GuiGameGrid() delete btnLeft; delete trigA; + delete trigHeldA; + delete trigL; + delete trigR; + delete trigPlus; + delete trigMinus; delete btnSoundClick; + delete btnSoundOver; for(int i=0; iAppend(&gameBrowser);} - if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} - //if (Settings.gameDisplay==carousel){mainWindow->Append(&gameCarousel);} + if (Settings.gameDisplay==grid){mainWindow->Append(&gameGrid);} + if (Settings.gameDisplay==carousel){mainWindow->Append(&gameCarousel);} mainWindow->Append(&w); ResumeGui(); @@ -3403,8 +3404,8 @@ static int MenuDiscList() } else { 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);} + else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} } } @@ -3435,8 +3436,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==carousel){gameCarousel.SetFocus(1);} + else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} } } @@ -3444,8 +3445,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==carousel){gameCarousel.SetFocus(1);} + else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} } else if(installBtn.GetState() == STATE_CLICKED) { @@ -3459,8 +3460,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==carousel){gameCarousel.SetFocus(1);} + else if (Settings.gameDisplay==grid){gameGrid.SetFocus(1);} + else if (Settings.gameDisplay==carousel){gameCarousel.SetFocus(1);} } } @@ -3473,10 +3474,10 @@ static int MenuDiscList() offset = gameBrowser.GetOffset();} else if (Settings.gameDisplay==grid){ startat = gameGrid.GetSelectedOption(); - offset = gameGrid.GetOffset();} - //else if (Settings.gameDisplay==carousel){ - // startat = gameCarousel.GetSelectedOption(); - // offset = gameCarousel.GetOffset();} + offset = gameGrid.GetOffset();} + else if (Settings.gameDisplay==carousel){ + startat = gameCarousel.GetSelectedOption(); + offset = gameCarousel.GetOffset();} if(isSdInserted()) { CFG_Load(); } @@ -3539,8 +3540,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==carousel){gameCarousel.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) @@ -3549,11 +3550,10 @@ static int MenuDiscList() offset = gameBrowser.GetOffset();} else if (Settings.gameDisplay==grid){ startat = gameGrid.GetSelectedOption(); - offset = gameGrid.GetOffset();} - /*else if (Settings.gameDisplay==carousel){ - startat = gameCarousel.GetSelectedOption(); + offset = gameGrid.GetOffset();} + else if (Settings.gameDisplay==carousel){ + startat = gameCarousel.GetSelectedOption(); offset = gameCarousel.GetOffset();} - */ menu = MENU_SETTINGS; break; @@ -3569,9 +3569,9 @@ static int MenuDiscList() if (Settings.gameDisplay==list){ gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ - gameGrid.Reload(gameList, gameCnt);} - //else if (Settings.gameDisplay==carousel){ - // gameCarousel.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(); @@ -3591,9 +3591,9 @@ static int MenuDiscList() if (Settings.gameDisplay==list){ gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ - gameGrid.Reload(gameList, gameCnt);} - //else if (Settings.gameDisplay==carousel){ - // gameCarousel.Reload(gameList, gameCnt);} + gameGrid.Reload(gameList, gameCnt);} + else if (Settings.gameDisplay==carousel){ + gameCarousel.Reload(gameList, gameCnt);} selectedold = 1; abcBtn.SetImage(&abcBtnImg); abcBtn.SetImageOver(&abcBtnImg); @@ -3616,9 +3616,9 @@ static int MenuDiscList() if (Settings.gameDisplay==list){ gameBrowser.Reload(gameList, gameCnt);} else if (Settings.gameDisplay==grid){ - gameGrid.Reload(gameList, gameCnt);} - //else if (Settings.gameDisplay==carousel){ - //gameCarousel.Reload(gameList, gameCnt);} + gameGrid.Reload(gameList, gameCnt);} + else if (Settings.gameDisplay==carousel){ + gameCarousel.Reload(gameList, gameCnt);} selectedold = 1; abcBtn.SetImage(&abcBtnImg_g); abcBtn.SetImageOver(&abcBtnImg_g); @@ -3629,25 +3629,25 @@ static int MenuDiscList() } countBtn.ResetState(); - } - + } + else if(listBtn.GetState() == STATE_CLICKED) { if (Settings.gameDisplay!=list){ if (Settings.gameDisplay==grid) { - mainWindow->Remove(&gameGrid); + mainWindow->Remove(&gameGrid); gridBtn.SetImage(&gridBtnImg_g); gridBtn.SetImageOver(&gridBtnImg_g); - gridBtn.SetAlpha(180); - } - /*if (Settings.gameDisplay==carousel) { - mainWindow->Remove(&gameCarousel); + gridBtn.SetAlpha(180); + } + if (Settings.gameDisplay==carousel) { + mainWindow->Remove(&gameCarousel); carouselBtn.SetImage(&carouselBtnImg_g); carouselBtn.SetImageOver(&carouselBtnImg_g); - carouselBtn.SetAlpha(180); - }*/ + carouselBtn.SetAlpha(180); + } HaltGui(); mainWindow->Remove(&w); - Settings.gameDisplay=list; + Settings.gameDisplay=list; gameBrowser.Reload(gameList, gameCnt); // initialize before append mainWindow->Append(&gameBrowser); mainWindow->Append(&w); @@ -3659,14 +3659,14 @@ static int MenuDiscList() { 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); 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); + 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); @@ -3679,35 +3679,35 @@ static int MenuDiscList() } w.Append(&favoriteBtn); w.Append(&abcBtn); - w.Append(&countBtn); + w.Append(&countBtn); w.Append(&listBtn); w.Append(&gridBtn); w.Append(&carouselBtn); w.Append(&DownloadBtn); if(isSdInserted()) { cfg_save_global(); - } + } } listBtn.ResetState(); - } - - else if (gridBtn.GetState() == STATE_CLICKED) { - if (Settings.gameDisplay!=grid){ - if (Settings.gameDisplay==list) { - mainWindow->Remove(&gameBrowser); + } + + 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); + w.Remove(&DownloadBtn); listBtn.SetImage(&listBtnImg_g); listBtn.SetImageOver(&listBtnImg_g); - listBtn.SetAlpha(180); - } - /*if (Settings.gameDisplay==carousel) { - mainWindow->Remove(&gameCarousel); + listBtn.SetAlpha(180); + } + if (Settings.gameDisplay==carousel) { + mainWindow->Remove(&gameCarousel); carouselBtn.SetImage(&carouselBtnImg_g); carouselBtn.SetImageOver(&carouselBtnImg_g); - carouselBtn.SetAlpha(180); - }*/ + carouselBtn.SetAlpha(180); + } HaltGui(); mainWindow->Remove(&w); Settings.gameDisplay=grid; @@ -3722,49 +3722,49 @@ static int MenuDiscList() { 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); + 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); + 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)) { + 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(&countBtn); w.Append(&listBtn); w.Append(&gridBtn); - w.Append(&carouselBtn); + 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); + } + } + 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); + w.Remove(&DownloadBtn); listBtn.SetImage(&listBtnImg_g); listBtn.SetImageOver(&listBtnImg_g); - listBtn.SetAlpha(180); - if (Settings.gameDisplay==grid) - mainWindow->Remove(&gameGrid); + listBtn.SetAlpha(180); + if (Settings.gameDisplay==grid) + mainWindow->Remove(&gameGrid); gridBtn.SetImage(&gridBtnImg_g); gridBtn.SetImageOver(&gridBtnImg_g); gridBtn.SetAlpha(180); @@ -3782,53 +3782,56 @@ static int MenuDiscList() { 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); + 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); + 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)) { + 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(&countBtn); w.Append(&listBtn); w.Append(&gridBtn); - w.Append(&carouselBtn); + w.Append(&carouselBtn); if(isSdInserted()) { cfg_save_global(); - } + } } - */ - carouselBtn.ResetState(); + carouselBtn.ResetState(); } if (Settings.gameDisplay==grid){ int selectimg; - selectimg = gameGrid.GetSelectedOption(); gameSelected = gameGrid.GetClickedOption(); } - /* + selectimg = gameGrid.GetSelectedOption(); + gameSelected = gameGrid.GetClickedOption(); + } + if (Settings.gameDisplay==carousel){ int selectimg; - selectimg = gameCarousel.GetSelectedOption(); gameSelected = gameCarousel.GetClickedOption(); } - */ + 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(); + selectimg = gameBrowser.GetSelectedOption(); + gameSelected = gameBrowser.GetClickedOption(); if (gameSelected > 0) //if click occured @@ -3949,7 +3952,7 @@ static int MenuDiscList() if (Settings.qboot == yes)//quickboot game { - wiilight(0); + wiilight(0); //////////save game play count//////////////// extern u8 favorite; extern u16 count; @@ -4181,16 +4184,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==carousel){gameCarousel.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==carousel)mainWindow->Remove(&gameCarousel); + else if (Settings.gameDisplay==grid)mainWindow->Remove(&gameGrid); + else if (Settings.gameDisplay==carousel)mainWindow->Remove(&gameCarousel); mainWindow->Remove(&w); ResumeGui(); return menu; diff --git a/source/usbstorage.c b/source/usbstorage.c index de46e74d..ed5ebc39 100644 --- a/source/usbstorage.c +++ b/source/usbstorage.c @@ -3,7 +3,7 @@ usbstorage_starlet.c -- USB mass storage support, inside starlet Copyright (C) 2009 Kwiirk -If this driver is linked before libogc, this will replace the original +If this driver is linked before libogc, this will replace the original usbstorage driver by svpe from libogc This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any @@ -40,11 +40,11 @@ distribution. #define USB_IOCTL_UMS_READ_STRESS (UMS_BASE+0x5) #define USB_IOCTL_UMS_SET_VERBOSE (UMS_BASE+0x6) -#define UMS_HEAPSIZE 0x8000 +#define UMS_HEAPSIZE 0x10000 /* Variables */ static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb/ehc"; - + static s32 hid = -1, fd = -1; static u32 sector_size; @@ -85,7 +85,7 @@ s32 USBStorage_Init(void) if (hid < 0) { hid = iosCreateHeap(UMS_HEAPSIZE); if (hid < 0) - return IPC_ENOMEM; + return IPC_ENOMEM; } /* Open USB device */