From a7a62dfffd68442636bfb34b02ad69494dcf50b1 Mon Sep 17 00:00:00 2001 From: flb Date: Mon, 15 Feb 2021 19:31:06 +0100 Subject: [PATCH] prompt to delete atmosphere/contents, cleanups --- move_files.json => copy_files.json | 0 include/constants.hpp | 2 +- resources/i18n/en-US/menus.json | 4 +++- source/confirm_page.cpp | 4 +--- source/dialogue_page.cpp | 2 ++ source/main_frame.cpp | 4 +--- source/tools_tab.cpp | 6 +++--- source/utils.cpp | 13 +++++++------ source/worker_page.cpp | 1 + 9 files changed, 19 insertions(+), 17 deletions(-) rename move_files.json => copy_files.json (100%) diff --git a/move_files.json b/copy_files.json similarity index 100% rename from move_files.json rename to copy_files.json diff --git a/include/constants.hpp b/include/constants.hpp index 386fb6f..ce7bf68 100644 --- a/include/constants.hpp +++ b/include/constants.hpp @@ -76,7 +76,7 @@ #define FW_DIRECTORY_PATH "/firmware/" #define HIDE_TABS_JSON "/config/aio-switch-updater/hide_tabs.json" -#define MOVE_FILES_JSON "/config/aio-switch-updater/move_files.json" +#define COPY_FILES_JSON "/config/aio-switch-updater/copy_files.json" #define ROMFS_FORWARDER "romfs:/aiosu-forwarder.nro" #define FORWARDER_PATH "/config/aio-switch-updater/aiosu-forwarder.nro" diff --git a/resources/i18n/en-US/menus.json b/resources/i18n/en-US/menus.json index 15f4d16..7515945 100644 --- a/resources/i18n/en-US/menus.json +++ b/resources/i18n/en-US/menus.json @@ -235,7 +235,9 @@ "tool_copyFiles": "Batch copy files", "files_not_found": "The following files were not found and couldn't be copied:\n", - "move_files_not_found": "This tool allows you to copy files to other locations, which may be needed for your bootloader/trinket. Grab move_files.json at 'https://git.io/aiosu_move_files' and add it to your config folder. This will also be performed after updates." + "copy_files_not_found": "This tool allows you to copy files to other locations, which may be needed for your bootloader/trinket. Grab copy_files.json at 'https://git.io/aiosu_copy_files' and add it to your config folder. This will also be performed after updates.", + + "delete_contents": "Would you like to remove the existing '/atmosphere/contents/' directory? This will prevent crashes if you have sysmodules that do not support the latest Atmosphère. Please note that it will delete all your existing sysmodules and cheats." diff --git a/source/confirm_page.cpp b/source/confirm_page.cpp index c9840d1..07274b5 100644 --- a/source/confirm_page.cpp +++ b/source/confirm_page.cpp @@ -26,9 +26,7 @@ ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool this->label->setHorizontalAlign(NVG_ALIGN_CENTER); this->label->setParent(this); - this->registerAction("", brls::Key::B, [this] { - return true; - }); + this->registerAction("", brls::Key::B, [this] { return true; }); } void ConfirmPage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) diff --git a/source/dialogue_page.cpp b/source/dialogue_page.cpp index d7bc565..4d8369b 100644 --- a/source/dialogue_page.cpp +++ b/source/dialogue_page.cpp @@ -38,6 +38,8 @@ DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text) this->button2, brls::FocusDirection::LEFT, this->button1); + + this->registerAction("", brls::Key::B, [this] { return true; }); } void DialoguePage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) diff --git a/source/main_frame.cpp b/source/main_frame.cpp index 3d9cbd7..98cd834 100644 --- a/source/main_frame.cpp +++ b/source/main_frame.cpp @@ -51,8 +51,6 @@ MainFrame::MainFrame() : TabFrame() this->addTab("menus/main_tools"_i18n , new ToolsTab(tag)); - this->registerAction("" , brls::Key::B, [this] { - return true; - }); + this->registerAction("" , brls::Key::B, [this] { return true; }); } diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp index 71915d9..ce09f72 100644 --- a/source/tools_tab.cpp +++ b/source/tools_tab.cpp @@ -153,11 +153,11 @@ ToolsTab::ToolsTab(std::string tag) : brls::List() move->getClickEvent()->subscribe([&](brls::View* view){ chdir("/"); std::string error = ""; - if(std::filesystem::exists(MOVE_FILES_JSON)){ - error = copyFiles(MOVE_FILES_JSON); + if(std::filesystem::exists(COPY_FILES_JSON)){ + error = copyFiles(COPY_FILES_JSON); } else{ - error = "menus/move_files_not_found"_i18n; + error = "menus/copy_files_not_found"_i18n; } brls::Dialog* dialog = new brls::Dialog(error); brls::GenericEvent::Callback callback = [dialog](brls::View* view) { diff --git a/source/utils.cpp b/source/utils.cpp index 48654c6..4194f33 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -180,15 +180,17 @@ void extractArchive(archiveType type, std::string tag){ break; case ams_cfw: if(isArchive(AMS_FILENAME)){ - overwriteInis = showDialogBox("menus/ultils_overwrite"_i18n , "menus/utils_no"_i18n , "menus/utils_yes"_i18n ); - if(showDialogBox("menus/ultils_overwrite"_i18n , "menus/utils_no"_i18n , "menus/utils_yes"_i18n) == 0) + overwriteInis = showDialogBox("menus/ultils_overwrite"_i18n , "menus/utils_no"_i18n, "menus/utils_yes"_i18n); + usleep(800000); + int deleteContents = showDialogBox("menus/delete_contents"_i18n , "menus/utils_no"_i18n , "menus/utils_yes"_i18n); + if(deleteContents == 1) removeDir(AMS_CONTENTS); extract(AMS_FILENAME, ROOT_PATH, overwriteInis); } break; } - if(std::filesystem::exists(MOVE_FILES_JSON)) - copyFiles(MOVE_FILES_JSON); + if(std::filesystem::exists(COPY_FILES_JSON)) + copyFiles(COPY_FILES_JSON); } void progressTest(std::string url, archiveType type){ @@ -208,7 +210,6 @@ std::string formatListItemTitle(const std::string str, size_t maxScore) { return str.substr(0, i-1) + "\u2026"; } } - return str; } @@ -366,7 +367,7 @@ std::string readVersion(const char* path){ std::string copyFiles(const char* path) { nlohmann::json toMove; - std::ifstream f(MOVE_FILES_JSON); + std::ifstream f(COPY_FILES_JSON); f >> toMove; f.close(); std::string error = ""; diff --git a/source/worker_page.cpp b/source/worker_page.cpp index 7e2b33a..70a266d 100644 --- a/source/worker_page.cpp +++ b/source/worker_page.cpp @@ -21,6 +21,7 @@ WorkerPage::WorkerPage(brls::StagedAppletFrame* frame, const std::string& text, this->button->setParent(this); this->registerAction("", brls::Key::B, [this] { return true; }); + this->registerAction("", brls::Key::A, [this] { return true; }); } void WorkerPage::draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx)