mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-08 11:31:43 +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
|
||||
DATA := data
|
||||
INCLUDES := include lib/minizip/include
|
||||
APP_TITLE := AIO Switch Updater
|
||||
APP_TITLE := All-in-One Switch Updater
|
||||
APP_AUTHOR := HamletDuFromage
|
||||
APP_VERSION := 1.1.0
|
||||
APP_VERSION := 1.1.1
|
||||
|
||||
#ROMFS := $(BUILD)/romfs
|
||||
BOREALIS_PATH := lib/borealis
|
||||
|
|
27
README.md
27
README.md
|
@ -15,23 +15,24 @@ A Nintendo Switch homebrew app download and update CFWs, sigpatches, FWs and che
|
|||
## How to install
|
||||
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
|
||||
### - 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.
|
||||
|
||||
### - Update Sigpatches
|
||||
For Atmosphere. Downloads sigpatches, which are patches required for launching unofficial .NSPs. Both AMS and Hekate+AMS sigpatches are available.
|
||||
### ⬦ Update Sigpatches
|
||||
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 cheats
|
||||
Downloads and extracts daily-updated cheat code. The program will only extract cheat codes for the games you own.
|
||||
### ⬦ Download cheats
|
||||
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
|
||||
![ss](https://user-images.githubusercontent.com/61667930/93691403-30fb2e80-fad4-11ea-9701-7992a1de53e0.jpg)
|
||||
|
@ -43,4 +44,8 @@ Downloads and extracts daily-updated cheat code. The program will only extract c
|
|||
|
||||
|
||||
## 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 "progress_event.hpp"
|
||||
#include "json.hpp"
|
||||
#include "main_frame.hpp"
|
||||
|
||||
CFW getCFW();
|
||||
bool isServiceRunning(const char *serviceName);
|
||||
|
@ -23,5 +24,6 @@ std::string formatApplicationId(u64 ApplicationId);
|
|||
std::set<std::string> readLineByLine(const char * path);
|
||||
std::vector<std::string> fetchPayloads();
|
||||
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);
|
||||
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::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);
|
||||
switch(type){
|
||||
case sigpatches:
|
||||
|
@ -18,10 +25,7 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
|||
case fw:
|
||||
links = fetchLinks(FIRMWARE_URL);
|
||||
operation += "firmware";
|
||||
this->description->setText(
|
||||
"\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."
|
||||
);
|
||||
this->description->setText(firmwareText);
|
||||
break;
|
||||
case app:
|
||||
std::get<0>(links).push_back("Latest version");
|
||||
|
@ -59,6 +63,8 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
|||
);
|
||||
break;
|
||||
}
|
||||
std::get<0>(links).push_back("Test");
|
||||
std::get<1>(links).push_back("https://github.com");
|
||||
this->addView(description);
|
||||
|
||||
int nbLinks = std::get<0>(links).size();
|
||||
|
|
|
@ -54,6 +54,7 @@ bool isArchive(const char * path){
|
|||
|
||||
void downloadArchive(std::string url, archiveType type){
|
||||
createTree(DOWNLOAD_PATH);
|
||||
AppletType at;
|
||||
switch(type){
|
||||
case sigpatches:
|
||||
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);
|
||||
break;
|
||||
case fw:
|
||||
downloadFile(url.c_str(), FIRMWARE_FILENAME, OFF);
|
||||
at = appletGetAppletType();
|
||||
if (at == AppletType_Application || at == AppletType_SystemApplication) {
|
||||
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;
|
||||
case app:
|
||||
downloadFile(url.c_str(), APP_FILENAME, OFF);
|
||||
|
@ -75,6 +84,24 @@ void downloadArchive(std::string url, archiveType type){
|
|||
|
||||
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 result = -1;
|
||||
brls::Dialog* dialog = new brls::Dialog(text);
|
||||
|
@ -119,23 +146,42 @@ void extractArchive(archiveType type){
|
|||
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;
|
||||
case cheats:
|
||||
titles = getInstalledTitlesNs();
|
||||
titles = excludeTitles((std::string(DOWNLOAD_PATH) + "exclude.txt").c_str(), titles);
|
||||
titles = excludeTitles(CHEATS_EXCLUDE, titles);
|
||||
extractCheats(CHEATS_FILENAME, titles, getCFW());
|
||||
break;
|
||||
case fw:
|
||||
if (std::filesystem::exists(FIRMWARE_PATH)) std::filesystem::remove_all(FIRMWARE_PATH);
|
||||
createTree(FIRMWARE_PATH);
|
||||
extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
||||
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);
|
||||
createTree(FIRMWARE_PATH);
|
||||
extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
||||
}
|
||||
break;
|
||||
case app:
|
||||
extract(APP_FILENAME);
|
||||
break;
|
||||
case cfw:
|
||||
overwriteInis = showDialogBox("Do you want to overwrite existing .ini config files?", "No", "Yes");
|
||||
extract(CFW_FILENAME, ROOT_PATH, overwriteInis);
|
||||
if(isArchive(CFW_FILENAME)){
|
||||
overwriteInis = showDialogBox("Do you want to overwrite existing .ini config files?", "No", "Yes");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue