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 lwp_t coverLoaderThread = LWP_THREAD_NULL;
|
||||
SmartBuf coverLoaderThreadStack;
|
||||
|
||||
static inline int loopNum(int i, int s)
|
||||
{
|
||||
@ -182,7 +181,6 @@ CCoverFlow::CCoverFlow(void)
|
||||
m_selected = false;
|
||||
m_hideCover = false;
|
||||
m_tickCount = 0;
|
||||
m_hqCover = -1;
|
||||
m_blurRadius = 3;
|
||||
m_blurFactor = 1.f;
|
||||
//
|
||||
@ -200,7 +198,7 @@ CCoverFlow::CCoverFlow(void)
|
||||
m_lodBias = -0.3f;
|
||||
m_aniso = GX_ANISO_1;
|
||||
m_edgeLOD = false;
|
||||
m_numBufCovers = 100;
|
||||
m_numBufCovers = 20;
|
||||
m_compressTextures = true;
|
||||
m_compressCache = false;
|
||||
m_deletePicsAfterCaching = false;
|
||||
@ -600,14 +598,14 @@ void CCoverFlow::stopCoverLoader(bool empty)
|
||||
LWP_JoinThread(coverLoaderThread, NULL);
|
||||
coverLoaderThread = LWP_THREAD_NULL;
|
||||
|
||||
SMART_FREE(coverLoaderThreadStack);
|
||||
|
||||
if (empty)
|
||||
{
|
||||
for (u32 i = 0; i < m_items.size(); ++i)
|
||||
{
|
||||
SMART_FREE(m_items[i].texture.data);
|
||||
m_items[i].state = CCoverFlow::STATE_Loading;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,11 +615,8 @@ void CCoverFlow::startCoverLoader(void)
|
||||
|
||||
m_loadingCovers = true;
|
||||
|
||||
unsigned int stack_size = (unsigned int)32768;
|
||||
SMART_FREE(coverLoaderThreadStack);
|
||||
coverLoaderThreadStack = smartMem2Alloc(stack_size);
|
||||
LWP_CreateThread(&coverLoaderThread, (void *(*)(void *))CCoverFlow::_coverLoader, (void *)this, coverLoaderThreadStack.get(), stack_size, 40);
|
||||
|
||||
unsigned int stack_size = (unsigned int)8192;
|
||||
LWP_CreateThread(&coverLoaderThread, (void *(*)(void *))CCoverFlow::_coverLoader, (void *)this, 0, stack_size, 40);
|
||||
}
|
||||
|
||||
void CCoverFlow::clear(void)
|
||||
@ -1808,6 +1803,8 @@ bool CCoverFlow::start(const char *id)
|
||||
m_covers.resize(m_range);
|
||||
m_jump = 0;
|
||||
m_selected = false;
|
||||
m_moved = true;
|
||||
gprintf("Coverflow started!\n");
|
||||
if (id == 0 || !findId(id, true))
|
||||
_loadAllCovers(0);
|
||||
_updateAllTargets();
|
||||
@ -2671,45 +2668,40 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq)
|
||||
|
||||
int CCoverFlow::_coverLoader(CCoverFlow *cf)
|
||||
{
|
||||
bool box = cf->m_box;
|
||||
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)
|
||||
{
|
||||
u32 i;
|
||||
ret = CCoverFlow::CL_OK;
|
||||
update = cf->m_moved;
|
||||
cf->m_moved = false;
|
||||
u32 numItems = cf->m_items.size();
|
||||
u32 firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||
u32 lastVisible = bufferSize - 1;
|
||||
int newHQCover = firstItem;
|
||||
if ((u32)cf->m_hqCover < numItems && newHQCover != cf->m_hqCover)
|
||||
|
||||
for (u32 j = cf->m_items.size(); j >= bufferSize && cf->m_loadingCovers && !cf->m_moved && update; --j)
|
||||
{
|
||||
cf->_dropHQLOD(cf->m_hqCover);
|
||||
cf->m_hqCover = -1;
|
||||
}
|
||||
for (u32 j = numItems - 1; j > lastVisible; --j)
|
||||
{
|
||||
i = loopNum((j & 1) != 0 ? firstItem - (j + 1) / 2 : firstItem + j / 2, numItems);
|
||||
firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
|
||||
LWP_MutexLock(cf->m_mutex);
|
||||
SMART_FREE(cf->m_items[i].texture.data);
|
||||
cf->m_items[i].state = CCoverFlow::STATE_Loading;
|
||||
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)
|
||||
break;
|
||||
i = loopNum((j & 1) != 0 ? firstItem - (j + 1) / 2 : firstItem + j / 2, numItems);
|
||||
if (cf->m_items[i].state != CCoverFlow::STATE_Loading && (i != (u32)newHQCover || newHQCover == cf->m_hqCover))
|
||||
firstItem = cf->m_covers[cf->m_range / 2].index;
|
||||
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
|
||||
if (cf->m_items[i].state != CCoverFlow::STATE_Loading)
|
||||
continue;
|
||||
cf->m_hqCover = newHQCover;
|
||||
ret = cf->_loadCoverTex(i, box, i == (u32)newHQCover);
|
||||
if (ret == CCoverFlow::CL_ERROR)
|
||||
|
||||
if ((ret = cf->_loadCoverTex(i, cf->m_box, i == (u32)firstItem)) == CCoverFlow::CL_ERROR)
|
||||
{
|
||||
ret = cf->_loadCoverTex(i, !box, i == (u32)newHQCover);
|
||||
if (ret == CCoverFlow::CL_ERROR && cf->m_loadingCovers)
|
||||
if ((ret = cf->_loadCoverTex(i, !cf->m_box, i == (u32)firstItem)) == CCoverFlow::CL_ERROR)
|
||||
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());
|
||||
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
|
||||
m_cf.setSounds(
|
||||
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.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));
|
||||
if (m_curGameId.empty() || !m_cf.findId(m_curGameId.c_str(), true))
|
||||
m_cf.findId(m_cfg.getString(domain, "current_item").c_str(), true);
|
||||
|
Loading…
Reference in New Issue
Block a user