2020-09-20 02:21:28 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-05-28 15:51:30 +02:00
|
|
|
#include "constants.hpp"
|
2020-09-20 02:21:28 +02:00
|
|
|
#include <regex>
|
|
|
|
#include <set>
|
2020-09-26 16:55:24 +02:00
|
|
|
#include <switch.h>
|
2021-02-10 17:28:47 +01:00
|
|
|
#include <borealis.hpp>
|
2021-03-16 03:43:48 +01:00
|
|
|
#include <json.hpp>
|
2020-09-20 02:21:28 +02:00
|
|
|
|
2021-03-16 03:04:21 +01:00
|
|
|
namespace util {
|
|
|
|
|
2021-03-16 15:56:46 +01:00
|
|
|
typedef char NsApplicationName[0x201];
|
|
|
|
typedef uint8_t NsApplicationIcon[0x20000];
|
2020-09-26 16:55:24 +02:00
|
|
|
|
2021-06-28 00:46:00 +02:00
|
|
|
typedef struct {
|
2021-03-16 15:56:46 +01:00
|
|
|
uint64_t tid;
|
|
|
|
NsApplicationName name;
|
|
|
|
NsApplicationIcon icon;
|
|
|
|
brls::ListItem* listItem;
|
2021-06-28 00:46:00 +02:00
|
|
|
} app;
|
2020-09-26 16:55:24 +02:00
|
|
|
|
2021-03-16 15:56:46 +01:00
|
|
|
void clearConsole();
|
2021-05-22 18:10:34 +02:00
|
|
|
bool isArchive(const std::string& path);
|
2021-07-17 14:29:55 +02:00
|
|
|
void downloadArchive(const std::string& url, archiveType type);
|
|
|
|
void downloadArchive(const std::string& url, archiveType type, long& status_code);
|
|
|
|
void extractArchive(archiveType type, const std::string& tag = "0");
|
2021-03-16 15:56:46 +01:00
|
|
|
std::string formatListItemTitle(const std::string &str, size_t maxScore = 140);
|
|
|
|
std::string formatApplicationId(u64 ApplicationId);
|
|
|
|
std::vector<std::string> fetchPayloads();
|
|
|
|
void shutDown(bool reboot = false);
|
2021-05-28 15:51:30 +02:00
|
|
|
void rebootToPayload(const std::string& path);
|
2021-07-17 14:29:55 +02:00
|
|
|
int showDialogBox(const std::string& text, const std::string& opt);
|
|
|
|
int showDialogBox(const std::string& text, const std::string& opt1, const std::string& opt2);
|
2021-05-22 18:10:34 +02:00
|
|
|
std::string getLatestTag(const std::string& url);
|
2021-06-28 00:46:00 +02:00
|
|
|
std::string downloadFileToString(const std::string& url);
|
2021-07-17 14:29:55 +02:00
|
|
|
void saveVersion(const std::string& version, const std::string& path);
|
2021-05-22 18:10:34 +02:00
|
|
|
std::string readVersion(const std::string& path);
|
2021-03-16 15:56:46 +01:00
|
|
|
bool isErista();
|
2021-05-22 18:10:34 +02:00
|
|
|
void removeSysmodulesFlags(const std::string& directory);
|
2021-06-28 00:46:00 +02:00
|
|
|
std::string lowerCase(const std::string& str);
|
2021-06-28 16:58:04 +02:00
|
|
|
std::string upperCase(const std::string& str);
|
2021-06-28 00:46:00 +02:00
|
|
|
std::string getErrorMessage(long status_code);
|
|
|
|
bool isApplet();
|
2021-07-15 19:56:59 +02:00
|
|
|
std::string getContentsPath();
|
2021-07-21 15:38:43 +02:00
|
|
|
bool getBoolValue(const nlohmann::json& jsonFile, const std::string& key);
|
2021-03-16 03:04:21 +01:00
|
|
|
}
|