mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2025-03-02 20:25:49 +00:00
fixed crash when downloading cheats in applet mode, updated borealis submodule, passed strings as references
This commit is contained in:
parent
13cc1ff4e2
commit
a697365a77
23 changed files with 49 additions and 43 deletions
2
Makefile
2
Makefile
|
@ -22,7 +22,7 @@ DATA := data
|
|||
INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann
|
||||
APP_TITLE := All-in-One Switch Updater
|
||||
APP_AUTHOR := HamletDuFromage
|
||||
APP_VERSION := 2.11.1
|
||||
APP_VERSION := 2.11.2
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
|
||||
ROMFS := resources
|
||||
|
|
|
@ -26,6 +26,6 @@ class AmsTab : public brls::List
|
|||
class UnTogglableListItem : public brls::ToggleListItem
|
||||
{
|
||||
public:
|
||||
UnTogglableListItem(std::string label, bool initialValue, std::string description = "", std::string onValue = "On", std::string offValue = "Off") : ToggleListItem(label, initialValue, description, onValue, offValue) {}
|
||||
UnTogglableListItem(const std::string& label, bool initialValue, std::string description = "", std::string onValue = "On", std::string offValue = "Off") : ToggleListItem(label, initialValue, description, onValue, offValue) {}
|
||||
virtual bool onClick() override;
|
||||
};
|
|
@ -10,7 +10,7 @@ class ChoicePage: public brls::View
|
|||
brls::Label* label = nullptr;
|
||||
|
||||
public:
|
||||
ChoicePage(brls::StagedAppletFrame* frame, std::string text);
|
||||
ChoicePage(brls::StagedAppletFrame* frame, const std::string text);
|
||||
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
|
||||
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override;
|
||||
brls::View* getDefaultFocus() override;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
namespace JC {
|
||||
|
||||
int setColor(std::vector<int> colors);
|
||||
int setColor(const std::vector<int>& colors);
|
||||
int backupToJSON(nlohmann::json &profiles, const std::string& path);
|
||||
std::vector<std::pair<std::string, std::vector<int>>> getProfiles(const std::string& path);
|
||||
void changeJCColor(std::vector<int> values);
|
||||
void changeJCColor(const std::vector<int>& values);
|
||||
nlohmann::json backupProfile();
|
||||
void backupJCColor(const std::string& path);
|
||||
|
||||
|
@ -15,10 +15,10 @@ namespace JC {
|
|||
|
||||
namespace PC {
|
||||
|
||||
int setColor(std::vector<int> colors);
|
||||
int setColor(const std::vector<int>& colors);
|
||||
int backupToJSON(nlohmann::json &profiles,const std::string& path);
|
||||
std::vector<std::pair<std::string, std::vector<int>>> getProfiles(const std::string& path);
|
||||
void changePCColor(std::vector<int> values);
|
||||
void changePCColor(const std::vector<int>& values);
|
||||
nlohmann::json backupProfile();
|
||||
void backupPCColor(const std::string& path);
|
||||
|
||||
|
@ -26,8 +26,8 @@ namespace PC {
|
|||
|
||||
namespace ColorSwapper {
|
||||
|
||||
int hexToBGR(std::string hex);
|
||||
int hexToBGR(const std::string& hex);
|
||||
std::string BGRToHex(int v);
|
||||
bool isHexaAnd3Bytes(std::string str);
|
||||
bool isHexaAnd3Bytes(const std::string& str);
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ class DialoguePage : public brls::View
|
|||
bool erista = true;
|
||||
|
||||
public:
|
||||
DialoguePage(brls::StagedAppletFrame* frame, std::string text, bool erista = true);
|
||||
DialoguePage(brls::StagedAppletFrame* frame, const std::string& text, bool erista = true);
|
||||
|
||||
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
|
||||
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override;
|
||||
|
|
|
@ -27,7 +27,7 @@ class DownloadCheatsPage : public brls::AppletFrame
|
|||
void GetBuildIDFromDmnt();
|
||||
void GetVersion();
|
||||
void GetBuildIDFromFile();
|
||||
void WriteCheats(std::string cheatContent);
|
||||
void WriteCheats(const std::string& cheatContent);
|
||||
void DeleteCheats();
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -30,6 +30,6 @@ namespace extract {
|
|||
void extractCheats(const std::string& zipPath, std::vector<std::string> titles, CFW cfw, bool credits = false);
|
||||
void extractAllCheats(const std::string& zipPath, CFW cfw);
|
||||
void removeCheats();
|
||||
bool isBID(std::string bid);
|
||||
bool isBID(const std::string& bid);
|
||||
|
||||
}
|
|
@ -15,6 +15,6 @@ class NetPage : public brls::AppletFrame
|
|||
public:
|
||||
NetPage();
|
||||
std::string ipToString(unsigned char* ip);
|
||||
int stringToIp(std::string ip, unsigned char* out);
|
||||
int stringToIp(const std::string& ip, unsigned char* out);
|
||||
|
||||
};
|
|
@ -24,6 +24,6 @@ class ToolsTab : public brls::List
|
|||
brls::StagedAppletFrame* stagedFrame;
|
||||
|
||||
public:
|
||||
ToolsTab(std::string tag, bool erista = true);
|
||||
ToolsTab(const std::string& tag, bool erista = true);
|
||||
|
||||
};
|
|
@ -21,19 +21,19 @@ namespace util {
|
|||
|
||||
void clearConsole();
|
||||
bool isArchive(const std::string& path);
|
||||
void downloadArchive(std::string url, archiveType type);
|
||||
void downloadArchive(std::string url, archiveType type, long& status_code);
|
||||
void extractArchive(archiveType type, std::string tag = "0");
|
||||
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");
|
||||
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);
|
||||
void rebootToPayload(const std::string& path);
|
||||
int showDialogBox(std::string text, std::string opt);
|
||||
int showDialogBox(std::string text, std::string opt1, std::string opt2);
|
||||
int showDialogBox(const std::string& text, const std::string& opt);
|
||||
int showDialogBox(const std::string& text, const std::string& opt1, const 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);
|
||||
void saveVersion(const std::string& version, const std::string& path);
|
||||
std::string readVersion(const std::string& path);
|
||||
bool isErista();
|
||||
void removeSysmodulesFlags(const std::string& directory);
|
||||
|
|
|
@ -11,7 +11,7 @@ class WarningPage : public brls::View
|
|||
std::chrono::system_clock::time_point start = std::chrono::high_resolution_clock::now();
|
||||
|
||||
public:
|
||||
WarningPage(std::string text);
|
||||
WarningPage(const std::string& text);
|
||||
~WarningPage();
|
||||
|
||||
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit aee597a7a40f4a486c3a793f03e97aee12d009ef
|
||||
Subproject commit 22b62c7bee7a156400d5109fcb8459bab0bee78a
|
|
@ -11,6 +11,8 @@
|
|||
#include <fstream>
|
||||
#include <regex>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
|
||||
|
@ -53,6 +55,7 @@ void AppPage::PopulatePage()
|
|||
else {
|
||||
tid = GetCurrentApplicationId();
|
||||
if (R_SUCCEEDED(InitControlData(&controlData)) && R_SUCCEEDED(GetControlData(tid, controlData, controlSize, name))) {
|
||||
listItem = new brls::ListItem(name, "", util::formatApplicationId(tid));
|
||||
this->DeclareGameListItem(name, tid, &controlData);
|
||||
}
|
||||
label = new brls::Label(brls::LabelStyle::SMALL, "menus/common/applet_mode_not_supported"_i18n, true);
|
||||
|
|
|
@ -184,6 +184,9 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
|
|||
verTitles.push_back("v2.11.1");
|
||||
changes.push_back("\uE016 Added ability to view existing cheats when downloading cheat codes/sheets.\n\uE016 Fixed wrong tid for theme detection.");
|
||||
|
||||
verTitles.push_back("v2.11.2");
|
||||
changes.push_back("\uE016 Fixed crash when downloading cheats in applet mode.\n\uE016 Fixed progress bar percentage not showing past 10%.");
|
||||
|
||||
for(int i = verTitles.size() -1 ; i >= 0; i--){
|
||||
listItem = new brls::ListItem(verTitles[i]);
|
||||
change = changes[i];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
ChoicePage::ChoicePage(brls::StagedAppletFrame* frame, std::string text)
|
||||
ChoicePage::ChoicePage(brls::StagedAppletFrame* frame, const std::string text)
|
||||
{
|
||||
this->yes = (new brls::Button(brls::ButtonStyle::BORDERLESS))->setLabel("yes");
|
||||
this->yes->setParent(this);
|
||||
|
|
|
@ -13,7 +13,7 @@ using json = nlohmann::json;
|
|||
|
||||
namespace ColorSwapper {
|
||||
|
||||
int hexToBGR(std::string hex){
|
||||
int hexToBGR(const std::string& hex){
|
||||
std::string R = hex.substr(0, 2);
|
||||
std::string G = hex.substr(2, 2);
|
||||
std::string B = hex.substr(4, 2);
|
||||
|
@ -27,7 +27,7 @@ namespace ColorSwapper {
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
bool isHexaAnd3Bytes(std::string str){
|
||||
bool isHexaAnd3Bytes(const std::string& str){
|
||||
if(str.size()!=6) return false;
|
||||
for(char const &c : str){
|
||||
if(!isxdigit(c)) return false;
|
||||
|
@ -39,7 +39,7 @@ namespace ColorSwapper {
|
|||
|
||||
namespace JC {
|
||||
|
||||
int setColor(std::vector<int> colors){
|
||||
int setColor(const std::vector<int>& colors){
|
||||
Result pads, ljc, rjc;
|
||||
int res = 0;
|
||||
s32 nbEntries;
|
||||
|
@ -149,7 +149,7 @@ namespace JC {
|
|||
return res;
|
||||
}
|
||||
|
||||
void changeJCColor(std::vector<int> values){
|
||||
void changeJCColor(const std::vector<int>& values){
|
||||
hiddbgInitialize();
|
||||
hidsysInitialize();
|
||||
ProgressEvent::instance().reset();
|
||||
|
@ -205,7 +205,7 @@ namespace JC {
|
|||
|
||||
namespace PC {
|
||||
|
||||
int setColor(std::vector<int> colors){
|
||||
int setColor(const std::vector<int>& colors){
|
||||
Result pads, pc;
|
||||
int res = 0;
|
||||
s32 nbEntries;
|
||||
|
@ -301,14 +301,14 @@ namespace PC {
|
|||
return res;
|
||||
}
|
||||
|
||||
void changePCColor(std::vector<int> values){
|
||||
void changePCColor(const std::vector<int>& values){
|
||||
hiddbgInitialize();
|
||||
hidsysInitialize();
|
||||
ProgressEvent::instance().reset();
|
||||
ProgressEvent::instance().setStep(1);
|
||||
int res = setColor(values);
|
||||
if(res != 0){
|
||||
util::showDialogBox("Could not change the Pro-Con color. Make they're connected to P1. This feature may not work on unoffical controllers. \nError :" + std::to_string(res), "Ok");
|
||||
util::showDialogBox("Could not change the Pro-Con color. Make they're connected to P1. This feature may not work on unofficial controllers. \nError :" + std::to_string(res), "Ok");
|
||||
}
|
||||
hiddbgExit();
|
||||
hidsysExit();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
|
||||
DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text, bool erista) : erista(erista)
|
||||
DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, const std::string& text, bool erista) : erista(erista)
|
||||
{
|
||||
this->button1 = (new brls::Button(brls::ButtonStyle::REGULAR))->setLabel("menus/common/yes"_i18n);
|
||||
this->button1->setParent(this);
|
||||
|
|
|
@ -128,7 +128,7 @@ void DownloadCheatsPage::GetBuildIDFromFile() {
|
|||
}
|
||||
}
|
||||
|
||||
void DownloadCheatsPage::WriteCheats(std::string cheatContent) {
|
||||
void DownloadCheatsPage::WriteCheats(const std::string& cheatContent) {
|
||||
std::string path = util::getContentsPath();
|
||||
std::string tidstr = util::formatApplicationId(this->tid);
|
||||
path += tidstr + "/cheats/";
|
||||
|
|
|
@ -290,7 +290,7 @@ void extractAllCheats(const std::string& zipPath, CFW cfw){
|
|||
ProgressEvent::instance().setStep(ProgressEvent::instance().getMax());
|
||||
}
|
||||
|
||||
bool isBID(std::string bid) {
|
||||
bool isBID(const std::string& bid) {
|
||||
for(char const &c : bid){
|
||||
if(!isxdigit(c)) return false;
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ std::string NetPage::ipToString(u8* ip){
|
|||
return res;
|
||||
}
|
||||
|
||||
int NetPage::stringToIp(std::string ip, u8 *out){
|
||||
int NetPage::stringToIp(const std::string& ip, u8 *out){
|
||||
size_t start;
|
||||
size_t end = 0;
|
||||
int i = 0;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
|||
constexpr const char AppVersion[] = APP_VERSION;
|
||||
}
|
||||
|
||||
ToolsTab::ToolsTab(std::string tag, bool erista) : brls::List()
|
||||
ToolsTab::ToolsTab(const std::string& tag, bool erista) : brls::List()
|
||||
{
|
||||
if(!tag.empty() && tag != AppVersion){
|
||||
updateApp = new brls::ListItem("menus/tools/update_app"_i18n + tag +")");
|
||||
|
|
|
@ -27,12 +27,12 @@ bool isArchive(const std::string& path){
|
|||
return fileContent.find("DOCTYPE") == std::string::npos;
|
||||
}
|
||||
|
||||
void downloadArchive(std::string url, archiveType type) {
|
||||
void downloadArchive(const std::string& url, archiveType type) {
|
||||
long status_code;
|
||||
downloadArchive(url,type, status_code);
|
||||
downloadArchive(url, type, status_code);
|
||||
}
|
||||
|
||||
void downloadArchive(std::string url, archiveType type, long& status_code) {
|
||||
void downloadArchive(const std::string& url, archiveType type, long& status_code) {
|
||||
fs::createTree(DOWNLOAD_PATH);
|
||||
switch(type){
|
||||
case archiveType::sigpatches:
|
||||
|
@ -61,7 +61,7 @@ void downloadArchive(std::string url, archiveType type, long& status_code) {
|
|||
ProgressEvent::instance().setStatusCode(status_code);
|
||||
}
|
||||
|
||||
int showDialogBox(std::string text, std::string opt){
|
||||
int showDialogBox(const std::string& text, const std::string& opt){
|
||||
int dialogResult = -1;
|
||||
int result = -1;
|
||||
brls::Dialog* dialog = new brls::Dialog(text);
|
||||
|
@ -79,7 +79,7 @@ int showDialogBox(std::string text, std::string opt){
|
|||
return result;
|
||||
}
|
||||
|
||||
int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
||||
int showDialogBox(const std::string& text, const std::string& opt1, const std::string& opt2){
|
||||
int dialogResult = -1;
|
||||
int result = -1;
|
||||
brls::Dialog* dialog = new brls::Dialog(text);
|
||||
|
@ -102,7 +102,7 @@ int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
|||
return result;
|
||||
}
|
||||
|
||||
void extractArchive(archiveType type, std::string tag){
|
||||
void extractArchive(archiveType type, const std::string& tag){
|
||||
int overwriteInis = 0;
|
||||
std::vector<std::string> titles;
|
||||
std::string nroPath ="sdmc:" + std::string(APP_PATH);
|
||||
|
@ -235,7 +235,7 @@ std::string downloadFileToString(const std::string& url) {
|
|||
return str;
|
||||
}
|
||||
|
||||
void saveVersion(std::string version, const std::string& path){
|
||||
void saveVersion(const std::string& version, const std::string& path){
|
||||
std::ofstream newVersion(path);
|
||||
newVersion << version << std::endl;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
WarningPage::WarningPage(std::string text)
|
||||
WarningPage::WarningPage(const std::string& text)
|
||||
{
|
||||
fs::createTree(CONFIG_PATH);
|
||||
std::ofstream hiddenFile(HIDDEN_AIO_FILE);
|
||||
|
|
Loading…
Add table
Reference in a new issue