mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-19 17:59:16 +01:00
*Fixed settings codedumps and other codedumps with carousel and grid (oh boy we had so many memory mess up stuff)
This commit is contained in:
parent
99cd6f420e
commit
f2822719b1
@ -240,9 +240,9 @@ GuiCustomOptionBrowser::~GuiCustomOptionBrowser()
|
||||
delete bgOptionsEntry;
|
||||
|
||||
delete trigA;
|
||||
delete trigHeldA;
|
||||
delete btnSoundClick;
|
||||
|
||||
// delete optionBg;
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
delete optionTxt[i];
|
||||
|
@ -82,9 +82,7 @@ class GuiCustomOptionBrowser : public GuiElement
|
||||
GuiImageData * scrollbarBox;
|
||||
GuiImageData * scrollbarBoxOver;
|
||||
|
||||
GuiSound * btnSoundOver;
|
||||
GuiSound * btnSoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigB;
|
||||
GuiTrigger * trigHeldA;
|
||||
};
|
||||
|
@ -181,7 +181,6 @@ GuiGameBrowser::~GuiGameBrowser()
|
||||
delete trigA;
|
||||
delete trigHeldA;
|
||||
delete btnSoundClick;
|
||||
delete btnSoundOver;
|
||||
|
||||
for(int i=0; i<pagesize; i++)
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ class GuiGameBrowser : public GuiElement
|
||||
GuiImageData * scrollbarBox;
|
||||
GuiImageData * scrollbarBoxOver;
|
||||
|
||||
GuiSound * btnSoundOver;
|
||||
GuiSound * btnSoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigHeldA;
|
||||
|
@ -23,19 +23,18 @@
|
||||
#define IN_SPEED 175
|
||||
#define SHIFT_SPEED 100
|
||||
#define SPEED_STEP 4
|
||||
#define PAGESIZE 9
|
||||
#define SAFETY 9
|
||||
#define SAFETY 320
|
||||
|
||||
extern const int vol;
|
||||
|
||||
/**
|
||||
* Constructor for the GuiGameCarousel class.
|
||||
*/
|
||||
GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt, const char *themePath, const u8 *imagebg, int selected, int offset)
|
||||
GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int count, const char *themePath, const u8 *imagebg, int selected, int offset)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
this->gameCnt = (gameCnt < SAFETY) ? gameCnt : SAFETY;
|
||||
gameCnt = (count < SAFETY) ? count : SAFETY;
|
||||
gameList = l;
|
||||
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
||||
listOffset = (offset == 0) ? this->FindMenuItem(-1, 1) : offset;
|
||||
@ -49,7 +48,6 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
||||
|
||||
trigA = new GuiTrigger;
|
||||
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
trigHeldA = new GuiTrigger;
|
||||
trigL = new GuiTrigger;
|
||||
trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
||||
trigR = new GuiTrigger;
|
||||
@ -159,7 +157,6 @@ GuiGameCarousel::~GuiGameCarousel()
|
||||
delete btnLeft;
|
||||
|
||||
delete trigA;
|
||||
delete trigHeldA;
|
||||
delete trigL;
|
||||
delete trigR;
|
||||
delete trigPlus;
|
||||
@ -430,7 +427,7 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
||||
|
||||
LOCK(this);
|
||||
|
||||
gameCnt = count;
|
||||
gameCnt = (count < SAFETY) ? count : SAFETY;
|
||||
gameList = l;
|
||||
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
||||
listOffset = this->FindMenuItem(-1, 1);
|
||||
|
@ -55,6 +55,5 @@ class GuiGameCarousel : public GuiElement
|
||||
GuiTrigger * trigR;
|
||||
GuiTrigger * trigPlus;
|
||||
GuiTrigger * trigMinus;
|
||||
GuiTrigger * trigHeldA;
|
||||
};
|
||||
#endif
|
||||
|
@ -459,6 +459,17 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
||||
|
||||
void GuiGameGrid::Reload(struct discHdr * l, int count)
|
||||
{
|
||||
for(int i=0; i<pagesize; i++)
|
||||
{
|
||||
delete game[i];
|
||||
delete coverImg[i];
|
||||
delete cover[i];
|
||||
}
|
||||
delete [] gameIndex;
|
||||
delete [] game;
|
||||
delete [] cover;
|
||||
delete [] coverImg;
|
||||
|
||||
LOCK(this);
|
||||
gameList = l;
|
||||
gameCnt = count;
|
||||
@ -470,16 +481,12 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
||||
char IDfull[7];
|
||||
char imgPath[100];
|
||||
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
gameIndex = new int[pagesize];
|
||||
game = new GuiButton * [pagesize];
|
||||
coverImg = new GuiImage * [pagesize];
|
||||
cover = new GuiImageData * [pagesize];
|
||||
|
||||
if(coverImg[i]) {
|
||||
delete coverImg[i];
|
||||
coverImg[i] = NULL;
|
||||
}
|
||||
if(cover[i]) {
|
||||
delete cover[i];
|
||||
cover[i] = NULL;
|
||||
}
|
||||
for(int i=0; i<pagesize; i++) {
|
||||
|
||||
struct discHdr *header = &gameList[i+changed];
|
||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||
@ -501,20 +508,29 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||
}
|
||||
}
|
||||
|
||||
coverImg[i] = new GuiImage(cover[i]);
|
||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||
coverImg[i]->SetScale(0.6);
|
||||
game[i] = new GuiButton(coverImg[i]->GetWidth()*.45,coverImg[i]->GetHeight()*.7);
|
||||
game[i]->SetParent(this);
|
||||
game[i]->SetAlignment(ALIGN_TOP,ALIGN_LEFT);
|
||||
game[i]->SetImage(coverImg[i]);
|
||||
coverImg[i]->SetParent(game[i]);
|
||||
coverImg[i]->SetPosition(-10,-35);
|
||||
game[i]->ResetState();
|
||||
if (i<4)game[i]->SetPosition((117+i*110)+THEME.gamegrid_x,25+THEME.gamegrid_y);
|
||||
if (i>3)game[i]->SetPosition((117+(i-4)*110)+THEME.gamegrid_x,185+THEME.gamegrid_y);
|
||||
game[i]->SetRumble(false);
|
||||
game[i]->SetTrigger(trigA);
|
||||
game[i]->SetSoundOver(btnSoundOver);
|
||||
game[i]->SetSoundClick(btnSoundClick);
|
||||
game[i]->SetEffectGrow();
|
||||
game[i]->SetVisible(true);
|
||||
game[i]->SetImage(coverImg[i]);
|
||||
game[i]->SetClickable(true);
|
||||
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
||||
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
|
||||
game[i]->SetVisible(false);
|
||||
game[i]->SetClickable(false);
|
||||
game[i]->RemoveSoundOver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user