mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-01 05:42:02 +00:00
Added some safety checks before dowloading or extracting
This commit is contained in:
parent
2feb6901d6
commit
47e2df4c77
5 changed files with 83 additions and 24 deletions
4
Makefile
4
Makefile
|
@ -43,9 +43,9 @@ SOURCES := source lib/minizip/source
|
||||||
RESOURCES := resources
|
RESOURCES := resources
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := include lib/minizip/include
|
INCLUDES := include lib/minizip/include
|
||||||
APP_TITLE := AIO Switch Updater
|
APP_TITLE := All-in-One Switch Updater
|
||||||
APP_AUTHOR := HamletDuFromage
|
APP_AUTHOR := HamletDuFromage
|
||||||
APP_VERSION := 1.1.0
|
APP_VERSION := 1.1.1
|
||||||
|
|
||||||
#ROMFS := $(BUILD)/romfs
|
#ROMFS := $(BUILD)/romfs
|
||||||
BOREALIS_PATH := lib/borealis
|
BOREALIS_PATH := lib/borealis
|
||||||
|
|
25
README.md
25
README.md
|
@ -15,23 +15,24 @@ A Nintendo Switch homebrew app download and update CFWs, sigpatches, FWs and che
|
||||||
## How to install
|
## How to install
|
||||||
Copy the `aio-switch-updater/` directory to `/switch/` in your sdcard
|
Copy the `aio-switch-updater/` directory to `/switch/` in your sdcard
|
||||||
|
|
||||||
## Extras
|
|
||||||
This app can also reboot to specific payload and change software color scheme of Joy-Cons. Additional color profiles can be found in the releases and should be copied to `config/aio-switch-updater/jc_profiles.json`.
|
|
||||||
|
|
||||||
|
|
||||||
## Description of the features
|
## Description of the features
|
||||||
### - Update CFW
|
### ⬦ Update CFW
|
||||||
Download the most popular Switch CFWs. After downloading the CFW archive, the program will ask you whether you want to override your existing .ini files.
|
Download the most popular Switch CFWs. After downloading the CFW archive, the program will ask you whether you want to override your existing .ini files.
|
||||||
|
|
||||||
### - Update Sigpatches
|
### ⬦ Update Sigpatches
|
||||||
For Atmosphere. Downloads sigpatches, which are patches required for launching unofficial .NSPs. Both AMS and Hekate+AMS sigpatches are available.
|
For Atmosphere. Downloads sigpatches, which are patches required for launching unofficial .NSPs. Both AMS and Hekate+AMS sigpatches are available. After downloading the sigpatches archive, the program will ask you whether you want to override your existing .ini files.
|
||||||
|
|
||||||
### -Download firmares
|
### ⬦ Download firmares
|
||||||
Download firmare files to `/firmware` that can then be installed using DayBreak or ChoiDuJour.
|
Download firmare files to `/firmware` that can then be installed using DayBreak or ChoiDuJour.
|
||||||
|
|
||||||
### - Download cheats
|
### ⬦ Download cheats
|
||||||
Downloads and extracts daily-updated cheat code. The program will only extract cheat codes for the games you own.
|
Downloads and extracts daily-updated cheat code. The program will only extract cheat codes for the games you own. By default, this homebrew will overwrite the existing cheats. If you have your own cheat files that you'd like to keep as is, you may add the title IDs of the corresponding games, one ID per line, to `/config/cheats-updater/exclude.txt`. Use http://tinfoil.io/title to find the title ID of a game.
|
||||||
|
|
||||||
|
## Extras (in the `Tools` tab)
|
||||||
|
- Reboot to specific payload.
|
||||||
|
- Download payloads to `/bootloader/payloads`.
|
||||||
|
- Change software color scheme of Joy-Cons. Additional color profiles can be found in the releases and should be copied to `config/aio-switch-updater/jc_profiles.json`.
|
||||||
|
- View which of your games got cheat codes from the app.
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
![ss](https://user-images.githubusercontent.com/61667930/93691403-30fb2e80-fad4-11ea-9701-7992a1de53e0.jpg)
|
![ss](https://user-images.githubusercontent.com/61667930/93691403-30fb2e80-fad4-11ea-9701-7992a1de53e0.jpg)
|
||||||
|
@ -44,3 +45,7 @@ Downloads and extracts daily-updated cheat code. The program will only extract c
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
I do not own, host nor distribute any of the files that can be downloaded with this homebrew tool. At the owner's request, I will immediately remove the ability to download the problematic files.
|
I do not own, host nor distribute any of the files that can be downloaded with this homebrew tool. At the owner's request, I will immediately remove the ability to download the problematic files.
|
||||||
|
|
||||||
|
### Like the app?
|
||||||
|
|
||||||
|
[![5cbed8a433a3f45a772abaf5_SupportMe_blue-p-500](https://user-images.githubusercontent.com/61667930/93899702-1a2b2680-fce4-11ea-9eaa-4e2b44eebe86.png)](https://ko-fi.com/hamletdufromage)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "progress_event.hpp"
|
#include "progress_event.hpp"
|
||||||
#include "json.hpp"
|
#include "json.hpp"
|
||||||
|
#include "main_frame.hpp"
|
||||||
|
|
||||||
CFW getCFW();
|
CFW getCFW();
|
||||||
bool isServiceRunning(const char *serviceName);
|
bool isServiceRunning(const char *serviceName);
|
||||||
|
@ -23,5 +24,6 @@ std::string formatApplicationId(u64 ApplicationId);
|
||||||
std::set<std::string> readLineByLine(const char * path);
|
std::set<std::string> readLineByLine(const char * path);
|
||||||
std::vector<std::string> fetchPayloads();
|
std::vector<std::string> fetchPayloads();
|
||||||
void shut_down(bool reboot = false);
|
void shut_down(bool reboot = false);
|
||||||
|
int showDialogBox(std::string text, std::string opt);
|
||||||
int showDialogBox(std::string text, std::string opt1, std::string opt2);
|
int showDialogBox(std::string text, std::string opt1, std::string opt2);
|
||||||
std::string getLatestTag(const char *url);
|
std::string getLatestTag(const char *url);
|
|
@ -5,6 +5,13 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
{
|
{
|
||||||
std::tuple<std::vector<std::string>, std::vector<std::string>> links;
|
std::tuple<std::vector<std::string>, std::vector<std::string>> links;
|
||||||
std::string operation = "Getting ";
|
std::string operation = "Getting ";
|
||||||
|
std::string firmwareText("\uE016 Here are firmware dumps from \"https://darthsternie.net/switch-firmwares/\". "\
|
||||||
|
"Once downloaded, it will be extracted in \"/firmware\". You can then install the update through Daybreak or ChoiDuJour.\n"\
|
||||||
|
"\uE016 Current FW: "
|
||||||
|
);
|
||||||
|
SetSysFirmwareVersion ver;
|
||||||
|
if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version;
|
||||||
|
else firmwareText += "not found";
|
||||||
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
||||||
switch(type){
|
switch(type){
|
||||||
case sigpatches:
|
case sigpatches:
|
||||||
|
@ -18,10 +25,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
case fw:
|
case fw:
|
||||||
links = fetchLinks(FIRMWARE_URL);
|
links = fetchLinks(FIRMWARE_URL);
|
||||||
operation += "firmware";
|
operation += "firmware";
|
||||||
this->description->setText(
|
this->description->setText(firmwareText);
|
||||||
"\uE016 Here are firmware dumps from \"https://darthsternie.net/switch-firmwares/\". "\
|
|
||||||
"Once downloaded, it will be extracted in \"/firmware\". You can then install the update though Daybreak or ChoiDuJour."
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case app:
|
case app:
|
||||||
std::get<0>(links).push_back("Latest version");
|
std::get<0>(links).push_back("Latest version");
|
||||||
|
@ -59,6 +63,8 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
std::get<0>(links).push_back("Test");
|
||||||
|
std::get<1>(links).push_back("https://github.com");
|
||||||
this->addView(description);
|
this->addView(description);
|
||||||
|
|
||||||
int nbLinks = std::get<0>(links).size();
|
int nbLinks = std::get<0>(links).size();
|
||||||
|
|
|
@ -54,6 +54,7 @@ bool isArchive(const char * path){
|
||||||
|
|
||||||
void downloadArchive(std::string url, archiveType type){
|
void downloadArchive(std::string url, archiveType type){
|
||||||
createTree(DOWNLOAD_PATH);
|
createTree(DOWNLOAD_PATH);
|
||||||
|
AppletType at;
|
||||||
switch(type){
|
switch(type){
|
||||||
case sigpatches:
|
case sigpatches:
|
||||||
downloadFile(url.c_str(), SIGPATCHES_FILENAME, OFF);
|
downloadFile(url.c_str(), SIGPATCHES_FILENAME, OFF);
|
||||||
|
@ -62,7 +63,15 @@ void downloadArchive(std::string url, archiveType type){
|
||||||
downloadFile(url.c_str(), CHEATS_FILENAME, OFF);
|
downloadFile(url.c_str(), CHEATS_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case fw:
|
case fw:
|
||||||
|
at = appletGetAppletType();
|
||||||
|
if (at == AppletType_Application || at == AppletType_SystemApplication) {
|
||||||
downloadFile(url.c_str(), FIRMWARE_FILENAME, OFF);
|
downloadFile(url.c_str(), FIRMWARE_FILENAME, OFF);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showDialogBox("Because of the size of the FW archive, downloading firmwares in Applet Mode is not supported. "\
|
||||||
|
"Please launch the app with full RAM access.", "Ok");
|
||||||
|
brls::Application::pushView(new MainFrame());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case app:
|
case app:
|
||||||
downloadFile(url.c_str(), APP_FILENAME, OFF);
|
downloadFile(url.c_str(), APP_FILENAME, OFF);
|
||||||
|
@ -75,6 +84,24 @@ void downloadArchive(std::string url, archiveType type){
|
||||||
|
|
||||||
int dialogResult = -1;
|
int dialogResult = -1;
|
||||||
|
|
||||||
|
int showDialogBox(std::string text, std::string opt){
|
||||||
|
int result = -1;
|
||||||
|
brls::Dialog* dialog = new brls::Dialog(text);
|
||||||
|
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
|
||||||
|
dialogResult = 0;
|
||||||
|
dialog->close();
|
||||||
|
};
|
||||||
|
dialog->addButton(opt, callback);
|
||||||
|
dialog->setCancelable(false);
|
||||||
|
dialog->open();
|
||||||
|
while(result == -1){
|
||||||
|
usleep(1);
|
||||||
|
result = dialogResult;
|
||||||
|
}
|
||||||
|
dialogResult = -1;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
||||||
int result = -1;
|
int result = -1;
|
||||||
brls::Dialog* dialog = new brls::Dialog(text);
|
brls::Dialog* dialog = new brls::Dialog(text);
|
||||||
|
@ -119,23 +146,42 @@ void extractArchive(archiveType type){
|
||||||
extract(SIGPATCHES_FILENAME);
|
extract(SIGPATCHES_FILENAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
showDialogBox("The downloaded file is not a sigpatches archive. This is most likely due to a broken link. If the problem persists after more than 3 hours, "\
|
||||||
|
"please open an issue on Github.", "Ok");
|
||||||
|
brls::Application::pushView(new MainFrame());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case cheats:
|
case cheats:
|
||||||
titles = getInstalledTitlesNs();
|
titles = getInstalledTitlesNs();
|
||||||
titles = excludeTitles((std::string(DOWNLOAD_PATH) + "exclude.txt").c_str(), titles);
|
titles = excludeTitles(CHEATS_EXCLUDE, titles);
|
||||||
extractCheats(CHEATS_FILENAME, titles, getCFW());
|
extractCheats(CHEATS_FILENAME, titles, getCFW());
|
||||||
break;
|
break;
|
||||||
case fw:
|
case fw:
|
||||||
|
if(std::filesystem::file_size(FIRMWARE_FILENAME) < 200000){
|
||||||
|
showDialogBox("The downloaded file is not a firmware archive. This is most likely due to a broken link. If the problem persists after more than 3 hours, "\
|
||||||
|
"please open an issue on Github.", "Ok");
|
||||||
|
brls::Application::pushView(new MainFrame());
|
||||||
|
}
|
||||||
|
else{
|
||||||
if (std::filesystem::exists(FIRMWARE_PATH)) std::filesystem::remove_all(FIRMWARE_PATH);
|
if (std::filesystem::exists(FIRMWARE_PATH)) std::filesystem::remove_all(FIRMWARE_PATH);
|
||||||
createTree(FIRMWARE_PATH);
|
createTree(FIRMWARE_PATH);
|
||||||
extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case app:
|
case app:
|
||||||
extract(APP_FILENAME);
|
extract(APP_FILENAME);
|
||||||
break;
|
break;
|
||||||
case cfw:
|
case cfw:
|
||||||
|
if(isArchive(CFW_FILENAME)){
|
||||||
overwriteInis = showDialogBox("Do you want to overwrite existing .ini config files?", "No", "Yes");
|
overwriteInis = showDialogBox("Do you want to overwrite existing .ini config files?", "No", "Yes");
|
||||||
extract(CFW_FILENAME, ROOT_PATH, overwriteInis);
|
extract(CFW_FILENAME, ROOT_PATH, overwriteInis);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showDialogBox("The downloaded file is not a CFW archive. This is most likely due to a broken link. If the problem persists after more than 3 hours, "\
|
||||||
|
"please open an issue on Github.", "Ok");
|
||||||
|
brls::Application::pushView(new MainFrame());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue