1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2025-01-01 12:16:02 +00:00
flb 2021-07-21 01:37:33 +02:00
parent 755bd8dfc1
commit bd1cc7ee08

View file

@ -22,7 +22,8 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
std::string operation("menus/main/getting"_i18n); std::string operation("menus/main/getting"_i18n);
std::string firmwareText("menus/main/firmware_text"_i18n); std::string firmwareText("menus/main/firmware_text"_i18n);
std::string currentCheatsVer = "menus/main/cheats_text"_i18n; std::string currentCheatsVer = "";
std::string newCheatsVer = "";
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true); this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
switch(type){ switch(type){
@ -57,23 +58,23 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
); );
break; break;
case archiveType::cheats: case archiveType::cheats:
std::string cheatsVer = util::downloadFileToString(CHEATS_URL_VERSION); newCheatsVer = util::downloadFileToString(CHEATS_URL_VERSION);
if(cheatsVer != ""){ if(newCheatsVer != ""){
switch(CurrentCfw::running_cfw){ switch(CurrentCfw::running_cfw){
case CFW::sxos: case CFW::sxos:
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + cheatsVer + ")", CHEATS_URL_TITLES)); links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_TITLES));
break; break;
case CFW::ams: case CFW::ams:
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + cheatsVer + ")", CHEATS_URL_CONTENTS)); links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_CONTENTS));
break; break;
case CFW::rnx: case CFW::rnx:
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + cheatsVer + ")", CHEATS_URL_CONTENTS)); links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_CONTENTS));
break; break;
} }
} }
operation += "menus/main/cheats"_i18n; operation += "menus/main/cheats"_i18n;
currentCheatsVer += util::readVersion(CHEATS_VERSION); currentCheatsVer = util::readVersion(CHEATS_VERSION);
this->description->setText(currentCheatsVer); this->description->setText("menus/main/cheats_text"_i18n + currentCheatsVer);
break; break;
} }
@ -86,15 +87,17 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url); std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
listItem = new brls::ListItem(link.first); listItem = new brls::ListItem(link.first);
listItem->setHeight(LISTITEM_HEIGHT); listItem->setHeight(LISTITEM_HEIGHT);
listItem->getClickEvent()->subscribe([&, text, url, type, operation](brls::View* view) { listItem->getClickEvent()->subscribe([&, text, url, type, operation, newCheatsVer, currentCheatsVer](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle(operation); stagedFrame->setTitle(operation);
stagedFrame->addStage( stagedFrame->addStage(
new ConfirmPage(stagedFrame, text) new ConfirmPage(stagedFrame, text)
); );
if(type != archiveType::cheats || newCheatsVer != currentCheatsVer || !std::filesystem::exists(CHEATS_ZIP_PATH)) {
stagedFrame->addStage( stagedFrame->addStage(
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, type](){util::downloadArchive(url, type);}) new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, type](){util::downloadArchive(url, type);})
); );
}
stagedFrame->addStage( stagedFrame->addStage(
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [type](){util::extractArchive(type);}) new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [type](){util::extractArchive(type);})
); );