From 7c4bb1fa048aea00a9088633ecd647780eb0dfd5 Mon Sep 17 00:00:00 2001 From: yardape8000 Date: Thu, 17 May 2012 13:26:02 +0000 Subject: [PATCH] Update english.ini Stop 0 size covers from being created --- source/menu/menu_download.cpp | 154 +++++++++++++++--------------- wii/wiiflow/Languages/english.ini | 1 + 2 files changed, 79 insertions(+), 76 deletions(-) diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index 68b7a03e..f9c628c5 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -590,7 +590,7 @@ int CMenu::_coverDownloader(bool missingOnly) for( int o = 0; o < 12; ++o ) { bool tdl = false; - if( download.data != NULL ) + if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data)) break; switch( o ) { @@ -680,30 +680,31 @@ int CMenu::_coverDownloader(bool missingOnly) download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this); } } - if (download.data != NULL) - { - if (savePNG) - { - LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); - LWP_MutexUnlock(m_mutex); - file = fopen(path.c_str(), "wb"); - if (file != NULL) - { - fwrite(download.data, download.size, 1, file); - fclose(file); - } - } + if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data)) + continue; + + if (savePNG) + { LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); LWP_MutexUnlock(m_mutex); - if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true)) + file = fopen(path.c_str(), "wb"); + if (file != NULL) { - ++count; - success = true; + fwrite(download.data, download.size, 1, file); + fclose(file); } } + + LWP_MutexLock(m_mutex); + _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + LWP_MutexUnlock(m_mutex); + if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true)) + { + ++count; + success = true; + } } } } @@ -729,7 +730,7 @@ int CMenu::_coverDownloader(bool missingOnly) for( int o = 0; o < 12; ++o ) { bool tdl = false; - if( download.data != NULL ) + if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data)) break; switch( o ) @@ -824,30 +825,30 @@ int CMenu::_coverDownloader(bool missingOnly) } } - if (download.data != NULL) - { - if (savePNG) - { - LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); - LWP_MutexUnlock(m_mutex); - file = fopen(path.c_str(), "wb"); - if (file != NULL) - { - fwrite(download.data, download.size, 1, file); - fclose(file); - } - } + if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data)) + continue; + if (savePNG) + { LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); LWP_MutexUnlock(m_mutex); - if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true)) + file = fopen(path.c_str(), "wb"); + if (file != NULL) { - ++count; - success = true; + fwrite(download.data, download.size, 1, file); + fclose(file); } } + + LWP_MutexLock(m_mutex); + _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + LWP_MutexUnlock(m_mutex); + if (m_cf.preCacheCover(coverList[i].c_str(), download.data, true)) + { + ++count; + success = true; + } } } } @@ -873,7 +874,7 @@ int CMenu::_coverDownloader(bool missingOnly) for( int o = 0; o < 12; ++o ) { bool tdl = false; - if( download.data != NULL ) + if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data)) break; switch( o ) @@ -967,30 +968,30 @@ int CMenu::_coverDownloader(bool missingOnly) } } - if (download.data != NULL) - { - if (savePNG) - { - LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); - LWP_MutexUnlock(m_mutex); - file = fopen(path.c_str(), "wb"); - if (file != NULL) - { - fwrite(download.data, download.size, 1, file); - fclose(file); - } - } + if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data)) + continue; + if (savePNG) + { LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); LWP_MutexUnlock(m_mutex); - if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false)) + file = fopen(path.c_str(), "wb"); + if (file != NULL) { - ++countFlat; - success = true; + fwrite(download.data, download.size, 1, file); + fclose(file); } } + + LWP_MutexLock(m_mutex); + _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + LWP_MutexUnlock(m_mutex); + if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false)) + { + ++countFlat; + success = true; + } } } } @@ -1016,7 +1017,7 @@ int CMenu::_coverDownloader(bool missingOnly) for( int o = 0; o < 12; ++o ) { bool tdl = false; - if( download.data != NULL ) + if(download.data != NULL && download.size > 0 && checkPNGBuf(download.data)) break; switch( o ) @@ -1109,30 +1110,31 @@ int CMenu::_coverDownloader(bool missingOnly) download = downloadfile(buffer.get(), bufferSize, url.c_str(), CMenu::_downloadProgress, this); } } - if (download.data != NULL) - { - if (savePNG) - { - LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); - LWP_MutexUnlock(m_mutex); - file = fopen(path.c_str(), "wb"); - if (file != NULL) - { - fwrite(download.data, download.size, 1, file); - fclose(file); - } - } + if(download.data == NULL || download.size == 0 || !checkPNGBuf(download.data)) + continue; + + if (savePNG) + { LWP_MutexLock(m_mutex); - _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + _setThrdMsg(wfmt(_fmt("dlmsg4", L"Saving %s"), path.c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); LWP_MutexUnlock(m_mutex); - if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false)) + file = fopen(path.c_str(), "wb"); + if (file != NULL) { - ++countFlat; - success = true; + fwrite(download.data, download.size, 1, file); + fclose(file); } } + + LWP_MutexLock(m_mutex); + _setThrdMsg(wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverList[i].c_str()).c_str()), listWeight + dlWeight * (float)(step + 1) / (float)nbSteps); + LWP_MutexUnlock(m_mutex); + if (m_cf.preCacheCover(coverList[i].c_str(), download.data, false)) + { + ++countFlat; + success = true; + } } } } diff --git a/wii/wiiflow/Languages/english.ini b/wii/wiiflow/Languages/english.ini index 7b689219..849b3802 100644 --- a/wii/wiiflow/Languages/english.ini +++ b/wii/wiiflow/Languages/english.ini @@ -22,6 +22,7 @@ byplayers=By Players bywifiplayers=By Wifi Players cd1=Back cd2=Erase +cd3=Age Lock cfg1=Settings cfg10=Back cfg11=USB Saves Emulation