diff --git a/out/boot.dol b/out/boot.dol index 57c34dea..34251ce5 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index e3972c41..49e5a9c4 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -659,7 +659,7 @@ void CCoverFlow::startCoverLoader(void) m_loadingCovers = true; m_moved = true; - LWP_CreateThread(&coverLoaderThread, _coverLoader, this, coverThreadStack, coverThreadStackSize, 30); + LWP_CreateThread(&coverLoaderThread, _coverLoader, this, coverThreadStack, coverThreadStackSize, 40); //gprintf("Coverflow started!\n"); } @@ -1603,12 +1603,60 @@ void CCoverFlow::cancel(void) _playSound(m_cancelSound); } -void CCoverFlow::defaultLoad(void) +u32 CCoverFlow::_currentPos(void) const { - _loadAllCovers(0); + if (m_covers == NULL) return 0; + + return m_covers[m_range / 2].index; +} + +void CCoverFlow::_setCurPos(u32 index) +{ + _loadAllCovers(index); _updateAllTargets(true); } +bool CCoverFlow::_setCurPosToID(const char *id, bool instant, bool path) +{ + LockMutex lock(m_mutex); + u32 i, curPos = _currentPos(); + + if(m_items.empty() || (instant && m_covers == NULL) || strlen(id) == 0) + return false; + // + for(i = 0; i < m_items.size(); ++i) + { + if(path) + { + //homebrew folder or rom title.ext + const char *name = strrchr(m_items[i].hdr->path, '/'); + if(name != NULL && strcmp(name + 1, id) == 0) + break; + else if(strcmp(m_items[i].hdr->path, id) == 0)// scummvm + break; + } + else if(strcmp(m_items[i].hdr->id, id) == 0) + break; + } + if(i >= m_items.size()) + return false; + m_jump = 0; + if (instant) + { + _loadAllCovers(i); + _updateAllTargets(true); + } + else + { + int j = (int)i - (int)curPos; + if (abs(j) <= (int)m_items.size() / 2) + _setJump(j); + else + _setJump(j < 0 ? j + (int)m_items.size() : j - (int)m_items.size()); + } + return true; +} + void CCoverFlow::_updateAllTargets(bool instant) { m_targetCameraPos = m_selected ? m_loSelected.camera : m_loNormal.camera; @@ -2047,13 +2095,6 @@ void CCoverFlow::_right(int repeatDelay, u32 step) m_covers[m_range / 2].pos -= _coverMovesP(); } -u32 CCoverFlow::_currentPos(void) const -{ - if (m_covers == NULL) return 0; - - return m_covers[m_range / 2].index; -} - void CCoverFlow::mouse(int chan, int x, int y) { if (m_covers == NULL) return; @@ -2098,47 +2139,6 @@ void CCoverFlow::setSelected(int i) select(); } -bool CCoverFlow::findId(const char *id, bool instant, bool path) -{ - LockMutex lock(m_mutex); - u32 i, curPos = _currentPos(); - - if(m_items.empty() || (instant && m_covers == NULL) || strlen(id) == 0) - return false; - // - for(i = 0; i < m_items.size(); ++i) - { - if(path) - { - //homebrew folder or rom title.ext - const char *name = strrchr(m_items[i].hdr->path, '/'); - if(name != NULL && strcmp(name + 1, id) == 0) - break; - else if(strcmp(m_items[i].hdr->path, id) == 0)// scummvm - break; - } - else if(strcmp(m_items[i].hdr->id, id) == 0) - break; - } - if(i >= m_items.size()) - return false; - m_jump = 0; - if (instant) - { - _loadAllCovers(i); - _updateAllTargets(true); - } - else - { - int j = (int)i - (int)curPos; - if (abs(j) <= (int)m_items.size() / 2) - _setJump(j); - else - _setJump(j < 0 ? j + (int)m_items.size() : j - (int)m_items.size()); - } - return true; -} - void CCoverFlow::pageUp(void) { if (m_covers == NULL) return; @@ -2880,6 +2880,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank fclose(fp); return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR; } + DCFlushRange(&header, sizeof(header)); //make sure wfc cache file matches what we want if(header.newFmt == 1 && (header.full != 0) == box && (header.cmpr != 0) == m_compressTextures) { @@ -2907,13 +2908,13 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank fclose(fp); return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR; } + DCFlushRange(tex.data, texLen); } if(!allocFailed) { LockMutex lock(m_mutex); TexHandle.Cleanup(m_items[i].texture); m_items[i].texture = tex; - DCFlushRange(tex.data, texLen); m_items[i].state = STATE_Ready; m_items[i].boxTexture = header.full != 0; success = true; diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index dbb5f661..68107ebf 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -50,13 +50,14 @@ public: bool start(const string &m_imgsDir); void stopCoverLoader(bool empty = false); void startCoverLoader(void); - void defaultLoad(void); + u32 _currentPos(void) const; + void _setCurPos(u32 index); + bool _setCurPosToID(const char *id, bool instant = false, bool path = false); // void simulateOtherScreenFormat(bool s); // Commands void tick(void); void setSelected(int i); - bool findId(const char *id, bool instant = false, bool path = false); void pageUp(void); void pageDown(void); void nextLetter(wchar_t *c); @@ -316,7 +317,6 @@ private: static const u32 coverThreadStackSize; private: void _draw(DrawMode dm = CFDR_NORMAL, bool mirror = false, bool blend = true); - u32 _currentPos(void) const; void _effectBg(const TexData * &tex); void _effectBlur(bool vertical); bool _effectVisible(void); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 07e096d0..402c04fc 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -2226,8 +2226,8 @@ void CMenu::_initCF(void) path = true; strncpy(cur_item, m_cfg.getString(_domainFromView(), "current_item").c_str(), 63); } - if(!CoverFlow.findId(cur_item, true, path)) - CoverFlow.defaultLoad(); + if(!CoverFlow._setCurPosToID(cur_item, true, path)) + CoverFlow._setCurPos(0); CoverFlow.startCoverLoader(); } } diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 91058fa4..cc0f44aa 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -599,11 +599,13 @@ void CMenu::_game(bool launch) /* switch coverflow layout */ else if((BTN_1_PRESSED || BTN_2_PRESSED) && !coverFlipped && !m_video_playing) { + u32 curPos = CoverFlow._currentPos(); s8 direction = BTN_1_PRESSED ? 1 : -1; int cfVersion = loopNum((_getCFVersion() - 1) + direction, m_numCFVersions) + 1; - _loadCFLayout(cfVersion); - CoverFlow.applySettings(); _setCFVersion(cfVersion); + _loadCFLayout(cfVersion); + CoverFlow._setCurPos(curPos); + CoverFlow.applySettings(); } else if(launch || BTN_A_PRESSED) { diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 23111392..5cc21f6e 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -648,10 +648,12 @@ int CMenu::main(void) /* change coverflow layout/mode */ else if(BTN_1_PRESSED || BTN_2_PRESSED) { + u32 curPos = CoverFlow._currentPos(); s8 direction = BTN_1_PRESSED ? 1 : -1; int cfVersion = 1 + loopNum((_getCFVersion() - 1) + direction, m_numCFVersions); _setCFVersion(cfVersion); _loadCFLayout(cfVersion); + CoverFlow._setCurPos(curPos); CoverFlow.applySettings(); } } diff --git a/source/music/SoundHandler.cpp b/source/music/SoundHandler.cpp index 152154ce..b1dcd1bf 100644 --- a/source/music/SoundHandler.cpp +++ b/source/music/SoundHandler.cpp @@ -46,7 +46,7 @@ void SoundHandler::Init() for(u32 i = 0; i < MAX_DECODERS; ++i) DecoderList[i] = NULL; - LWP_CreateThread(&SoundThread, UpdateThread, this, SoundStack, SoundStackSize, LWP_PRIO_HIGHEST); + LWP_CreateThread(&SoundThread, UpdateThread, this, SoundStack, SoundStackSize, 64); gprintf("Running sound thread\n"); }