mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
Remove downloadToRAM param.
And make Universal-Updater fully touch usable.
This commit is contained in:
@@ -39,8 +39,8 @@ enum DownloadError {
|
|||||||
DL_ERROR_GIT,
|
DL_ERROR_GIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
Result downloadToFile(std::string url, std::string path, bool downloadToRAM);
|
Result downloadToFile(std::string url, std::string path);
|
||||||
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);
|
||||||
|
|
||||||
void displayProgressBar();
|
void displayProgressBar();
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ void doneMsg(void);
|
|||||||
* item is that to get from the API. (Ex. "tag_name")
|
* item is that to get from the API. (Ex. "tag_name")
|
||||||
* @return the string from the API.
|
* @return the string from the API.
|
||||||
*/
|
*/
|
||||||
std::string getLatestRelease(std::string repo, std::string item, bool downloadToRAM);
|
std::string getLatestRelease(std::string repo, std::string item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get info from the GitHub API about a Commit.
|
* Get info from the GitHub API about a Commit.
|
||||||
@@ -77,7 +77,7 @@ std::string getLatestRelease(std::string repo, std::string item, bool downloadTo
|
|||||||
* item is that to get from the API. (Ex. "sha")
|
* item is that to get from the API. (Ex. "sha")
|
||||||
* @return the string from the API.
|
* @return the string from the API.
|
||||||
*/
|
*/
|
||||||
std::string getLatestCommit(std::string repo, std::string item, bool downloadToRAM);
|
std::string getLatestCommit(std::string repo, std::string item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get info from the GitHub API about a Commit.
|
* Get info from the GitHub API about a Commit.
|
||||||
@@ -86,4 +86,4 @@ std::string getLatestCommit(std::string repo, std::string item, bool downloadToR
|
|||||||
* item is that to get from the API. (Ex. "message")
|
* item is that to get from the API. (Ex. "message")
|
||||||
* @return the string from the API.
|
* @return the string from the API.
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include "screens/screen.hpp"
|
#include "screens/screen.hpp"
|
||||||
|
|
||||||
|
#include "utils/structs.hpp"
|
||||||
|
|
||||||
class FTPScreen : public screen
|
class FTPScreen : public screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -34,4 +36,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int ftpEnabled = 1;
|
int ftpEnabled = 1;
|
||||||
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
|
};
|
||||||
};
|
};
|
||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
{170, 100, 140, 35, -1}, // ScriptCreator.
|
{170, 100, 140, 35, -1}, // ScriptCreator.
|
||||||
{10, 160, 140, 35, -1}, // Language.
|
{10, 160, 140, 35, -1}, // Language.
|
||||||
{170, 160, 140, 35, -1}, // Colors.
|
{170, 160, 140, 35, -1}, // Colors.
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ private:
|
|||||||
std::vector<Structs::ButtonPos> arrowPos = {
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
{295, 0, 25, 25, -1}, // Arrow Up.
|
{295, 0, 25, 25, -1}, // Arrow Up.
|
||||||
{295, 215, 25, 25, -1}, // Arrow Down.
|
{295, 215, 25, 25, -1}, // Arrow Down.
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ private:
|
|||||||
std::vector<Structs::ButtonPos> arrowPos = {
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
{295, 0, 25, 25, -1}, // Arrow Up.
|
{295, 0, 25, 25, -1}, // Arrow Up.
|
||||||
{295, 215, 25, 25, -1}, // Arrow Down.
|
{295, 215, 25, 25, -1}, // Arrow Down.
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::vector<Structs::ButtonPos> barPos = {
|
std::vector<Structs::ButtonPos> barPos = {
|
||||||
{0, 215, 320, 25, -1},
|
{100, 215, 100, 25, -1},
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
|
{0, 0, 25, 25, -1}, // Previous Arrow.
|
||||||
|
{295, 0, 25, 25, -1}, // Next Arrow.
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private:
|
|||||||
std::vector<Structs::ButtonPos> arrowPos = {
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
{295, 0, 25, 25, -1}, // Arrow Up.
|
{295, 0, 25, 25, -1}, // Arrow Up.
|
||||||
{295, 215, 25, 25, -1}, // Arrow Down.
|
{295, 215, 25, 25, -1}, // Arrow Down.
|
||||||
|
{0, 215, 25, 25, -1}, // Back Arrow.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace ScriptHelper {
|
|||||||
int getNum(nlohmann::json json, const std::string &key, const std::string &key2);
|
int getNum(nlohmann::json json, const std::string &key, const std::string &key2);
|
||||||
|
|
||||||
// Script Functions.
|
// Script Functions.
|
||||||
void downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, bool downloadToRAM, std::string message);
|
void downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, std::string message);
|
||||||
void downloadFile(std::string file, std::string output, bool downloadToRAM, std::string message);
|
void downloadFile(std::string file, std::string output, std::string message);
|
||||||
|
|
||||||
void removeFile(std::string file, std::string message);
|
void removeFile(std::string file, std::string message);
|
||||||
void installFile(std::string file, std::string message);
|
void installFile(std::string file, std::string message);
|
||||||
|
|||||||
@@ -161,11 +161,12 @@ static Result setupContextForDirectToFileDownload(CURL *hnd, const char * url)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
|
Result downloadToFile(std::string url, std::string path)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
u64 offset = 0;
|
u64 offset = 0;
|
||||||
u32 bytesWritten = 0;
|
u32 bytesWritten = 0;
|
||||||
|
bool isDownloadToRAM = true;
|
||||||
printf("Downloading from:\n%s\nto:\n%s\n", url.c_str(), path.c_str());
|
printf("Downloading from:\n%s\nto:\n%s\n", url.c_str(), path.c_str());
|
||||||
|
|
||||||
void *socubuf = memalign(0x1000, 0x100000);
|
void *socubuf = memalign(0x1000, 0x100000);
|
||||||
@@ -198,11 +199,12 @@ Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
|
|||||||
result_fileHandle = &fileHandle;
|
result_fileHandle = &fileHandle;
|
||||||
|
|
||||||
CURL *hnd = curl_easy_init();
|
CURL *hnd = curl_easy_init();
|
||||||
if (downloadToRAM == true) {
|
ret = setupContext(hnd, url.c_str());
|
||||||
ret = setupContext(hnd, url.c_str());
|
if (downloadTotal > 30000000) {
|
||||||
} else {
|
|
||||||
ret = setupContextForDirectToFileDownload(hnd, url.c_str());
|
ret = setupContextForDirectToFileDownload(hnd, url.c_str());
|
||||||
|
isDownloadToRAM = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
socExit();
|
socExit();
|
||||||
free(result_buf);
|
free(result_buf);
|
||||||
@@ -232,7 +234,7 @@ Result downloadToFile(std::string url, std::string path, bool downloadToRAM)
|
|||||||
FSFILE_Close(fileHandle);
|
FSFILE_Close(fileHandle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (downloadToRAM == true) {
|
if (isDownloadToRAM == true) {
|
||||||
FSFILE_Write(fileHandle, &bytesWritten, offset, result_buf, result_written, 0);
|
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;
|
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;
|
Result ret = 0;
|
||||||
void *socubuf = memalign(0x1000, 0x100000);
|
void *socubuf = memalign(0x1000, 0x100000);
|
||||||
@@ -335,7 +337,7 @@ Result downloadFromRelease(std::string url, std::string asset, std::string path,
|
|||||||
if (assetUrl.empty())
|
if (assetUrl.empty())
|
||||||
ret = DL_ERROR_GIT;
|
ret = DL_ERROR_GIT;
|
||||||
else
|
else
|
||||||
ret = downloadToFile(assetUrl, path, downloadToRAM);
|
ret = downloadToFile(assetUrl, path);
|
||||||
|
|
||||||
return ret;
|
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;
|
Result ret = 0;
|
||||||
void *socubuf = memalign(0x1000, 0x100000);
|
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();
|
std::string apiurl = apiurlStream.str();
|
||||||
|
|
||||||
CURL *hnd = curl_easy_init();
|
CURL *hnd = curl_easy_init();
|
||||||
|
ret = setupContext(hnd, apiurl.c_str());
|
||||||
if (downloadToRAM == true) {
|
|
||||||
ret = setupContext(hnd, apiurl.c_str());
|
|
||||||
} else {
|
|
||||||
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
socExit();
|
socExit();
|
||||||
free(result_buf);
|
free(result_buf);
|
||||||
@@ -453,7 +449,7 @@ std::string getLatestRelease(std::string repo, std::string item, bool downloadTo
|
|||||||
return jsonItem;
|
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;
|
Result ret = 0;
|
||||||
void *socubuf = memalign(0x1000, 0x100000);
|
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();
|
std::string apiurl = apiurlStream.str();
|
||||||
|
|
||||||
CURL *hnd = curl_easy_init();
|
CURL *hnd = curl_easy_init();
|
||||||
if (downloadToRAM == true) {
|
ret = setupContext(hnd, apiurl.c_str());
|
||||||
ret = setupContext(hnd, apiurl.c_str());
|
|
||||||
} else {
|
|
||||||
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
|
|
||||||
}
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
socExit();
|
socExit();
|
||||||
free(result_buf);
|
free(result_buf);
|
||||||
@@ -521,7 +513,7 @@ std::string getLatestCommit(std::string repo, std::string item, bool downloadToR
|
|||||||
return jsonItem;
|
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;
|
Result ret = 0;
|
||||||
void *socubuf = memalign(0x1000, 0x100000);
|
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();
|
std::string apiurl = apiurlStream.str();
|
||||||
|
|
||||||
CURL *hnd = curl_easy_init();
|
CURL *hnd = curl_easy_init();
|
||||||
if (downloadToRAM == true) {
|
ret = setupContext(hnd, apiurl.c_str());
|
||||||
ret = setupContext(hnd, apiurl.c_str());
|
|
||||||
} else {
|
|
||||||
ret = setupContextForDirectToFileDownload(hnd, apiurl.c_str());
|
|
||||||
}
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
socExit();
|
socExit();
|
||||||
free(result_buf);
|
free(result_buf);
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ extern "C" {
|
|||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
||||||
|
extern touchPosition touch;
|
||||||
|
|
||||||
void FTPScreen::Draw(void) const
|
void FTPScreen::Draw(void) const
|
||||||
{
|
{
|
||||||
ftp_init();
|
ftp_init();
|
||||||
@@ -54,6 +57,7 @@ void FTPScreen::Draw(void) const
|
|||||||
Gui::DrawTop();
|
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::DrawString((400-Gui::GetStringWidth(0.8f, Lang::get("FTP_MODE")))/2, 0, 0.8f, Config::TxtColor, Lang::get("FTP_MODE"), 400);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
ret = ACU_GetWifiStatus(&wifiStatus);
|
ret = ACU_GetWifiStatus(&wifiStatus);
|
||||||
|
|
||||||
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
|
if ((wifiStatus != 0) && R_SUCCEEDED(ret)) {
|
||||||
@@ -77,10 +81,13 @@ void FTPScreen::Draw(void) const
|
|||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameEnd(0);
|
C3D_FrameEnd(0);
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
hidTouchRead(&touch);
|
||||||
u32 hDown = hidKeysDown();
|
u32 hDown = hidKeysDown();
|
||||||
|
|
||||||
if (hDown & KEY_B)
|
if (hDown & KEY_B)
|
||||||
break;
|
break;
|
||||||
|
if (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
memset(ftp_accepted_connection, 0, 20); // Empty accepted connection address.
|
memset(ftp_accepted_connection, 0, 20); // Empty accepted connection address.
|
||||||
memset(ftp_file_transfer, 0, 50); // Empty transfer status.
|
memset(ftp_file_transfer, 0, 50); // Empty transfer status.
|
||||||
|
|||||||
@@ -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);
|
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
|
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadealpha)); // Fade in out effect
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
@@ -186,6 +187,8 @@ void MainMenu::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
} else {
|
} else {
|
||||||
notConnectedMsg();
|
notConnectedMsg();
|
||||||
}
|
}
|
||||||
|
} else if (touching(touch, mainButtons[6])) {
|
||||||
|
exiting = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ ScriptBrowse::ScriptBrowse() {
|
|||||||
DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
|
DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
|
||||||
|
|
||||||
// Get repo info
|
// 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");
|
FILE* file = fopen(metaFile, "r");
|
||||||
if(file) infoJson = nlohmann::json::parse(file, nullptr, false);
|
if(file) infoJson = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
@@ -128,8 +128,10 @@ void ScriptBrowse::Draw(void) const {
|
|||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::DrawArrow(295, 0);
|
Gui::DrawArrow(295, 0);
|
||||||
Gui::DrawArrow(315, 240, 180.0);
|
Gui::DrawArrow(315, 240, 180.0);
|
||||||
Gui::sprite(sprites_search_idx, -3, 0);
|
// Gui::sprite(sprites_search_idx, -3, 0);
|
||||||
Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
|
// 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);
|
Gui::DrawStringCentered(-23, 3, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
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 (hHeld & KEY_DOWN && !keyRepeatDelay) {
|
||||||
if (selection < (int)infoJson.size()-1) {
|
if (selection < (int)infoJson.size()-1) {
|
||||||
selection++;
|
selection++;
|
||||||
@@ -230,7 +238,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisplayMsg(fileName);
|
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"];
|
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +255,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisplayMsg(fileName);
|
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"];
|
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,7 +275,7 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
DisplayMsg(fileName);
|
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"];
|
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));
|
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"];
|
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,19 +128,17 @@ void runFunctions(nlohmann::json &json) {
|
|||||||
if(!missing) ScriptHelper::removeFile(file, message);
|
if(!missing) ScriptHelper::removeFile(file, message);
|
||||||
|
|
||||||
} else if(type == "downloadFile") {
|
} else if(type == "downloadFile") {
|
||||||
bool missing = false, downloadToRAM = false;
|
bool missing = false;
|
||||||
std::string file, output, message;
|
std::string file, output, message;
|
||||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
if(json.at(choice).at(i).contains("output")) output = json.at(choice).at(i).at("output");
|
||||||
else missing = true;
|
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(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") {
|
} else if(type == "downloadRelease") {
|
||||||
bool missing = false, includePrereleases = false, downloadToRAM = false;
|
bool missing = false, includePrereleases = false;
|
||||||
std::string repo, file, output, message;
|
std::string repo, file, output, message;
|
||||||
if(json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
|
if(json.at(choice).at(i).contains("repo")) repo = json.at(choice).at(i).at("repo");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
@@ -150,10 +148,8 @@ void runFunctions(nlohmann::json &json) {
|
|||||||
else missing = true;
|
else missing = true;
|
||||||
if(json.at(choice).at(i).contains("includePrereleases") && json.at(choice).at(i).at("includePrereleases").is_boolean())
|
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");
|
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(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") {
|
} else if(type == "extractFile") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
@@ -290,7 +286,7 @@ void ScriptList::DrawList(void) const {
|
|||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::DrawArrow(295, 0);
|
Gui::DrawArrow(295, 0);
|
||||||
Gui::DrawArrow(315, 240, 180.0);
|
Gui::DrawArrow(315, 240, 180.0);
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
||||||
line1 = fileInfo[screenPos + i].title;
|
line1 = fileInfo[screenPos + i].title;
|
||||||
@@ -345,6 +341,7 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::DrawArrow(295, 0);
|
Gui::DrawArrow(295, 0);
|
||||||
Gui::DrawArrow(315, 240, 180.0);
|
Gui::DrawArrow(315, 240, 180.0);
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
|
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 (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
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 (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN;i++) {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ void Settings::DrawSubMenu(void) const {
|
|||||||
Gui::DrawTop();
|
Gui::DrawTop();
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.8f, "Universal-Updater"))/2, 2, 0.8f, Config::TxtColor, "Universal-Updater", 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.8f, "Universal-Updater"))/2, 2, 0.8f, Config::TxtColor, "Universal-Updater", 400);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (Selection == i) {
|
if (Selection == i) {
|
||||||
@@ -67,6 +68,7 @@ void Settings::DrawLanguageSelection(void) const {
|
|||||||
Gui::DrawTop();
|
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::DrawString((400-Gui::GetStringWidth(0.8f, Lang::get("SELECT_LANG")))/2, 2, 0.8f, Config::TxtColor, Lang::get("SELECT_LANG"), 400);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
|
|
||||||
for (int language = 0; language < 10; language++) {
|
for (int language = 0; language < 10; language++) {
|
||||||
if (Config::lang == language) {
|
if (Config::lang == language) {
|
||||||
@@ -109,20 +111,24 @@ void Settings::DrawColorChanging(void) const {
|
|||||||
|
|
||||||
|
|
||||||
Gui::DrawBottom();
|
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++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if (colorMode == 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(58 + 0 * 25, 5, 0.5f, WHITE, "1", 400);
|
||||||
Gui::DrawString(29 + 1 * 25, 5, 0.5f, WHITE, "2", 400);
|
Gui::DrawString(58 + 1 * 25, 5, 0.5f, WHITE, "2", 400);
|
||||||
Gui::DrawString(29 + 2 * 25, 5, 0.5f, WHITE, "3", 400);
|
Gui::DrawString(58 + 2 * 25, 5, 0.5f, WHITE, "3", 400);
|
||||||
Gui::DrawString(29 + 3 * 25, 5, 0.5f, WHITE, "4", 400);
|
Gui::DrawString(58 + 3 * 25, 5, 0.5f, WHITE, "4", 400);
|
||||||
Gui::DrawString(29 + 4 * 25, 5, 0.5f, WHITE, "5", 400);
|
Gui::DrawString(58 + 4 * 25, 5, 0.5f, WHITE, "5", 400);
|
||||||
Gui::DrawString(29 + 5 * 25, 5, 0.5f, WHITE, "6", 400);
|
Gui::DrawString(58 + 5 * 25, 5, 0.5f, WHITE, "6", 400);
|
||||||
Gui::DrawString(29 + 6 * 25, 5, 0.5f, WHITE, "7", 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[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));
|
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;
|
currentVersion += V_STRING;
|
||||||
Gui::DrawString(395-Gui::GetStringWidth(0.72f, currentVersion), 218, 0.72f, Config::TxtColor, currentVersion, 400);
|
Gui::DrawString(395-Gui::GetStringWidth(0.72f, currentVersion), 218, 0.72f, Config::TxtColor, currentVersion, 400);
|
||||||
Gui::DrawBottom();
|
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("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.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);
|
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::sprite(sprites_discord_idx, 115, 35);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, 190));
|
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();
|
Screen::back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
|
||||||
|
Screen::back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
|
void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
|
||||||
@@ -250,6 +263,10 @@ void Settings::LanguageSelection(u32 hDown, touchPosition touch) {
|
|||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
mode = 0;
|
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;
|
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 (hDown & KEY_L || hDown & KEY_LEFT) {
|
||||||
if(colorMode > 0) colorMode--;
|
if(colorMode > 0) colorMode--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH && touching(touch, arrowPos[1])) {
|
||||||
|
if(colorMode < 6) colorMode++;
|
||||||
|
}
|
||||||
|
|
||||||
if (hDown & KEY_R || hDown & KEY_RIGHT) {
|
if (hDown & KEY_R || hDown & KEY_RIGHT) {
|
||||||
if(colorMode < 6) colorMode++;
|
if(colorMode < 6) colorMode++;
|
||||||
}
|
}
|
||||||
@@ -349,6 +378,8 @@ void Settings::CreditsLogic(u32 hDown, touchPosition touch) {
|
|||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (touching(touch, barPos[0])) {
|
if (touching(touch, barPos[0])) {
|
||||||
DisplayMode = 2;
|
DisplayMode = 2;
|
||||||
|
} else if (touching(touch, arrowPos[2])) {
|
||||||
|
mode = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
@@ -357,6 +388,8 @@ void Settings::CreditsLogic(u32 hDown, touchPosition touch) {
|
|||||||
} else if (DisplayMode == 2) {
|
} else if (DisplayMode == 2) {
|
||||||
if (hDown & KEY_B) {
|
if (hDown & KEY_B) {
|
||||||
DisplayMode = 1;
|
DisplayMode = 1;
|
||||||
|
} else if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
|
||||||
|
DisplayMode = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ std::vector<std::string> tinyDBList;
|
|||||||
|
|
||||||
TinyDB::TinyDB() {
|
TinyDB::TinyDB() {
|
||||||
DisplayMsg(Lang::get("TINYDB_DOWNLOADING"));
|
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();
|
tinyDBList = parseObjects();
|
||||||
selectedOption = tinyDBList[0];
|
selectedOption = tinyDBList[0];
|
||||||
}
|
}
|
||||||
@@ -107,9 +107,10 @@ void TinyDB::Draw(void) const {
|
|||||||
|
|
||||||
Gui::DrawArrow(295, 0);
|
Gui::DrawArrow(295, 0);
|
||||||
Gui::DrawArrow(315, 240, 180.0);
|
Gui::DrawArrow(315, 240, 180.0);
|
||||||
|
Gui::DrawArrow(0, 242, 270.0);
|
||||||
// Search Icon.
|
// Search Icon.
|
||||||
Gui::sprite(sprites_search_idx, -3, 0);
|
// Gui::sprite(sprites_search_idx, -3, 0);
|
||||||
Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
|
// Gui::DrawString(7.5, 1.5, 0.72f, BLACK, "\uE003");
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)tinyDBList.size();i++) {
|
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 (hHeld & KEY_UP && !keyRepeatDelay) {
|
||||||
if (selection > 0) {
|
if (selection > 0) {
|
||||||
selection--;
|
selection--;
|
||||||
@@ -256,18 +262,14 @@ void TinyDB::execute() {
|
|||||||
if(!missing) ScriptHelper::removeFile(file, message);
|
if(!missing) ScriptHelper::removeFile(file, message);
|
||||||
|
|
||||||
} else if(type == "downloadFile") {
|
} else if(type == "downloadFile") {
|
||||||
bool missing = false, downloadToRAM = false;
|
bool missing = false;
|
||||||
std::string file, output, message;
|
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");
|
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("file")) file = tinyDBJson.at(selectedOption).at("script").at(i).at("file");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("output")) output = tinyDBJson.at(selectedOption).at("script").at(i).at("output");
|
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("output")) output = tinyDBJson.at(selectedOption).at("script").at(i).at("output");
|
||||||
else missing = true;
|
else missing = true;
|
||||||
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
|
if(tinyDBJson.at(selectedOption).at("script").at(i).contains("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
|
||||||
|
if(!missing) ScriptHelper::downloadFile(file, output, message);
|
||||||
if (int64_t(tinyDBJson[selectedOption]["info"]["fileSize"]) < 30000000) {
|
|
||||||
downloadToRAM = true;
|
|
||||||
}
|
|
||||||
if(!missing) ScriptHelper::downloadFile(file, output, downloadToRAM, message);
|
|
||||||
|
|
||||||
} else if(type == "installCia") {
|
} else if(type == "installCia") {
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ int ScriptHelper::getNum(nlohmann::json json, const std::string &key, const std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download from a Github Release.
|
// 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());
|
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||||
showProgressBar = true;
|
showProgressBar = true;
|
||||||
progressBarType = 0;
|
progressBarType = 0;
|
||||||
Threads::create((ThreadFunc)displayProgressBar);
|
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;
|
showProgressBar = false;
|
||||||
downloadFailed();
|
downloadFailed();
|
||||||
return;
|
return;
|
||||||
@@ -81,12 +81,12 @@ void ScriptHelper::downloadRelease(std::string repo, std::string file, std::stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download a File from everywhere.
|
// 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());
|
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||||
showProgressBar = true;
|
showProgressBar = true;
|
||||||
progressBarType = 0;
|
progressBarType = 0;
|
||||||
Threads::create((ThreadFunc)displayProgressBar);
|
Threads::create((ThreadFunc)displayProgressBar);
|
||||||
if (downloadToFile(file, output, downloadToRAM) != 0) {
|
if (downloadToFile(file, output) != 0) {
|
||||||
showProgressBar = false;
|
showProgressBar = false;
|
||||||
downloadFailed();
|
downloadFailed();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user