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.
This commit is contained in:
StackZ
2020-11-03 08:49:38 +01:00
parent b6d1de03c1
commit 466fe27d51
5 changed files with 18 additions and 12 deletions
-1
View File
@@ -10,7 +10,6 @@ sprites/noIcon.png
sprites/qr_code.png sprites/qr_code.png
sprites/search.png sprites/search.png
sprites/settings.png sprites/settings.png
sprites/sheet.png
sprites/sort.png sprites/sort.png
sprites/sort_checked.png sprites/sort_checked.png
sprites/sort_unchecked.png sprites/sort_unchecked.png
Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

+1 -1
View File
@@ -87,7 +87,7 @@ private:
nlohmann::json json; nlohmann::json json;
bool changesMade = false; bool changesMade = false;
std::string v_language = "en", v_lastStore = "universal-db-beta.unistore", std::string v_language = "en", v_lastStore = "universal-db.unistore",
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:"; v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:";
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true, v_showBg = false; bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true, v_showBg = false;
}; };
+7 -7
View File
@@ -46,31 +46,31 @@ MainScreen::MainScreen() {
this->meta = std::make_unique<Meta>(); this->meta = std::make_unique<Meta>();
/* Check if lastStore is accessible. */ /* 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) { 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 { } else {
/* check version and file here. */ /* check version and file here. */
const UniStoreInfo info = GetInfo((std::string(_STORE_PATH) + config->lastStore()), config->lastStore()); const UniStoreInfo info = GetInfo((std::string(_STORE_PATH) + config->lastStore()), config->lastStore());
if (info.Version != 3) { 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 != "") { // Ensure to check for this.
if ((info.File.find("/") != std::string::npos)) { 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 Universal DB --> Get! */
if (config->lastStore() == "universal-db-beta.unistore" || config->lastStore() == "") { if (config->lastStore() == "universal-db.unistore" || config->lastStore() == "") {
if (access("sdmc:/3ds/Universal-Updater/stores/universal-db-beta.unistore", F_OK) != 0) { if (access("sdmc:/3ds/Universal-Updater/stores/universal-db.unistore", F_OK) != 0) {
std::string tmp = ""; // Just a temp. 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"); DownloadSpriteSheet("https://db.universal-team.net/unistore/universal-db.t3x", "universal-db.t3x");
} }
} }
+10 -3
View File
@@ -147,7 +147,6 @@ Result downloadToFile(const std::string &url, const std::string &path) {
int res; int res;
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());
const char *filepath = path.c_str();
void *socubuf = memalign(0x1000, 0x100000); void *socubuf = memalign(0x1000, 0x100000);
if (!socubuf) { if (!socubuf) {
@@ -161,9 +160,17 @@ Result downloadToFile(const std::string &url, const std::string &path) {
goto exit; 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) { if (!downfile) {
retcode = -2; retcode = -2;
goto exit; goto exit;