1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-28 04:12:03 +00:00

(hopefully) increased copying reliability

This commit is contained in:
flb 2021-01-17 18:26:20 +01:00
parent f20f24cad1
commit 0f76f7a39d
8 changed files with 43 additions and 22 deletions

View file

@ -10,6 +10,10 @@ jobs:
- name: Update repo.
run: |
git submodule update --init --recursive
- name: Update libnx to 4.0.
run: |
pacman -S libnx>=4.0
- name: Building aio-switch-updater
run: |

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
.vscode/settings.json
.vscode/
!.vscode/c_cpp_properties.json
build/
screenshots/
switch/

View file

@ -45,7 +45,7 @@ DATA := data
INCLUDES := include lib/zipper/include
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 1.4.1
APP_VERSION := 1.4.2
TARGET := $(notdir $(CURDIR))-v$(APP_VERSION)
ROMFS := resources

View file

@ -34,7 +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`.
- 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.
- Launch the Switch's web browser.
- Edit internet settings (DNS, IP address, MTU, etc). Add you own configs to `config/aio-switch-updater/internet.json`. You can find a template in the root of the repo.

View file

@ -52,6 +52,8 @@
"v1_4_0_text": "\uE016 Added possibility to use pre-set network settings. Add your own in `config/aio-switch-updater/internet.json.\n\uE016 Added web browser.",
"v1_4_1": "v1.4.1",
"v1_4_1_text": "\uE016 Fixed misleading display in internet settings page.",
"v1_4_2": "v1.4.2",
"v1_4_2_text": "\uE016 (hopefully) fixed unreliable copy of payloads",
"Ok_button": "Ok",
"cheats_page.cpp":"",
@ -105,7 +107,7 @@
"pro_con": "Pro-Con color swapper",
"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_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",
@ -156,7 +158,7 @@
"tools_tab.cpp":"",
"tool_cheats": "Cheats menu",
"tool_change": "Change the Joy-Cons color",
"tool_change_procon": "Change the Pro controller 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

@ -64,6 +64,9 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
verTitles.push_back("menus/v1_4_1"_i18n );
changes.push_back("menus/v1_4_1_text"_i18n );
verTitles.push_back("menus/v1_4_2"_i18n );
changes.push_back("menus/v1_4_2_text"_i18n );
int nbVersions = verTitles.size();
items.reserve(nbVersions);
for(int i = nbVersions -1 ; i >= 0; i--){

View file

@ -25,28 +25,39 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
});
if(cfw == ams){
items[i]->registerAction("menus/payload_set"_i18n , brls::Key::X, [this, payload] {
std::string res1;
if(R_SUCCEEDED(CopyFile(payload.c_str(), REBOOT_PAYLOAD_PATH))){
brls::Dialog* dialog = new brls::Dialog("menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'.");
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/payload_ok"_i18n , callback);
dialog->setCancelable(true);
dialog->open();
res1 += "menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'.";
}
else{
res1 += "Failed.";
}
brls::Dialog* dialog = new brls::Dialog(res1);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/payload_ok"_i18n , callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
}
items[i]->registerAction("menus/payload_set_up"_i18n , brls::Key::Y, [this, payload] {
std::string res2;
if(R_SUCCEEDED(CopyFile(payload.c_str(), UPDATE_BIN_PATH))){
brls::Dialog* dialog = new brls::Dialog("menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(UPDATE_BIN_PATH) + "'.");
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/payload_ok"_i18n , callback);
dialog->setCancelable(true);
dialog->open();
res2 += "menus/payload_success"_i18n + payload + "menus/payload_to"_i18n + std::string(UPDATE_BIN_PATH) + "'.";
}
else{
res2 += "Failed.";
}
brls::Dialog* dialog = new brls::Dialog(res2);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/payload_ok"_i18n , callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
list->addView(items[i]);

View file

@ -299,9 +299,9 @@ Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PA
fsFileClose(&src_handle);
return ret;
}
if (!std::filesystem::exists(dest_path))
fsFsCreateFile(fs, dest_path, size, 0);
std::filesystem::remove(dest_path);
fsFsCreateFile(fs, dest_path, size, 0);
ret = fsFsOpenFile(fs, dest_path, FsOpenMode_Write, &dest_handle);
if (R_FAILED(ret)){