mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-29 10:56:01 +00:00
few tweaks and added dialogue to delete /atmosphere/contents/
This commit is contained in:
parent
149fe3a86e
commit
dfb0566000
8 changed files with 60 additions and 27 deletions
|
@ -1,6 +1,8 @@
|
|||
# AIO-switch-updater
|
||||
![releases](https://img.shields.io/github/downloads/HamletDuFromage/AIO-switch-updater/total)
|
||||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/HamletDuFromage/AIO-switch-updater/Build%20AIO-switch-updater)
|
||||
|
||||
[//]: <![GitHub Workflow Status](https://img.shields.io/github/workflow/status/HamletDuFromage/AIO-switch-updater/Build%20AIO-switch-updater)>
|
||||
|
||||
![tag](https://img.shields.io/github/v/release/HamletDuFromage/AIO-switch-updater)
|
||||
![GitHub](https://img.shields.io/github/license/HamletDuFromage/aio-switch-updater)
|
||||
|
||||
|
|
|
@ -9,9 +9,17 @@
|
|||
#define PREFIX "/switch/aio-switch-updater/aio-switch-updater-v"
|
||||
#define FORWARDER_PATH "/config/aio-switch-updater/aiosu-forwarder.nro"
|
||||
|
||||
int removeDir(const char* path)
|
||||
{
|
||||
Result ret = 0;
|
||||
FsFileSystem *fs = fsdevGetDeviceFileSystem("sdmc");
|
||||
if (R_FAILED(ret = fsFsDeleteDirectoryRecursively(fs, path))) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
||||
{
|
||||
std::filesystem::create_directory(PATH);
|
||||
for (const auto & entry : std::filesystem::directory_iterator(PATH)){
|
||||
|
@ -25,9 +33,7 @@ int main(int argc, char* argv[])
|
|||
std::filesystem::create_directory(PATH);
|
||||
std::filesystem::remove(FULL_PATH);
|
||||
std::filesystem::rename(CONFIG_PATH, FULL_PATH);
|
||||
std::filesystem::remove_all("/config/aio-switch-updater/switch/aio-switch-updater/");
|
||||
rmdir("/config/aio-switch-updater/switch/aio-switch-updater/");
|
||||
rmdir("/config/aio-switch-updater/switch/");
|
||||
removeDir("/config/aio-switch-updater/switch/");
|
||||
}
|
||||
|
||||
std::filesystem::remove(FORWARDER_PATH);
|
||||
|
|
|
@ -37,4 +37,5 @@ Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PA
|
|||
void saveVersion(std::string version, const char* path);
|
||||
std::string readVersion(const char* path);
|
||||
void cp(const char *to, const char *from);
|
||||
std::string copyFiles(const char* path);
|
||||
std::string copyFiles(const char* path);
|
||||
int removeDir(const char* path);
|
|
@ -55,7 +55,7 @@ AppPage::AppPage(const bool cheatSlips) : AppletFrame(true, true)
|
|||
continue;
|
||||
}
|
||||
|
||||
listItem = new brls::ListItem(formatListItemTitle(std::string(langEntry->name)), "", formatApplicationId(tid));
|
||||
listItem = new brls::ListItem(std::string(langEntry->name), "", formatApplicationId(tid));
|
||||
listItem->setThumbnail(controlData.icon, sizeof(controlData.icon));
|
||||
if(cheatSlips){
|
||||
listItem->getClickEvent()->subscribe([&, tid](brls::View* view) {
|
||||
|
|
|
@ -26,8 +26,7 @@ ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool
|
|||
this->label->setHorizontalAlign(NVG_ALIGN_CENTER);
|
||||
this->label->setParent(this);
|
||||
|
||||
this->registerAction("menus/Back"_i18n , brls::Key::B, [this] {
|
||||
brls::Application::popView();
|
||||
this->registerAction("", brls::Key::B, [this] {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -109,7 +109,24 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid) : AppletFrame(true, true)
|
|||
dialog->open();
|
||||
}
|
||||
}
|
||||
if(error == 0) brls::Application::popView();
|
||||
if(error == 0) {
|
||||
/* brls::Dialog* dialog = new brls::Dialog("menus/cheatslips_success"_i18n);
|
||||
bool dialogResult = false;
|
||||
bool result = false;
|
||||
brls::GenericEvent::Callback callback = [dialog, &dialogResult](brls::View* view) {
|
||||
dialogResult = true;
|
||||
dialog->close();
|
||||
};
|
||||
dialog->addButton("menus/Ok_button"_i18n , callback);
|
||||
dialog->setCancelable(true);
|
||||
dialog->open();
|
||||
while(result == false){
|
||||
usleep(1);
|
||||
result = dialogResult;
|
||||
}
|
||||
dialogResult = false; */
|
||||
brls::Application::popView();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -180,7 +197,7 @@ std::string DownloadCheatsPage::GetCheatsTitle(json cheat) {
|
|||
}
|
||||
res.erase(res.length() - 3);
|
||||
if(res.size() > 80){
|
||||
res = res.substr(0, 79) + "...";
|
||||
res = res.substr(0, 79) + "\u2026";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "json.hpp"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
|
@ -179,12 +178,9 @@ ToolsTab::ToolsTab(std::string tag) : brls::List()
|
|||
std::filesystem::remove(FW_ZIP_PATH);
|
||||
std::filesystem::remove(CHEATS_ZIP_PATH);
|
||||
std::filesystem::remove(SIGPATCHES_ZIP_PATH);
|
||||
std::filesystem::remove_all(AMS_DIRECTORY_PATH);
|
||||
rmdir(AMS_DIRECTORY_PATH);
|
||||
std::filesystem::remove_all(SEPT_DIRECTORY_PATH);
|
||||
rmdir(SEPT_DIRECTORY_PATH);
|
||||
std::filesystem::remove_all(FW_DIRECTORY_PATH);
|
||||
rmdir(FW_DIRECTORY_PATH);
|
||||
removeDir(AMS_DIRECTORY_PATH);
|
||||
removeDir(SEPT_DIRECTORY_PATH);
|
||||
removeDir(FW_DIRECTORY_PATH);
|
||||
brls::Dialog* dialog = new brls::Dialog("menus/All_done"_i18n);
|
||||
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
|
||||
dialog->close();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "main_frame.hpp"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
|
@ -77,12 +78,12 @@ void downloadArchive(std::string url, archiveType type){
|
|||
}
|
||||
}
|
||||
|
||||
int dialogResult = -1;
|
||||
|
||||
int showDialogBox(std::string text, std::string opt){
|
||||
int dialogResult = -1;
|
||||
int result = -1;
|
||||
brls::Dialog* dialog = new brls::Dialog(text);
|
||||
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
|
||||
brls::GenericEvent::Callback callback = [dialog, &dialogResult](brls::View* view) {
|
||||
dialogResult = 0;
|
||||
dialog->close();
|
||||
};
|
||||
|
@ -93,18 +94,18 @@ int showDialogBox(std::string text, std::string opt){
|
|||
usleep(1);
|
||||
result = dialogResult;
|
||||
}
|
||||
dialogResult = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
||||
int dialogResult = -1;
|
||||
int result = -1;
|
||||
brls::Dialog* dialog = new brls::Dialog(text);
|
||||
brls::GenericEvent::Callback callback1 = [dialog](brls::View* view) {
|
||||
brls::GenericEvent::Callback callback1 = [dialog, &dialogResult](brls::View* view) {
|
||||
dialogResult = 0;
|
||||
dialog->close();
|
||||
};
|
||||
brls::GenericEvent::Callback callback2 = [dialog](brls::View* view) {
|
||||
brls::GenericEvent::Callback callback2 = [dialog, &dialogResult](brls::View* view) {
|
||||
dialogResult = 1;
|
||||
dialog->close();
|
||||
};
|
||||
|
@ -116,7 +117,6 @@ int showDialogBox(std::string text, std::string opt1, std::string opt2){
|
|||
usleep(1);
|
||||
result = dialogResult;
|
||||
}
|
||||
dialogResult = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -128,8 +128,8 @@ void extractArchive(archiveType type, std::string tag){
|
|||
switch(type){
|
||||
case sigpatches:
|
||||
if(isArchive(SIGPATCHES_FILENAME)) {
|
||||
std::string backup(HEKATE_IPL_PATH);
|
||||
backup += ".old";
|
||||
/* std::string backup(HEKATE_IPL_PATH);
|
||||
backup += ".old"; */
|
||||
if(std::filesystem::exists(HEKATE_IPL_PATH)){
|
||||
overwriteInis = showDialogBox("menus/utils_do"_i18n + std::string(HEKATE_IPL_PATH) +"?", "menus/utils_no"_i18n , "menus/utils_yes"_i18n );
|
||||
if(overwriteInis == 0){
|
||||
|
@ -181,11 +181,14 @@ void extractArchive(archiveType type, std::string tag){
|
|||
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)
|
||||
removeDir(AMS_CONTENTS);
|
||||
extract(AMS_FILENAME, ROOT_PATH, overwriteInis);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(std::filesystem::exists(MOVE_FILES_JSON))
|
||||
copyFiles(MOVE_FILES_JSON);
|
||||
}
|
||||
}
|
||||
|
||||
void progressTest(std::string url, archiveType type){
|
||||
|
@ -384,3 +387,12 @@ std::string copyFiles(const char* path) {
|
|||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int removeDir(const char* path) {
|
||||
Result ret = 0;
|
||||
FsFileSystem *fs = fsdevGetDeviceFileSystem("sdmc");
|
||||
if (R_FAILED(ret = fsFsDeleteDirectoryRecursively(fs, path))) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue