mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-03 00:39:02 +00:00
It's StackZ now, not VoltZ.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -39,7 +39,7 @@ enum DownloadError {
|
||||
DL_ERROR_GIT,
|
||||
};
|
||||
|
||||
struct ThemeEntry {
|
||||
struct ListEntry {
|
||||
std::string downloadUrl;
|
||||
std::string name;
|
||||
std::string path;
|
||||
@@ -101,13 +101,4 @@ std::string getLatestCommit(std::string repo, std::string array, std::string ite
|
||||
* path is the path within the repo (Ex. "contents/_nds/TWiLightMenu/dsimenu/themes")
|
||||
* @return the string from the API.
|
||||
*/
|
||||
std::vector<ThemeEntry> getThemeList(std::string repo, std::string path);
|
||||
|
||||
namespace download {
|
||||
void downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, std::string message);
|
||||
void downloadFile(std::string file, std::string output, std::string message);
|
||||
void deleteFileList(std::string file, std::string message);
|
||||
void installFileList(std::string file, std::string message);
|
||||
void extractFileList(std::string file, std::string input, std::string output, std::string message);
|
||||
void displayTimeMsg(std::string message, int seconds);
|
||||
}
|
||||
std::vector<ListEntry> getList(std::string repo, std::string path);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef MAINMENU_HPP
|
||||
#define MAINMENU_HPP
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTBROWSE_HPP
|
||||
#define SCRIPTBROWSE_HPP
|
||||
|
||||
@@ -47,4 +48,5 @@ private:
|
||||
int keyRepeatDelay = 0;
|
||||
int fastMode = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTCREATOR_HPP
|
||||
#define SCRIPTCREATOR_HPP
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTLIST_HPP
|
||||
#define SCRIPTLIST_HPP
|
||||
|
||||
@@ -58,5 +59,4 @@ private:
|
||||
int fastMode = false;
|
||||
};
|
||||
|
||||
Result createFile(const char * path);
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SETTINGS_HPP
|
||||
#define SETTINGS_HPP
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +23,7 @@
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef TINYDB_HPP
|
||||
#define TINYDB_HPP
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
std::string formatBytes(int bytes);
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef SCRIPTHELPER_HPP
|
||||
#define SCRIPTHELPER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ScriptHelper {
|
||||
// Get stuff from a JSON.
|
||||
std::string getString(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.
|
||||
void downloadRelease(std::string repo, std::string file, std::string output, bool includePrereleases, std::string message);
|
||||
void downloadFile(std::string file, std::string output, std::string message);
|
||||
|
||||
void removeFile(std::string file, std::string message);
|
||||
void installFile(std::string file, std::string message);
|
||||
void extractFile(std::string file, std::string input, std::string output, std::string message);
|
||||
Result createFile(const char * path);
|
||||
void displayTimeMsg(std::string message, int seconds);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
"CREDITS": "Credits",
|
||||
"DEVELOPED_BY": "Developed by: Universal-Team.",
|
||||
"MAIN_DEV": "Main Developer: VoltZ",
|
||||
"MAIN_DEV": "Main Developer: StackZ",
|
||||
"CURRENT_VERSION": "Current version: ",
|
||||
"MANY_THANKS": "Many Thanks to:",
|
||||
"TRANSLATORS": "All our Translators",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,20 +33,11 @@
|
||||
#include "screens/screenCommon.hpp"
|
||||
|
||||
#include "utils/config.hpp"
|
||||
#include "utils/extract.hpp"
|
||||
#include "utils/fileBrowse.h"
|
||||
#include "utils/thread.hpp"
|
||||
#include "utils/formatting.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
#include "utils/cia.h"
|
||||
}
|
||||
|
||||
#define USER_AGENT APP_TITLE "-" VERSION_STRING
|
||||
|
||||
static char* result_buf = NULL;
|
||||
@@ -574,11 +565,11 @@ std::string getLatestCommit(std::string repo, std::string array, std::string ite
|
||||
return jsonItem;
|
||||
}
|
||||
|
||||
std::vector<ThemeEntry> getThemeList(std::string repo, std::string path)
|
||||
std::vector<ListEntry> getList(std::string repo, std::string path)
|
||||
{
|
||||
Result ret = 0;
|
||||
void *socubuf = memalign(0x1000, 0x100000);
|
||||
std::vector<ThemeEntry> emptyVector;
|
||||
std::vector<ListEntry> emptyVector;
|
||||
if (!socubuf)
|
||||
{
|
||||
return emptyVector;
|
||||
@@ -625,27 +616,27 @@ std::vector<ThemeEntry> getThemeList(std::string repo, std::string path)
|
||||
return emptyVector;
|
||||
}
|
||||
|
||||
std::vector<ThemeEntry> jsonItems;
|
||||
std::vector<ListEntry> jsonItems;
|
||||
json parsedAPI = json::parse(result_buf);
|
||||
for(uint i=0;i<parsedAPI.size();i++) {
|
||||
ThemeEntry themeEntry;
|
||||
ListEntry listEntry;
|
||||
if (parsedAPI[i]["name"].is_string()) {
|
||||
themeEntry.name = parsedAPI[i]["name"];
|
||||
listEntry.name = parsedAPI[i]["name"];
|
||||
}
|
||||
if (parsedAPI[i]["download_url"].is_string()) {
|
||||
themeEntry.downloadUrl = parsedAPI[i]["download_url"];
|
||||
listEntry.downloadUrl = parsedAPI[i]["download_url"];
|
||||
}
|
||||
if (parsedAPI[i]["path"].is_string()) {
|
||||
themeEntry.sdPath = "sdmc:/";
|
||||
themeEntry.sdPath += parsedAPI[i]["path"];
|
||||
themeEntry.path = parsedAPI[i]["path"];
|
||||
listEntry.sdPath = "sdmc:/";
|
||||
listEntry.sdPath += parsedAPI[i]["path"];
|
||||
listEntry.path = parsedAPI[i]["path"];
|
||||
|
||||
size_t pos;
|
||||
while ((pos = themeEntry.path.find(" ")) != std::string::npos) {
|
||||
themeEntry.path.replace(pos, 1, "%20");
|
||||
while ((pos = listEntry.path.find(" ")) != std::string::npos) {
|
||||
listEntry.path.replace(pos, 1, "%20");
|
||||
}
|
||||
}
|
||||
jsonItems.push_back(themeEntry);
|
||||
jsonItems.push_back(listEntry);
|
||||
}
|
||||
|
||||
socExit();
|
||||
@@ -658,21 +649,6 @@ std::vector<ThemeEntry> getThemeList(std::string repo, std::string path)
|
||||
return jsonItems;
|
||||
}
|
||||
|
||||
void downloadTheme(std::string path) {
|
||||
std::vector<ThemeEntry> themeContents = getThemeList("Universal-Team/extras", path);
|
||||
for(uint i=0;i<themeContents.size();i++) {
|
||||
if(themeContents[i].downloadUrl != "") {
|
||||
DisplayMsg((Lang::get("DOWNLOADING")+themeContents[i].name).c_str());
|
||||
downloadToFile(themeContents[i].downloadUrl, themeContents[i].sdPath);
|
||||
} else {
|
||||
DisplayMsg((Lang::get("DOWNLOADING")+themeContents[i].name).c_str());
|
||||
mkdir((themeContents[i].sdPath).c_str(), 0777);
|
||||
downloadTheme(themeContents[i].path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void displayProgressBar() {
|
||||
char str[256];
|
||||
while(showProgressBar) {
|
||||
@@ -714,58 +690,4 @@ void displayProgressBar() {
|
||||
C3D_FrameEnd(0);
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
}
|
||||
|
||||
void download::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) != 0) {
|
||||
showProgressBar = false;
|
||||
downloadFailed();
|
||||
return;
|
||||
}
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
|
||||
void download::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) != 0) {
|
||||
showProgressBar = false;
|
||||
downloadFailed();
|
||||
return;
|
||||
}
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
void download::deleteFileList(std::string file, std::string message) {
|
||||
DisplayMsg(message);
|
||||
deleteFile(file.c_str());
|
||||
}
|
||||
|
||||
void download::installFileList(std::string file, std::string message) {
|
||||
DisplayMsg(message);
|
||||
installCia(file.c_str());
|
||||
}
|
||||
|
||||
void download::extractFileList(std::string file, std::string input, std::string output, std::string message) {
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||
showProgressBar = true;
|
||||
filesExtracted = 0;
|
||||
progressBarType = 1;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
extractArchive(file, input, output);
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
void download::displayTimeMsg(std::string message, int seconds) {
|
||||
DisplayMsg(message);
|
||||
for (int i = 0; i < 60*seconds; i++) {
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -40,7 +40,6 @@ nlohmann::json infoJson;
|
||||
|
||||
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
|
||||
|
||||
extern std::string get(nlohmann::json json, const std::string &key, const std::string &key2);
|
||||
std::string maxScripts;
|
||||
|
||||
void fixInfo(nlohmann::json &json) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "screens/scriptlist.hpp"
|
||||
|
||||
#include "utils/config.hpp"
|
||||
#include "utils/scriptHelper.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
@@ -53,25 +54,6 @@ std::string selectedTitle;
|
||||
std::string Desc = "";
|
||||
nlohmann::json jsonFile;
|
||||
|
||||
std::string get(nlohmann::json json, const std::string &key, const std::string &key2) {
|
||||
if(!json.contains(key)) return "MISSING: " + key;
|
||||
if(!json.at(key).is_object()) return "NOT OBJECT: " + key;
|
||||
|
||||
if(!json.at(key).contains(key2)) return "MISSING: " + key + "." + key2;
|
||||
if(!json.at(key).at(key2).is_string()) return "NOT STRING: " + key + "." + key2;
|
||||
|
||||
return json.at(key).at(key2).get_ref<const std::string&>();
|
||||
}
|
||||
|
||||
int getNum(nlohmann::json json, const std::string &key, const std::string &key2) {
|
||||
if(!json.contains(key)) return 0;
|
||||
if(!json.at(key).is_object()) return 0;
|
||||
|
||||
if(!json.at(key).contains(key2)) return 0;
|
||||
if(!json.at(key).at(key2).is_number()) return 0;
|
||||
return json.at(key).at(key2).get_ref<const int64_t&>();
|
||||
}
|
||||
|
||||
Info parseInfo(std::string fileName) {
|
||||
FILE* file = fopen(fileName.c_str(), "rt");
|
||||
if(!file) {
|
||||
@@ -83,9 +65,9 @@ Info parseInfo(std::string fileName) {
|
||||
fclose(file);
|
||||
|
||||
Info info;
|
||||
info.title = get(json, "info", "title");
|
||||
info.author = get(json, "info", "author");
|
||||
info.shortDesc = get(json, "info", "shortDesc");
|
||||
info.title = ScriptHelper::getString(json, "info", "title");
|
||||
info.author = ScriptHelper::getString(json, "info", "author");
|
||||
info.shortDesc = ScriptHelper::getString(json, "info", "shortDesc");
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -93,10 +75,7 @@ void checkForValidate(void) {
|
||||
FILE* file = fopen(currentFile.c_str(), "rt");
|
||||
nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
|
||||
fclose(file);
|
||||
|
||||
std::string version;
|
||||
version = get(json, "info", "version");
|
||||
int ver = getNum(json, "info", "version");
|
||||
int ver = ScriptHelper::getNum(json, "info", "version");
|
||||
if (ver < SCRIPT_VERSION || ver > SCRIPT_VERSION) {
|
||||
Gui::DisplayWarnMsg(Lang::get("INCOMPATIBLE_SCRIPT"));
|
||||
}
|
||||
@@ -137,14 +116,6 @@ std::string Description(nlohmann::json &json) {
|
||||
return out;
|
||||
}
|
||||
|
||||
// Because we need `#include <fstream>`.
|
||||
Result createFile(const char * path) {
|
||||
std::ofstream ofstream;
|
||||
ofstream.open(path, std::ofstream::out | std::ofstream::app);
|
||||
ofstream.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void runFunctions(nlohmann::json &json) {
|
||||
for(int i=0;i<(int)json.at(choice).size();i++) {
|
||||
std::string type = json.at(choice).at(i).at("type");
|
||||
@@ -155,7 +126,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
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("message")) message = json.at(choice).at(i).at("message");
|
||||
if(!missing) download::deleteFileList(file, message);
|
||||
if(!missing) ScriptHelper::removeFile(file, message);
|
||||
|
||||
} else if(type == "downloadFile") {
|
||||
bool missing = false;
|
||||
@@ -165,7 +136,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
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("message")) message = json.at(choice).at(i).at("message");
|
||||
if(!missing) download::downloadFile(file, output, message);
|
||||
if(!missing) ScriptHelper::downloadFile(file, output, message);
|
||||
|
||||
} else if(type == "downloadRelease") {
|
||||
bool missing = false, includePrereleases = false;
|
||||
@@ -179,7 +150,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
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("message")) message = json.at(choice).at(i).at("message");
|
||||
if(!missing) download::downloadRelease(repo, file, output, includePrereleases, message);
|
||||
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, message);
|
||||
|
||||
} else if(type == "extractFile") {
|
||||
bool missing = false;
|
||||
@@ -191,7 +162,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
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("message")) message = json.at(choice).at(i).at("message");
|
||||
if(!missing) download::extractFileList(file, input, output, message);
|
||||
if(!missing) ScriptHelper::extractFile(file, input, output, message);
|
||||
|
||||
} else if(type == "installCia") {
|
||||
bool missing = false;
|
||||
@@ -199,7 +170,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
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("message")) message = json.at(choice).at(i).at("message");
|
||||
if(!missing) download::installFileList(file, message);
|
||||
if(!missing) ScriptHelper::installFile(file, message);
|
||||
|
||||
} else if (type == "mkdir") {
|
||||
bool missing = false;
|
||||
@@ -225,7 +196,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
std::string file;
|
||||
if(json.at(choice).at(i).contains("file")) file = json.at(choice).at(i).at("file");
|
||||
else missing = true;
|
||||
if(!missing) createFile(file.c_str());
|
||||
if(!missing) ScriptHelper::createFile(file.c_str());
|
||||
|
||||
} else if (type == "timeMsg") {
|
||||
bool missing = false;
|
||||
@@ -236,7 +207,7 @@ void runFunctions(nlohmann::json &json) {
|
||||
if(json.at(choice).at(i).contains("seconds") && json.at(choice).at(i).at("seconds").is_number())
|
||||
seconds = json.at(choice).at(i).at("seconds");
|
||||
else missing = true;
|
||||
if(!missing) download::displayTimeMsg(message, seconds);
|
||||
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
|
||||
}
|
||||
}
|
||||
doneMsg();
|
||||
@@ -270,25 +241,25 @@ u32 progressBar;
|
||||
|
||||
void loadColors(nlohmann::json &json) {
|
||||
u32 colorTemp;
|
||||
colorTemp = getColor(get(json, "info", "barColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "barColor"));
|
||||
barColor = colorTemp == 0 ? Config::Color1 : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "bgTopColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgTopColor"));
|
||||
bgTopColor = colorTemp == 0 ? Config::Color2 : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "bgBottomColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "bgBottomColor"));
|
||||
bgBottomColor = colorTemp == 0 ? Config::Color3 : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "textColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "textColor"));
|
||||
TextColor = colorTemp == 0 ? Config::TxtColor : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "selectedColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "selectedColor"));
|
||||
selected = colorTemp == 0 ? Config::SelectedColor : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "unselectedColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "unselectedColor"));
|
||||
unselected = colorTemp == 0 ? Config::UnselectedColor : colorTemp;
|
||||
|
||||
colorTemp = getColor(get(json, "info", "progressbarColor"));
|
||||
colorTemp = getColor(ScriptHelper::getString(json, "info", "progressbarColor"));
|
||||
progressBar = colorTemp == 0 ? Config::progressbarColor : colorTemp;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "utils/fileBrowse.h"
|
||||
#include "utils/json.hpp"
|
||||
#include "utils/formatting.hpp"
|
||||
#include "utils/scriptHelper.hpp"
|
||||
|
||||
#define ENTRIES_PER_SCREEN 3
|
||||
#define ENTRIES_PER_LIST 7
|
||||
@@ -45,7 +46,6 @@ extern C2D_SpriteSheet sprites;
|
||||
|
||||
#define tinyDBFile "sdmc:/3ds/Universal-Updater/TinyDB.json"
|
||||
|
||||
extern std::string get(nlohmann::json json, const std::string &key, const std::string &key2);
|
||||
std::string maxEntries;
|
||||
|
||||
// Parse the Objects.
|
||||
@@ -211,7 +211,7 @@ void TinyDB::execute() {
|
||||
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("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
|
||||
if(!missing) download::deleteFileList(file, message);
|
||||
if(!missing) ScriptHelper::removeFile(file, message);
|
||||
|
||||
} else if(type == "downloadFile") {
|
||||
bool missing = false;
|
||||
@@ -221,7 +221,7 @@ void TinyDB::execute() {
|
||||
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(!missing) download::downloadFile(file, output, message);
|
||||
if(!missing) ScriptHelper::downloadFile(file, output, message);
|
||||
|
||||
} else if(type == "installCia") {
|
||||
bool missing = false;
|
||||
@@ -229,7 +229,7 @@ void TinyDB::execute() {
|
||||
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("message")) message = tinyDBJson.at(selectedOption).at("script").at(i).at("message");
|
||||
if(!missing) download::installFileList(file, message);
|
||||
if(!missing) ScriptHelper::installFile(file, message);
|
||||
}
|
||||
}
|
||||
doneMsg();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,4 +1,31 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "utils/formatting.hpp"
|
||||
|
||||
// adapted from GM9i's byte parsing.
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* This file is part of Universal-Updater
|
||||
* Copyright (C) 2019 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "gui.hpp"
|
||||
|
||||
#include "download/download.hpp"
|
||||
|
||||
#include "utils/extract.hpp"
|
||||
#include "utils/scriptHelper.hpp"
|
||||
#include "utils/thread.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
extern "C" {
|
||||
#include "utils/cia.h"
|
||||
}
|
||||
|
||||
extern bool showProgressBar;
|
||||
extern bool progressBarType;
|
||||
extern char progressBarMsg[128];
|
||||
extern int filesExtracted;
|
||||
|
||||
extern void downloadFailed();
|
||||
|
||||
// Get String of the Script.
|
||||
std::string ScriptHelper::getString(nlohmann::json json, const std::string &key, const std::string &key2) {
|
||||
if(!json.contains(key)) return "MISSING: " + key;
|
||||
if(!json.at(key).is_object()) return "NOT OBJECT: " + key;
|
||||
|
||||
if(!json.at(key).contains(key2)) return "MISSING: " + key + "." + key2;
|
||||
if(!json.at(key).at(key2).is_string()) return "NOT STRING: " + key + "." + key2;
|
||||
|
||||
return json.at(key).at(key2).get_ref<const std::string&>();
|
||||
}
|
||||
|
||||
// Get int of the Script.
|
||||
int ScriptHelper::getNum(nlohmann::json json, const std::string &key, const std::string &key2) {
|
||||
if(!json.contains(key)) return 0;
|
||||
if(!json.at(key).is_object()) return 0;
|
||||
|
||||
if(!json.at(key).contains(key2)) return 0;
|
||||
if(!json.at(key).at(key2).is_number()) return 0;
|
||||
return json.at(key).at(key2).get_ref<const int64_t&>();
|
||||
}
|
||||
|
||||
// Download from a Github Release.
|
||||
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) != 0) {
|
||||
showProgressBar = false;
|
||||
downloadFailed();
|
||||
return;
|
||||
}
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
// Download a File from everywhere.
|
||||
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) != 0) {
|
||||
showProgressBar = false;
|
||||
downloadFailed();
|
||||
return;
|
||||
}
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
// Remove a File.
|
||||
void ScriptHelper::removeFile(std::string file, std::string message) {
|
||||
DisplayMsg(message);
|
||||
deleteFile(file.c_str());
|
||||
}
|
||||
|
||||
// Install a file.
|
||||
void ScriptHelper::installFile(std::string file, std::string message) {
|
||||
DisplayMsg(message);
|
||||
installCia(file.c_str());
|
||||
}
|
||||
|
||||
// Extract Files.
|
||||
void ScriptHelper::extractFile(std::string file, std::string input, std::string output, std::string message) {
|
||||
snprintf(progressBarMsg, sizeof(progressBarMsg), message.c_str());
|
||||
showProgressBar = true;
|
||||
filesExtracted = 0;
|
||||
progressBarType = 1;
|
||||
Threads::create((ThreadFunc)displayProgressBar);
|
||||
extractArchive(file, input, output);
|
||||
showProgressBar = false;
|
||||
}
|
||||
|
||||
// Create an empty file.
|
||||
Result ScriptHelper::createFile(const char * path) {
|
||||
std::ofstream ofstream;
|
||||
ofstream.open(path, std::ofstream::out | std::ofstream::app);
|
||||
ofstream.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Display a Message for a specific amount of time.
|
||||
void ScriptHelper::displayTimeMsg(std::string message, int seconds) {
|
||||
DisplayMsg(message);
|
||||
for (int i = 0; i < 60*seconds; i++) {
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user