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"
|
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}"
|
#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 */
|
/* load the colored skin/spine images if not already done */
|
||||||
if(!m_dvdskin_loaded)
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
return false;
|
||||||
m_dvdskin_loaded = true;
|
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(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;
|
return false;
|
||||||
}
|
}
|
||||||
if(m_pngNoCover.empty() || TexHandle.fromImageFile(m_boxNoCoverTexture, m_pngNoCover.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
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(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;
|
return false;
|
||||||
}
|
}
|
||||||
if(m_pngNoCoverFlat.empty() || TexHandle.fromImageFile(m_flatNoCoverTexture, m_pngNoCoverFlat.c_str(), GX_TF_CMPR, 32, 512) != TE_OK)
|
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) )
|
if ( (ctx->prop.imgWidth != width) || (ctx->prop.imgHeight != height) )
|
||||||
return PNGU_INVALID_WIDTH_OR_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
|
// 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;
|
return PNGU_UNSUPPORTED_COLOR_TYPE;
|
||||||
|
|
||||||
// error handling
|
// error handling
|
||||||
|
@ -1215,8 +1215,8 @@ void CMenu::_buildMenus(void)
|
|||||||
theme.btnTexMinusS = _texture("GENERAL", "minus_button_texture_selected", theme.btnTexMinusS);
|
theme.btnTexMinusS = _texture("GENERAL", "minus_button_texture_selected", theme.btnTexMinusS);
|
||||||
|
|
||||||
// Default background
|
// Default background
|
||||||
TexHandle.fromImageFile(theme.bg, fmt("%s/background.jpg", m_imgsDir.c_str()));
|
TexHandle.fromImageFile(theme.bg, fmt("%s/background.png", m_imgsDir.c_str()));
|
||||||
TexHandle.fromImageFile(m_mainBgLQ, fmt("%s/background.jpg", m_imgsDir.c_str()), GX_TF_CMPR, 64, 64);
|
TexHandle.fromImageFile(m_mainBgLQ, fmt("%s/background.png", m_imgsDir.c_str()), GX_TF_CMPR, 64, 64);
|
||||||
m_gameBgLQ = m_mainBgLQ;
|
m_gameBgLQ = m_mainBgLQ;
|
||||||
|
|
||||||
// Build menus
|
// Build menus
|
||||||
@ -2785,9 +2785,9 @@ const char *CMenu::getBlankCoverPath(const dir_discHdr *element)
|
|||||||
}
|
}
|
||||||
blankCoverTitle = m_platform.getString("PLUGINS", m_plugin.PluginMagicWord, "wii");
|
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))
|
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;
|
return blankCoverPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ int CMenu::_downloadCheatFileAsync()
|
|||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
update_pThread(1);// its downloaded
|
update_pThread(1);// its downloaded
|
||||||
fsop_WriteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id), file.data, file.size);
|
fsop_WriteFile(fmt("%s/%s.txt", m_txtCheatDir.c_str(), id), file.data, file.size);
|
||||||
free(file.data);
|
MEM2_free(file.data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(file.size > 0)// received a 301/302 redirect instead of a 404?
|
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 -4;// the file doesn't exist on the server
|
||||||
}
|
}
|
||||||
return -3;// download failed
|
return -3;// download failed
|
||||||
|
@ -265,7 +265,7 @@ void CMenu::_download(string gameId, int dl_type)
|
|||||||
{
|
{
|
||||||
if(m_btnMgr.selected(m_downloadBtnAll) || dl_type == 1)
|
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_downloadLblCovers);
|
||||||
m_btnMgr.hide(m_downloadBtnAll);
|
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."));
|
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg30", L"No covers missing."));
|
||||||
dl_finished = true;
|
dl_finished = true;
|
||||||
dl_type = 0;
|
dl_type = 0;
|
||||||
//maybe show back button
|
// Maybe show back button
|
||||||
//m_btnMgr.show(m_downloadBtnBack);
|
//m_btnMgr.show(m_downloadBtnBack);
|
||||||
}
|
}
|
||||||
if(m_btnMgr.selected(m_downloadBtnBanners) || dl_type == 2)
|
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."));
|
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg14", L"Done."));
|
||||||
}
|
}
|
||||||
else if(ret == -1)
|
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)
|
else if(ret == -2)
|
||||||
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg2", L"Network initialization failed!"));
|
m_btnMgr.setText(m_wbfsLblDialog, _t("dlmsg2", L"Network initialization failed!"));
|
||||||
else if(ret == -3)
|
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_finished = true;
|
||||||
dl_type = 0;
|
dl_type = 0;
|
||||||
//maybe show back button
|
// Maybe show back button
|
||||||
//m_btnMgr.show(m_downloadBtnBack);
|
//m_btnMgr.show(m_downloadBtnBack);
|
||||||
}
|
}
|
||||||
else if(m_btnMgr.selected(m_downloadBtnGameTDBDownload))
|
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_downloadLblCovers);
|
||||||
m_btnMgr.hide(m_downloadBtnAll);
|
m_btnMgr.hide(m_downloadBtnAll);
|
||||||
m_btnMgr.hide(m_downloadBtnMissing);
|
m_btnMgr.hide(m_downloadBtnMissing);
|
||||||
@ -756,7 +756,6 @@ s32 CMenu::_networkComplete(s32 ok, void *usrData)
|
|||||||
if(networkInit)
|
if(networkInit)
|
||||||
wolfSSL_Init();
|
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)
|
if(m->m_use_wifi_gecko)
|
||||||
{
|
{
|
||||||
const string &ip = m->m_cfg.getString("DEBUG", "wifi_gecko_ip");
|
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)
|
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)
|
if(networkInit)
|
||||||
return 0;
|
return 0;
|
||||||
@ -893,7 +892,7 @@ static string makeURL(const string format, const string gameId, const string cou
|
|||||||
{
|
{
|
||||||
string url = format;
|
string url = format;
|
||||||
if(url.find(TAG_LOC) != url.npos)
|
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)
|
if(url.find(TAG_CONSOLE) != url.npos)
|
||||||
url.replace(url.find(TAG_CONSOLE), strlen(TAG_CONSOLE), "wii");
|
url.replace(url.find(TAG_CONSOLE), strlen(TAG_CONSOLE), "wii");
|
||||||
@ -1008,7 +1007,7 @@ int CMenu::_coverDownloader()
|
|||||||
|
|
||||||
vector<string> coverIDList;
|
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())
|
if(dl_gameID.empty())
|
||||||
{
|
{
|
||||||
for(u32 i = 0; i < m_gameList.size(); ++i)
|
for(u32 i = 0; i < m_gameList.size(); ++i)
|
||||||
@ -1023,7 +1022,7 @@ int CMenu::_coverDownloader()
|
|||||||
coverIDList.push_back(dl_gameID);
|
coverIDList.push_back(dl_gameID);
|
||||||
|
|
||||||
n = coverIDList.size();
|
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)
|
if(m_thrdTotal == 0)
|
||||||
{
|
{
|
||||||
@ -1033,7 +1032,7 @@ int CMenu::_coverDownloader()
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize network connection */
|
/* Initialize network connection */
|
||||||
m_thrdMessage = _t("dlmsg1", L"Initializing network...");
|
m_thrdMessage = _t("dlmsg1", L"Initializing network...");
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
if(_initNetwork() < 0)
|
if(_initNetwork() < 0)
|
||||||
@ -1044,7 +1043,7 @@ int CMenu::_coverDownloader()
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* download covers in the list */
|
/* Download covers in the list */
|
||||||
u32 CoverType = 0;
|
u32 CoverType = 0;
|
||||||
string url;
|
string url;
|
||||||
char path[256];
|
char path[256];
|
||||||
@ -1057,20 +1056,20 @@ int CMenu::_coverDownloader()
|
|||||||
bool custom = false;
|
bool custom = false;
|
||||||
int c_altCase = 0;
|
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)
|
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)
|
switch(p)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? CBOX : BOX;
|
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? CBOX : BOX;
|
||||||
break;
|
break;
|
||||||
case 1:
|
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;
|
break;
|
||||||
case 2:
|
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;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? FLAT : CFLAT;
|
CoverType = m_downloadPrioVal & C_TYPE_PRIOA ? FLAT : CFLAT;
|
||||||
@ -1084,7 +1083,7 @@ int CMenu::_coverDownloader()
|
|||||||
original = false;
|
original = false;
|
||||||
if(!success && original)
|
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)
|
for(u8 j = 0; !success && j < fmtURLBox.size(); ++j)
|
||||||
{
|
{
|
||||||
url = makeURL(fmtURLBox[j], coverID, countryCode(coverID));
|
url = makeURL(fmtURLBox[j], coverID, countryCode(coverID));
|
||||||
@ -1096,7 +1095,7 @@ int CMenu::_coverDownloader()
|
|||||||
|
|
||||||
for(int o = 0; o < 12; ++o)
|
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))
|
if(file.size > 0)// && checkPNGBuf(file.data))
|
||||||
break;
|
break;
|
||||||
switch( o )
|
switch( o )
|
||||||
@ -1181,33 +1180,30 @@ int CMenu::_coverDownloader()
|
|||||||
case ZHCN:
|
case ZHCN:
|
||||||
break;
|
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_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
downloadfile(url.c_str(), &file);
|
downloadfile(url.c_str(), &file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if none of the downloads succeeded */
|
/* If none of the downloads succeeded */
|
||||||
if(file.size == 0)// || !checkPNGBuf(file.data))
|
if(file.size == 0)// || !checkPNGBuf(file.data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* a download succeeded */
|
/* Download succeeded - save png */
|
||||||
|
|
||||||
/* save cover png */
|
|
||||||
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
fsop_WriteFile(path, file.data, file.size);
|
fsop_WriteFile(path, file.data, file.size);
|
||||||
if(file.size > 0)
|
MEM2_free(file.data);
|
||||||
free(file.data);
|
|
||||||
|
|
||||||
/* make cover cache file (wfc) */
|
/* Make cover cache file (wfc) */
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||||
m_thrdMessageAdded = true;
|
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;
|
++count;
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
@ -1221,7 +1217,7 @@ int CMenu::_coverDownloader()
|
|||||||
c_altCase = c_gameTDB.GetCaseVersions(coverID.c_str());
|
c_altCase = c_gameTDB.GetCaseVersions(coverID.c_str());
|
||||||
if(!success && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
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)
|
for(u8 j = 0; !success && j < fmtURLCBox.size(); ++j)
|
||||||
{
|
{
|
||||||
url = makeURL(fmtURLCBox[j], coverID, countryCode(coverID));
|
url = makeURL(fmtURLCBox[j], coverID, countryCode(coverID));
|
||||||
@ -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))
|
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* a download succeeded */
|
/* Download succeeded - save png */
|
||||||
|
|
||||||
/* save cover png */
|
|
||||||
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
strncpy(path, fmt("%s/%s.png", m_boxPicDir.c_str(), coverID.c_str()), 255);
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
fsop_WriteFile(path, file.data, file.size);
|
fsop_WriteFile(path, file.data, file.size);
|
||||||
if(file.size > 0)
|
MEM2_free(file.data);
|
||||||
free(file.data);
|
|
||||||
|
|
||||||
/* make cover cache file (wfc) */
|
/* Make cover cache file (wfc) */
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s.wfc"), coverID.c_str());
|
||||||
m_thrdMessageAdded = true;
|
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;
|
++count;
|
||||||
|
update_pThread(1);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1359,6 +1352,7 @@ int CMenu::_coverDownloader()
|
|||||||
original = false;
|
original = false;
|
||||||
if(!success && original)
|
if(!success && original)
|
||||||
{
|
{
|
||||||
|
/* Each fmtURL may have more than one URL */
|
||||||
for(u8 j = 0; !success && j < fmtURLFlat.size(); ++j)
|
for(u8 j = 0; !success && j < fmtURLFlat.size(); ++j)
|
||||||
{
|
{
|
||||||
url = makeURL(fmtURLFlat[j], coverID, countryCode(coverID));
|
url = makeURL(fmtURLFlat[j], coverID, countryCode(coverID));
|
||||||
@ -1463,23 +1457,23 @@ int CMenu::_coverDownloader()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If none of the downloads succeeded */
|
||||||
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*download succeeded - save png */
|
/* Download succeeded - save png */
|
||||||
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
fsop_WriteFile(path, file.data, file.size);
|
fsop_WriteFile(path, file.data, file.size);
|
||||||
if(file.size > 0)
|
MEM2_free(file.data);
|
||||||
free(file.data);
|
|
||||||
|
|
||||||
/* make cover cache file (wfc) */
|
/* Make cover cache file (wfc) */
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||||
m_thrdMessageAdded = true;
|
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;
|
++countFlat;
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
@ -1492,6 +1486,7 @@ int CMenu::_coverDownloader()
|
|||||||
custom = true;
|
custom = true;
|
||||||
if(!success && c_gameTDB.IsLoaded() && c_altCase > 1 && custom)
|
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)
|
for(u8 j = 0; !success && j < fmtURLCFlat.size(); ++j)
|
||||||
{
|
{
|
||||||
url = makeURL(fmtURLCFlat[j], coverID, countryCode(coverID));
|
url = makeURL(fmtURLCFlat[j], coverID, countryCode(coverID));
|
||||||
@ -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_thrdMessage = wfmt(_fmt("dlmsg3", L"Downloading %i/%i from %s"), i + 1, n, url.c_str());
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
LWP_MutexUnlock(m_mutex);
|
LWP_MutexUnlock(m_mutex);
|
||||||
|
|
||||||
downloadfile(url.c_str(), &file);
|
downloadfile(url.c_str(), &file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If none of the downloads succeeded */
|
||||||
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
if(file.size <= 0)// || !checkPNGBuf(file.data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* save png */
|
/* Download succeeded - save png */
|
||||||
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
strncpy(path, fmt("%s/%s.png", m_picDir.c_str(), coverID.c_str()), 255);
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), path);
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
fsop_WriteFile(path, file.data, file.size);
|
fsop_WriteFile(path, file.data, file.size);
|
||||||
if(file.size > 0)
|
MEM2_free(file.data);
|
||||||
free(file.data);
|
|
||||||
|
|
||||||
/* make wfc */
|
/* Make cover cache file (wfc) */
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
m_thrdMessage = wfmt(_fmt("dlmsg10", L"Making %s"), sfmt("%s.wfc", coverID.c_str()));
|
||||||
m_thrdMessageAdded = true;
|
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;
|
++countFlat;
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
@ -1629,7 +1623,7 @@ int CMenu::_coverDownloader()
|
|||||||
if(!success)
|
if(!success)
|
||||||
update_pThread(3);
|
update_pThread(3);
|
||||||
}
|
}
|
||||||
/* cover list done and downloading complete */
|
/* Cover list done and downloading complete */
|
||||||
if(c_gameTDB.IsLoaded())
|
if(c_gameTDB.IsLoaded())
|
||||||
c_gameTDB.CloseFile();
|
c_gameTDB.CloseFile();
|
||||||
coverIDList.clear();
|
coverIDList.clear();
|
||||||
@ -1642,7 +1636,7 @@ int CMenu::_coverDownloader()
|
|||||||
int CMenu::_gametdbDownloaderAsync()
|
int CMenu::_gametdbDownloaderAsync()
|
||||||
{
|
{
|
||||||
const string &langCode = m_loc.getString(m_curLanguage, "gametdb_code", "EN");
|
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_thrdMessage = _t("dlmsg1", L"Initializing network...");
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
@ -1662,7 +1656,7 @@ int CMenu::_gametdbDownloaderAsync()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
update_pThread(1);//its downloaded
|
update_pThread(1); // It's downloaded
|
||||||
bool res = false;
|
bool res = false;
|
||||||
char *zippath = fmt_malloc("%s/wiitdb.zip", m_settingsDir.c_str());
|
char *zippath = fmt_malloc("%s/wiitdb.zip", m_settingsDir.c_str());
|
||||||
if(zippath != NULL)
|
if(zippath != NULL)
|
||||||
@ -1674,8 +1668,7 @@ int CMenu::_gametdbDownloaderAsync()
|
|||||||
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip");
|
m_thrdMessage = wfmt(_fmt("dlmsg4", L"Saving %s"), "wiitdb.zip");
|
||||||
m_thrdMessageAdded = true;
|
m_thrdMessageAdded = true;
|
||||||
res = fsop_WriteFile(zippath, file.data, file.size);
|
res = fsop_WriteFile(zippath, file.data, file.size);
|
||||||
if(file.size > 0)
|
MEM2_free(file.data);
|
||||||
free(file.data);
|
|
||||||
}
|
}
|
||||||
if(res == false)
|
if(res == false)
|
||||||
{
|
{
|
||||||
@ -1686,7 +1679,7 @@ int CMenu::_gametdbDownloaderAsync()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
update_pThread(1);//its saved
|
update_pThread(1); // It's saved
|
||||||
gprintf("Extracting zip file: ");
|
gprintf("Extracting zip file: ");
|
||||||
|
|
||||||
m_thrdMessage = wfmt(_fmt("dlmsg24", L"Extracting %s"), "wiitdb.zip");
|
m_thrdMessage = wfmt(_fmt("dlmsg24", L"Extracting %s"), "wiitdb.zip");
|
||||||
@ -1694,7 +1687,7 @@ int CMenu::_gametdbDownloaderAsync()
|
|||||||
ZipFile zFile(zippath);
|
ZipFile zFile(zippath);
|
||||||
bool zres = zFile.ExtractAll(m_settingsDir.c_str());
|
bool zres = zFile.ExtractAll(m_settingsDir.c_str());
|
||||||
gprintf(zres ? "success\n" : "failed\n");
|
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
|
// We don't need the zipfile anymore
|
||||||
fsop_deleteFile(zippath);
|
fsop_deleteFile(zippath);
|
||||||
@ -1703,7 +1696,7 @@ int CMenu::_gametdbDownloaderAsync()
|
|||||||
// We should always remove the offsets file to make sure it's reloaded
|
// We should always remove the offsets file to make sure it's reloaded
|
||||||
fsop_deleteFile(fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()));
|
fsop_deleteFile(fmt("%s/gametdb_offsets.bin", m_settingsDir.c_str()));
|
||||||
|
|
||||||
update_pThread(1);//its extracted
|
update_pThread(1); // It's extracted
|
||||||
|
|
||||||
// Update cache
|
// Update cache
|
||||||
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
|
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
|
||||||
@ -1789,18 +1782,18 @@ int CMenu::_bannerDownloader()
|
|||||||
if(file.size < 0x5000)
|
if(file.size < 0x5000)
|
||||||
{
|
{
|
||||||
if(file.size > 0)
|
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);
|
downloadfile(banner_url_id3, &file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* minimum 50kb */
|
/* Minimum 50kb */
|
||||||
if(file.size > 51200 && file.data[0] != '<')
|
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);
|
fsop_WriteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), BnrIDList[i].c_str()), file.data, file.size);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if(file.size > 0)
|
if(file.size > 0)
|
||||||
free(file.data);
|
MEM2_free(file.data);
|
||||||
update_pThread(1);
|
update_pThread(1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1810,7 +1803,7 @@ int CMenu::_bannerDownloader()
|
|||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
|
|
||||||
const char *url_dl = NULL;
|
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_file = NULL;
|
||||||
m_filesize = 0;
|
m_filesize = 0;
|
||||||
|
@ -654,17 +654,17 @@ void CMenu::_textGameInfo(void)
|
|||||||
break;
|
break;
|
||||||
case GAMETDB_RATING_TYPE_ESRB:
|
case GAMETDB_RATING_TYPE_ESRB:
|
||||||
if(RatingValue[0] == 'E')
|
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)
|
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)
|
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')
|
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')
|
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)
|
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;
|
break;
|
||||||
case GAMETDB_RATING_TYPE_PEGI:
|
case GAMETDB_RATING_TYPE_PEGI:
|
||||||
if(RatingValue[0] == '3')
|
if(RatingValue[0] == '3')
|
||||||
|
@ -52,7 +52,7 @@ void add_game_to_card(const char *gameid)
|
|||||||
strcpy(url, providers[i].url);
|
strcpy(url, providers[i].url);
|
||||||
str_replace(url, "{KEY}", providers[i].key, MAX_URL_SIZE);
|
str_replace(url, "{KEY}", providers[i].key, MAX_URL_SIZE);
|
||||||
str_replace(url, "{ID6}", gameid, 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 = {};
|
struct download file = {};
|
||||||
file.skip_response = 1;
|
file.skip_response = 1;
|
||||||
downloadfile(url, &file);
|
downloadfile(url, &file);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*
|
// Code by blackb0x @ GBAtemp.net
|
||||||
Code by blackb0x @ GBAtemp.net
|
// This allows the Wii to download from servers that use SNI.
|
||||||
This allows the Wii to download from servers that use SNI.
|
|
||||||
*/
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -12,8 +11,10 @@
|
|||||||
#include "https.h"
|
#include "https.h"
|
||||||
#include "gecko/gecko.hpp"
|
#include "gecko/gecko.hpp"
|
||||||
#include "picohttpparser.h"
|
#include "picohttpparser.h"
|
||||||
|
#include "memory/mem2.hpp"
|
||||||
|
|
||||||
u8 loop;
|
u8 loop;
|
||||||
|
WOLFSSL_SESSION *session;
|
||||||
|
|
||||||
int https_write(HTTP_INFO *httpinfo, char *buffer, int len)
|
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)
|
int https_read(HTTP_INFO *httpinfo, char *buffer, int len)
|
||||||
{
|
{
|
||||||
if (len > 8192)
|
struct pollsd fds[1];
|
||||||
len = 8192; // 16KB is the max on a Wii, but 8KB is safe
|
fds[0].socket = httpinfo->sock;
|
||||||
if (httpinfo->use_https)
|
fds[0].events = POLLIN;
|
||||||
return wolfSSL_read(httpinfo->ssl, buffer, len);
|
|
||||||
return net_read(httpinfo->sock, buffer, len);
|
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)
|
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");
|
gprintf("Increased buffer size\n");
|
||||||
#endif
|
#endif
|
||||||
capacity *= 2;
|
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)
|
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;
|
start_pos += rsize;
|
||||||
} while (pret == -2);
|
} while (pret == -2);
|
||||||
buffer->size = start_pos;
|
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)
|
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");
|
gprintf("Increased buffer size\n");
|
||||||
#endif
|
#endif
|
||||||
capacity *= 2;
|
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)
|
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;
|
start_pos += ret;
|
||||||
};
|
};
|
||||||
buffer->size = start_pos;
|
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)
|
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)
|
if (ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_CONNECT_TIMEOUT)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
gprintf("The connection has timed out\n");
|
gprintf("The connection timed out\n");
|
||||||
#endif
|
#endif
|
||||||
net_close(sock);
|
net_close(sock);
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
@ -202,11 +223,6 @@ int connect(char *host, u16 port)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
net_fcntl(sock, F_SETFL, 0);
|
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;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,8 +271,9 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
|
|
||||||
if (httpinfo.use_https)
|
if (httpinfo.use_https)
|
||||||
{
|
{
|
||||||
// Create a new SSL context and use the highest possible protocol version
|
// Create a new SSL context
|
||||||
if ((httpinfo.ctx = wolfSSL_CTX_new(wolfSSLv23_client_method())) == NULL)
|
// wolfSSLv23_client_method() works, but resume would require further changes
|
||||||
|
if ((httpinfo.ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
gprintf("Failed to create WOLFSSL_CTX\n");
|
gprintf("Failed to create WOLFSSL_CTX\n");
|
||||||
@ -293,6 +310,14 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
https_close(&httpinfo);
|
https_close(&httpinfo);
|
||||||
return;
|
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
|
// Initiate a handshake
|
||||||
if (wolfSSL_connect(httpinfo.ssl) != SSL_SUCCESS)
|
if (wolfSSL_connect(httpinfo.ssl) != SSL_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -302,6 +327,14 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
https_close(&httpinfo);
|
https_close(&httpinfo);
|
||||||
return;
|
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
|
// Cipher info
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
/*char ciphers[4096];
|
/*char ciphers[4096];
|
||||||
@ -313,13 +346,13 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send our request
|
// Send our request
|
||||||
char request[2048];
|
char request[2200];
|
||||||
char isgecko[36] = "Cookie: challenge=BitMitigate.com\r\n";
|
char isgecko[36] = "Cookie: challenge=BitMitigate.com\r\n";
|
||||||
int ret, len;
|
int ret, len;
|
||||||
if (strcmp(host, "www.geckocodes.org") != 0)
|
if (strcmp(host, "www.geckocodes.org") != 0)
|
||||||
memset(isgecko, 0, sizeof(isgecko)); // Not geckocodes, so don't set a cookie
|
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"
|
"GET %s HTTP/1.1\r\n"
|
||||||
"Host: %s\r\n"
|
"Host: %s\r\n"
|
||||||
"User-Agent: WiiFlow-Lite\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
|
// We got what we wanted
|
||||||
if (status == 200)
|
if (status == 200)
|
||||||
{
|
{
|
||||||
buffer->data = malloc(4096);
|
buffer->data = MEM2_alloc(4096);
|
||||||
buffer->size = 4096;
|
buffer->size = 4096;
|
||||||
memcpy(buffer->data, &response[pret], buflen - pret);
|
memcpy(buffer->data, &response[pret], buflen - pret);
|
||||||
// Determine how to read the data
|
// Determine how to read the data
|
||||||
@ -428,6 +461,9 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
read_chunked(&httpinfo, buffer, buflen - pret);
|
read_chunked(&httpinfo, buffer, buflen - pret);
|
||||||
else
|
else
|
||||||
read_all(&httpinfo, buffer, buflen - pret);
|
read_all(&httpinfo, buffer, buflen - pret);
|
||||||
|
// Save the session
|
||||||
|
if (httpinfo.use_https)
|
||||||
|
session = wolfSSL_get_session(httpinfo.ssl);
|
||||||
// Finished
|
// Finished
|
||||||
https_close(&httpinfo);
|
https_close(&httpinfo);
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
@ -439,5 +475,8 @@ void downloadfile(const char *url, struct download *buffer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Close on all other status codes
|
// Close on all other status codes
|
||||||
|
#ifdef DEBUG_NETWORK
|
||||||
|
gprintf("Status code: %i - %s\n", status, url);
|
||||||
|
#endif
|
||||||
https_close(&httpinfo);
|
https_close(&httpinfo);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*
|
// Code by blackb0x @ GBAtemp.net
|
||||||
Code by blackb0x @ GBAtemp.net
|
// This allows the Wii to download from servers that use SNI.
|
||||||
This allows the Wii to download from servers that use SNI.
|
|
||||||
*/
|
|
||||||
#ifndef _HTTPS_H_
|
#ifndef _HTTPS_H_
|
||||||
#define _HTTPS_H_
|
#define _HTTPS_H_
|
||||||
|
|
||||||
@ -16,11 +15,11 @@ extern "C"
|
|||||||
// #define DEBUG_NETWORK
|
// #define DEBUG_NETWORK
|
||||||
#define REDIRECT_LIMIT 3
|
#define REDIRECT_LIMIT 3
|
||||||
#define TCP_CONNECT_TIMEOUT 5000
|
#define TCP_CONNECT_TIMEOUT 5000
|
||||||
#define READ_WRITE_TIMEOUT 10
|
#define READ_WRITE_TIMEOUT 5000
|
||||||
|
|
||||||
struct download
|
struct download
|
||||||
{
|
{
|
||||||
u8 skip_response; // Used by WiinnerTag
|
u8 skip_response; // Used by WiinnerTag
|
||||||
u64 size;
|
u64 size;
|
||||||
char *data;
|
char *data;
|
||||||
};
|
};
|
||||||
|