From 149fe3a86e50469056f39ec7b24834e41f2041a2 Mon Sep 17 00:00:00 2001 From: flb Date: Mon, 15 Feb 2021 01:02:34 +0100 Subject: [PATCH] updated borealis --- include/tools_tab.hpp | 2 +- include/utils.hpp | 3 ++- resources/i18n/en-US/menus.json | 5 +++-- source/list_download_tab.cpp | 2 +- source/main_frame.cpp | 4 ++++ source/tools_tab.cpp | 28 +++++----------------------- source/utils.cpp | 26 ++++++++++++++++++++++++++ 7 files changed, 42 insertions(+), 28 deletions(-) diff --git a/include/tools_tab.hpp b/include/tools_tab.hpp index 50128f2..0e64885 100644 --- a/include/tools_tab.hpp +++ b/include/tools_tab.hpp @@ -18,7 +18,7 @@ class ToolsTab : public brls::List brls::ListItem* hideTabs; //brls::ListItem* ntcp; brls::ListItem* netSettings; - brls::ListItem* moveFiles; + brls::ListItem* move; brls::ListItem* browser; brls::StagedAppletFrame* stagedFrame; diff --git a/include/utils.hpp b/include/utils.hpp index 24bbccc..d1f70b1 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -36,4 +36,5 @@ std::string getLatestTag(const char *url); Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PATH]); void saveVersion(std::string version, const char* path); std::string readVersion(const char* path); -void cp(const char *to, const char *from); \ No newline at end of file +void cp(const char *to, const char *from); +std::string copyFiles(const char* path); \ No newline at end of file diff --git a/resources/i18n/en-US/menus.json b/resources/i18n/en-US/menus.json index e9e377d..15f4d16 100644 --- a/resources/i18n/en-US/menus.json +++ b/resources/i18n/en-US/menus.json @@ -95,7 +95,8 @@ "quota_cheatslips": "Quota exceeded for today!\nHead on to 'https://www.cheatslips.com/subscriptions' to see how to increase it.", "cheat_cheat_content": "Cheatsheet content", "app_cheatslips_label": "Select a game to download cheats for.", - "wrong_cheatslips_id": "Couldn't retrieve token, make sure you enter you login properly", + "wrong_cheatslips_id": "Couldn't retrieve token, make sure you enter you login properly", + "keyboard_no_show": "If they keyboard did not show up, try running the app with full RAM access (title redirection)", "see_more": "See more", "download_cheats": "Download cheats and go back", "bid_not_found": "Couldn't obtain build ID. Try launching aio-switch-updater in applet mode while the game is running.", @@ -234,7 +235,7 @@ "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 tools 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" + "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." diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index 9aa2e88..e441554 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -169,7 +169,7 @@ ListDownloadTab::ListDownloadTab(const archiveType type) : return true; } else { - brls::Dialog* dialog = new brls::Dialog("menus/wrong_cheatslips_id"_i18n); + brls::Dialog* dialog = new brls::Dialog("menus/wrong_cheatslips_id"_i18n + "\n" + "menus/keyboard_no_show"_i18n); brls::GenericEvent::Callback callback = [dialog](brls::View* view) { dialog->close(); }; diff --git a/source/main_frame.cpp b/source/main_frame.cpp index 8f20351..3d9cbd7 100644 --- a/source/main_frame.cpp +++ b/source/main_frame.cpp @@ -51,4 +51,8 @@ MainFrame::MainFrame() : TabFrame() this->addTab("menus/main_tools"_i18n , new ToolsTab(tag)); + this->registerAction("" , brls::Key::B, [this] { + return true; + }); + } diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp index e0526d6..effacfd 100644 --- a/source/tools_tab.cpp +++ b/source/tools_tab.cpp @@ -150,30 +150,12 @@ ToolsTab::ToolsTab(std::string tag) : brls::List() browser->setHeight(LISTITEM_HEIGHT); this->addView(browser); - moveFiles = new brls::ListItem("menus/tool_copyFiles"_i18n ); - moveFiles->getClickEvent()->subscribe([&](brls::View* view){ + move = new brls::ListItem("menus/tool_copyFiles"_i18n ); + move->getClickEvent()->subscribe([&](brls::View* view){ chdir("/"); std::string error = ""; if(std::filesystem::exists(MOVE_FILES_JSON)){ - json toMove; - std::ifstream f(MOVE_FILES_JSON); - f >> toMove; - f.close(); - for (auto it = toMove.begin(); it != toMove.end(); ++it) { - if(std::filesystem::exists(it.key())) { - createTree(std::string(std::filesystem::path(it.value().get()).parent_path()) + "/"); - cp(it.key().c_str(), it.value().get().c_str()); - } - else { - error += it.key() + "\n"; - } - } - if(error == "") { - error = "menus/All_done"_i18n; - } - else { - error = "menus/files_not_found"_i18n + error; - } + error = copyFiles(MOVE_FILES_JSON); } else{ error = "menus/move_files_not_found"_i18n; @@ -186,8 +168,8 @@ ToolsTab::ToolsTab(std::string tag) : brls::List() dialog->setCancelable(true); dialog->open(); }); - moveFiles->setHeight(LISTITEM_HEIGHT); - this->addView(moveFiles); + move->setHeight(LISTITEM_HEIGHT); + this->addView(move); cleanUp = new brls::ListItem("menus/tool_cleanUp"_i18n ); cleanUp->getClickEvent()->subscribe([&](brls::View* view){ diff --git a/source/utils.cpp b/source/utils.cpp index 96ad35e..f0da8b3 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -183,6 +183,8 @@ void extractArchive(archiveType type, std::string tag){ overwriteInis = showDialogBox("menus/ultils_overwrite"_i18n , "menus/utils_no"_i18n , "menus/utils_yes"_i18n ); extract(AMS_FILENAME, ROOT_PATH, overwriteInis); } + if(std::filesystem::exists(MOVE_FILES_JSON)) + copyFiles(MOVE_FILES_JSON); } } @@ -358,3 +360,27 @@ std::string readVersion(const char* path){ } return version; } + +std::string copyFiles(const char* path) { + nlohmann::json toMove; + std::ifstream f(MOVE_FILES_JSON); + f >> toMove; + f.close(); + std::string error = ""; + for (auto it = toMove.begin(); it != toMove.end(); ++it) { + if(std::filesystem::exists(it.key())) { + createTree(std::string(std::filesystem::path(it.value().get()).parent_path()) + "/"); + cp(it.key().c_str(), it.value().get().c_str()); + } + else { + error += it.key() + "\n"; + } + } + if(error == "") { + error = "menus/All_done"_i18n; + } + else { + error = "menus/files_not_found"_i18n + error; + } + return error; +}