mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-28 12:22:02 +00:00
updated borealis
This commit is contained in:
parent
24ec7e414d
commit
149fe3a86e
7 changed files with 42 additions and 28 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
void cp(const char *to, const char *from);
|
||||
std::string copyFiles(const char* path);
|
|
@ -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."
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -51,4 +51,8 @@ MainFrame::MainFrame() : TabFrame()
|
|||
|
||||
this->addTab("menus/main_tools"_i18n , new ToolsTab(tag));
|
||||
|
||||
this->registerAction("" , brls::Key::B, [this] {
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -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<std::string>()).parent_path()) + "/");
|
||||
cp(it.key().c_str(), it.value().get<std::string>().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){
|
||||
|
|
|
@ -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<std::string>()).parent_path()) + "/");
|
||||
cp(it.key().c_str(), it.value().get<std::string>().c_str());
|
||||
}
|
||||
else {
|
||||
error += it.key() + "\n";
|
||||
}
|
||||
}
|
||||
if(error == "") {
|
||||
error = "menus/All_done"_i18n;
|
||||
}
|
||||
else {
|
||||
error = "menus/files_not_found"_i18n + error;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue