1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-29 10:56:01 +00:00

Added way to preserve files when updating

This commit is contained in:
flb 2020-12-29 00:24:35 +01:00
parent 6fae77cdc8
commit a4d0eb6d57
11 changed files with 74 additions and 21 deletions

View file

@ -19,7 +19,7 @@ Copy the `aio-switch-updater/` directory to `/switch/` in your sdcard
## Description of the features
### ⬦ 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. If you would like to preserve additional files or directories, write their path (one line each) in `/config/aio-switch-updater/preserve.txt` and they won't be overwritten when updating.
### ⬦ 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.
@ -34,6 +34,7 @@ Downloads and extracts daily-updated cheat code. The program will only extract c
- 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`.
- Change software color scheme of Pro controllers (has to be paired as Player 1). Additional color profiles can be found in the releases and should be copied to `config/aio-switch-updater/pc_profiles.json`.
- View which of your games got cheat codes from the app.
## Screenshots
@ -53,6 +54,7 @@ I do not own, host nor distribute any of the files that can be downloaded with t
- [yyoossk](https://github.com/yyoossk) for the Japanese locale.
- [sergiou87](https://github.com/sergiou87) for the Spanish locale.
- [Team Neptune](https://github.com/Team-Neptune) whose rcm code I used
- [fennectech](https://github.com/fennectech) for helping test the app and providing suggestions
### 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)

View file

@ -36,6 +36,7 @@
#define CHEATS_URL_CONTENTS "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/contents.zip"
#define CHEATS_FILENAME "/config/aio-switch-updater/cheats.zip"
#define CHEATS_EXCLUDE "/config/aio-switch-updater/exclude.txt"
#define FILES_IGNORE "/config/aio-switch-updater/preserve.txt"
#define UPDATED_TITLES_PATH "/config/aio-switch-updater/updated.dat"
#define CHEATS_VERSION "/config/aio-switch-updater/cheats_version.dat"
#define AMS_CONTENTS "/atmosphere/contents/"

View file

@ -76,6 +76,13 @@
"R_JC": "323232",
"name": "Pro Black"
},
{
"L_BTN": "0a0a1e",
"L_JC": "0ab9e6",
"R_BTN": "0a0a1e",
"R_JC": "ff3c28",
"name": "Splatoon"
},
{
"L_BTN": "281900",
"L_JC": "C88C32",

5
pc_profiles.json Normal file
View file

@ -0,0 +1,5 @@
{
"BODY": "2d2d2d",
"BTN": "e6e6e6",
"name": "Default black"
}

View file

@ -46,6 +46,8 @@
"v1_3_0_text": "\uE016 Added back the ability to update CFWs",
"v1_3_1": "v1.3.1",
"v1_3_1_text": "\uE016 Small fixes for bugs causing hangs.",
"v1_3_2": "v1.3.2",
"v1_3_2_text": "\uE016 Added ability to change the internet color of Pro controllers.\n\uE016 Added the ability to preserve specific files when updating.\n\uE016 Added the ability to clean up downloaded archives.",
"Ok_button": "Ok",
"cheats_page.cpp":"",
@ -94,10 +96,14 @@
"jc_color": "Joy-Con color swapper",
"jc_backing": "Backing up the current color profile. Make sure the Joy-Con are docked. If the process hangs, try docking/undocking the JCs.",
"jc_all_done": "All done!",
"jc_con_color": "Joy-Con color swapper",
"jc_change": "Changing color. Make sure the Joy-Con are docked. If the process hangs, try docking/undocking the JCs.",
"jc_all_": "All done! You may need to dock/undock your Joy-Cons for the change to take effect.",
"pc_you_can" : "You can change the internal color of your Pro controller. Make sure it's set to Player 1.",
"pc_color": "Pro controller color swapper",
"pc_backing": "Backing up the color profile",
"pc_all_done": "All done! You may need to turn your controller on and off for the change to take effect",
"list_donwload.cpp":"",
"Getting": "Getting ",
"firmware_text": "\uE016 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: ",
@ -145,6 +151,7 @@
"tools_tab.cpp":"",
"tool_cheats": "Cheats menu",
"tool_change": "Change the Joy-Cons color",
"tool_change_procon": "Change the Pro controller color",
"tool_download": "Dowload payloads to ",
"tool_inject": "Inject payload",
"tool_update": "Update the app (v",

View file

@ -38,7 +38,7 @@ JCPage::JCPage() : AppletFrame(true, true)
items[i] = new brls::ListItem(names[i]);
items[i]->getClickEvent()->subscribe([&, value](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/jc_concolor"_i18n );
stagedFrame->setTitle("menus/jc_con"_i18n );
stagedFrame->addStage(
new WorkerPage(stagedFrame, "menus/jc_changing"_i18n ,
[value](){changeJCColor(value);})

View file

@ -106,9 +106,9 @@ std::tuple<std::vector<std::string>, std::vector<std::vector<int>>> getProfiles(
}
if(profilesJson.empty()){
profilesJson = {{
{"BTN", "0A1E0A"},
{"BODY", "82FF96"},
{"name", "Animal Crossing: New Horizons"}
{"BTN", "2d2d2d"},
{"BODY", "e6e6e6"},
{"name", "Default black"}
}};
writeJSONToFile(profilesJson, path);
}

View file

@ -6,17 +6,16 @@ PCPage::PCPage() : AppletFrame(true, true)
{
this->setTitle("menus/joy_con"_i18n );
list = new brls::List();
std::string labelText = "menus/jc_you_can_1"_i18n + std::string(PC_COLOR_PATH) + "menus/jc_you_can_goto"\
"menus/jc_you_can_2"_i18n ;
std::string labelText = "menus/pc_you_can"_i18n;
label = new brls::Label(brls::LabelStyle::DESCRIPTION, labelText, true);
list->addView(label);
backup = new brls::ListItem("menus/jc_backup"_i18n );
backup->getClickEvent()->subscribe([&](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/jc_color"_i18n );
stagedFrame->setTitle("menus/pc_color"_i18n );
stagedFrame->addStage(
new WorkerPage(stagedFrame, "menus/jc_backing"_i18n ,
new WorkerPage(stagedFrame, "menus/pc_backing"_i18n ,
[](){pc::backupPCColor(PC_COLOR_PATH);})
);
stagedFrame->addStage(
@ -38,13 +37,13 @@ PCPage::PCPage() : AppletFrame(true, true)
items[i] = new brls::ListItem(names[i]);
items[i]->getClickEvent()->subscribe([&, value](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/jc_concolor"_i18n );
stagedFrame->setTitle("menus/pc_color"_i18n );
stagedFrame->addStage(
new WorkerPage(stagedFrame, "menus/jc_changing"_i18n ,
[value](){pc::changePCColor(value);})
);
stagedFrame->addStage(
new ConfirmPage(stagedFrame, "menus/jc_all_"_i18n , true)
new ConfirmPage(stagedFrame, "menus/pc_all_done"_i18n , true)
);
brls::Application::pushView(stagedFrame);
});

View file

@ -8,14 +8,35 @@ void extract(const char * filename, const char* workingPath, int overwriteInis){
ProgressEvent::instance().reset();
ProgressEvent::instance().setStep(1);
chdir(workingPath);
std::set<std::string> ignoreList = readLineByLine(FILES_IGNORE);
std::set<std::string>::iterator it;
zipper::Unzipper unzipper(filename);
std::vector<zipper::ZipEntry> entries = unzipper.entries();
int k = -1;
bool isIgnored;
ProgressEvent::instance().setTotalSteps(entries.size() + 1);
for (int i = 0; i < (int) entries.size(); i++){
isIgnored = false;
it = ignoreList.begin();
if(overwriteInis == 0 && entries[i].name.substr(entries[i].name.length() - 4) == ".ini"){
if(!std::filesystem::exists("/" + entries[i].name)) unzipper.extractEntry(entries[i].name);
if(!std::filesystem::exists("/" + entries[i].name)){
unzipper.extractEntry(entries[i].name);
}
continue;
}
else{
while (it != ignoreList.end() ){
k = ("/" + entries[i].name).find((*it));
//std::cout << k << " " << (*it) << " " << entries[i].name << std::endl;
if(k == 0 || k == 1){
isIgnored = true;
if(!std::filesystem::exists("/" + entries[i].name)){
unzipper.extractEntry(entries[i].name);
}
break;
}
it++;
}
if(!isIgnored){
if(entries[i].name == "sept/payload.bin" || entries[i].name == "atmosphere/fusee-secondary.bin"){
//std::cout << entries[i].name << std::endl;
unzipper.extractEntry(entries[i].name, CONFIG_PATH_UNZIP);
@ -39,16 +60,29 @@ void extract(const char * filename, const char* workingPath, const char* toExclu
ProgressEvent::instance().reset();
ProgressEvent::instance().setStep(1);
chdir(workingPath);
std::set<std::string> ignoreList = readLineByLine(FILES_IGNORE);
ignoreList.insert(toExclude);
std::set<std::string>::iterator it;
zipper::Unzipper unzipper(filename);
std::vector<zipper::ZipEntry> entries = unzipper.entries();
int k = -1;
bool isIgnored;
ProgressEvent::instance().setTotalSteps(entries.size() + 1);
for (int i = 0; i < (int) entries.size(); i++){
if("/" + entries[i].name == toExclude){
if(!std::filesystem::exists(toExclude)) {
unzipper.extractEntry(entries[i].name);
isIgnored = false;
it = ignoreList.begin();
while (it != ignoreList.end()){
k = ("/" + entries[i].name).find((*it));
if(k == 0 || k == 1){
isIgnored = true;
if(!std::filesystem::exists("/" + entries[i].name)){
unzipper.extractEntry(entries[i].name);
}
break;
}
it++;
}
else {
if(!isIgnored) {
unzipper.extractEntry(entries[i].name);
}

View file

@ -55,8 +55,6 @@ int main(int argc, char* argv[])
createTree(CONFIG_PATH);
std::string appName = std::string(argv[0]).substr(5);
std::cout << appName << std::endl;
std::cout << "in folder" << std::endl;
bool star = false;
//if(1){
if(appName.find(APP_PATH) != std::string::npos){

View file

@ -18,7 +18,7 @@ ToolsTab::ToolsTab(std::string tag) : brls::List()
JCcolor->setHeight(LISTITEM_HEIGHT);
this->addView(JCcolor);
PCcolor = new brls::ListItem("menus/tool_change_pcrocon"_i18n );
PCcolor = new brls::ListItem("menus/tool_change_procon"_i18n );
PCcolor->getClickEvent()->subscribe([&](brls::View* view){
brls::Application::pushView(new PCPage());
});