Merge pull request #164 from wiidev/master
Various improvements and fixes
Before Width: | Height: | Size: 854 B |
BIN
out/imgs/background.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 984 B |
BIN
out/imgs/dvdskin.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 636 B |
BIN
out/imgs/dvdskin_black.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 858 B |
BIN
out/imgs/dvdskin_greenone.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 951 B |
BIN
out/imgs/dvdskin_greentwo.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 964 B |
BIN
out/imgs/dvdskin_red.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 888 B |
BIN
out/imgs/dvdskin_yellow.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
out/imgs/esrb_ao.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
out/imgs/esrb_e.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
out/imgs/esrb_ec.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
out/imgs/esrb_eten.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
out/imgs/esrb_m.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.4 KiB |
BIN
out/imgs/esrb_t.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.0 KiB |
BIN
out/imgs/flatloading.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 970 B After Width: | Height: | Size: 966 B |
Before Width: | Height: | Size: 4.2 KiB |
BIN
out/imgs/loading.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB |
BIN
out/imgs/norating.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 999 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.1 KiB |
@ -52,5 +52,5 @@ uLoader, NeoGamma, Mighty Channels, WiiXplorer, Triiforce, \
|
||||
postLoader"
|
||||
|
||||
|
||||
#define WIINNERTAG_URL "http://tag.rc24.xyz/wii?game={ID6}&key={KEY}"// RiiTag as of 3/11/2020
|
||||
#define WIINNERTAG_URL "https://tag.rc24.xyz/wii?game={ID6}&key={KEY}"// RiiTag as of 3/11/2020
|
||||
#define DUTAG_URL "http://tag.darkumbra.net/{KEY}.update={ID6}"
|
||||
|
@ -1926,17 +1926,17 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
/* load the colored skin/spine images if not already done */
|
||||
if(!m_dvdskin_loaded)
|
||||
{
|
||||
if(TexHandle.fromImageFile(m_dvdSkin, fmt("%s/dvdskin.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin, fmt("%s/dvdskin.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Red, fmt("%s/dvdskin_red.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Red, fmt("%s/dvdskin_red.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Black, fmt("%s/dvdskin_black.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Black, fmt("%s/dvdskin_black.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Yellow, fmt("%s/dvdskin_yellow.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_Yellow, fmt("%s/dvdskin_yellow.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_GreenOne, fmt("%s/dvdskin_greenone.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_GreenOne, fmt("%s/dvdskin_greenone.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_GreenTwo, fmt("%s/dvdskin_greentwo.jpg", m_imgsDir.c_str())) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_dvdSkin_GreenTwo, fmt("%s/dvdskin_greentwo.png", m_imgsDir.c_str())) != TE_OK)
|
||||
return false;
|
||||
m_dvdskin_loaded = true;
|
||||
}
|
||||
@ -1945,7 +1945,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
{
|
||||
if(m_pngLoadCover.empty() || TexHandle.fromImageFile(m_boxLoadingTexture, m_pngLoadCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
{
|
||||
if(TexHandle.fromImageFile(m_boxLoadingTexture, fmt("%s/loading.jpg", m_imgsDir.c_str()), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_boxLoadingTexture, fmt("%s/loading.png", m_imgsDir.c_str()), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
return false;
|
||||
}
|
||||
if(m_pngNoCover.empty() || TexHandle.fromImageFile(m_boxNoCoverTexture, m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
@ -1955,7 +1955,7 @@ bool CCoverFlow::start(const string &m_imgsDir)
|
||||
}
|
||||
if(m_pngLoadCoverFlat.empty() || TexHandle.fromImageFile(m_flatLoadingTexture, m_pngLoadCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
{
|
||||
if(TexHandle.fromImageFile(m_flatLoadingTexture, fmt("%s/flatloading.jpg", m_imgsDir.c_str()), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
if(TexHandle.fromImageFile(m_flatLoadingTexture, fmt("%s/flatloading.png", m_imgsDir.c_str()), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
return false;
|
||||
}
|
||||
if(m_pngNoCoverFlat.empty() || TexHandle.fromImageFile(m_flatNoCoverTexture, m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
||||
|
@ -1114,8 +1114,12 @@ int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlph
|
||||
if ( (ctx->prop.imgWidth != width) || (ctx->prop.imgHeight != height) )
|
||||
return PNGU_INVALID_WIDTH_OR_HEIGHT;
|
||||
|
||||
// Support paletted images
|
||||
if (ctx->prop.imgColorType == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb(ctx->png_ptr);
|
||||
|
||||
// Check if color type is supported by PNGU
|
||||
if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_PALETTE) || (ctx->prop.imgColorType == PNGU_COLOR_TYPE_UNKNOWN) )
|
||||
if ( (ctx->prop.imgColorType == PNGU_COLOR_TYPE_UNKNOWN) )
|
||||
return PNGU_UNSUPPORTED_COLOR_TYPE;
|
||||
|
||||
// error handling
|
||||
|
@ -1215,8 +1215,8 @@ void CMenu::_buildMenus(void)
|
||||
theme.btnTexMinusS = _texture("GENERAL", "minus_button_texture_selected", theme.btnTexMinusS);
|
||||
|
||||
// Default background
|
||||
TexHandle.fromImageFile(theme.bg, fmt("%s/background.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_mainBgLQ, fmt("%s/background.jpg", m_imgsDir.c_str()), GX_TF_CMPR, 64, 64);
|
||||
TexHandle.fromImageFile(theme.bg, fmt("%s/background.png", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_mainBgLQ, fmt("%s/background.png", m_imgsDir.c_str()), GX_TF_CMPR, 64, 64);
|
||||
m_gameBgLQ = m_mainBgLQ;
|
||||
|
||||
// Build menus
|
||||
@ -2785,9 +2785,9 @@ const char *CMenu::getBlankCoverPath(const dir_discHdr *element)
|
||||
}
|
||||
blankCoverTitle = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "wii");
|
||||
}
|
||||
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.jpg", m_boxPicDir.c_str(), blankCoverTitle.c_str());
|
||||
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.png", m_boxPicDir.c_str(), blankCoverTitle.c_str());
|
||||
if(!fsop_FileExist(blankCoverPath))
|
||||
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.png", m_boxPicDir.c_str(), blankCoverTitle.c_str());
|
||||
snprintf(blankCoverPath, sizeof(blankCoverPath), "%s/blank_covers/%s.jpg", m_boxPicDir.c_str(), blankCoverTitle.c_str());
|
||||
return blankCoverPath;
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,12 @@ int CMenu::_downloadCheatFileAsync()
|
||||
m_thrdMessageAdded = true;
|
||||
update_pThread(1);// its downloaded
|
||||
fsop_WriteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id), file.data, file.size);
|
||||
free(file.data);
|
||||
MEM2_free(file.data);
|
||||
return 0;
|
||||
}
|
||||
if(file.size > 0)// received a 301/302 redirect instead of a 404?
|
||||
{
|
||||
free(file.data);
|
||||
MEM2_free(file.data);
|
||||
return -4;// the file doesn't exist on the server
|
||||
}
|
||||
return -3;// download failed
|
||||
|
@ -82,52 +82,52 @@ void CMenu::_showSettings()
|
||||
m_btnMgr.show(m_downloadLblPrio);
|
||||
m_btnMgr.show(m_downloadBtnPrioM);
|
||||
m_btnMgr.show(m_downloadBtnPrioP);
|
||||
m_btnMgr.show(m_downloadLblRegion);
|
||||
m_btnMgr.show(m_downloadLblRegion);
|
||||
if( m_downloadPrioVal&C_TYPE_EN )
|
||||
m_btnMgr.show(m_downloadBtnENs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnEN);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_JA )
|
||||
m_btnMgr.show(m_downloadBtnJAs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnJA);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_FR )
|
||||
m_btnMgr.show(m_downloadBtnFRs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnFR);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_DE )
|
||||
m_btnMgr.show(m_downloadBtnDEs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnDE);
|
||||
|
||||
m_btnMgr.show(m_downloadBtnDE);
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_ES )
|
||||
m_btnMgr.show(m_downloadBtnESs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnES);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_IT )
|
||||
m_btnMgr.show(m_downloadBtnITs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnIT);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_NL )
|
||||
m_btnMgr.show(m_downloadBtnNLs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnNL);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_PT )
|
||||
m_btnMgr.show(m_downloadBtnPTs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnPT);
|
||||
|
||||
m_btnMgr.show(m_downloadBtnPT);
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_RU )
|
||||
m_btnMgr.show(m_downloadBtnRUs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnRU);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_KO )
|
||||
m_btnMgr.show(m_downloadBtnKOs);
|
||||
else
|
||||
@ -137,16 +137,16 @@ void CMenu::_showSettings()
|
||||
m_btnMgr.show(m_downloadBtnZHCNs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnZHCN);
|
||||
|
||||
|
||||
if( m_downloadPrioVal&C_TYPE_AU )
|
||||
m_btnMgr.show(m_downloadBtnAUs);
|
||||
else
|
||||
m_btnMgr.show(m_downloadBtnAU);
|
||||
|
||||
|
||||
//
|
||||
if( m_downloadPrioVal&C_TYPE_ONOR )
|
||||
{
|
||||
m_btnMgr.setText(m_downloadLblPrio, _t("dl24", L"Custom only"));
|
||||
m_btnMgr.setText(m_downloadLblPrio, _t("dl24", L"Custom only"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -158,7 +158,7 @@ void CMenu::_showSettings()
|
||||
{
|
||||
m_btnMgr.setText(m_downloadLblPrio, _t("dl23", L"Custom/Custom"));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
m_btnMgr.setText(m_downloadLblPrio, _t("dl22", L"Custom/Original"));
|
||||
}
|
||||
@ -221,7 +221,7 @@ void CMenu::_showDownload(void)
|
||||
m_btnMgr.show(m_downloadBtnBanners);
|
||||
for(u8 i = 0; i < ARRAY_SIZE(m_downloadLblUser); ++i)
|
||||
if(m_downloadLblUser[i] != -1)
|
||||
m_btnMgr.show(m_downloadLblUser[i]);
|
||||
m_btnMgr.show(m_downloadLblUser[i]);
|
||||
}
|
||||
|
||||
int count, countFlat;
|
||||
@ -265,8 +265,8 @@ 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);
|
||||
m_btnMgr.hide(m_downloadLblGameTDBDownload);
|
||||
@ -276,14 +276,14 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
m_btnMgr.hide(m_downloadLblBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBack);
|
||||
|
||||
|
||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
|
||||
m_btnMgr.setText(m_wbfsLblMessage, L"0%");
|
||||
m_btnMgr.setText(m_wbfsLblDialog, L"");
|
||||
m_btnMgr.show(m_wbfsPBar);
|
||||
m_btnMgr.show(m_wbfsLblMessage);
|
||||
m_btnMgr.show(m_wbfsLblDialog);
|
||||
|
||||
|
||||
_start_pThread();
|
||||
int ret = _coverDownloader();
|
||||
_stop_pThread();
|
||||
@ -308,13 +308,13 @@ 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)
|
||||
{
|
||||
//m_refreshGameList = true;
|
||||
|
||||
|
||||
m_btnMgr.hide(m_downloadLblCovers);
|
||||
m_btnMgr.hide(m_downloadBtnAll);
|
||||
m_btnMgr.hide(m_downloadLblGameTDBDownload);
|
||||
@ -324,14 +324,14 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
m_btnMgr.hide(m_downloadLblBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBack);
|
||||
|
||||
|
||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
|
||||
m_btnMgr.setText(m_wbfsLblMessage, L"0%");
|
||||
m_btnMgr.setText(m_wbfsLblDialog, L"");
|
||||
m_btnMgr.show(m_wbfsPBar);
|
||||
m_btnMgr.show(m_wbfsLblMessage);
|
||||
m_btnMgr.show(m_wbfsLblDialog);
|
||||
|
||||
|
||||
_start_pThread();
|
||||
int ret = _bannerDownloader();
|
||||
_stop_pThread();
|
||||
@ -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);
|
||||
@ -369,14 +369,14 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
m_btnMgr.hide(m_downloadLblBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBanners);
|
||||
m_btnMgr.hide(m_downloadBtnBack);
|
||||
|
||||
|
||||
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
|
||||
m_btnMgr.setText(m_wbfsLblMessage, L"0%");
|
||||
m_btnMgr.setText(m_wbfsLblDialog, L"");
|
||||
m_btnMgr.show(m_wbfsPBar);
|
||||
m_btnMgr.show(m_wbfsLblMessage);
|
||||
m_btnMgr.show(m_wbfsLblDialog);
|
||||
|
||||
|
||||
_start_pThread();
|
||||
int ret = _gametdbDownloaderAsync();
|
||||
_stop_pThread();
|
||||
@ -402,7 +402,7 @@ void CMenu::_download(string gameId, int dl_type)
|
||||
else if(m_btnMgr.selected(m_downloadBtnCoverSet))
|
||||
{
|
||||
settingsmenu = true;
|
||||
_showSettings();
|
||||
_showSettings();
|
||||
}
|
||||
else if(m_btnMgr.selected(m_downloadBtnBack))
|
||||
{
|
||||
@ -667,7 +667,7 @@ void CMenu::_initDownloadMenu()
|
||||
_setHideAnim(m_downloadPBar, "DOWNLOAD/PROGRESS_BAR", 0, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_downloadBtnCancel, "DOWNLOAD/CANCEL_BTN", 0, 0, 1.f, -1.f);
|
||||
|
||||
// Cover settings
|
||||
// Cover settings
|
||||
_setHideAnim(m_downloadLblSetTitle, "DOWNLOAD/SETTITLE", 0, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_downloadLblCoverPrio, "DOWNLOAD/COVERPRIO", 50, 0, -2.f, 0.f);
|
||||
_setHideAnim(m_downloadLblPrio, "DOWNLOAD/PRIO_BTN", -50, 0, 1.f, 0.f);
|
||||
@ -712,15 +712,15 @@ void CMenu::_textDownload(void)
|
||||
m_btnMgr.setText(m_downloadLblCovers, _t("dl8", L"Covers"));
|
||||
m_btnMgr.setText(m_downloadBtnAll, _t("dl6", L"Download"));
|
||||
m_btnMgr.setText(m_downloadLblCoverSet, _t("dl15", L"Cover download settings"));
|
||||
m_btnMgr.setText(m_downloadBtnCoverSet, _t("dl16", L"Set"));
|
||||
m_btnMgr.setText(m_downloadBtnCoverSet, _t("dl16", L"Set"));
|
||||
m_btnMgr.setText(m_downloadLblGameTDBDownload, _t("dl12", L"GameTDB"));
|
||||
m_btnMgr.setText(m_downloadBtnGameTDBDownload, _t("dl6", L"Download"));
|
||||
m_btnMgr.setText(m_downloadLblBanners, _t("dl26", L"GC Custom Banners"));
|
||||
m_btnMgr.setText(m_downloadBtnBanners, _t("dl6", L"Download"));
|
||||
m_btnMgr.setText(m_downloadBtnBanners, _t("dl6", L"Download"));
|
||||
|
||||
m_btnMgr.setText(m_downloadLblGameTDB, _t("dl10", L"Please donate\nto GameTDB.com"));
|
||||
m_btnMgr.setText(m_downloadBtnCancel, _t("dl1", L"Cancel"));
|
||||
|
||||
|
||||
m_btnMgr.setText(m_downloadLblSetTitle, _t("dl17", L"Cover Download Settings"));
|
||||
m_btnMgr.setText(m_downloadLblCoverPrio, _t("dl13", L"Download order"));
|
||||
m_btnMgr.setText(m_downloadLblRegion, _t("dl14", L"Select regions to check for covers:"));
|
||||
@ -752,11 +752,10 @@ s32 CMenu::_networkComplete(s32 ok, void *usrData)
|
||||
|
||||
networkInit = ok == 0;
|
||||
m->m_thrdNetwork = false;
|
||||
|
||||
|
||||
if(networkInit)
|
||||
wolfSSL_Init();
|
||||
|
||||
gprintf("NET: Network init complete, enabled wifi_gecko: %s\n", m->m_use_wifi_gecko ? "yes" : "no");
|
||||
if(m->m_use_wifi_gecko)
|
||||
{
|
||||
const string &ip = m->m_cfg.getString("DEBUG", "wifi_gecko_ip");
|
||||
@ -787,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;
|
||||
@ -893,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");
|
||||
@ -1000,15 +999,15 @@ int CMenu::_coverDownloader()
|
||||
c_gameTDB.OpenFile(fmt("%s/wiitdb.xml", m_settingsDir.c_str()));
|
||||
c_gameTDB.SetLanguageCode(m_curLanguage.c_str());
|
||||
}
|
||||
|
||||
|
||||
vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|');
|
||||
vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|');
|
||||
vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|');
|
||||
vector<string> fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|');
|
||||
|
||||
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)
|
||||
@ -1023,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)
|
||||
{
|
||||
@ -1033,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)
|
||||
@ -1044,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];
|
||||
@ -1057,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;
|
||||
@ -1084,11 +1083,11 @@ 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));
|
||||
|
||||
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
struct download file = {};
|
||||
@ -1096,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 )
|
||||
@ -1181,33 +1180,30 @@ 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);
|
||||
m_thrdMessageAdded = true;
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* 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);
|
||||
@ -1221,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));
|
||||
@ -1230,7 +1226,7 @@ int CMenu::_coverDownloader()
|
||||
m_thrdMessageAdded = true;
|
||||
struct download file = {};
|
||||
downloadfile(url.c_str(), &file);
|
||||
|
||||
|
||||
for(int o = 0; o < 12; ++o)
|
||||
{
|
||||
bool tdl = false;
|
||||
@ -1310,7 +1306,7 @@ int CMenu::_coverDownloader()
|
||||
break;
|
||||
case AU:
|
||||
if(coverID[3] == 'W' && m_downloadPrioVal&C_TYPE_ZHCN)
|
||||
{
|
||||
{
|
||||
url = makeURL(fmtURLCBox[j], coverID, "ZH");
|
||||
tdl = true;
|
||||
}
|
||||
@ -1327,29 +1323,26 @@ 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);
|
||||
m_thrdMessageAdded = true;
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* 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
|
||||
|
||||
update_pThread(1);
|
||||
CoverFlow.cacheCoverFile(fmt("%s/%s.wfc", m_cacheDir.c_str(), coverID.c_str()), path, true); // Might fail if OOM
|
||||
|
||||
++count;
|
||||
update_pThread(1);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@ -1359,10 +1352,11 @@ 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));
|
||||
|
||||
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
struct download file = {};
|
||||
@ -1463,23 +1457,23 @@ 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);
|
||||
m_thrdMessageAdded = true;
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
|
||||
/* make cover cache file (wfc) */
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* 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);
|
||||
@ -1492,15 +1486,16 @@ 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));
|
||||
|
||||
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||
m_thrdMessageAdded = true;
|
||||
struct download file = {};
|
||||
downloadfile(url.c_str(), &file);
|
||||
|
||||
|
||||
for(int o = 0; o < 12; ++o)
|
||||
{
|
||||
bool tdl = false;
|
||||
@ -1595,28 +1590,27 @@ 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);
|
||||
m_thrdMessageAdded = true;
|
||||
fsop_WriteFile(path, file.data, file.size);
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
|
||||
/* make wfc */
|
||||
MEM2_free(file.data);
|
||||
|
||||
/* 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);
|
||||
@ -1629,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();
|
||||
@ -1642,8 +1636,8 @@ 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;
|
||||
if(_initNetwork() < 0)
|
||||
@ -1662,20 +1656,19 @@ 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)
|
||||
{
|
||||
gprintf("Writing file to '%s'\n", zippath);
|
||||
|
||||
|
||||
fsop_deleteFile(zippath);
|
||||
|
||||
|
||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip");
|
||||
m_thrdMessageAdded = true;
|
||||
m_thrdMessageAdded = true;
|
||||
res = fsop_WriteFile(zippath, file.data, file.size);
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
MEM2_free(file.data);
|
||||
}
|
||||
if(res == false)
|
||||
{
|
||||
@ -1686,15 +1679,15 @@ 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");
|
||||
m_thrdMessageAdded = true;
|
||||
m_thrdMessageAdded = true;
|
||||
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);
|
||||
@ -1702,8 +1695,8 @@ 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);
|
||||
@ -1730,7 +1723,7 @@ int CMenu::_bannerDownloader()
|
||||
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
|
||||
string cacheDir(fmt("%s/%s_gamecube.db", m_listCacheDir.c_str(), DeviceName[currentPartition]));
|
||||
m_cacheList.CreateList(COVERFLOW_GAMECUBE, gameDir, stringToVector(".iso|.ciso|root", '|'), cacheDir, false);
|
||||
|
||||
|
||||
for(u32 i = 0; i < m_cacheList.size(); ++i)
|
||||
{
|
||||
if(!fsop_FileExist(fmt("%s/%s.bnr", m_customBnrDir.c_str(), m_cacheList[i].id)))
|
||||
@ -1740,16 +1733,16 @@ int CMenu::_bannerDownloader()
|
||||
}
|
||||
else
|
||||
BnrIDList.push_back(dl_gameID);
|
||||
|
||||
|
||||
n = BnrIDList.size();
|
||||
m_thrdTotal = n;
|
||||
|
||||
|
||||
if(n == 0)
|
||||
{
|
||||
BnrIDList.clear();
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
||||
const char *banner_url = NULL;
|
||||
const char *banner_url_id3 = NULL;
|
||||
const char *GAME_BNR_ID = "{gameid}";
|
||||
@ -1767,7 +1760,7 @@ int CMenu::_bannerDownloader()
|
||||
BnrIDList.clear();
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
for(u32 i = 0; i < BnrIDList.size(); ++i)
|
||||
{
|
||||
string base_url_id6 = base_url;
|
||||
@ -1789,18 +1782,18 @@ int CMenu::_bannerDownloader()
|
||||
if(file.size < 0x5000)
|
||||
{
|
||||
if(file.size > 0)
|
||||
free(file.data); // More than 0 bytes and less than 50kb
|
||||
MEM2_free(file.data); // More than 0 bytes and less than 50kb
|
||||
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);
|
||||
count++;
|
||||
}
|
||||
if(file.size > 0)
|
||||
free(file.data);
|
||||
MEM2_free(file.data);
|
||||
update_pThread(1);
|
||||
}
|
||||
return 0;
|
||||
@ -1810,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;
|
||||
|
@ -654,17 +654,17 @@ void CMenu::_textGameInfo(void)
|
||||
break;
|
||||
case GAMETDB_RATING_TYPE_ESRB:
|
||||
if(RatingValue[0] == 'E')
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_e.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_e.png", m_imgsDir.c_str()));
|
||||
else if(memcmp(RatingValue, "EC", 2) == 0)
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_ec.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_ec.png", m_imgsDir.c_str()));
|
||||
else if(memcmp(RatingValue, "E10+", 4) == 0)
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_eten.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_eten.png", m_imgsDir.c_str()));
|
||||
else if(RatingValue[0] == 'T')
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_t.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_t.png", m_imgsDir.c_str()));
|
||||
else if(RatingValue[0] == 'M')
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_m.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_m.png", m_imgsDir.c_str()));
|
||||
else if(memcmp(RatingValue, "AO", 2) == 0)
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_ao.jpg", m_imgsDir.c_str()));
|
||||
TexHandle.fromImageFile(m_rating, fmt("%s/esrb_ao.png", m_imgsDir.c_str()));
|
||||
break;
|
||||
case GAMETDB_RATING_TYPE_PEGI:
|
||||
if(RatingValue[0] == '3')
|
||||
|
@ -52,7 +52,7 @@ void add_game_to_card(const char *gameid)
|
||||
strcpy(url, providers[i].url);
|
||||
str_replace(url, "{KEY}", providers[i].key, MAX_URL_SIZE);
|
||||
str_replace(url, "{ID6}", gameid, MAX_URL_SIZE);
|
||||
gprintf("Gamertag URL:\n%s\n", url);
|
||||
gprintf("Gamertag URL: %s\n", url);
|
||||
struct download file = {};
|
||||
file.skip_response = 1;
|
||||
downloadfile(url, &file);
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
Code by blackb0x @ GBAtemp.net
|
||||
This allows the Wii to download from servers that use SNI.
|
||||
*/
|
||||
// Code by blackb0x @ GBAtemp.net
|
||||
// This allows the Wii to download from servers that use SNI.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -12,8 +11,10 @@
|
||||
#include "https.h"
|
||||
#include "gecko/gecko.hpp"
|
||||
#include "picohttpparser.h"
|
||||
#include "memory/mem2.hpp"
|
||||
|
||||
u8 loop;
|
||||
WOLFSSL_SESSION *session;
|
||||
|
||||
int https_write(HTTP_INFO *httpinfo, char *buffer, int len)
|
||||
{
|
||||
@ -39,11 +40,31 @@ int https_write(HTTP_INFO *httpinfo, char *buffer, int len)
|
||||
|
||||
int https_read(HTTP_INFO *httpinfo, char *buffer, int len)
|
||||
{
|
||||
if (len > 8192)
|
||||
len = 8192; // 16KB is the max on a Wii, but 8KB is safe
|
||||
if (httpinfo->use_https)
|
||||
return wolfSSL_read(httpinfo->ssl, buffer, len);
|
||||
return net_read(httpinfo->sock, buffer, len);
|
||||
struct pollsd fds[1];
|
||||
fds[0].socket = httpinfo->sock;
|
||||
fds[0].events = POLLIN;
|
||||
|
||||
net_fcntl(httpinfo->sock, F_SETFL, 4);
|
||||
switch (net_poll(fds, 1, READ_WRITE_TIMEOUT))
|
||||
{
|
||||
case -1:
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("net_poll error\n");
|
||||
#endif
|
||||
return -1;
|
||||
case 0:
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("The connection timed out\n");
|
||||
#endif
|
||||
return -ETIMEDOUT;
|
||||
default:
|
||||
net_fcntl(httpinfo->sock, F_SETFL, 0);
|
||||
if (len > 8192)
|
||||
len = 8192; // 16KB is the max on a Wii, but 8KB is safe
|
||||
if (httpinfo->use_https)
|
||||
return wolfSSL_read(httpinfo->ssl, buffer, len);
|
||||
return net_read(httpinfo->sock, buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
void https_close(HTTP_INFO *httpinfo)
|
||||
@ -99,7 +120,7 @@ void read_chunked(HTTP_INFO *httpinfo, struct download *buffer, size_t start_pos
|
||||
gprintf("Increased buffer size\n");
|
||||
#endif
|
||||
capacity *= 2;
|
||||
buffer->data = realloc(buffer->data, capacity);
|
||||
buffer->data = MEM2_realloc(buffer->data, capacity);
|
||||
}
|
||||
while ((rret = https_read(httpinfo, &buffer->data[start_pos], capacity - start_pos)) == -1 && errno == EINTR)
|
||||
;
|
||||
@ -122,7 +143,7 @@ void read_chunked(HTTP_INFO *httpinfo, struct download *buffer, size_t start_pos
|
||||
start_pos += rsize;
|
||||
} while (pret == -2);
|
||||
buffer->size = start_pos;
|
||||
buffer->data = realloc(buffer->data, buffer->size);
|
||||
buffer->data = MEM2_realloc(buffer->data, buffer->size);
|
||||
}
|
||||
|
||||
void read_all(HTTP_INFO *httpinfo, struct download *buffer, size_t start_pos)
|
||||
@ -140,7 +161,7 @@ void read_all(HTTP_INFO *httpinfo, struct download *buffer, size_t start_pos)
|
||||
gprintf("Increased buffer size\n");
|
||||
#endif
|
||||
capacity *= 2;
|
||||
buffer->data = realloc(buffer->data, capacity);
|
||||
buffer->data = MEM2_realloc(buffer->data, capacity);
|
||||
}
|
||||
while ((ret = https_read(httpinfo, &buffer->data[start_pos], capacity - start_pos)) == -1 && errno == EINTR)
|
||||
;
|
||||
@ -150,7 +171,7 @@ void read_all(HTTP_INFO *httpinfo, struct download *buffer, size_t start_pos)
|
||||
start_pos += ret;
|
||||
};
|
||||
buffer->size = start_pos;
|
||||
buffer->data = realloc(buffer->data, buffer->size);
|
||||
buffer->data = MEM2_realloc(buffer->data, buffer->size);
|
||||
}
|
||||
|
||||
int connect(char *host, u16 port)
|
||||
@ -181,7 +202,7 @@ int connect(char *host, u16 port)
|
||||
if (ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_CONNECT_TIMEOUT)
|
||||
{
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("The connection has timed out\n");
|
||||
gprintf("The connection timed out\n");
|
||||
#endif
|
||||
net_close(sock);
|
||||
return -ETIMEDOUT;
|
||||
@ -202,11 +223,6 @@ int connect(char *host, u16 port)
|
||||
break;
|
||||
}
|
||||
net_fcntl(sock, F_SETFL, 0);
|
||||
// Set a read and write timeout
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = READ_WRITE_TIMEOUT;
|
||||
net_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout));
|
||||
net_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout));
|
||||
return sock;
|
||||
}
|
||||
|
||||
@ -255,8 +271,9 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
|
||||
if (httpinfo.use_https)
|
||||
{
|
||||
// Create a new SSL context and use the highest possible protocol version
|
||||
if ((httpinfo.ctx = wolfSSL_CTX_new(wolfSSLv23_client_method())) == NULL)
|
||||
// Create a new SSL context
|
||||
// wolfSSLv23_client_method() works, but resume would require further changes
|
||||
if ((httpinfo.ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL)
|
||||
{
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("Failed to create WOLFSSL_CTX\n");
|
||||
@ -293,6 +310,14 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
https_close(&httpinfo);
|
||||
return;
|
||||
}
|
||||
// Attempt to resume the session
|
||||
if (session != NULL && wolfSSL_set_session(httpinfo.ssl, session) != SSL_SUCCESS)
|
||||
{
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("Failed to set session (session timed out?)\n");
|
||||
#endif
|
||||
session = NULL;
|
||||
}
|
||||
// Initiate a handshake
|
||||
if (wolfSSL_connect(httpinfo.ssl) != SSL_SUCCESS)
|
||||
{
|
||||
@ -302,6 +327,14 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
https_close(&httpinfo);
|
||||
return;
|
||||
}
|
||||
// Check if we resumed successfully
|
||||
if (session != NULL && !wolfSSL_session_reused(httpinfo.ssl))
|
||||
{
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("Failed to resume session\n");
|
||||
#endif
|
||||
session = NULL;
|
||||
}
|
||||
// Cipher info
|
||||
#ifdef DEBUG_NETWORK
|
||||
/*char ciphers[4096];
|
||||
@ -313,13 +346,13 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
}
|
||||
|
||||
// Send our request
|
||||
char request[2048];
|
||||
char request[2200];
|
||||
char isgecko[36] = "Cookie: challenge=BitMitigate.com\r\n";
|
||||
int ret, len;
|
||||
if (strcmp(host, "www.geckocodes.org") != 0)
|
||||
memset(isgecko, 0, sizeof(isgecko)); // Not geckocodes, so don't set a cookie
|
||||
|
||||
len = snprintf(request, 2048,
|
||||
len = snprintf(request, 2200,
|
||||
"GET %s HTTP/1.1\r\n"
|
||||
"Host: %s\r\n"
|
||||
"User-Agent: WiiFlow-Lite\r\n"
|
||||
@ -420,7 +453,7 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
// We got what we wanted
|
||||
if (status == 200)
|
||||
{
|
||||
buffer->data = malloc(4096);
|
||||
buffer->data = MEM2_alloc(4096);
|
||||
buffer->size = 4096;
|
||||
memcpy(buffer->data, &response[pret], buflen - pret);
|
||||
// Determine how to read the data
|
||||
@ -428,6 +461,9 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
read_chunked(&httpinfo, buffer, buflen - pret);
|
||||
else
|
||||
read_all(&httpinfo, buffer, buflen - pret);
|
||||
// Save the session
|
||||
if (httpinfo.use_https)
|
||||
session = wolfSSL_get_session(httpinfo.ssl);
|
||||
// Finished
|
||||
https_close(&httpinfo);
|
||||
#ifdef DEBUG_NETWORK
|
||||
@ -439,5 +475,8 @@ void downloadfile(const char *url, struct download *buffer)
|
||||
return;
|
||||
}
|
||||
// Close on all other status codes
|
||||
#ifdef DEBUG_NETWORK
|
||||
gprintf("Status code: %i - %s\n", status, url);
|
||||
#endif
|
||||
https_close(&httpinfo);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
Code by blackb0x @ GBAtemp.net
|
||||
This allows the Wii to download from servers that use SNI.
|
||||
*/
|
||||
// Code by blackb0x @ GBAtemp.net
|
||||
// This allows the Wii to download from servers that use SNI.
|
||||
|
||||
#ifndef _HTTPS_H_
|
||||
#define _HTTPS_H_
|
||||
|
||||
@ -16,11 +15,11 @@ extern "C"
|
||||
// #define DEBUG_NETWORK
|
||||
#define REDIRECT_LIMIT 3
|
||||
#define TCP_CONNECT_TIMEOUT 5000
|
||||
#define READ_WRITE_TIMEOUT 10
|
||||
#define READ_WRITE_TIMEOUT 5000
|
||||
|
||||
struct download
|
||||
{
|
||||
u8 skip_response; // Used by WiinnerTag
|
||||
u8 skip_response; // Used by WiinnerTag
|
||||
u64 size;
|
||||
char *data;
|
||||
};
|
||||
|