Remove downloadToRAM param.

And make Universal-Updater fully touch usable.
This commit is contained in:
SuperSaiyajinStackZ
2019-12-23 01:10:26 +01:00
parent 34bcfd113b
commit 350401b357
16 changed files with 138 additions and 72 deletions
+15 -27
View File
@@ -161,11 +161,12 @@ static Result setupContextForDirectToFileDownload(CURL *hnd, const char * url)
return 0;
}
Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
Result downloadToFile(std::string url, std::string path)
{
Result ret = 0;
u64 offset = 0;
u32 bytesWritten = 0;
bool isDownloadToRAM = true;
printf("Downloading from:\n%s\nto:\n%s\n", url.c_str(), path.c_str());
void *socubuf = memalign(0x1000, 0x100000);
@@ -198,11 +199,12 @@ Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
result_fileHandle = &fileHandle;
CURL *hnd = curl_easy_init();
if (downloadToRAM == true) {
ret = setupContext(hnd, url.c_str());
} else {
ret = setupContext(hnd, url.c_str());
if (downloadTotal > 30000000) {
ret = setupContextForDirectToFileDownload(hnd, url.c_str());
isDownloadToRAM = false;
}
if (ret != 0) {
socExit();
free(result_buf);
@@ -232,7 +234,7 @@ Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
FSFILE_Close(fileHandle);
return -1;
}
if (downloadToRAM == true) {
if (isDownloadToRAM == true) {
FSFILE_Write(fileHandle, &bytesWritten, offset, result_buf, result_written, 0);
}
@@ -251,7 +253,7 @@ Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
return 0;
}
Result downloadFromRelease(std::string url, std::string asset, std::string path, bool includePrereleases, bool downloadToRAM)
Result downloadFromRelease(std::string url, std::string asset, std::string path, bool includePrereleases)
{
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -335,7 +337,7 @@ Result downloadFromRelease(std::string url, std::string asset, std::string path,
if (assetUrl.empty())
ret = DL_ERROR_GIT;
else
ret = downloadToFile(assetUrl, path, downloadToRAM);
ret = downloadToFile(assetUrl, path);
return ret;
}
@@ -383,7 +385,7 @@ void notConnectedMsg(void) {
}
}
std::string getLatestRelease(std::string repo, std::string item, bool downloadToRAM)
std::string getLatestRelease(std::string repo, std::string item)
{
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -404,13 +406,7 @@ std::string getLatestRelease(std::string repo, std::string item, bool downloadTo
std::string apiurl = apiurlStream.str();
CURL *hnd = curl_easy_init();
if (downloadToRAM == true) {
ret = setupContext(hnd, apiurl.c_str());
} else {
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
}
ret = setupContext(hnd, apiurl.c_str());
if (ret != 0) {
socExit();
free(result_buf);
@@ -453,7 +449,7 @@ std::string getLatestRelease(std::string repo, std::string item, bool downloadTo
return jsonItem;
}
std::string getLatestCommit(std::string repo, std::string item, bool downloadToRAM)
std::string getLatestCommit(std::string repo, std::string item)
{
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -474,11 +470,7 @@ std::string getLatestCommit(std::string repo, std::string item, bool downloadToR
std::string apiurl = apiurlStream.str();
CURL *hnd = curl_easy_init();
if (downloadToRAM == true) {
ret = setupContext(hnd, apiurl.c_str());
} else {
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
}
ret = setupContext(hnd, apiurl.c_str());
if (ret != 0) {
socExit();
free(result_buf);
@@ -521,7 +513,7 @@ std::string getLatestCommit(std::string repo, std::string item, bool downloadToR
return jsonItem;
}
std::string getLatestCommit(std::string repo, std::string array, std::string item, bool downloadToRAM)
std::string getLatestCommit(std::string repo, std::string array, std::string item)
{
Result ret = 0;
void *socubuf = memalign(0x1000, 0x100000);
@@ -542,11 +534,7 @@ std::string getLatestCommit(std::string repo, std::string array, std::string ite
std::string apiurl = apiurlStream.str();
CURL *hnd = curl_easy_init();
if (downloadToRAM == true) {
ret = setupContext(hnd, apiurl.c_str());
} else {
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
}
ret = setupContext(hnd, apiurl.c_str());
if (ret != 0) {
socExit();
free(result_buf);
+7
View File
@@ -39,6 +39,9 @@ extern "C" {
#include "ftp.h"
}
extern bool touching(touchPosition touch, Structs::ButtonPos button);
extern touchPosition touch;
void FTPScreen::Draw(void) const
{
ftp_init();
@@ -54,6 +57,7 @@ void FTPScreen::Draw(void) const
Gui::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.8f, Lang::get("FTP_MODE")))/2, 0, 0.8f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
ret = ACU_GetWifiStatus(&wifiStatus);
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
@@ -77,10 +81,13 @@ void FTPScreen::Draw(void) const
Gui::clearTextBufs();
C3D_FrameEnd(0);
hidScanInput();
hidTouchRead(&touch);
u32 hDown = hidKeysDown();
if (hDown & KEY_B)
break;
if (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))
break;
}
memset(ftp_accepted_connection, 0, 20); // Empty accepted connection address.
memset(ftp_file_transfer, 0, 50); // Empty transfer status.
+3
View File
@@ -54,6 +54,7 @@ void MainMenu::Draw(void) const {
Gui::DrawString(397-Gui::GetStringWidth(0.5f, V_STRING), 237-Gui::GetStringHeight(0.5f, V_STRING), 0.5f, Config::TxtColor, V_STRING);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
for (int i = 0; i < 6; i++) {
if (Selection == i) {
@@ -186,6 +187,8 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
} else {
notConnectedMsg();
}
} else if (touching(touch, mainButtons[6])) {
exiting = true;
}
}
}
+15 -7
View File
@@ -99,7 +99,7 @@ ScriptBrowse::ScriptBrowse() {
DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
// Get repo info
downloadToFile("https://github.com/Universal-Team/extras/raw/scripts/info/scriptInfo.json", metaFile, true);
downloadToFile("https://github.com/Universal-Team/extras/raw/scripts/info/scriptInfo.json", metaFile);
FILE* file = fopen(metaFile, "r");
if(file) infoJson = nlohmann::json::parse(file, nullptr, false);
fclose(file);
@@ -128,8 +128,10 @@ void ScriptBrowse::Draw(void) const {
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::sprite(sprites_search_idx, -3, 0);
Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
// Gui::sprite(sprites_search_idx, -3, 0);
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
Gui::DrawArrow(0, 242, 270.0);
Gui::DrawStringCentered(-23, 3, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts);
if (Config::viewMode == 0) {
@@ -191,6 +193,12 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
infoJson.clear();
Screen::back();
return;
}
if (hHeld & KEY_DOWN && !keyRepeatDelay) {
if (selection < (int)infoJson.size()-1) {
selection++;
@@ -230,7 +238,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
DisplayMsg(fileName);
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json", true);
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
}
}
@@ -247,7 +255,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
DisplayMsg(fileName);
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json", true);
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
}
}
@@ -267,7 +275,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
DisplayMsg(fileName);
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json", true);
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[selection]["curRevision"] = infoJson[selection]["revision"];
}
}
@@ -315,7 +323,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json", true);
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[i]["curRevision"] = infoJson[i]["revision"];
}
}
+19 -9
View File
@@ -128,19 +128,17 @@ void runFunctions(nlohmann::json &json) {
if(!missing) ScriptHelper::removeFile(file, message);
} else if(type == "downloadFile") {
bool missing = false, downloadToRAM = false;
bool missing = false;
std::string file, output, message;
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
else missing = true;
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
else missing = true;
if(json.at(choice).at(i).contains("downloadToRAM") && json.at(choice).at(i).at("downloadToRAM").is_boolean())
downloadToRAM = json.at(choice).at(i).at("downloadToRAM");
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
if(!missing) ScriptHelper::downloadFile(file, output, downloadToRAM, message);
if(!missing) ScriptHelper::downloadFile(file, output, message);
} else if(type == "downloadRelease") {
bool missing = false, includePrereleases = false, downloadToRAM = false;
bool missing = false, includePrereleases = false;
std::string repo, file, output, message;
if(json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
else missing = true;
@@ -150,10 +148,8 @@ void runFunctions(nlohmann::json &json) {
else missing = true;
if(json.at(choice).at(i).contains("includePrereleases") && json.at(choice).at(i).at("includePrereleases").is_boolean())
includePrereleases = json.at(choice).at(i).at("includePrereleases");
if(json.at(choice).at(i).contains("downloadToRAM") && json.at(choice).at(i).at("downloadToRAM").is_boolean())
downloadToRAM = json.at(choice).at(i).at("downloadToRAM");
if(json.at(choice).at(i).contains("message")) message = json.at(choice).at(i).at("message");
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, downloadToRAM, message);
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, message);
} else if(type == "extractFile") {
bool missing = false;
@@ -290,7 +286,7 @@ void ScriptList::DrawList(void) const {
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 242, 270.0);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
line1 = fileInfo[screenPos + i].title;
@@ -345,6 +341,7 @@ void ScriptList::DrawSingleObject(void) const {
Gui::DrawBottom();
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 242, 270.0);
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
@@ -395,6 +392,12 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
fileInfo.clear();
Screen::back();
return;
}
if (hDown & KEY_TOUCH) {
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
@@ -526,6 +529,13 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
selection2 = 0;
fileInfo2.clear();
isScriptSelected = false;
mode = 0;
}
if (hDown & KEY_TOUCH) {
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
+41 -8
View File
@@ -49,6 +49,7 @@ void Settings::DrawSubMenu(void) const {
Gui::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.8f, "Universal-Updater"))/2, 2, 0.8f, Config::TxtColor, "Universal-Updater", 400);
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
for (int i = 0; i < 3; i++) {
if (Selection == i) {
@@ -67,6 +68,7 @@ void Settings::DrawLanguageSelection(void) const {
Gui::DrawTop();
Gui::DrawString((400-Gui::GetStringWidth(0.8f, Lang::get("SELECT_LANG")))/2, 2, 0.8f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
for (int language = 0; language < 10; language++) {
if (Config::lang == language) {
@@ -109,20 +111,24 @@ void Settings::DrawColorChanging(void) const {
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
Gui::DrawArrow(0, 21, 270.0);
Gui::DrawArrow(320, -5, 90.0);
for (int i = 0; i < 7; i++) {
if (colorMode == i) {
Gui::Draw_Rect(25 + i * 25, 5, 16, 16, C2D_Color32(140, 140, 140, 255));
Gui::Draw_Rect(54 + i * 25, 5, 16, 16, C2D_Color32(140, 140, 140, 255));
}
}
Gui::DrawString(29 + 0 * 25, 5, 0.5f, WHITE, "1", 400);
Gui::DrawString(29 + 1 * 25, 5, 0.5f, WHITE, "2", 400);
Gui::DrawString(29 + 2 * 25, 5, 0.5f, WHITE, "3", 400);
Gui::DrawString(29 + 3 * 25, 5, 0.5f, WHITE, "4", 400);
Gui::DrawString(29 + 4 * 25, 5, 0.5f, WHITE, "5", 400);
Gui::DrawString(29 + 5 * 25, 5, 0.5f, WHITE, "6", 400);
Gui::DrawString(29 + 6 * 25, 5, 0.5f, WHITE, "7", 400);
Gui::DrawString(58 + 0 * 25, 5, 0.5f, WHITE, "1", 400);
Gui::DrawString(58 + 1 * 25, 5, 0.5f, WHITE, "2", 400);
Gui::DrawString(58 + 2 * 25, 5, 0.5f, WHITE, "3", 400);
Gui::DrawString(58 + 3 * 25, 5, 0.5f, WHITE, "4", 400);
Gui::DrawString(58 + 4 * 25, 5, 0.5f, WHITE, "5", 400);
Gui::DrawString(58 + 5 * 25, 5, 0.5f, WHITE, "6", 400);
Gui::DrawString(58 + 6 * 25, 5, 0.5f, WHITE, "7", 400);
Gui::Draw_Rect(buttons[0].x, buttons[0].y, 95, 41, C2D_Color32(255, 0, 0, 255));
Gui::Draw_Rect(buttons[1].x, buttons[1].y, 95, 41, C2D_Color32(0, 255, 0, 255));
@@ -180,6 +186,7 @@ void Settings::DrawCreditsScreen(void) const {
currentVersion += V_STRING;
Gui::DrawString(395-Gui::GetStringWidth(0.72f, currentVersion), 218, 0.72f, Config::TxtColor, currentVersion, 400);
Gui::DrawBottom();
Gui::DrawArrow(0, 242, 270.0);
Gui::DrawString((320-Gui::GetStringWidth(0.7f, Lang::get("MANY_THANKS")))/2, 1, 0.8f, Config::TxtColor, Lang::get("MANY_THANKS"), 320);
Gui::DrawString((320-Gui::GetStringWidth(0.7f, Lang::get("TRANSLATORS")))/2, 40, 0.7f, Config::TxtColor, Lang::get("TRANSLATORS"), 320);
Gui::DrawString((320-Gui::GetStringWidth(0.5f, Lang::get("HELP_TRANSLATE")))/2, 70, 0.5f, Config::TxtColor, Lang::get("HELP_TRANSLATE"), 320);
@@ -194,6 +201,7 @@ void Settings::DrawCreditsScreen(void) const {
Gui::sprite(sprites_discord_idx, 115, 35);
Gui::DrawBottom();
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, 190));
Gui::DrawArrow(0, 242, 270.0);
}
}
@@ -235,6 +243,11 @@ void Settings::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
Screen::back();
return;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
Screen::back();
return;
}
}
void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
@@ -250,6 +263,10 @@ void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
if (hDown & KEY_B) {
mode = 0;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
mode = 0;
}
}
@@ -262,10 +279,22 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
mode = 0;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
mode = 0;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[0])) {
if(colorMode > 0) colorMode--;
}
if (hDown & KEY_L || hDown & KEY_LEFT) {
if(colorMode > 0) colorMode--;
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[1])) {
if(colorMode < 6) colorMode++;
}
if (hDown & KEY_R || hDown & KEY_RIGHT) {
if(colorMode < 6) colorMode++;
}
@@ -349,6 +378,8 @@ void Settings::CreditsLogic(u32 hDown, touchPosition touch) {
if (hDown & KEY_TOUCH) {
if (touching(touch, barPos[0])) {
DisplayMode = 2;
} else if (touching(touch, arrowPos[2])) {
mode = 0;
}
}
if (hDown & KEY_B) {
@@ -357,6 +388,8 @@ void Settings::CreditsLogic(u32 hDown, touchPosition touch) {
} else if (DisplayMode == 2) {
if (hDown & KEY_B) {
DisplayMode = 1;
} else if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
DisplayMode = 1;
}
}
}
+11 -9
View File
@@ -72,7 +72,7 @@ std::vector<std::string> tinyDBList;
TinyDB::TinyDB() {
DisplayMsg(Lang::get("TINYDB_DOWNLOADING"));
downloadToFile("https://tinydb.eiphax.tech/api/universal-updater.json?raw=true", tinyDBFile, true);
downloadToFile("https://tinydb.eiphax.tech/api/universal-updater.json?raw=true", tinyDBFile);
tinyDBList = parseObjects();
selectedOption = tinyDBList[0];
}
@@ -107,9 +107,10 @@ void TinyDB::Draw(void) const {
Gui::DrawArrow(295, 0);
Gui::DrawArrow(315, 240, 180.0);
Gui::DrawArrow(0, 242, 270.0);
// Search Icon.
Gui::sprite(sprites_search_idx, -3, 0);
Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
// Gui::sprite(sprites_search_idx, -3, 0);
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)tinyDBList.size();i++) {
@@ -167,6 +168,11 @@ void TinyDB::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
Screen::back();
return;
}
if (hHeld & KEY_UP && !keyRepeatDelay) {
if (selection > 0) {
selection--;
@@ -256,18 +262,14 @@ void TinyDB::execute() {
if(!missing) ScriptHelper::removeFile(file, message);
} else if(type == "downloadFile") {
bool missing = false, downloadToRAM = false;
bool missing = false;
std::string file, output, message;
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("file")) file = tinyDBJson.at(selectedOption).at("script").at(i).at("file");
else missing = true;
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("output")) output = tinyDBJson.at(selectedOption).at("script").at(i).at("output");
else missing = true;
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
if (int64_t(tinyDBJson[selectedOption]["info"]["fileSize"]) < 30000000) {
downloadToRAM = true;
}
if(!missing) ScriptHelper::downloadFile(file, output, downloadToRAM, message);
if(!missing) ScriptHelper::downloadFile(file, output, message);
} else if(type == "installCia") {
bool missing = false;
+4 -4
View File
@@ -67,12 +67,12 @@ int ScriptHelper::getNum(nlohmann::json json, const std::string &key, const std:
}
// Download from a Github Release.
void ScriptHelper::downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, bool downloadToRAM, std::string message) {
void ScriptHelper::downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, std::string message) {
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
showProgressBar = true;
progressBarType = 0;
Threads::create((ThreadFunc)displayProgressBar);
if (downloadFromRelease("https://github.com/" + repo, file, output, includePrereleases, downloadToRAM) != 0) {
if (downloadFromRelease("https://github.com/" + repo, file, output, includePrereleases) != 0) {
showProgressBar = false;
downloadFailed();
return;
@@ -81,12 +81,12 @@ void ScriptHelper::downloadRelease(std::string repo, std::string file, std::stri
}
// Download a File from everywhere.
void ScriptHelper::downloadFile(std::string file, std::string output, bool downloadToRAM, std::string message) {
void ScriptHelper::downloadFile(std::string file, std::string output, std::string message) {
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
showProgressBar = true;
progressBarType = 0;
Threads::create((ThreadFunc)displayProgressBar);
if (downloadToFile(file, output, downloadToRAM) != 0) {
if (downloadToFile(file, output) != 0) {
showProgressBar = false;
downloadFailed();
return;