mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-24 04:09:15 +01:00
-using miigotus new coverflow loader (thanks) its
way faster than the current one -set down cover buffer from 120 (thats insane and just fills up memory) down to 20, thats enough
This commit is contained in:
parent
350f7d64d1
commit
f5407363fc
@ -47,7 +47,6 @@ static const int greenTwo_len = 1;
|
|||||||
static const char* greenTwo[greenTwo_len] = {"PDUE01"};
|
static const char* greenTwo[greenTwo_len] = {"PDUE01"};
|
||||||
|
|
||||||
static lwp_t coverLoaderThread = LWP_THREAD_NULL;
|
static lwp_t coverLoaderThread = LWP_THREAD_NULL;
|
||||||
SmartBuf coverLoaderThreadStack;
|
|
||||||
|
|
||||||
static inline int loopNum(int i, int s)
|
static inline int loopNum(int i, int s)
|
||||||
{
|
{
|
||||||
@ -182,7 +181,6 @@ CCoverFlow::CCoverFlow(void)
|
|||||||
m_selected = false;
|
m_selected = false;
|
||||||
m_hideCover = false;
|
m_hideCover = false;
|
||||||
m_tickCount = 0;
|
m_tickCount = 0;
|
||||||
m_hqCover = -1;
|
|
||||||
m_blurRadius = 3;
|
m_blurRadius = 3;
|
||||||
m_blurFactor = 1.f;
|
m_blurFactor = 1.f;
|
||||||
//
|
//
|
||||||
@ -200,7 +198,7 @@ CCoverFlow::CCoverFlow(void)
|
|||||||
m_lodBias = -0.3f;
|
m_lodBias = -0.3f;
|
||||||
m_aniso = GX_ANISO_1;
|
m_aniso = GX_ANISO_1;
|
||||||
m_edgeLOD = false;
|
m_edgeLOD = false;
|
||||||
m_numBufCovers = 100;
|
m_numBufCovers = 20;
|
||||||
m_compressTextures = true;
|
m_compressTextures = true;
|
||||||
m_compressCache = false;
|
m_compressCache = false;
|
||||||
m_deletePicsAfterCaching = false;
|
m_deletePicsAfterCaching = false;
|
||||||
@ -600,9 +598,8 @@ void CCoverFlow::stopCoverLoader(bool empty)
|
|||||||
LWP_JoinThread(coverLoaderThread, NULL);
|
LWP_JoinThread(coverLoaderThread, NULL);
|
||||||
coverLoaderThread = LWP_THREAD_NULL;
|
coverLoaderThread = LWP_THREAD_NULL;
|
||||||
|
|
||||||
SMART_FREE(coverLoaderThreadStack);
|
|
||||||
|
|
||||||
if (empty)
|
if (empty)
|
||||||
|
{
|
||||||
for (u32 i = 0; i < m_items.size(); ++i)
|
for (u32 i = 0; i < m_items.size(); ++i)
|
||||||
{
|
{
|
||||||
SMART_FREE(m_items[i].texture.data);
|
SMART_FREE(m_items[i].texture.data);
|
||||||
@ -610,6 +607,7 @@ void CCoverFlow::stopCoverLoader(bool empty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCoverFlow::startCoverLoader(void)
|
void CCoverFlow::startCoverLoader(void)
|
||||||
{
|
{
|
||||||
@ -617,11 +615,8 @@ void CCoverFlow::startCoverLoader(void)
|
|||||||
|
|
||||||
m_loadingCovers = true;
|
m_loadingCovers = true;
|
||||||
|
|
||||||
unsigned int stack_size = (unsigned int)32768;
|
unsigned int stack_size = (unsigned int)8192;
|
||||||
SMART_FREE(coverLoaderThreadStack);
|
LWP_CreateThread(&coverLoaderThread, (void *(*)(void *))CCoverFlow::_coverLoader, (void *)this, 0, stack_size, 40);
|
||||||
coverLoaderThreadStack = smartMem2Alloc(stack_size);
|
|
||||||
LWP_CreateThread(&coverLoaderThread, (void *(*)(void *))CCoverFlow::_coverLoader, (void *)this, coverLoaderThreadStack.get(), stack_size, 40);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCoverFlow::clear(void)
|
void CCoverFlow::clear(void)
|
||||||
@ -1808,6 +1803,8 @@ bool CCoverFlow::start(const char *id)
|
|||||||
m_covers.resize(m_range);
|
m_covers.resize(m_range);
|
||||||
m_jump = 0;
|
m_jump = 0;
|
||||||
m_selected = false;
|
m_selected = false;
|
||||||
|
m_moved = true;
|
||||||
|
gprintf("Coverflow started!\n");
|
||||||
if (id == 0 || !findId(id, true))
|
if (id == 0 || !findId(id, true))
|
||||||
_loadAllCovers(0);
|
_loadAllCovers(0);
|
||||||
_updateAllTargets();
|
_updateAllTargets();
|
||||||
@ -2671,45 +2668,40 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
|
|||||||
|
|
||||||
int CCoverFlow::_coverLoader(CCoverFlow *cf)
|
int CCoverFlow::_coverLoader(CCoverFlow *cf)
|
||||||
{
|
{
|
||||||
bool box = cf->m_box;
|
|
||||||
CCoverFlow::CLRet ret;
|
CCoverFlow::CLRet ret;
|
||||||
u32 bufferSize = cf->m_range + cf->m_numBufCovers * 2;
|
u32 firstItem;
|
||||||
|
bool update;
|
||||||
|
u32 i;
|
||||||
|
|
||||||
|
u32 bufferSize = cf->m_range + cf->m_numBufCovers;
|
||||||
|
if(bufferSize >= cf->m_items.size())
|
||||||
|
bufferSize = cf->m_items.size();
|
||||||
|
|
||||||
while (cf->m_loadingCovers)
|
while (cf->m_loadingCovers)
|
||||||
{
|
{
|
||||||
u32 i;
|
update = cf->m_moved;
|
||||||
ret = CCoverFlow::CL_OK;
|
|
||||||
cf->m_moved = false;
|
cf->m_moved = false;
|
||||||
u32 numItems = cf->m_items.size();
|
|
||||||
u32 firstItem = cf->m_covers[cf->m_range / 2].index;
|
for (u32 j = cf->m_items.size(); j >= bufferSize && cf->m_loadingCovers && !cf->m_moved && update; --j)
|
||||||
u32 lastVisible = bufferSize - 1;
|
|
||||||
int newHQCover = firstItem;
|
|
||||||
if ((u32)cf->m_hqCover < numItems && newHQCover != cf->m_hqCover)
|
|
||||||
{
|
{
|
||||||
cf->_dropHQLOD(cf->m_hqCover);
|
firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||||
cf->m_hqCover = -1;
|
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
|
||||||
}
|
|
||||||
for (u32 j = numItems - 1; j > lastVisible; --j)
|
|
||||||
{
|
|
||||||
i = loopNum((j & 1) != 0 ? firstItem - (j + 1) / 2 : firstItem + j / 2, numItems);
|
|
||||||
LWP_MutexLock(cf->m_mutex);
|
LWP_MutexLock(cf->m_mutex);
|
||||||
SMART_FREE(cf->m_items[i].texture.data);
|
SMART_FREE(cf->m_items[i].texture.data);
|
||||||
cf->m_items[i].state = CCoverFlow::STATE_Loading;
|
cf->m_items[i].state = CCoverFlow::STATE_Loading;
|
||||||
LWP_MutexUnlock(cf->m_mutex);
|
LWP_MutexUnlock(cf->m_mutex);
|
||||||
}
|
}
|
||||||
for (u32 j = 0; j <= lastVisible; ++j)
|
ret = CCoverFlow::CL_OK;
|
||||||
|
for (u32 j = 0; j <= bufferSize && cf->m_loadingCovers && !cf->m_moved && update && ret != CCoverFlow::CL_NOMEM; ++j)
|
||||||
{
|
{
|
||||||
if (!cf->m_loadingCovers || cf->m_moved || ret == CCoverFlow::CL_NOMEM)
|
firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||||
break;
|
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
|
||||||
i = loopNum((j & 1) != 0 ? firstItem - (j + 1) / 2 : firstItem + j / 2, numItems);
|
if (cf->m_items[i].state != CCoverFlow::STATE_Loading)
|
||||||
if (cf->m_items[i].state != CCoverFlow::STATE_Loading && (i != (u32)newHQCover || newHQCover == cf->m_hqCover))
|
|
||||||
continue;
|
continue;
|
||||||
cf->m_hqCover = newHQCover;
|
|
||||||
ret = cf->_loadCoverTex(i, box, i == (u32)newHQCover);
|
if ((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem)) == CCoverFlow::CL_ERROR)
|
||||||
if (ret == CCoverFlow::CL_ERROR)
|
|
||||||
{
|
{
|
||||||
ret = cf->_loadCoverTex(i, !box, i == (u32)newHQCover);
|
if ((ret = cf->_loadCoverTex(i, !cf->m_box, i == (u32)firstItem)) == CCoverFlow::CL_ERROR)
|
||||||
if (ret == CCoverFlow::CL_ERROR && cf->m_loadingCovers)
|
|
||||||
cf->m_items[i].state = CCoverFlow::STATE_NoCover;
|
cf->m_items[i].state = CCoverFlow::STATE_NoCover;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ void CMenu::_loadCFCfg(SThemeData &theme)
|
|||||||
|
|
||||||
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
|
//gprintf("Preparing to load sounds from %s\n", m_themeDataDir.c_str());
|
||||||
m_cf.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), m_cfg.getBool("GENERAL", "compress_cache", false));
|
m_cf.setCachePath(m_cacheDir.c_str(), !m_cfg.getBool("GENERAL", "keep_png", true), m_cfg.getBool("GENERAL", "compress_cache", false));
|
||||||
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 120));
|
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
|
||||||
// Coverflow Sounds
|
// Coverflow Sounds
|
||||||
m_cf.setSounds(
|
m_cf.setSounds(
|
||||||
SmartGuiSound(new GuiSound(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "sound_flip").c_str()))),
|
SmartGuiSound(new GuiSound(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString(domain, "sound_flip").c_str()))),
|
||||||
@ -1508,7 +1508,7 @@ void CMenu::_initCF(void)
|
|||||||
}
|
}
|
||||||
m_cf.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
|
m_cf.setBoxMode(m_cfg.getBool("GENERAL", "box_mode", true));
|
||||||
m_cf.setCompression(m_cfg.getBool("GENERAL", "allow_texture_compression", true));
|
m_cf.setCompression(m_cfg.getBool("GENERAL", "allow_texture_compression", true));
|
||||||
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 120));
|
m_cf.setBufferSize(m_cfg.getInt("GENERAL", "cover_buffer", 20));
|
||||||
m_cf.setSorting((Sorting)m_cfg.getInt(domain, "sort", 0));
|
m_cf.setSorting((Sorting)m_cfg.getInt(domain, "sort", 0));
|
||||||
if (m_curGameId.empty() || !m_cf.findId(m_curGameId.c_str(), true))
|
if (m_curGameId.empty() || !m_cf.findId(m_curGameId.c_str(), true))
|
||||||
m_cf.findId(m_cfg.getString(domain, "current_item").c_str(), true);
|
m_cf.findId(m_cfg.getString(domain, "current_item").c_str(), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user