From fc20580add0bf3023e900ed7decb5379f40d6da8 Mon Sep 17 00:00:00 2001 From: "ardi@ist-einmalig.de" Date: Mon, 11 May 2009 18:45:33 +0000 Subject: [PATCH] Fixed thi Install-Bug ... i think --- source/libwiigui/gui.h | 6 +++--- source/libwiigui/gui_element.cpp | 6 +++--- source/libwiigui/gui_text.cpp | 4 ++-- source/main.cpp | 2 +- source/menu.cpp | 37 ++++++++++++++++++++++---------- 5 files changed, 35 insertions(+), 20 deletions(-) diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index b7b6ec7d..640ddbc7 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -376,7 +376,7 @@ class GuiElement protected: void Lock(); void Unlock(); - mutex_t mutex; + static mutex_t mutex; friend class SimpleLock; //int position2; //! B Scrollbariable @@ -422,9 +422,9 @@ public: private: GuiElement *element; }; -//#define LOCK(e) SimpleLock LOCK(e) +#define LOCK(e) SimpleLock LOCK(e) //disabled because of problems with FW 4.0 -#define LOCK(e) +//#define LOCK(e) //!Allows GuiElements to be grouped together into a "window" class GuiWindow : public GuiElement diff --git a/source/libwiigui/gui_element.cpp b/source/libwiigui/gui_element.cpp index 55b30990..3a6c1565 100644 --- a/source/libwiigui/gui_element.cpp +++ b/source/libwiigui/gui_element.cpp @@ -13,6 +13,7 @@ /** * Constructor for the Object class. */ +mutex_t GuiElement::mutex = 0; GuiElement::GuiElement() { xoffset = 0; @@ -55,8 +56,7 @@ GuiElement::GuiElement() // default alignment - align to top left alignmentVert = ALIGN_TOP; alignmentHor = ALIGN_LEFT; - LWP_MutexInit(&mutex, true); - + if(mutex == 0) LWP_MutexInit(&mutex, true); } /** @@ -64,7 +64,7 @@ GuiElement::GuiElement() */ GuiElement::~GuiElement() { - LWP_MutexDestroy(mutex); +// LWP_MutexDestroy(mutex); } void GuiElement::SetParent(GuiElement * e) diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index d7e1d526..e7213f0b 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -67,7 +67,7 @@ GuiText::~GuiText() { if(text) { - delete text; + delete [] text; text = NULL; } } @@ -76,7 +76,7 @@ void GuiText::SetText(const char * t) { LOCK(this); if(text) - delete text; + delete [] text; text = NULL; if(t) diff --git a/source/main.cpp b/source/main.cpp index d95657ca..42a388f3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -112,7 +112,7 @@ main(int argc, char *argv[]) s32 ret2; - + __io_wiisd.startup(); fatMountSimple("SD", &__io_wiisd); diff --git a/source/menu.cpp b/source/menu.cpp index 44503ca6..91a7b959 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1341,16 +1341,22 @@ void ShowProgress (s32 done, s32 total) { - static time_t start; + static time_t start; static u32 expected; f32 percent; //, size; u32 d, h, m, s; + static int last_percent; + static u32 last_d; + static int last_gamesizedone; //first time if (!done) { start = time(0); expected = 300; + last_percent = -1; + last_d = 0; + last_gamesizedone = -1; } //Elapsed time @@ -1374,19 +1380,31 @@ ShowProgress (s32 done, s32 total) percent = (done * 100.0) / total; //size = (hdd->wbfs_sec_sz / GB_SIZE) * total; - sprintf(prozent, "%0.2f", percent); - prTxt.SetText(prozent); + if(last_percent != (int)(percent*100)) + { + last_percent = (int)(percent*100); + sprintf(prozent, "%d.%.2d", last_percent/100, last_percent%100); + prTxt.SetText(prozent); + } //prTxt.SetFont(fontClock); - sprintf(timet,"Time left: %d:%02d:%02d",h,m,s); - timeTxt.SetText(timet); + if(last_d != d) + { + last_d = d; + sprintf(timet,"Time left: %d:%02d:%02d",h,m,s); + timeTxt.SetText(timet); + } float gamesizedone = 0.00; gamesizedone = gamesize * done/total; - sprintf(sizeshow,"%0.2fGB/%0.2fGB", gamesizedone, gamesize); - sizeTxt.SetText(sizeshow); - + if(last_gamesizedone != (int)(gamesizedone*100)); + { + last_gamesizedone = (int)(gamesizedone*100); + int int_gamesize = (int)(gamesize*100); + sprintf(sizeshow,"%d.%.2dGB/%d.%.2dGB", last_gamesizedone/100, last_gamesizedone%100, int_gamesize/100, int_gamesize%100); + sizeTxt.SetText(sizeshow); + } // timeTxt.SetFont(fontClock); if ((Settings.wsprompt == yes) && (CFG.widescreen)){ progressbarImg.SetTile(80*done/total);} @@ -2218,7 +2236,6 @@ static int MenuDiscList() //CLOCK struct tm * timeinfo; char theTime[80]; - int counter = 0; time_t lastrawtime=0; WBFS_DiskSpace(&used, &freespace); @@ -2496,8 +2513,6 @@ static int MenuDiscList() strftime(theTime, sizeof(theTime), "%H %M", timeinfo); clockTime.SetText(theTime); } - counter++; - #ifdef HW_RVL for(i=0; i < 4; i++) {