1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-09 20:11:48 +00:00
AIO-switch-updater/include/utils.hpp

44 lines
1.5 KiB
C++
Raw Normal View History

2020-09-20 01:21:28 +01:00
#pragma once
2021-05-28 14:51:30 +01:00
#include "constants.hpp"
2020-09-20 01:21:28 +01:00
#include <regex>
#include <set>
#include <switch.h>
2021-02-10 16:28:47 +00:00
#include <borealis.hpp>
2021-03-16 02:43:48 +00:00
#include <json.hpp>
2020-09-20 01:21:28 +01:00
namespace util {
2021-03-16 14:56:46 +00:00
typedef char NsApplicationName[0x201];
typedef uint8_t NsApplicationIcon[0x20000];
typedef struct {
2021-03-16 14:56:46 +00:00
uint64_t tid;
NsApplicationName name;
NsApplicationIcon icon;
brls::ListItem* listItem;
} app;
2021-03-16 14:56:46 +00:00
void clearConsole();
bool isArchive(const std::string& path);
2021-03-16 14:56:46 +00:00
void downloadArchive(std::string url, archiveType type);
void downloadArchive(std::string url, archiveType type, long& status_code);
2021-03-16 14:56:46 +00:00
void extractArchive(archiveType type, std::string tag = "0");
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 14:51:30 +01:00
void rebootToPayload(const std::string& path);
2021-03-16 14:56:46 +00:00
int showDialogBox(std::string text, std::string opt);
int showDialogBox(std::string text, std::string opt1, std::string opt2);
std::string getLatestTag(const std::string& url);
std::string downloadFileToString(const std::string& url);
void saveVersion(std::string version, const std::string& path);
std::string readVersion(const std::string& path);
2021-03-16 14:56:46 +00:00
bool isErista();
void removeSysmodulesFlags(const std::string& directory);
std::string lowerCase(const std::string& str);
std::string upperCase(const std::string& str);
std::string getErrorMessage(long status_code);
bool isApplet();
}