mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-29 10:56:01 +00:00
added ams version display
This commit is contained in:
parent
cc95fc66eb
commit
242e93fdca
9 changed files with 36 additions and 32 deletions
|
@ -1,7 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "constants.hpp"
|
||||
#include <string>
|
||||
|
||||
bool isServiceRunning(const char *serviceName);
|
||||
CFW getCFW();
|
||||
std::string getAmsInfo();
|
||||
const extern CFW running_cfw;
|
|
@ -13,5 +13,5 @@ class ListDownloadTab : public brls::List
|
|||
brls::Label *cheatSlipLabel;
|
||||
public:
|
||||
ListDownloadTab(const archiveType type);
|
||||
~ListDownloadTab();
|
||||
|
||||
};
|
|
@ -147,7 +147,8 @@
|
|||
"reboot_rcm": "The Switch will now reboot to a special payload in order to finalise the install.",
|
||||
"install_hekate": "Do you want to also download Hekate?\nIf not, the Switch will now launch reboot to a special payload in order to finalise the install.",
|
||||
"delete_contents": "Would you like to remove the existing '/atmosphere/contents/' directory? This will prevent crashes if you have sysmodules that do not support the latest Atmosph\u00e8re. Please note that it will delete all your existing sysmodules, mods and cheats.",
|
||||
"delete_sysmodules_flags": "Would you like to delete all the custom sysmodules startup flags? This will turn off all your sysmodules and prevent crashes if you have sysmodules that do not support the latest Atmosphère."
|
||||
"delete_sysmodules_flags": "Would you like to delete all the custom sysmodules startup flags? This will turn off all your sysmodules and prevent crashes if you have sysmodules that do not support the latest Atmosphère.",
|
||||
"current_ams": "\ue016 Current Atmosphère: "
|
||||
},
|
||||
"net": {
|
||||
"title": "Internet settings"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "dialogue_page.hpp"
|
||||
#include "worker_page.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "current_cfw.hpp"
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
|
@ -14,27 +15,24 @@ AmsTab::AmsTab() :
|
|||
brls::List()
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> links;
|
||||
std::string operation = "menus/main/getting"_i18n ;
|
||||
std::string operation("menus/main/getting"_i18n);
|
||||
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
||||
operation += "menus/main/cfw"_i18n;
|
||||
links = getLinks(AMS_URL);
|
||||
operation += "menus/main/cfw"_i18n ;
|
||||
this->description->setText(
|
||||
"menus/main/ams_text"_i18n
|
||||
"menus/main/ams_text"_i18n + (running_cfw == ams ? "\n" + "menus/ams_update/current_ams"_i18n + getAmsInfo() : "")
|
||||
);
|
||||
|
||||
this->addView(description);
|
||||
|
||||
|
||||
|
||||
int nbLinks = links.size();
|
||||
if(nbLinks){
|
||||
auto hekate_link = getLinks(HEKATE_URL);
|
||||
std::string hekate_url = hekate_link[0].second;
|
||||
std::string text_hekate = "menus/common/download"_i18n + hekate_link[0].first;
|
||||
std::string text_hekate = "menus/common/download"_i18n + hekate_link[0].first;
|
||||
|
||||
for (int i = 0; i < nbLinks; i++){
|
||||
std::string url = links[i].second;
|
||||
std::string text("menus/common/download"_i18n + links[i].first + "menus/common/from"_i18n + url);
|
||||
std::string text("menus/common/download"_i18n + links[i].first + "menus/common/from"_i18n + url);
|
||||
listItem = new brls::ListItem(links[i].first);
|
||||
listItem->setHeight(LISTITEM_HEIGHT);
|
||||
listItem->getClickEvent()->subscribe([&, text, text_hekate, url, hekate_url, operation](brls::View* view) {
|
||||
|
@ -44,22 +42,22 @@ AmsTab::AmsTab() :
|
|||
new ConfirmPage(stagedFrame, text)
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n , [url](){downloadArchive(url, ams_cfw);})
|
||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url](){downloadArchive(url, ams_cfw);})
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n , [](){extractArchive(ams_cfw);})
|
||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [](){extractArchive(ams_cfw);})
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new DialoguePage(stagedFrame, text_hekate)
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n , [hekate_url](){downloadArchive(hekate_url, cfw);})
|
||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [hekate_url](){downloadArchive(hekate_url, cfw);})
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n , [](){extractArchive(cfw);})
|
||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [](){extractArchive(cfw);})
|
||||
);
|
||||
stagedFrame->addStage(
|
||||
new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n , false, true)
|
||||
new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n, false, true)
|
||||
);
|
||||
brls::Application::pushView(stagedFrame);
|
||||
});
|
||||
|
@ -69,11 +67,10 @@ AmsTab::AmsTab() :
|
|||
else{
|
||||
notFound = new brls::Label(
|
||||
brls::LabelStyle::DESCRIPTION,
|
||||
"menus/main/links_not_found"_i18n ,
|
||||
"menus/main/links_not_found"_i18n,
|
||||
true
|
||||
);
|
||||
notFound->setHorizontalAlign(NVG_ALIGN_CENTER);
|
||||
this->addView(notFound);
|
||||
}
|
||||
|
||||
}
|
|
@ -116,7 +116,7 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
|
|||
changes.push_back("\uE016 Minor fixes, refactored old switch-cheats updater code and changed way to detect CFW");
|
||||
|
||||
verTitles.push_back("v2.4.0");
|
||||
changes.push_back("\uE016 Added option to extract the entire gbatemp cheats archive.\n\uE016 Shortened load times.\n\uE016 Added German localisation (thanks to github.com/Slluxx).\n\uE016 Added option to disable sysmodules prior to updating.\n\uE016 Improved Japanese localisation (thanks to github.com/yyoossk).");
|
||||
changes.push_back("\uE016 Added option to extract the entire gbatemp cheats archive.\n\uE016 Shortened load times.\n\uE016 Added German localisation (thanks to github.com/Slluxx).\n\uE016 Added option to disable sysmodules prior to updating.\n\uE016 Improved Japanese localisation (thanks to github.com/yyoossk).\n\uE016 Added current AMS version display.");
|
||||
|
||||
for(int i = verTitles.size() -1 ; i >= 0; i--){
|
||||
listItem = new brls::ListItem(verTitles[i]);
|
||||
|
|
|
@ -34,4 +34,19 @@ CFW getCFW(){
|
|||
if(isServiceRunning("tx")) return sxos;
|
||||
}
|
||||
return ams;
|
||||
}
|
||||
|
||||
std::string getAmsInfo() {
|
||||
u64 version;
|
||||
std::string res;
|
||||
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65000, &version))){
|
||||
res += std::to_string((version >> 56) & ((1 << 8) - 1)) + "." +
|
||||
std::to_string((version >> 48) & ((1 << 8) - 1)) + "." +
|
||||
std::to_string((version >> 40) & ((1 << 8) - 1));
|
||||
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65007, &version)))
|
||||
res += version ? "|E" : "|S";
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return "Couldn't retrieve AMS version";
|
||||
}
|
|
@ -18,7 +18,7 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
|
|||
{
|
||||
std::vector<std::pair<std::string, std::string>> links;
|
||||
std::vector<std::pair<std::string, std::string>> sxoslinks;
|
||||
std::string operation = "menus/main/getting"_i18n ;
|
||||
std::string operation("menus/main/getting"_i18n);
|
||||
std::string firmwareText("menus/main/firmware_text"_i18n);
|
||||
|
||||
std::string currentCheatsVer = "menus/main/cheats_text"_i18n ;
|
||||
|
@ -182,9 +182,4 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
|
|||
});
|
||||
this->addView(cheatslipsItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ListDownloadTab::~ListDownloadTab(){
|
||||
|
||||
}
|
|
@ -32,17 +32,14 @@ int main(int argc, char* argv[])
|
|||
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);
|
||||
#endif
|
||||
|
||||
// Initialize services with a PC shim
|
||||
setsysInitialize();
|
||||
plInitialize(PlServiceType_User);
|
||||
|
||||
nsInitialize();
|
||||
socketInitializeDefault();
|
||||
nxlinkStdio();
|
||||
|
||||
splInitialize();
|
||||
|
||||
romfsInit();
|
||||
|
||||
createTree(CONFIG_PATH);
|
||||
|
||||
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);
|
||||
|
@ -55,11 +52,8 @@ int main(int argc, char* argv[])
|
|||
brls::Application::pushView(new WarningPage("menus/main/launch_warning"_i18n));
|
||||
}
|
||||
|
||||
|
||||
// Run the app
|
||||
while (brls::Application::mainLoop());
|
||||
|
||||
// Exit
|
||||
romfsExit();
|
||||
splExit();
|
||||
socketExit();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "json.hpp"
|
||||
#include <fstream>
|
||||
#include "utils.hpp"
|
||||
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
using json = nlohmann::json;
|
||||
|
|
Loading…
Reference in a new issue