mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 19:59:16 +01:00
Improved file formatting
This commit is contained in:
parent
a85d33ffd7
commit
4d6f75112b
@ -265,7 +265,7 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
{
|
||||
if(m_btnMgr.selected(m_downloadBtnAll) || dl_type == 1)
|
||||
{
|
||||
m_refreshGameList = true;// not needed instead just initcf()
|
||||
m_refreshGameList = true; // Not needed instead just initcf()
|
||||
|
||||
m_btnMgr.hide(m_downloadLblCovers);
|
||||
m_btnMgr.hide(m_downloadBtnAll);
|
||||
@ -308,7 +308,7 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg30", L"No covers missing."));
|
||||
dl_finished = true;
|
||||
dl_type = 0;
|
||||
//maybe show back button
|
||||
// Maybe show back button
|
||||
//m_btnMgr.show(m_downloadBtnBack);
|
||||
}
|
||||
if(m_btnMgr.selected(m_downloadBtnBanners) || dl_type == 2)
|
||||
@ -346,19 +346,19 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg14", L"Done."));
|
||||
}
|
||||
else if(ret == -1)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg34", L"Banner URL not set properly!"));//banner url not set
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg34", L"Banner URL not set properly!")); // Banner URL not set
|
||||
else if(ret == -2)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg2", L"Network initialization failed!"));
|
||||
else if(ret == -3)
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg33", L"No banners missing."));// no banners missing
|
||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg33", L"No banners missing.")); // No banners missing
|
||||
dl_finished = true;
|
||||
dl_type = 0;
|
||||
//maybe show back button
|
||||
// Maybe show back button
|
||||
//m_btnMgr.show(m_downloadBtnBack);
|
||||
}
|
||||
else if(m_btnMgr.selected(m_downloadBtnGameTDBDownload))
|
||||
{
|
||||
m_refreshGameList = true;// to refresh titles
|
||||
m_refreshGameList = true; // To refresh titles
|
||||
m_btnMgr.hide(m_downloadLblCovers);
|
||||
m_btnMgr.hide(m_downloadBtnAll);
|
||||
m_btnMgr.hide(m_downloadBtnMissing);
|
||||
@ -786,7 +786,7 @@ int CMenu::_initNetwork()
|
||||
{
|
||||
while(net_get_status() == -EBUSY && m_thrdNetwork == true)
|
||||
{
|
||||
usleep(100);// Async initialization may be busy, wait to see if it succeeds.
|
||||
usleep(100); // Async initialization may be busy, wait to see if it succeeds.
|
||||
}
|
||||
if(networkInit)
|
||||
return 0;
|
||||
@ -892,7 +892,7 @@ static string makeURL(const string format, const string gameId, const string cou
|
||||
{
|
||||
string url = format;
|
||||
if(url.find(TAG_LOC) != url.npos)
|
||||
url.replace(url.find(TAG_LOC), strlen(TAG_LOC), country.c_str());
|
||||
url.replace(url.find(TAG_LOC), strlen(TAG_LOC), country.c_str());
|
||||
|
||||
if(url.find(TAG_CONSOLE) != url.npos)
|
||||
url.replace(url.find(TAG_CONSOLE), strlen(TAG_CONSOLE), "wii");
|
||||
@ -1007,7 +1007,7 @@ int CMenu::_coverDownloader()
|
||||
|
||||
vector<string> coverIDList;
|
||||
|
||||
/* create list of cover ID's that need downloading */
|
||||
/* Create list of cover ID's that need downloading */
|
||||
if(dl_gameID.empty())
|
||||
{
|
||||
for(u32 i = 0; i < m_gameList.size(); ++i)
|
||||
@ -1022,7 +1022,7 @@ int CMenu::_coverDownloader()
|
||||
coverIDList.push_back(dl_gameID);
|
||||
|
||||
n = coverIDList.size();
|
||||
m_thrdTotal = n * 3;// 3 = download cover, save png, and make wfc
|
||||
m_thrdTotal = n * 3; // 3 = Download cover, save png and make wfc
|
||||
|
||||
if(m_thrdTotal == 0)
|
||||
{
|
||||
@ -1032,7 +1032,7 @@ int CMenu::_coverDownloader()
|
||||
return -3;
|
||||
}
|
||||
|
||||
/* initialize network connection */
|
||||
/* Initialize network connection */
|
||||
m_thrdMessage = _t("dlmsg1", L"Initializing network...");
|
||||
m_thrdMessageAdded = true;
|
||||
if(_initNetwork() < 0)
|
||||
@ -1043,7 +1043,7 @@ int CMenu::_coverDownloader()
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* download covers in the list */
|
||||
/* Download covers in the list */
|
||||
u32 CoverType = 0;
|
||||
string url;
|
||||
char path[256];
|
||||
@ -1056,20 +1056,20 @@ int CMenu::_coverDownloader()
|
||||
bool custom = false;
|
||||
int c_altCase = 0;
|
||||
|
||||
/* try downloading the cover 4 times but a different type each time.*/
|
||||
/* Try downloading the cover 4 times but a different type each time.*/
|
||||
for(int p = 0; p < 4; ++p)
|
||||
{
|
||||
/* the cover type (BOX, CBOX, FLAT, CFLAT) is different each time based on m_downloadPrioVal */
|
||||
/* The cover type (BOX, CBOX, FLAT, CFLAT) is different each time based on m_downloadPrioVal */
|
||||
switch(p)
|
||||
{
|
||||
case 0:
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? CBOX : BOX;
|
||||
break;
|
||||
case 1:
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? (m_downloadPrioVal & C_TYPE_PRIOB ? CFLAT : BOX) : (m_downloadPrioVal & C_TYPE_PRIOB ? CBOX : FLAT);
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? (m_downloadPrioVal & C_TYPE_PRIOB ? CFLAT : BOX) : (m_downloadPrioVal & C_TYPE_PRIOB ? CBOX : FLAT);
|
||||
break;
|
||||
case 2:
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? (m_downloadPrioVal & C_TYPE_PRIOB ? BOX : CFLAT) : (m_downloadPrioVal & C_TYPE_PRIOB ? FLAT : CBOX);
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? (m_downloadPrioVal & C_TYPE_PRIOB ? BOX : CFLAT) : (m_downloadPrioVal & C_TYPE_PRIOB ? FLAT : CBOX);
|
||||
break;
|
||||
case 3:
|
||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? FLAT : CFLAT;
|
||||
@ -1083,7 +1083,7 @@ int CMenu::_coverDownloader()
|
||||
original = false;
|
||||
if(!success && original)
|
||||
{
|
||||
/* each fmtURL may have more than one URL */
|
||||
/* Each fmtURL may have more than one URL */
|
||||
for(u8 j = 0; !success && j < fmtURLBox.size(); ++j)
|
||||
{
|
||||
url = makeURL(fmtURLBox[j], coverID, countryCode(coverID));
|
||||
@ -1095,7 +1095,7 @@ int CMenu::_coverDownloader()
|
||||
|
||||
for(int o = 0; o < 12; ++o)
|
||||
{
|
||||
bool tdl = false;// tdl = try download
|
||||
bool tdl = false; // tdl = try download
|
||||
if(file.size > 0)// && checkPNGBuf(file.data))
|
||||
break;
|
||||
switch( o )
|
||||
@ -1180,20 +1180,18 @@ int CMenu::_coverDownloader()
|
||||
case ZHCN:
|
||||
break;
|
||||
}
|
||||
if(tdl)// try another download
|
||||
if(tdl) // Try another download
|
||||
{
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
downloadfile(url.c_str(), &file);
|
||||
}
|
||||
}
|
||||
/* if none of the downloads succeeded */
|
||||
/* If none of the downloads succeeded */
|
||||
if(file.size == 0)// || !checkPNGBuf(file.data))
|
||||
continue;
|
||||
|
||||
/* a download succeeded */
|
||||
|
||||
/* save cover png */
|
||||
/* Download succeeded - save png */
|
||||
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||
@ -1201,11 +1199,11 @@ int CMenu::_coverDownloader()
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
/* Make cover cache file (wfc) */
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true);//it may fail
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true); // Might fail if OOM
|
||||
|
||||
++count;
|
||||
update_pThread(1);
|
||||
@ -1219,7 +1217,7 @@ int CMenu::_coverDownloader()
|
||||
c_altCase = c_gameTDB.GetCaseVersions(coverID.c_str());
|
||||
if(!success && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
||||
{
|
||||
/* each fmtURL may have more than one URL */
|
||||
/* Each fmtURL may have more than one URL */
|
||||
for(u8 j = 0; !success && j < fmtURLCBox.size(); ++j)
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], coverID, countryCode(coverID));
|
||||
@ -1325,13 +1323,11 @@ int CMenu::_coverDownloader()
|
||||
}
|
||||
}
|
||||
|
||||
/* if none of the downloads succeeded */
|
||||
/* If none of the downloads succeeded */
|
||||
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||
continue;
|
||||
|
||||
/* a download succeeded */
|
||||
|
||||
/* save cover png */
|
||||
/* Download succeeded - save png */
|
||||
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||
@ -1339,14 +1335,14 @@ int CMenu::_coverDownloader()
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
/* Make cover cache file (wfc) */
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true);//it may fail
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true); // Might fail if OOM
|
||||
|
||||
update_pThread(1);
|
||||
++count;
|
||||
update_pThread(1);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@ -1356,6 +1352,7 @@ int CMenu::_coverDownloader()
|
||||
original = false;
|
||||
if(!success && original)
|
||||
{
|
||||
/* Each fmtURL may have more than one URL */
|
||||
for(u8 j = 0; !success && j < fmtURLFlat.size(); ++j)
|
||||
{
|
||||
url = makeURL(fmtURLFlat[j], coverID, countryCode(coverID));
|
||||
@ -1460,10 +1457,11 @@ int CMenu::_coverDownloader()
|
||||
}
|
||||
}
|
||||
|
||||
/* If none of the downloads succeeded */
|
||||
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||
continue;
|
||||
|
||||
/*download succeeded - save png */
|
||||
/* Download succeeded - save png */
|
||||
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||
@ -1471,11 +1469,11 @@ int CMenu::_coverDownloader()
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
/* Make cover cache file (wfc) */
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false);//it may fail
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false); // Might fail if OOM
|
||||
|
||||
++countFlat;
|
||||
update_pThread(1);
|
||||
@ -1488,6 +1486,7 @@ int CMenu::_coverDownloader()
|
||||
custom = true;
|
||||
if(!success && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
||||
{
|
||||
/* Each fmtURL may have more than one URL */
|
||||
for(u8 j = 0; !success && j < fmtURLCFlat.size(); ++j)
|
||||
{
|
||||
url = makeURL(fmtURLCFlat[j], coverID, countryCode(coverID));
|
||||
@ -1591,15 +1590,15 @@ int CMenu::_coverDownloader()
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
LWP_MutexUnlock(m_mutex);
|
||||
|
||||
downloadfile(url.c_str(), &file);
|
||||
}
|
||||
}
|
||||
|
||||
/* If none of the downloads succeeded */
|
||||
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||
continue;
|
||||
|
||||
/* save png */
|
||||
/* Download succeeded - save png */
|
||||
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||
@ -1607,11 +1606,11 @@ int CMenu::_coverDownloader()
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* make wfc */
|
||||
/* Make cover cache file (wfc) */
|
||||
update_pThread(1);
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||
m_thrdMessageAdded = true;
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false);//it may fail
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, false); // Might fail if OOM
|
||||
|
||||
++countFlat;
|
||||
update_pThread(1);
|
||||
@ -1624,7 +1623,7 @@ int CMenu::_coverDownloader()
|
||||
if(!success)
|
||||
update_pThread(3);
|
||||
}
|
||||
/* cover list done and downloading complete */
|
||||
/* Cover list done and downloading complete */
|
||||
if(c_gameTDB.IsLoaded())
|
||||
c_gameTDB.CloseFile();
|
||||
coverIDList.clear();
|
||||
@ -1637,7 +1636,7 @@ int CMenu::_coverDownloader()
|
||||
int CMenu::_gametdbDownloaderAsync()
|
||||
{
|
||||
const string &langCode = m_loc.getString(m_curLanguage, "gametdb_code", "EN");
|
||||
m_thrdTotal = 3;// download, save, and unzip
|
||||
m_thrdTotal = 3; // Download, save and unzip
|
||||
|
||||
m_thrdMessage = _t("dlmsg1", L"Initializing network...");
|
||||
m_thrdMessageAdded = true;
|
||||
@ -1657,7 +1656,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
}
|
||||
else
|
||||
{
|
||||
update_pThread(1);//its downloaded
|
||||
update_pThread(1); // It's downloaded
|
||||
bool res = false;
|
||||
char *zippath = fmt_malloc("%s/wiitdb.zip", m_settingsDir.c_str());
|
||||
if(zippath != NULL)
|
||||
@ -1680,7 +1679,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
}
|
||||
else
|
||||
{
|
||||
update_pThread(1);//its saved
|
||||
update_pThread(1); // It's saved
|
||||
gprintf("Extracting zip file: ");
|
||||
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg24", L"Extracting %s"), "wiitdb.zip");
|
||||
@ -1688,7 +1687,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
ZipFile zFile(zippath);
|
||||
bool zres = zFile.ExtractAll(m_settingsDir.c_str());
|
||||
gprintf(zres ? "success\n" : "failed\n");
|
||||
//may add if zres failed return -4 extraction failed
|
||||
// May add if zres failed return -4 extraction failed
|
||||
|
||||
// We don't need the zipfile anymore
|
||||
fsop_deleteFile(zippath);
|
||||
@ -1697,7 +1696,7 @@ int CMenu::_gametdbDownloaderAsync()
|
||||
// We should always remove the offsets file to make sure it's reloaded
|
||||
fsop_deleteFile(fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()));
|
||||
|
||||
update_pThread(1);//its extracted
|
||||
update_pThread(1); // It's extracted
|
||||
|
||||
// Update cache
|
||||
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
|
||||
@ -1787,7 +1786,7 @@ int CMenu::_bannerDownloader()
|
||||
downloadfile(banner_url_id3, &file);
|
||||
}
|
||||
|
||||
/* minimum 50kb */
|
||||
/* Minimum 50kb */
|
||||
if(file.size > 51200 && file.data[0] != '<')
|
||||
{
|
||||
fsop_WriteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), BnrIDList[i].c_str()), file.data, file.size);
|
||||
@ -1804,7 +1803,7 @@ int CMenu::_bannerDownloader()
|
||||
/**************************************************************************************/
|
||||
|
||||
const char *url_dl = NULL;
|
||||
void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size)// nothing uses this
|
||||
void CMenu::_downloadUrl(const char *url, u8 **dl_file, u32 *dl_size) // Nothing uses this
|
||||
{
|
||||
m_file = NULL;
|
||||
m_filesize = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user