*Moved wii.spiffy360.com url in theme downloader a bit down (wasn't shown on some TVs)

*Moved font cache to mem2 (seems to fix the font issues)
*Moved thread start of free space getting out of the constructor (caused a few freezes on start up)
*Added destroy of sound handler when closing app
This commit is contained in:
dimok321 2011-01-02 13:56:24 +00:00
parent 2ea5a823e0
commit 9480208373
10 changed files with 374 additions and 382 deletions

View File

@ -146,7 +146,7 @@ extern "C" bool CheckFile(const char * filepath)
char dirnoslash[strlen(filepath)+2]; char dirnoslash[strlen(filepath)+2];
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath); snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
if(dirnoslash[strlen(dirnoslash)-1] == '/') while(dirnoslash[strlen(dirnoslash)-1] == '/')
dirnoslash[strlen(dirnoslash)-1] = '\0'; dirnoslash[strlen(dirnoslash)-1] = '\0';
char * notRoot = strrchr(dirnoslash, '/'); char * notRoot = strrchr(dirnoslash, '/');

View File

@ -21,6 +21,7 @@
*/ */
#include "FreeTypeGX.h" #include "FreeTypeGX.h"
#include "memory/mem2.h"
using namespace std; using namespace std;
@ -228,7 +229,7 @@ void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
{ {
int length = ((((charData->textureWidth + 3) >> 2) * ((charData->textureHeight + 3) >> 2) * 32 * 2 + 31) & ~31); int length = ((((charData->textureWidth + 3) >> 2) * ((charData->textureHeight + 3) >> 2) * 32 * 2 + 31) & ~31);
uint8_t * glyphData = (uint8_t *) memalign(32, length); uint8_t * glyphData = (uint8_t *) MEM2_alloc(length);
if (!glyphData) return; if (!glyphData) return;
memset(glyphData, 0x00, length); memset(glyphData, 0x00, length);

View File

@ -24,7 +24,6 @@ GuiBGM::~GuiBGM()
ClearList(); ClearList();
} }
;
void GuiBGM::SetLoop(u8 l) void GuiBGM::SetLoop(u8 l)
{ {

View File

@ -1,10 +1,12 @@
#include "mem2.h" #include "mem2.h"
#include "mem2alloc.hpp" #include "mem2alloc.hpp"
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#define MEM2_PRIORITY_SIZE 2097152 //2MB #define MEM2_PRIORITY_SIZE 2097152 //2MB
// Forbid the use of MEM2 through malloc // Forbid the use of MEM2 through malloc
u32 MALLOC_MEM2 = 0; u32 MALLOC_MEM2 = 0;
@ -15,183 +17,175 @@ static bool g_bigGoesToMem2 = false;
extern "C" extern "C"
{ {
void MEM2_takeBigOnes(bool b) void MEM2_takeBigOnes(bool b)
{ {
g_bigGoesToMem2 = b; g_bigGoesToMem2 = b;
} }
void MEM2_init(unsigned int mem2Size) void MEM2_init(unsigned int mem2Size)
{ {
g_mem2gp.init(mem2Size); g_mem2gp.init(mem2Size);
} }
void MEM2_cleanup(void) void MEM2_cleanup(void)
{ {
g_mem2gp.cleanup(); g_mem2gp.cleanup();
} }
void *MEM2_alloc(unsigned int s) void *MEM2_alloc(unsigned int s)
{ {
return g_mem2gp.allocate(s); return g_mem2gp.allocate(s);
} }
void MEM2_free(void *p) void MEM2_free(void *p)
{ {
g_mem2gp.release(p); g_mem2gp.release(p);
} }
void *MEM2_realloc(void *p, unsigned int s) void *MEM2_realloc(void *p, unsigned int s)
{ {
return g_mem2gp.reallocate(p, s); return g_mem2gp.reallocate(p, s);
} }
unsigned int MEM2_usableSize(void *p) unsigned int MEM2_usableSize(void *p)
{ {
return CMEM2Alloc::usableSize(p); return CMEM2Alloc::usableSize(p);
} }
unsigned int MEM2_freesize() unsigned int MEM2_freesize()
{ {
return g_mem2gp.FreeSize(); return g_mem2gp.FreeSize();
} }
extern __typeof( malloc ) __real_malloc; extern __typeof(malloc) __real_malloc;
extern __typeof( calloc ) __real_calloc; extern __typeof(calloc) __real_calloc;
extern __typeof( realloc ) __real_realloc; extern __typeof(realloc) __real_realloc;
extern __typeof( memalign ) __real_memalign; extern __typeof(memalign) __real_memalign;
extern __typeof( free ) __real_free; extern __typeof(free) __real_free;
extern __typeof( malloc_usable_size ) __real_malloc_usable_size; extern __typeof(malloc_usable_size) __real_malloc_usable_size;
void *__wrap_malloc(size_t size) void *__wrap_malloc(size_t size)
{ {
void *p; void *p;
if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE) if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE)
{ {
p = MEM2_alloc(size); p = MEM2_alloc(size);
if (p != 0) if (p != 0) {
{ return p;
return p; }
} return __real_malloc(size);
return __real_malloc(size); }
} p = __real_malloc(size);
p = __real_malloc(size); if (p != 0) {
if (p != 0) return p;
{ }
return p; return MEM2_alloc(size);
} }
return MEM2_alloc(size);
}
void *__wrap_calloc(size_t n, size_t size) void *__wrap_calloc(size_t n, size_t size)
{ {
void *p; void *p;
if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE) if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE)
{ {
p = MEM2_alloc(n * size); p = MEM2_alloc(n * size);
if (p != 0) if (p != 0)
{ {
memset(p, 0, n * size); memset(p, 0, n * size);
return p; return p;
} }
return __real_calloc(n, size); return __real_calloc(n, size);
} }
p = __real_calloc(n, size); p = __real_calloc(n, size);
if (p != 0) if (p != 0) {
{ return p;
return p; }
} p = MEM2_alloc(n * size);
p = MEM2_alloc(n * size); if (p != 0) {
if (p != 0) memset(p, 0, n * size);
{ }
memset(p, 0, n * size); return p;
} }
return p;
}
void *__wrap_memalign(size_t a, size_t size) void *__wrap_memalign(size_t a, size_t size)
{ {
void *p; void *p;
if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE) if (g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE)
{ {
if (a <= 32 && 32 % a == 0) if (a <= 32 && 32 % a == 0)
{ {
p = MEM2_alloc(size); p = MEM2_alloc(size);
if (p != 0) if (p != 0) {
{ return p;
return p; }
} }
} return __real_memalign(a, size);
return __real_memalign(a, size); }
} p = __real_memalign(a, size);
p = __real_memalign(a, size); if (p != 0 || a > 32 || 32 % a != 0) {
if (p != 0 || a > 32 || 32 % a != 0) return p;
{ }
return p;
}
return MEM2_alloc(size); return MEM2_alloc(size);
} }
void __wrap_free(void *p) void __wrap_free(void *p)
{ {
if (!p) return; if(!p)
return;
if (((u32) p & 0x10000000) != 0) if (((u32)p & 0x10000000) != 0)
{ {
MEM2_free(p); MEM2_free(p);
} }
else else
{ {
__real_free(p); __real_free(p);
} }
} }
void *__wrap_realloc(void *p, size_t size) void *__wrap_realloc(void *p, size_t size)
{ {
void *n; void *n;
// ptr from mem2 // ptr from mem2
if (((u32) p & 0x10000000) != 0 || (p == 0 && g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE)) if (((u32)p & 0x10000000) != 0 || (p == 0 && g_bigGoesToMem2 && size > MEM2_PRIORITY_SIZE))
{ {
n = MEM2_realloc(p, size); n = MEM2_realloc(p, size);
if (n != 0) if (n != 0) {
{ return n;
return n; }
} n = __real_malloc(size);
n = __real_malloc(size); if (n == 0) {
if (n == 0) return 0;
{ }
return 0; if (p != 0)
} {
if (p != 0) memcpy(n, p, MEM2_usableSize(p) < size ? MEM2_usableSize(p) : size);
{ MEM2_free(p);
memcpy(n, p, MEM2_usableSize(p) < size ? MEM2_usableSize(p) : size); }
MEM2_free(p); return n;
} }
return n; // ptr from malloc
} n = __real_realloc(p, size);
// ptr from malloc if (n != 0) {
n = __real_realloc(p, size); return n;
if (n != 0) }
{ n = MEM2_alloc(size);
return n; if (n == 0) {
} return 0;
n = MEM2_alloc(size); }
if (n == 0) if (p != 0)
{ {
return 0; memcpy(n, p, __real_malloc_usable_size(p) < size ? __real_malloc_usable_size(p) : size);
} __real_free(p);
if (p != 0) }
{ return n;
memcpy(n, p, __real_malloc_usable_size(p) < size ? __real_malloc_usable_size(p) : size); }
__real_free(p);
}
return n;
}
size_t __wrap_malloc_usable_size(void *p) size_t __wrap_malloc_usable_size(void *p)
{ {
if (((u32) p & 0x10000000) != 0) return MEM2_usableSize(p); if (((u32)p & 0x10000000) != 0)
return __real_malloc_usable_size(p); return MEM2_usableSize(p);
} return __real_malloc_usable_size(p);
}
} ///extern "C" } ///extern "C"

View File

@ -5,12 +5,9 @@
#define __MEM2_H_ #define __MEM2_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#include <gctypes.h>
void MEM2_init(unsigned int mem2Size); void MEM2_init(unsigned int mem2Size);
void MEM2_cleanup(void); void MEM2_cleanup(void);
void MEM2_takeBigOnes(bool b); void MEM2_takeBigOnes(bool b);

View File

@ -1,226 +1,238 @@
#include "mem2alloc.hpp" #include "mem2alloc.hpp"
#include <ogc/system.h> #include <ogc/system.h>
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h>
class LockMutex class LockMutex
{ {
mutex_t &m_mutex; mutex_t &m_mutex;
public: public:
LockMutex(mutex_t &m) : LockMutex(mutex_t &m) : m_mutex(m) { LWP_MutexLock(m_mutex); }
m_mutex(m) ~LockMutex(void) { LWP_MutexUnlock(m_mutex); }
{
LWP_MutexLock(m_mutex);
}
~LockMutex(void)
{
LWP_MutexUnlock(m_mutex);
}
}; };
void CMEM2Alloc::init(unsigned int size) void CMEM2Alloc::init(unsigned int size)
{ {
m_baseAddress = (SBlock *) (((u32) SYS_GetArena2Lo() + 31) & ~31); m_baseAddress = (SBlock *) (((u32)SYS_GetArena2Lo() + 31) & ~31);
m_endAddress = (SBlock *) ((char *) m_baseAddress + std::min(size * 0x100000, SYS_GetArena2Size() & ~31)); m_endAddress = (SBlock *) ((char *)m_baseAddress + std::min(size * 0x100000, SYS_GetArena2Size() & ~31));
if (m_endAddress > (SBlock *) 0x93300000) //rest is reserved for usb/usb2/network and other stuff... (0xE0000 bytes) if (m_endAddress > (SBlock *) 0x93300000) //rest is reserved for usb/usb2/network and other stuff... (0xE0000 bytes)
m_endAddress = (SBlock *) 0x93300000; m_endAddress = (SBlock *) 0x93300000;
SYS_SetArena2Lo(m_endAddress); SYS_SetArena2Lo(m_endAddress);
LWP_MutexInit(&m_mutex, 0); LWP_MutexInit(&m_mutex, 0);
} }
void CMEM2Alloc::init(void *addr, void *end) void CMEM2Alloc::init(void *addr, void *end)
{ {
m_baseAddress = (SBlock *) (((u32) addr + 31) & ~31); m_baseAddress = (SBlock *)(((u32)addr + 31) & ~31);
m_endAddress = (SBlock *) ((u32) end & ~31); m_endAddress = (SBlock *)((u32)end & ~31);
LWP_MutexInit(&m_mutex, 0); LWP_MutexInit(&m_mutex, 0);
} }
void CMEM2Alloc::cleanup(void) void CMEM2Alloc::cleanup(void)
{ {
LWP_MutexDestroy(m_mutex); LWP_MutexDestroy(m_mutex);
m_mutex = 0; m_mutex = 0;
m_first = 0; m_first = 0;
// Try to release the range we took through SYS functions // Try to release the range we took through SYS functions
if (SYS_GetArena2Lo() == m_endAddress) SYS_SetArena2Lo(m_baseAddress); if (SYS_GetArena2Lo() == m_endAddress)
m_baseAddress = 0; SYS_SetArena2Lo(m_baseAddress);
m_endAddress = 0; m_baseAddress = 0;
m_endAddress = 0;
} }
void CMEM2Alloc::clear(void) void CMEM2Alloc::clear(void)
{ {
m_first = 0; m_first = 0;
memset(m_baseAddress, 0, (u8 *) m_endAddress - (u8 *) m_endAddress); memset(m_baseAddress, 0, (u8 *)m_endAddress - (u8 *)m_endAddress);
} }
unsigned int CMEM2Alloc::usableSize(void *p) unsigned int CMEM2Alloc::usableSize(void *p)
{ {
return p == 0 ? 0 : ((SBlock *) p - 1)->s * sizeof(SBlock); return p == 0 ? 0 : ((SBlock *)p - 1)->s * sizeof (SBlock);
} }
void *CMEM2Alloc::allocate(unsigned int s) void *CMEM2Alloc::allocate(unsigned int s)
{ {
if (s == 0) s = 1; if (s == 0)
// s = 1;
LockMutex lock(m_mutex); //
// LockMutex lock(m_mutex);
s = (s - 1) / sizeof(SBlock) + 1; //
// First block s = (s - 1) / sizeof (SBlock) + 1;
if (m_first == 0) // First block
{ if (m_first == 0)
if (m_baseAddress + s + 1 >= m_endAddress) return 0; {
m_first = m_baseAddress; if (m_baseAddress + s + 1 >= m_endAddress)
m_first->next = 0; return 0;
m_first->prev = 0; m_first = m_baseAddress;
m_first->s = s; m_first->next = 0;
m_first->f = false; m_first->prev = 0;
return (void *) (m_first + 1); m_first->s = s;
} m_first->f = false;
// Search for a free block return (void *)(m_first + 1);
SBlock *i; }
SBlock *j; // Search for a free block
for (i = m_first; i != 0; i = i->next) SBlock *i;
{ SBlock *j;
if (i->f && i->s >= s) break; for (i = m_first; i != 0; i = i->next)
j = i; {
} if (i->f && i->s >= s)
// Create a new block break;
if (i == 0) j = i;
{ }
i = j + j->s + 1; // Create a new block
if (i + s + 1 >= m_endAddress) return 0; if (i == 0)
j->next = i; {
i->prev = j; i = j + j->s + 1;
i->next = 0; if (i + s + 1 >= m_endAddress)
i->s = s; return 0;
i->f = false; j->next = i;
return (void *) (i + 1); i->prev = j;
} i->next = 0;
// Reuse a free block i->s = s;
i->f = false; i->f = false;
// Split it return (void *)(i + 1);
if (i->s > s + 1) }
{ // Reuse a free block
j = i + s + 1; i->f = false;
j->f = true; // Split it
j->s = i->s - s - 1; if (i->s > s + 1)
i->s = s; {
j->next = i->next; j = i + s + 1;
j->prev = i; j->f = true;
i->next = j; j->s = i->s - s - 1;
if (j->next != 0) j->next->prev = j; i->s = s;
} j->next = i->next;
return (void *) (i + 1); j->prev = i;
i->next = j;
if (j->next != 0)
j->next->prev = j;
}
return (void *)(i + 1);
} }
void CMEM2Alloc::release(void *p) void CMEM2Alloc::release(void *p)
{ {
if (p == 0) return; if (p == 0)
return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
SBlock *i = (SBlock *) p - 1; SBlock *i = (SBlock *)p - 1;
i->f = true; i->f = true;
// If there are no other blocks following yet, // If there are no other blocks following yet,
// set the remaining size to free size. - Dimok // set the remaining size to free size. - Dimok
if (i->next == 0) i->s = m_endAddress - i - 1; if(i->next == 0)
i->s = m_endAddress - i - 1;
// Merge with previous block // Merge with previous block
if (i->prev != 0 && i->prev->f) if (i->prev != 0 && i->prev->f)
{ {
i = i->prev; i = i->prev;
i->s += i->next->s + 1; i->s += i->next->s + 1;
i->next = i->next->next; i->next = i->next->next;
if (i->next != 0) i->next->prev = i; if (i->next != 0)
} i->next->prev = i;
// Merge with next block }
if (i->next != 0 && i->next->f) // Merge with next block
{ if (i->next != 0 && i->next->f)
i->s += i->next->s + 1; {
i->next = i->next->next; i->s += i->next->s + 1;
if (i->next != 0) i->next->prev = i; i->next = i->next->next;
} if (i->next != 0)
i->next->prev = i;
}
} }
void *CMEM2Alloc::reallocate(void *p, unsigned int s) void *CMEM2Alloc::reallocate(void *p, unsigned int s)
{ {
SBlock *i; SBlock *i;
SBlock *j; SBlock *j;
void *n; void *n;
if (s == 0) s = 1; if (s == 0)
if (p == 0) return allocate(s); s = 1;
if (p == 0)
return allocate(s);
i = (SBlock *) p - 1; i = (SBlock *)p - 1;
s = (s - 1) / sizeof(SBlock) + 1; s = (s - 1) / sizeof (SBlock) + 1;
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
//out of memory /* Dimok */ //out of memory /* Dimok */
if (i + s + 1 >= m_endAddress) if (i + s + 1 >= m_endAddress)
{ {
return 0; return 0;
} }
// Last block // Last block
if (i->next == 0 && i + s + 1 < m_endAddress) if (i->next == 0 && i + s + 1 < m_endAddress)
{ {
i->s = s; i->s = s;
return p; return p;
} }
// Size <= current size + next block // Size <= current size + next block
if (i->next != 0 && i->s < s && i->next->f && i->s + i->next->s + 1 >= s) if (i->next != 0 && i->s < s && i->next->f && i->s + i->next->s + 1 >= s)
{ {
// Merge // Merge
i->s += i->next->s + 1; i->s += i->next->s + 1;
i->next = i->next->next; i->next = i->next->next;
if (i->next != 0) i->next->prev = i; if (i->next != 0)
} i->next->prev = i;
// Size <= current size }
if (i->s >= s) // Size <= current size
{ if (i->s >= s)
// Split {
if (i->s > s + 1) // Split
{ if (i->s > s + 1)
j = i + s + 1; {
j->f = true; j = i + s + 1;
j->s = i->s - s - 1; j->f = true;
i->s = s; j->s = i->s - s - 1;
j->next = i->next; i->s = s;
j->prev = i; j->next = i->next;
i->next = j; j->prev = i;
if (j->next != 0) j->next->prev = j; i->next = j;
} if (j->next != 0)
return p; j->next->prev = j;
} }
} return p;
// Size > current size }
n = allocate(s * sizeof(SBlock)); }
if (n == 0) return 0; // Size > current size
memcpy(n, p, i->s * sizeof(SBlock)); n = allocate(s * sizeof (SBlock));
release(p); if (n == 0)
return n; return 0;
memcpy(n, p, i->s * sizeof (SBlock));
release(p);
return n;
} }
unsigned int CMEM2Alloc::FreeSize() unsigned int CMEM2Alloc::FreeSize()
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
if (m_first == 0) return (const char *) m_endAddress - (const char *) m_baseAddress; if (m_first == 0)
return (const char *) m_endAddress - (const char *) m_baseAddress;
SBlock *i; SBlock *i;
unsigned int size = 0; unsigned int size = 0;
for (i = m_first; i != 0; i = i->next) for(i = m_first; i != 0; i = i->next)
{ {
if (i->f && i->next != 0) if(i->f && i->next != 0)
size += i->s; size += i->s;
else if (i->f && i->next == 0) else if(i->f && i->next == 0)
size += m_endAddress - i - 1; size += m_endAddress - i - 1;
else if (!i->f && i->next == 0) size += m_endAddress - i - i->s - 1; else if(!i->f && i->next == 0)
size += m_endAddress - i - i->s - 1;
} }
return size * sizeof(SBlock); return size*sizeof(SBlock);
} }

View File

@ -8,48 +8,35 @@
class CMEM2Alloc class CMEM2Alloc
{ {
public: public:
void *allocate(unsigned int s); void *allocate(unsigned int s);
void release(void *p); void release(void *p);
void *reallocate(void *p, unsigned int s); void *reallocate(void *p, unsigned int s);
void init(unsigned int size); void init(unsigned int size);
void init(void *addr, void *end); void init(void *addr, void *end);
void cleanup(void); void cleanup(void);
void clear(void); void clear(void);
static unsigned int usableSize(void *p); static unsigned int usableSize(void *p);
void forceEndAddress(void *newAddr) void forceEndAddress(void *newAddr) { m_endAddress = (SBlock *)newAddr; }
{ void *getEndAddress(void) const { return m_endAddress; }
m_endAddress = (SBlock *) newAddr; void info(void *&address, unsigned int &size) const { address = m_baseAddress; size = (const char *)m_endAddress - (const char *)m_baseAddress; }
} unsigned int FreeSize();
void *getEndAddress(void) const //
{ CMEM2Alloc(void) : m_baseAddress(0), m_endAddress(0), m_first(0), m_mutex(0) { }
return m_endAddress; private:
} struct SBlock
void info(void *&address, unsigned int &size) const {
{ unsigned int s;
address = m_baseAddress; SBlock *next;
size = (const char *) m_endAddress - (const char *) m_baseAddress; SBlock *prev;
} bool f;
unsigned int FreeSize(); } __attribute__((aligned(32)));
// SBlock *m_baseAddress;
CMEM2Alloc(void) : SBlock *m_endAddress;
m_baseAddress(0), m_endAddress(0), m_first(0), m_mutex(0) SBlock *m_first;
{ mutex_t m_mutex;
} private:
private: CMEM2Alloc(const CMEM2Alloc &);
struct SBlock
{
unsigned int s;
SBlock *next;
SBlock *prev;
bool f;
}__attribute__((aligned(32)));
SBlock *m_baseAddress;
SBlock *m_endAddress;
SBlock *m_first;
mutex_t m_mutex;
private:
CMEM2Alloc(const CMEM2Alloc &);
}; };
#endif // !defined(__MEM2ALLOC_HPP) #endif // !defined(__MEM2ALLOC_HPP)

View File

@ -108,13 +108,6 @@ GameBrowseMenu::GameBrowseMenu()
usedSpaceTxt->SetAlignment(thAlign("center - hdd info align hor"), thAlign("top - hdd info align ver")); usedSpaceTxt->SetAlignment(thAlign("center - hdd info align hor"), thAlign("top - hdd info align ver"));
usedSpaceTxt->SetPosition(thInt("0 - hdd info pos x"), thInt("400 - hdd info pos y")); usedSpaceTxt->SetPosition(thInt("0 - hdd info pos x"), thInt("400 - hdd info pos y"));
if(Settings.ShowFreeSpace)
{
HDDSizeCallback.SetCallback(this, &GameBrowseMenu::UpdateFreeSpace);
ThreadedTask::Instance()->AddCallback(&HDDSizeCallback);
ThreadedTask::Instance()->Execute();
}
gamecntTxt = new GuiText((char *) NULL, 18, thColor("r=55 g=190 b=237 a=255 - game count color")); gamecntTxt = new GuiText((char *) NULL, 18, thColor("r=55 g=190 b=237 a=255 - game count color"));
gamecntBtn = new GuiButton(100, 18); gamecntBtn = new GuiButton(100, 18);
gamecntBtn->SetAlignment(thAlign("center - game count align hor"), thAlign("top - game count align ver")); gamecntBtn->SetAlignment(thAlign("center - game count align hor"), thAlign("top - game count align ver"));
@ -716,6 +709,13 @@ int GameBrowseMenu::Show()
{ {
int menu = MENU_NONE; int menu = MENU_NONE;
if(Settings.ShowFreeSpace)
{
HDDSizeCallback.SetCallback(this, &GameBrowseMenu::UpdateFreeSpace);
ThreadedTask::Instance()->AddCallback(&HDDSizeCallback);
ThreadedTask::Instance()->Execute();
}
while(menu == MENU_NONE) while(menu == MENU_NONE)
{ {
usleep(100); usleep(100);

View File

@ -13,6 +13,7 @@
#include "usbloader/playlog.h" #include "usbloader/playlog.h"
#include "usbloader/wbfs.h" #include "usbloader/wbfs.h"
#include "themes/CTheme.h" #include "themes/CTheme.h"
#include "SoundOperations/SoundHandler.hpp"
#include "utils/ThreadedTask.hpp" #include "utils/ThreadedTask.hpp"
#include "audio.h" #include "audio.h"
#include "lstub.h" #include "lstub.h"
@ -67,11 +68,12 @@ void AppCleanUp(void)
Settings.Save(); Settings.Save();
ExitGUIThreads(); ExitGUIThreads();
StopGX();
delete bgMusic;
delete btnSoundClick; delete btnSoundClick;
delete btnSoundOver; delete btnSoundOver;
delete btnSoundClick2; delete btnSoundClick2;
delete bgMusic;
delete background; delete background;
delete bgImg; delete bgImg;
delete mainWindow; delete mainWindow;
@ -83,9 +85,9 @@ void AppCleanUp(void)
Theme::CleanUp(); Theme::CleanUp();
NewTitles::DestroyInstance(); NewTitles::DestroyInstance();
ThreadedTask::DestroyInstance(); ThreadedTask::DestroyInstance();
SoundHandler::DestroyInstance();
DeinitNetwork(); DeinitNetwork();
StopGX();
ShutdownAudio(); ShutdownAudio();
ResourceManager::DestroyInstance(); ResourceManager::DestroyInstance();

View File

@ -47,7 +47,7 @@ ThemeDownloader::ThemeDownloader()
urlTxt = new GuiText(tr( "Themes by www.spiffy360.com" ), 22, (GXColor) {255, 255, 255, 255}); urlTxt = new GuiText(tr( "Themes by www.spiffy360.com" ), 22, (GXColor) {255, 255, 255, 255});
urlTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP); urlTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
urlTxt->SetPosition(350, 3); urlTxt->SetPosition(350, 12);
Append(urlTxt); Append(urlTxt);
for(int i = 0; i < 4; ++i) for(int i = 0; i < 4; ++i)