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
@ -62,7 +62,7 @@ void customOptionList::SetValue(int i, const char *format, ...)
|
|||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
vasprintf(&tmp, format, va);
|
vasprintf(&tmp, format, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
if(tmp)
|
if(tmp)
|
||||||
{
|
{
|
||||||
if(value[i] && !strcmp(tmp, value[i]))
|
if(value[i] && !strcmp(tmp, value[i]))
|
||||||
@ -240,9 +240,9 @@ GuiCustomOptionBrowser::~GuiCustomOptionBrowser()
|
|||||||
delete bgOptionsEntry;
|
delete bgOptionsEntry;
|
||||||
|
|
||||||
delete trigA;
|
delete trigA;
|
||||||
|
delete trigHeldA;
|
||||||
delete btnSoundClick;
|
delete btnSoundClick;
|
||||||
|
|
||||||
// delete optionBg;
|
|
||||||
for(int i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
delete optionTxt[i];
|
delete optionTxt[i];
|
||||||
@ -405,7 +405,7 @@ void GuiCustomOptionBrowser::UpdateListEntries()
|
|||||||
{
|
{
|
||||||
optionVal[i]->SetPosition(coL2,0);
|
optionVal[i]->SetPosition(coL2,0);
|
||||||
optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED);
|
optionVal[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::DOTTED);
|
||||||
|
|
||||||
optionValOver[i]->SetPosition(coL2,0);
|
optionValOver[i]->SetPosition(coL2,0);
|
||||||
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL);
|
optionValOver[i]->SetMaxWidth(bgOptionsImg->GetWidth() - (coL2+24), GuiText::SCROLL);
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t)
|
|||||||
arrowDownBtn->Update(t);
|
arrowDownBtn->Update(t);
|
||||||
scrollbarBoxBtn->Update(t);
|
scrollbarBoxBtn->Update(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
next = listOffset;
|
next = listOffset;
|
||||||
|
|
||||||
for(int i=0; i < size; i++)
|
for(int i=0; i < size; i++)
|
||||||
@ -632,7 +632,7 @@ void GuiCustomOptionBrowser::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
if(old_listOffset != listOffset)
|
if(old_listOffset != listOffset)
|
||||||
UpdateListEntries();
|
UpdateListEntries();
|
||||||
|
|
||||||
if(updateCB)
|
if(updateCB)
|
||||||
updateCB(this);
|
updateCB(this);
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,7 @@ class GuiCustomOptionBrowser : public GuiElement
|
|||||||
GuiImageData * scrollbarBox;
|
GuiImageData * scrollbarBox;
|
||||||
GuiImageData * scrollbarBoxOver;
|
GuiImageData * scrollbarBoxOver;
|
||||||
|
|
||||||
GuiSound * btnSoundOver;
|
|
||||||
GuiSound * btnSoundClick;
|
GuiSound * btnSoundClick;
|
||||||
GuiTrigger * trigA;
|
GuiTrigger * trigA;
|
||||||
GuiTrigger * trigB;
|
|
||||||
GuiTrigger * trigHeldA;
|
GuiTrigger * trigHeldA;
|
||||||
};
|
};
|
||||||
|
@ -181,7 +181,6 @@ GuiGameBrowser::~GuiGameBrowser()
|
|||||||
delete trigA;
|
delete trigA;
|
||||||
delete trigHeldA;
|
delete trigHeldA;
|
||||||
delete btnSoundClick;
|
delete btnSoundClick;
|
||||||
delete btnSoundOver;
|
|
||||||
|
|
||||||
for(int i=0; i<pagesize; i++)
|
for(int i=0; i<pagesize; i++)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,6 @@ class GuiGameBrowser : public GuiElement
|
|||||||
GuiImageData * scrollbarBox;
|
GuiImageData * scrollbarBox;
|
||||||
GuiImageData * scrollbarBoxOver;
|
GuiImageData * scrollbarBoxOver;
|
||||||
|
|
||||||
GuiSound * btnSoundOver;
|
|
||||||
GuiSound * btnSoundClick;
|
GuiSound * btnSoundClick;
|
||||||
GuiTrigger * trigA;
|
GuiTrigger * trigA;
|
||||||
GuiTrigger * trigHeldA;
|
GuiTrigger * trigHeldA;
|
||||||
|
@ -23,19 +23,18 @@
|
|||||||
#define IN_SPEED 175
|
#define IN_SPEED 175
|
||||||
#define SHIFT_SPEED 100
|
#define SHIFT_SPEED 100
|
||||||
#define SPEED_STEP 4
|
#define SPEED_STEP 4
|
||||||
#define PAGESIZE 9
|
#define SAFETY 320
|
||||||
#define SAFETY 9
|
|
||||||
|
|
||||||
extern const int vol;
|
extern const int vol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the GuiGameCarousel class.
|
* 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;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
this->gameCnt = (gameCnt < SAFETY) ? gameCnt : SAFETY;
|
gameCnt = (count < SAFETY) ? count : 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;
|
||||||
@ -49,7 +48,6 @@ GuiGameCarousel::GuiGameCarousel(int w, int h, struct discHdr * l, int gameCnt,
|
|||||||
|
|
||||||
trigA = new GuiTrigger;
|
trigA = new GuiTrigger;
|
||||||
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||||
trigHeldA = new GuiTrigger;
|
|
||||||
trigL = new GuiTrigger;
|
trigL = new GuiTrigger;
|
||||||
trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
trigL->SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
|
||||||
trigR = new GuiTrigger;
|
trigR = new GuiTrigger;
|
||||||
@ -159,7 +157,6 @@ GuiGameCarousel::~GuiGameCarousel()
|
|||||||
delete btnLeft;
|
delete btnLeft;
|
||||||
|
|
||||||
delete trigA;
|
delete trigA;
|
||||||
delete trigHeldA;
|
|
||||||
delete trigL;
|
delete trigL;
|
||||||
delete trigR;
|
delete trigR;
|
||||||
delete trigPlus;
|
delete trigPlus;
|
||||||
@ -430,7 +427,7 @@ void GuiGameCarousel::Reload(struct discHdr * l, int count)
|
|||||||
|
|
||||||
LOCK(this);
|
LOCK(this);
|
||||||
|
|
||||||
gameCnt = count;
|
gameCnt = (count < SAFETY) ? count : SAFETY;
|
||||||
gameList = l;
|
gameList = l;
|
||||||
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
pagesize = (gameCnt < PAGESIZE) ? gameCnt : PAGESIZE;
|
||||||
listOffset = this->FindMenuItem(-1, 1);
|
listOffset = this->FindMenuItem(-1, 1);
|
||||||
|
@ -55,6 +55,5 @@ class GuiGameCarousel : public GuiElement
|
|||||||
GuiTrigger * trigR;
|
GuiTrigger * trigR;
|
||||||
GuiTrigger * trigPlus;
|
GuiTrigger * trigPlus;
|
||||||
GuiTrigger * trigMinus;
|
GuiTrigger * trigMinus;
|
||||||
GuiTrigger * trigHeldA;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -459,6 +459,17 @@ void GuiGameGrid::Update(GuiTrigger * t)
|
|||||||
|
|
||||||
void GuiGameGrid::Reload(struct discHdr * l, int count)
|
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);
|
LOCK(this);
|
||||||
gameList = l;
|
gameList = l;
|
||||||
gameCnt = count;
|
gameCnt = count;
|
||||||
@ -470,16 +481,12 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
|||||||
char IDfull[7];
|
char IDfull[7];
|
||||||
char imgPath[100];
|
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]) {
|
for(int i=0; i<pagesize; i++) {
|
||||||
delete coverImg[i];
|
|
||||||
coverImg[i] = NULL;
|
|
||||||
}
|
|
||||||
if(cover[i]) {
|
|
||||||
delete cover[i];
|
|
||||||
cover[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct discHdr *header = &gameList[i+changed];
|
struct discHdr *header = &gameList[i+changed];
|
||||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||||
@ -501,20 +508,29 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
|
|||||||
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
cover[i] = new GuiImageData(imgPath, nocover_png); //load no image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
coverImg[i] = new GuiImage(cover[i]);
|
coverImg[i] = new GuiImage(cover[i]);
|
||||||
coverImg[i]->SetWidescreen(CFG.widescreen);
|
coverImg[i]->SetWidescreen(CFG.widescreen);
|
||||||
coverImg[i]->SetScale(0.6);
|
coverImg[i]->SetScale(0.6);
|
||||||
coverImg[i]->SetParent(game[i]);
|
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);
|
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]->SetVisible(true);
|
||||||
game[i]->SetImage(coverImg[i]);
|
game[i]->SetClickable(true);
|
||||||
game[i]->SetClickable(true);
|
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
||||||
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
|
||||||
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
|
game[i]->SetVisible(false);
|
||||||
game[i]->SetVisible(false);
|
game[i]->SetClickable(false);
|
||||||
game[i]->SetClickable(false);
|
game[i]->RemoveSoundOver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user