From 466fe27d518388788ea2563e95909dcdab1d1326 Mon Sep 17 00:00:00 2001 From: StackZ <47382115+SuperSaiyajinStackZ@users.noreply.github.com> Date: Tue, 3 Nov 2020 08:49:38 +0100 Subject: [PATCH] See desc for more. - Removed "beta" of Universal-DB. NOTE: This will only work at 12:00 UTC. - Fixed downloadFile caused an error, when the folder did not exist. - Removed sheet.png of the spritesheet, because unneeded. --- assets/gfx/sprites.t3s | 1 - assets/gfx/sprites/sheet.png | Bin 360 -> 0 bytes include/utils/config.hpp | 2 +- source/screens/mainScreen.cpp | 14 +++++++------- source/utils/download.cpp | 13 ++++++++++--- 5 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 assets/gfx/sprites/sheet.png diff --git a/assets/gfx/sprites.t3s b/assets/gfx/sprites.t3s index 3e612b3..145e747 100644 --- a/assets/gfx/sprites.t3s +++ b/assets/gfx/sprites.t3s @@ -10,7 +10,6 @@ sprites/noIcon.png sprites/qr_code.png sprites/search.png sprites/settings.png -sprites/sheet.png sprites/sort.png sprites/sort_checked.png sprites/sort_unchecked.png diff --git a/assets/gfx/sprites/sheet.png b/assets/gfx/sprites/sheet.png deleted file mode 100644 index 1167bfe4038ba8559621232eabd2ed8e5eebc681..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 360 zcmV-u0hj)XP)u8^CRb za4r_O0G5F=Fb>QH=V4$7c*=^_72Y#o6*vN>fH|NJOaePVU+A3!Bh3PLzzuL3oB^sp z1=tJ106AbDIQbSq&8ZL3iXPPgwVbiOikerK)Jt{YOJqL~?$v^N_{$CKs)OpAnopu6 zqreN$&*yDqp$;^FZQvkDlF|=`x~{&qaBrwpb)|*DAK(LojwKJ8`E&390000meta = std::make_unique(); /* Check if lastStore is accessible. */ - if (config->lastStore() != "universal-db-beta.unistore" || config->lastStore() != "") { + if (config->lastStore() != "universal-db.unistore" || config->lastStore() != "") { if (access((std::string(_STORE_PATH) + config->lastStore()).c_str(), F_OK) != 0) { - config->lastStore("universal-db-beta.unistore"); + config->lastStore("universal-db.unistore"); } else { /* check version and file here. */ const UniStoreInfo info = GetInfo((std::string(_STORE_PATH) + config->lastStore()), config->lastStore()); if (info.Version != 3) { - config->lastStore("universal-db-beta.unistore"); + config->lastStore("universal-db.unistore"); } if (info.File != "") { // Ensure to check for this. if ((info.File.find("/") != std::string::npos)) { - config->lastStore("universal-db-beta.unistore"); // It does contain a '/' which is invalid. + config->lastStore("universal-db.unistore"); // It does contain a '/' which is invalid. } } } } /* If Universal DB --> Get! */ - if (config->lastStore() == "universal-db-beta.unistore" || config->lastStore() == "") { - if (access("sdmc:/3ds/Universal-Updater/stores/universal-db-beta.unistore", F_OK) != 0) { + if (config->lastStore() == "universal-db.unistore" || config->lastStore() == "") { + if (access("sdmc:/3ds/Universal-Updater/stores/universal-db.unistore", F_OK) != 0) { std::string tmp = ""; // Just a temp. - DownloadUniStore("https://db.universal-team.net/unistore/universal-db-beta.unistore", -1, tmp, true, true); + DownloadUniStore("https://db.universal-team.net/unistore/universal-db.unistore", -1, tmp, true, true); DownloadSpriteSheet("https://db.universal-team.net/unistore/universal-db.t3x", "universal-db.t3x"); } } diff --git a/source/utils/download.cpp b/source/utils/download.cpp index d6adbaa..a53b6aa 100644 --- a/source/utils/download.cpp +++ b/source/utils/download.cpp @@ -147,7 +147,6 @@ Result downloadToFile(const std::string &url, const std::string &path) { int res; printf("Downloading from:\n%s\nto:\n%s\n", url.c_str(), path.c_str()); - const char *filepath = path.c_str(); void *socubuf = memalign(0x1000, 0x100000); if (!socubuf) { @@ -161,9 +160,17 @@ Result downloadToFile(const std::string &url, const std::string &path) { goto exit; } - makeDirs(strdup(filepath)); + /* make directories. */ + for (char *slashpos = strchr(path.c_str() + 1, '/'); slashpos != NULL; slashpos = strchr(slashpos + 1, '/')) { + char bak = *(slashpos); + *(slashpos) = '\0'; - downfile = fopen(filepath, "wb"); + mkdir(path.c_str(), 0777); + + *(slashpos) = bak; + } + + downfile = fopen(path.c_str(), "wb"); if (!downfile) { retcode = -2; goto exit;