diff --git a/Makefile.main b/Makefile.main index 14c9fa16..bc544c5c 100644 --- a/Makefile.main +++ b/Makefile.main @@ -38,10 +38,10 @@ SOURCES := source \ source/music \ source/network \ source/plugin \ + source/sicksaxis-wrapper \ source/unzip \ source/xml \ source/wstringEx -SOURCES += source/sicksaxis-wrapper DATA := data \ data/images \ data/help \ diff --git a/out/boot.dol b/out/boot.dol index 5b6bf104..bedceec6 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 4bb1c022..1f2ee0e4 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -7,7 +7,7 @@ #include #include #include - +#include #include "coverflow.hpp" #include "pngu.h" #include "boxmesh.hpp" @@ -1545,10 +1545,12 @@ void CCoverFlow::setRenderTex(bool val) void CCoverFlow::RenderTex(void) { - if(m_renderingTex == NULL || m_renderingTex->data == NULL) - return; - DrawTexture(m_renderingTex); - m_vid.renderToTexture(*m_renderingTex, true); + if(m_renderingTex != NULL && m_renderingTex->data != NULL) + { + LockMutex lock(m_mutex); + DrawTexture(m_renderingTex); + m_vid.renderToTexture(*m_renderingTex, true); + } setRenderTex(false); } @@ -2824,13 +2826,17 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank if(fp != NULL)//if wfc chache file is found { bool success = false; - fseek(fp, 0, SEEK_END); - u32 fileSize = ftell(fp); - rewind(fp); - SWFCHeader header; - if(fileSize > sizeof(header)) + struct stat stat_buf; + if(fstat(fileno(fp), &stat_buf) != 0) { - fread(&header, 1, sizeof(header), fp); + fclose(fp); + return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR; + } + u32 fileSize = stat_buf.st_size; + SWFCHeader header; + if(fileSize > sizeof header) + { + fread(&header, 1, sizeof header, fp); //make sure wfc cache file matches what we want if(header.newFmt == 1 && (header.full != 0) == box && (header.cmpr != 0) == m_compressTextures) { @@ -2854,12 +2860,12 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank allocFailed = true; else { - u8 *zBuffer = (u8*)MEM2_alloc(fileSize - sizeof(header)); + u8 *zBuffer = (u8*)MEM2_alloc(fileSize - sizeof header); if(zBuffer != NULL) { - fread(zBuffer, 1, fileSize - sizeof(header), fp); + fread(zBuffer, 1, fileSize - sizeof header, fp); uLongf size = bufSize; - if(uncompress(ptrTex, &size, zBuffer, fileSize - sizeof(header)) == Z_OK && size == bufSize) + if(uncompress(ptrTex, &size, zBuffer, fileSize - sizeof header) == Z_OK && size == bufSize) memcpy(tex.data, ptrTex + bufSize - texLen, texLen); free(zBuffer); free(ptrTex); @@ -2872,7 +2878,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank allocFailed = true; else { - fseek(fp, fileSize - sizeof(header) - texLen, SEEK_CUR); + fseek(fp, fileSize - sizeof header - texLen, SEEK_CUR); fread(tex.data, 1, texLen, fp); } } @@ -2903,6 +2909,7 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank // If wfc cache file not found, load the PNG and create a wfc cache file return _loadCoverTexPNG(i, box, hq, blankBoxCover) ? CL_OK : CL_ERROR; + //return CL_ERROR; } int CCoverFlow::_coverLoader(CCoverFlow *cf) diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 7e2292f0..96819d64 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1806,13 +1806,9 @@ void CMenu::_initCF(void) if(!CoverFlow.empty()) { - u8 view = m_current_view; - if(m_current_view == COVERFLOW_MAX) // target the last launched game type view - m_current_view = m_last_view; - bool path = m_sourceflow || (m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW); - if(!CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true, path)) + bool path = m_sourceflow || m_current_view == COVERFLOW_PLUGIN || m_current_view == COVERFLOW_HOMEBREW; + if(m_current_view == COVERFLOW_MAX || !CoverFlow.findId(m_cfg.getString(domain, "current_item").c_str(), true, path)) CoverFlow.defaultLoad(); - m_current_view = view; CoverFlow.startCoverLoader(); } } @@ -2259,6 +2255,9 @@ bool CMenu::_loadPluginList() if(!DeviceHandle.IsInserted(currentPartition)) return false; + bool addGamecube = false; + bool addWii = false; + bool addChannel = false; bool updateCache = m_cfg.getBool(PLUGIN_DOMAIN, "update_cache"); vector pluginList; @@ -2266,16 +2265,29 @@ bool CMenu::_loadPluginList() { m_gameList.clear(); u32 Magic = m_plugin.getPluginMagic(i); - //memset(m_plugin.PluginMagicWord, 0, sizeof(m_plugin.PluginMagicWord)); strncpy(m_plugin.PluginMagicWord, fmt("%08x", Magic), 8); if(!m_cfg.getBool(PLUGIN_ENABLED, m_plugin.PluginMagicWord, true)) continue; string romDir = m_plugin.GetRomDir(i); if(romDir.find("scummvm.ini") == string::npos) { + if(string(m_plugin.PluginMagicWord) == "4e47434d") + { + addGamecube = true; + continue; + } + if(string(m_plugin.PluginMagicWord) == "4e574949") + { + addWii = true; + continue; + } + if(string(m_plugin.PluginMagicWord) == "4e414e44") + { + addChannel = true; + continue; + } string gameDir(fmt("%s:/%s", DeviceName[currentPartition], m_plugin.GetRomDir(i))); string cacheDir(fmt("%s/%s_%s.db", m_listCacheDir.c_str(), DeviceName[currentPartition], m_plugin.PluginMagicWord)); - //string fileTypes = m_plugin.GetFileTypes(i); vector FileTypes = stringToVector(m_plugin.GetFileTypes(i), '|'); m_gameList.Color = m_plugin.GetCaseColor(i); m_gameList.Magic = Magic; @@ -2294,6 +2306,29 @@ bool CMenu::_loadPluginList() } } m_gameList.clear(); + if(addGamecube) + { + m_current_view = COVERFLOW_GAMECUBE; + _loadGamecubeList(); + for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) + pluginList.push_back(*tmp_itr); + } + if(addWii) + { + m_current_view = COVERFLOW_WII; + _loadWiiList(); + for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) + pluginList.push_back(*tmp_itr); + } + if(addChannel) + { + m_current_view = COVERFLOW_CHANNEL; + _loadChannelList(); + for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) + pluginList.push_back(*tmp_itr); + } + m_current_view = COVERFLOW_PLUGIN; + m_gameList.clear(); for(vector::iterator tmp_itr = pluginList.begin(); tmp_itr != pluginList.end(); tmp_itr++) { tmp_itr->index = m_gameList.size(); diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 9f27703b..86b674fd 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -51,7 +51,6 @@ public: const char *getBlankCoverPath(const dir_discHdr *element); u8 m_current_view; - u8 m_last_view; bool m_combined_view; u8 enabledPluginsCount; u8 m_catStartPage; @@ -201,7 +200,7 @@ private: bool m_show_gc; bool m_devo_installed; bool m_nintendont_installed; - bool m_GameTDBLoaded; + bool m_GameTDBAvailable; //Main Config menus s16 m_configLblPage; s16 m_configBtnPageM; diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index ceb51ace..82612c2c 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -2024,7 +2024,7 @@ int CMenu::_gametdbDownloaderAsync() _setThrdMsg(_t("dlmsg26", L"Updating cache..."), 0.f); LWP_MutexUnlock(m_mutex); - m_GameTDBLoaded = true; + m_GameTDBAvailable = true; m_load_view = true; //_loadList(); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index ee395e65..adb58bae 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -475,7 +475,7 @@ void CMenu::_game(bool launch) _cleanupBanner(); break; } - else if(BTN_PLUS_PRESSED && m_GameTDBLoaded && (CoverFlow.getHdr()->type == TYPE_WII_GAME || CoverFlow.getHdr()->type == TYPE_GC_GAME || CoverFlow.getHdr()->type == TYPE_CHANNEL)) + else if(BTN_PLUS_PRESSED && m_GameTDBAvailable && (CoverFlow.getHdr()->type == TYPE_WII_GAME || CoverFlow.getHdr()->type == TYPE_GC_GAME || CoverFlow.getHdr()->type == TYPE_CHANNEL)) { _hideGame(); m_banner.SetShowBanner(false); diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index 783c171e..b042dc77 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -289,7 +289,7 @@ void CMenu::exitHandler(int ExitTo) int CMenu::main(void) { - cf_domain = "_COVERFLOW"; + //cf_domain = "_COVERFLOW"; wstringEx curLetter; string prevTheme = m_cfg.getString("GENERAL", "theme", "default"); parental_homebrew = m_cfg.getBool(HOMEBREW_DOMAIN, "parental", false); @@ -308,20 +308,19 @@ int CMenu::main(void) SetupInput(true); GameTDB m_gametdb; m_gametdb.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str())); - m_GameTDBLoaded = false; + m_GameTDBAvailable = false; if(m_gametdb.IsLoaded()) { - m_GameTDBLoaded = true; + m_GameTDBAvailable = true; m_gametdb.CloseFile(); } - m_last_view = max(0, min(m_cfg.getInt("GENERAL", "last_view", 6), 6)); - if(m_last_view == 6 || m_last_view == 0) + m_current_view = max(m_cfg.getInt("GENERAL", "last_view", 0), 0); + if(m_current_view > COVERFLOW_MAX) { - m_last_view = 0; + m_current_view = COVERFLOW_WII; _clearSources(); m_cfg.setBool(WII_DOMAIN, "source", true); } - m_current_view = m_last_view; m_catStartPage = m_cfg.getInt("GENERAL", "cat_startpage", 1); if(m_current_view != COVERFLOW_MAX) { @@ -330,7 +329,7 @@ int CMenu::main(void) } else m_combined_view = true; - m_cfg.save(); + //m_cfg.save(); if(m_cfg.getBool("GENERAL", "update_cache", false)) UpdateCache(); LoadView();