1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-08 11:31:43 +00:00

Fixed stuck extracting progress bar

This commit is contained in:
flb 2020-09-21 08:53:59 +02:00
parent fa63d66027
commit 1b56d6f15a
4 changed files with 30 additions and 4 deletions

View file

@ -45,7 +45,7 @@ DATA := data
INCLUDES := include lib/minizip/include
APP_TITLE := AIO Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 1.0.1
APP_VERSION := 1.0.3
#ROMFS := $(BUILD)/romfs
BOREALIS_PATH := lib/borealis

View file

@ -10,6 +10,7 @@
#define SIGPATCHES_URL "https://hamletdufromage.github.io/sigpatches-updater/sigpatches.html"
#define SIGPATCHES_FILENAME "/config/aio-switch-updater/sigpatches.zip"
#define HEKATE_IPL_PATH "/bootloader/hekate_ipl.ini"
#define FIRMWARE_URL "https://hamletdufromage.github.io/switch-fw/firmwares.html"
#define FIRMWARE_FILENAME "/config/aio-switch-updater/firmware.zip"

View file

@ -2,10 +2,11 @@
void extract(const char * filename, const char* workingPath, int overwriteInis){
ProgressEvent::instance().reset();
ProgressEvent::instance().setStep(1);
chdir(workingPath);
zipper::Unzipper unzipper(filename);
std::vector<zipper::ZipEntry> entries = unzipper.entries();
ProgressEvent::instance().setTotalSteps(entries.size());
ProgressEvent::instance().setTotalSteps(entries.size() + 1);
for (int i = 0; i < (int) entries.size(); i++){
if(overwriteInis == 0){
if(entries[i].name.substr(entries[i].name.length() - 4) != ".ini")
@ -17,7 +18,7 @@ void extract(const char * filename, const char* workingPath, int overwriteInis){
ProgressEvent::instance().setStep(i);
}
unzipper.close();
ProgressEvent::instance().setStep(entries.size());
ProgressEvent::instance().setStep(ProgressEvent::instance().getMax());
}

View file

@ -93,7 +93,31 @@ void extractArchive(archiveType type){
switch(type){
case sigpatches:
if(isArchive(SIGPATCHES_FILENAME)) extract(SIGPATCHES_FILENAME);
if(isArchive(SIGPATCHES_FILENAME)) {
std::string backup(HEKATE_IPL_PATH);
backup += ".old";
if(std::filesystem::exists(HEKATE_IPL_PATH)){
dialog->open();
while(overwriteInis == -1){
usleep(1);
overwriteInis = dialogResult;
}
dialogResult = -1;
if(overwriteInis == 0){
std::filesystem::remove(backup);
std::filesystem::rename(HEKATE_IPL_PATH, backup);
extract(SIGPATCHES_FILENAME);
std::filesystem::remove(HEKATE_IPL_PATH);
std::filesystem::rename(backup, HEKATE_IPL_PATH);
}
else{
extract(SIGPATCHES_FILENAME);
}
}
else{
extract(SIGPATCHES_FILENAME);
}
}
break;
case cheats:
titles = getInstalledTitlesNs();