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

revert breaking changes

This commit is contained in:
flb 2021-10-03 19:54:09 +02:00
parent 86d0a2fddb
commit 29547e2993
14 changed files with 39 additions and 47 deletions

View file

@ -14,7 +14,7 @@ private:
bool erista = true;
public:
ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done = false, bool reboot = false, bool erista = true);
ConfirmPage(brls::StagedAppletFrame* frame, const std::string& text, bool done = false, bool reboot = false, bool erista = true);
~ConfirmPage();
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;

View file

@ -35,7 +35,7 @@ JCPage::JCPage() : AppletFrame(true, true)
for (int i = profiles.size() - 1; i >= 0; i--) {
std::vector<int> value = profiles[i].second;
listItem = new brls::ListItem(profiles[i].first);
listItem->getClickEvent()->subscribe([&value](brls::View* view) {
listItem->getClickEvent()->subscribe([value](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/joy_con/label"_i18n);
stagedFrame->addStage(

View file

@ -34,7 +34,7 @@ PCPage::PCPage() : AppletFrame(true, true)
for (int i = profiles.size() - 1; i >= 0; i--) {
std::vector<int> value = profiles[i].second;
listItem = new brls::ListItem(profiles[i].first);
listItem->getClickEvent()->subscribe([&value](brls::View* view) {
listItem->getClickEvent()->subscribe([value](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/pro_con/label"_i18n);
stagedFrame->addStage(

View file

@ -71,7 +71,7 @@ void AmsTab::CreateDownloadItems(const nlohmann::ordered_json& cfw_links, bool h
std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
listItem = new brls::ListItem(link.first);
listItem->setHeight(LISTITEM_HEIGHT);
listItem->getClickEvent()->subscribe([this, &text, &text_hekate, &url, &hekate_url, &operation, hekate](brls::View* view) {
listItem->getClickEvent()->subscribe([this, text, text_hekate, url, hekate_url, operation, hekate](brls::View* view) {
if (!erista && !std::filesystem::exists(MARIKO_PAYLOAD_PATH)) {
brls::Application::crash("menus/errors/mariko_payload_missing"_i18n);
}
@ -180,7 +180,7 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules)
"menus/common/off"_i18n);
}
name_map.insert(std::pair(module_value.at("displayName"), module.key()));
deepseaListItem->registerAction("menus/ams_update/show_module_description"_i18n, brls::Key::Y, [&module_value] {
deepseaListItem->registerAction("menus/ams_update/show_module_description"_i18n, brls::Key::Y, [module_value] {
brls::Dialog* dialog;
dialog = new brls::Dialog(fmt::format("{}:\n{}", module_value.at("repo"), module_value.at("description")));
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
@ -197,7 +197,7 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules)
appView->addTab(category.key(), list);
}
appView->registerAction("menus/ams_update/download_deepsea_package"_i18n, brls::Key::X, [this, &lists, &name_map] {
appView->registerAction("menus/ams_update/download_deepsea_package"_i18n, brls::Key::X, [this, lists, name_map] {
std::set<std::string> desired_modules;
for (const auto& list : lists) {
for (size_t i = 0; i < list->getViewsCount(); i++) {
@ -213,10 +213,10 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules)
for (const auto& e : desired_modules)
request_url += e + ";";
CreateStagedFrames("menus/common/download"_i18n + "Custom DeepSea package" + "menus/common/from"_i18n + request_url,
this->CreateStagedFrames("menus/common/download"_i18n + "Custom DeepSea package" + "menus/common/from"_i18n + request_url,
request_url,
"menus/ams_update/get_custom_deepsea"_i18n,
erista);
this->erista);
return true;
});
appView->registerAction("", brls::Key::PLUS, [this] { return true; });

View file

@ -84,7 +84,7 @@ void AppPage::CreateDownloadAllButton()
}
text += url;
download = new brls::ListItem("menus/cheats/dl_latest"_i18n);
download->getClickEvent()->subscribe([&url, &text](brls::View* view) {
download->getClickEvent()->subscribe([url, text](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/cheats/getting_cheats"_i18n);
stagedFrame->addStage(
@ -167,7 +167,7 @@ void AppPage_CheatSlips::CreateLabel()
void AppPage_CheatSlips::DeclareGameListItem(const std::string& name, u64 tid, NsApplicationControlData** controlData)
{
listItem->getClickEvent()->subscribe([tid, &name](brls::View* view) { brls::Application::pushView(new DownloadCheatsPage_CheatSlips(tid, name)); });
listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { brls::Application::pushView(new DownloadCheatsPage_CheatSlips(tid, name)); });
AppPage::DeclareGameListItem(name, tid, controlData);
}
@ -186,7 +186,7 @@ void AppPage_Gbatemp::CreateLabel()
void AppPage_Gbatemp::DeclareGameListItem(const std::string& name, u64 tid, NsApplicationControlData** controlData)
{
listItem->getClickEvent()->subscribe([tid, &name](brls::View* view) { brls::Application::pushView(new DownloadCheatsPage_GbaTemp(tid, name)); });
listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { brls::Application::pushView(new DownloadCheatsPage_GbaTemp(tid, name)); });
AppPage::DeclareGameListItem(name, tid, controlData);
}
@ -277,7 +277,7 @@ void AppPage_DownloadedCheats::DeclareGameListItem(const std::string& name, u64
{
auto tid_str = util::formatApplicationId(tid);
if (titles.find(tid_str) != titles.end()) {
listItem->getClickEvent()->subscribe([tid, &name](brls::View* view) { show_cheats::ShowCheatFiles(tid, name); });
listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { show_cheats::ShowCheatFiles(tid, name); });
listItem->registerAction("menus/cheats/delete_cheats"_i18n, brls::Key::Y, [&tid_str] {
brls::Dialog* dialog = new brls::Dialog(extract::removeCheatsDirectory(fmt::format("{}{}", util::getContentsPath(), tid_str)) ? "menus/common/all_done"_i18n : fmt::format("menus/cheats/deletion_error"_i18n, tid_str));
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {

View file

@ -214,7 +214,7 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
for (int i = verTitles.size() - 1; i >= 0; i--) {
listItem = new brls::ListItem(verTitles[i]);
change = changes[i];
listItem->getClickEvent()->subscribe([&change](brls::View* view) {
listItem->getClickEvent()->subscribe([change](brls::View* view) {
brls::Dialog* dialog = new brls::Dialog(change);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
@ -231,7 +231,7 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
void ChangelogPage::ShowChangelogContent(const std::string version, const std::string content)
{
listItem = new brls::ListItem(version);
listItem->getClickEvent()->subscribe([&version, &content](brls::View* view) {
listItem->getClickEvent()->subscribe([version, content](brls::View* view) {
brls::AppletFrame* appView = new brls::AppletFrame(true, true);
brls::PopupFrame::open(version, appView, "", "");

View file

@ -44,7 +44,7 @@ CheatsPage::CheatsPage() : AppletFrame(true, true)
std::string cheatsVer = util::downloadFileToString(CHEATS_URL_VERSION);
if (cheatsVer != "") {
dlAll = new brls::ListItem("menus/cheats/dl_all"_i18n);
dlAll->getClickEvent()->subscribe([&cheatsVer](brls::View* view) {
dlAll->getClickEvent()->subscribe([cheatsVer](brls::View* view) {
std::string url;
switch (CurrentCfw::running_cfw) {
case CFW::sxos:

View file

@ -10,7 +10,7 @@
namespace i18n = brls::i18n;
using namespace i18n::literals;
ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done, bool reboot, bool erista) : done(done), reboot(reboot), erista(erista)
ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, const std::string& text, bool done, bool reboot, bool erista) : done(done), reboot(reboot), erista(erista)
{
this->button = (new brls::Button(brls::ButtonStyle::REGULAR))->setLabel(done ? "menus/common/back"_i18n : "menus/common/continue"_i18n);
this->button->setParent(this);

View file

@ -96,7 +96,7 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) :
GetBuildID();
this->setTitle(name);
this->setFooterText("v" + std::to_string(this->version / 0x10000));
this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, &name] {
this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] {
show_cheats::ShowCheatSheet(this->tid, this->bid, name);
return true;
});
@ -191,7 +191,7 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const
//Something else went wrong
continue;
}
listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, &cheat] {
listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, cheat] {
if (cheat.find("titles") != cheat.end()) {
ShowCheatsContent(cheat.at("titles"));
}
@ -344,7 +344,7 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
for (const auto& p : cheatsJson[this->bid].items()) {
json cheat = p.value();
listItem = new ::brls::ListItem(cheat.at("title"));
listItem->registerAction("menus/cheats/gbatemp_dl_cheatcode"_i18n, brls::Key::A, [this, &cheat] {
listItem->registerAction("menus/cheats/gbatemp_dl_cheatcode"_i18n, brls::Key::A, [this, cheat] {
WriteCheats(cheat.at("content"));
brls::Dialog* dialog = new brls::Dialog(fmt::format("menus/cheats/gbatemp_dl_successful_dl"_i18n, cheat.at("title")));
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {

View file

@ -25,7 +25,7 @@ DownloadPayloadPage::DownloadPayloadPage(const nlohmann::ordered_json& payloads)
std::string path = std::string(BOOTLOADER_PL_PATH) + link.first;
std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
listItem = new brls::ListItem(link.first);
listItem->getClickEvent()->subscribe([&text, &url, &path](brls::View* view) {
listItem->getClickEvent()->subscribe([text, url, path](brls::View* view) {
fs::createTree(BOOTLOADER_PL_PATH);
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/tools/getting_payload"_i18n);

View file

@ -54,12 +54,12 @@ void ListDownloadTab::createList(contentType type)
this->size = links.size();
if (this->size) {
for (const auto& link : links) {
std::string title = link.first;
std::string url = link.second;
std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
const std::string title = link.first;
const std::string url = link.second;
const std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
listItem = new brls::ListItem(link.first);
listItem->setHeight(LISTITEM_HEIGHT);
listItem->getClickEvent()->subscribe([this, &text, &url, &title, &type](brls::View* view) {
listItem->getClickEvent()->subscribe([this, text, url, title, type](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle(fmt::format("menus/main/getting"_i18n, contentTypeNames[(int)type].data()));
stagedFrame->addStage(new ConfirmPage(stagedFrame, text));

View file

@ -118,9 +118,9 @@ NetPage::NetPage() : AppletFrame(true, true)
listItem = new brls::ListItem(values["name"]);
else
listItem = new brls::ListItem("Unnamed");
listItem->getClickEvent()->subscribe([this, &values](brls::View* view) {
listItem->getClickEvent()->subscribe([this, values](brls::View* view) {
brls::Dialog* dialog = new brls::Dialog(values.dump(0).substr(1, values.dump(0).size() - 2));
brls::GenericEvent::Callback callbackOk = [this, &dialog, &values](brls::View* view) {
brls::GenericEvent::Callback callbackOk = [this, dialog, values](brls::View* view) {
nifmInitialize(NifmServiceType_Admin);
NifmNetworkProfileData profile;
nifmGetCurrentNetworkProfile(&profile);

View file

@ -20,20 +20,16 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
for (const auto& payload : payloads) {
std::string payload_path = payload;
listItem = new brls::ListItem(payload_path);
listItem->getClickEvent()->subscribe([&payload](brls::View* view) {
listItem->getClickEvent()->subscribe([payload](brls::View* view) {
util::rebootToPayload(payload);
brls::Application::popView();
});
if (CurrentCfw::running_cfw == CFW::ams) {
listItem->registerAction("menus/payloads/set_reboot_payload"_i18n, brls::Key::X, [&payload_path] {
std::string res1;
if (fs::copyFile(payload_path, REBOOT_PAYLOAD_PATH)) {
res1 += "menus/payloads/copy_success"_i18n + payload_path + "menus/payloads/to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'.";
}
else {
res1 += "Failed.";
}
brls::Dialog* dialog = new brls::Dialog(res1);
listItem->registerAction("menus/payloads/set_reboot_payload"_i18n, brls::Key::X, [payload_path] {
std::string res = fs::copyFile(payload_path, REBOOT_PAYLOAD_PATH)
? "menus/payloads/copy_success"_i18n + payload_path + "menus/payloads/to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'."
: "Failed.";
brls::Dialog* dialog = new brls::Dialog(res);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
@ -43,15 +39,11 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
return true;
});
}
listItem->registerAction("menus/payloads/set_update_bin"_i18n, brls::Key::Y, [&payload] {
std::string res2;
if (fs::copyFile(payload, UPDATE_BIN_PATH)) {
res2 += "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(UPDATE_BIN_PATH) + "'.";
}
else {
res2 += "Failed.";
}
brls::Dialog* dialog = new brls::Dialog(res2);
listItem->registerAction("menus/payloads/set_update_bin"_i18n, brls::Key::Y, [payload] {
std::string res = fs::copyFile(payload, UPDATE_BIN_PATH)
? "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(UPDATE_BIN_PATH) + "'."
: "Failed.";
brls::Dialog* dialog = new brls::Dialog(res);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};

View file

@ -30,7 +30,7 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
if (!tag.empty() && tag != AppVersion) {
updateApp = new brls::ListItem("menus/tools/update_app"_i18n + tag + ")");
std::string text("menus/tools/dl_app"_i18n + std::string(APP_URL));
updateApp->getClickEvent()->subscribe([&text, &tag](brls::View* view) {
updateApp->getClickEvent()->subscribe([text, tag](brls::View* view) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/common/updating"_i18n);
stagedFrame->addStage(
@ -202,7 +202,7 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
list->addView(listItem);
for (auto& language : languages) {
listItem = new brls::ListItem(language.first);
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [&language] {
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [language] {
json updatedLanguage = json::object();
updatedLanguage["language"] = language.second;
std::ofstream out(LANGUAGE_JSON);