1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-29 10:56:01 +00:00

Small UX tweaks

This commit is contained in:
flb 2021-10-26 15:48:24 +02:00
parent c3fd0c2726
commit 62b0a162be
17 changed files with 50 additions and 80 deletions

View file

@ -24,6 +24,7 @@ protected:
brls::ListItem* del;
uint64_t tid = 0;
std::string bid = "";
std::string name;
u32 version = 0;
DownloadCheatsPage(uint64_t tid, const std::string& name);
@ -32,6 +33,7 @@ protected:
void GetVersion();
void GetBuildIDFromFile();
void WriteCheats(const std::string& cheatContent);
void AddCheatsfileListItem();
typedef struct
{

@ -1 +1 @@
Subproject commit 7c6ed9fae4f14f3bf5b31e53d57e2c230bd5fccc
Subproject commit b055712a92a176258dcabc516ce1056bdf3a4730

View file

@ -64,7 +64,6 @@
"dl_payloads": "Payloads herunterladen",
"select": " Wähle ein Payload zum neustarten aus.",
"not_found": "Konnte keinen Downloadlink finden. Stelle sicher, dass deine Switch Internetzugriff hat.\nWenn das Problem bestehen bleibt, öffne bitte ein issue auf Github.",
"reboot_title": "Neustart Menü",
"set_reboot_payload": "Setze als reboot_payload.bin",
"set_update_bin": "Setze als /bootloader/update.bin",
"copy_success": "Erfolgreich kopiert '",

View file

@ -45,7 +45,8 @@
"not_found": "No proper cheat codes could be found for this game",
"show_existing": "Show existing",
"delete_cheats": "Delete cheats for this game",
"deletion_error": "Couldn't delete the cheat files for game with id:\n{}"
"deletion_error": "Couldn't delete the cheat files for game with id:\n{}",
"show_cheat_files": "Show all cheat files"
},
"common": {
"downloading": "Downloading…",
@ -78,7 +79,6 @@
"dl_payloads": "Download payloads",
"select": " Select a payload to reboot to.",
"not_found": "Could not find a download link, make sure the Switch has access to the internet.\nIf this problem persists, please open an issue on Github.",
"reboot_title": "Reboot menu",
"set_reboot_payload": "Set as reboot_payload.bin",
"set_update_bin": "Set as /bootloader/update.bin",
"copy_success": "Successfully copied '",

View file

@ -42,7 +42,6 @@
"dl_payloads": "Descargar payloads",
"select": " Selecciona el payload al que reiniciar.",
"not_found": "No se pudo encontrar un enlace de descarga, asegúrate de que tu Switch tiene acceso a internet.\nSi el problema persiste, por favor abre un issue en Github.",
"reboot_title": "Menú de reinicio",
"set_reboot_payload": "Poner como reboot_payload.bin",
"set_update_bin": "Poner como /bootloader/update.bin",
"copy_success": "Éxito al copiar '",

View file

@ -43,7 +43,6 @@
"dl_payloads": "Télécharger des payloads",
"select": "Selectionner un payload à injecter.",
"not_found": "Impossible de trouver un lien de téléchargement, assurez vous que la Switch soit connectée à internet.\nSi ce problème persiste, veuillez ouvrir une issue sur GitHub.",
"reboot_title": "Menu des payloads",
"set_reboot_payload": "Déf comme reboot_payload.bin",
"set_update_bin": "Déf comme bootloader/update.bin",
"copy_success": "Copié avec succès '",

View file

@ -42,7 +42,6 @@
"dl_payloads": "Scarica payloads",
"select": " Seleziona un payload da riavviare.",
"not_found": "Non riesco a trova un link di download, accertati che la Switch abbia accesso a internet.\nSe il problema persiste, apri una issue su Github.",
"reboot_title": "Menu di riavvio",
"set_reboot_payload": "Imposta come reboot_payload.bin",
"set_update_bin": "Imposta come /bootloader/update.bin",
"copy_success": "Copiato con successo '",

View file

@ -76,7 +76,6 @@
"dl_payloads": "ペイロードをダウンロード",
"select": " 再起動するペイロードを選択します。",
"not_found": "ダウンロードリンクが見つかりませんでした。スイッチがインターネットにアクセスできることを確認してください。\nこの問題が解決しない場合は、Githubで問題を開いてください。",
"reboot_title": "メニューを再起動",
"set_reboot_payload": "reboot_payload.binにセットする",
"set_update_bin": "/bootloader/update.binにセットする",
"copy_success": "コピー完了 '",

View file

@ -64,7 +64,6 @@
"dl_payloads": "Pobierz payloady",
"select": " Wybierz payload do ponownego uruchomienia.",
"not_found": "Nie można było uzyskać linku pobierania. Upewnij się, że Switch ma połączenie z internetem.\nJeśli problem nie ustąpi, utwórz nowy problem na Githubie.",
"reboot_title": "Menu ponownego uruchomienia",
"set_reboot_payload": "Ustaw jako reboot_payload.bin",
"set_update_bin": "Ustaw jako /bootloader/update.bin",
"copy_success": "Skopiowano pomyślnie '",

View file

@ -42,7 +42,6 @@
"dl_payloads": "Baixar payloads",
"select": " Selecione a payload que deseja.",
"not_found": "Não foi possível encontrar um link de download, certifique-se de que seu Switch tenha acesso à Internet.\nSe o problema persistir, abra um 'issue' no Github.",
"reboot_title": "Menu de reinicio",
"set_reboot_payload": "Colocar como reboot_payload.bin",
"set_update_bin": "Colocar como /bootloader/update.bin",
"copy_success": "Cópia realizada '",

View file

@ -44,7 +44,6 @@
"dl_payloads": "下载注入程序",
"select": "选择一个注入文件重启.",
"not_found": "如果点击后界面没有反应,请确认switch是否连接网络\n如果检查后问题依然存在,请到github上给我提交issue",
"reboot_title": "重启菜单",
"set_reboot_payload": "设置 reboot_payload.bin",
"set_update_bin": "设置 bootloader/update.bin",
"copy_success": "成功复制 '",

View file

@ -78,7 +78,6 @@
"dl_payloads": "下載注入檔案",
"select": " 選擇重開機時的注入檔案",
"not_found": "無法使用下載連結請檢查Switch是否可正常存取網路連線。\n如果網路正常仍無法使用請使用Github提出問題來進行回報。",
"reboot_title": "重開機選單",
"set_reboot_payload": "設定為 reboot_payload.bin",
"set_update_bin": "設定為 /bootloader/update.bin",
"copy_success": "成功複製 '",

View file

@ -105,15 +105,15 @@ namespace show_cheats {
}
} // namespace show_cheats
DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) : AppletFrame(true, true), tid(tid)
DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) : AppletFrame(true, true), tid(tid), name(name)
{
this->list = new brls::List();
this->GetVersion();
this->GetBuildID();
this->setTitle(name);
this->setTitle(this->name);
this->setFooterText("v" + std::to_string(this->version / 0x10000));
this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] { // TODO: figure out why that doesn't show up for empty lists
show_cheats::ShowCheatSheet(this->tid, this->bid, name);
this->brls::AppletFrame::registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this] {
show_cheats::ShowCheatSheet(this->tid, this->bid, this->name);
return true;
});
this->rebuildHints();
@ -168,24 +168,29 @@ void DownloadCheatsPage::GetBuildIDFromFile()
void DownloadCheatsPage::WriteCheats(const std::string& cheatContent)
{
std::string path = util::getContentsPath();
std::string tidstr = util::formatApplicationId(this->tid);
path += tidstr + "/cheats/";
std::string path = util::getContentsPath() + util::formatApplicationId(this->tid) + "/cheats/";
fs::createTree(path);
path += this->bid + ".txt";
std::ofstream cheatFile;
cheatFile.open(path, std::ios::app);
std::ofstream cheatFile(path + this->bid + ".txt", std::ios::app);
cheatFile << "\n\n"
<< cheatContent;
}
void DownloadCheatsPage::AddCheatsfileListItem()
{
brls::ListItem* item = new brls::ListItem("menus/cheats/show_cheat_files"_i18n);
item->getClickEvent()->subscribe([this](brls::View* view) {
show_cheats::ShowCheatFiles(this->tid, this->name);
});
this->list->addView(item);
}
DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name)
{
label = new brls::Label(
this->label = new brls::Label(
brls::LabelStyle::DESCRIPTION,
"menus/cheats/cheatslips_dl"_i18n + "\n\uE016 Build ID: " + this->bid,
true);
list->addView(label);
this->list->addView(this->label);
if (this->bid != "") {
std::vector<std::string> headers = {"accept: application/json"};
@ -194,38 +199,30 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const
if (cheatsInfo.find("cheats") != cheatsInfo.end()) {
for (const auto& p : cheatsInfo.at("cheats").items()) {
json cheat = p.value();
try {
listItem = new ::brls::ToggleListItem(GetCheatsTitle(cheat), 0, "", "\uE016", "o");
} catch (const std::out_of_range& e) {
//Empty titles
continue;
} catch (...) {
//Something else went wrong
continue;
}
listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, cheat] {
listItem = new brls::ToggleListItem(GetCheatsTitle(cheat), 0, "", "\uE016", "o");
this->listItem->registerAction("menus/cheats/cheatslips_see_more"_i18n, brls::Key::Y, [this, cheat] {
if (cheat.find("titles") != cheat.end()) {
ShowCheatsContent(cheat.at("titles"));
}
return true;
});
toggles.push_back(std::make_pair(listItem, cheat.at("id")));
this->toggles.push_back(std::make_pair(listItem, cheat.at("id")));
list->addView(listItem);
}
if (list->getViewsCount() > 1)
list->addView(new brls::ListItemGroupSpacing(true));
if (this->list->getViewsCount() > 1)
this->list->addView(new brls::ListItemGroupSpacing(true));
}
}
else {
label = new brls::Label(
this->label = new brls::Label(
brls::LabelStyle::REGULAR,
"menus/cheats/bid_not_found"_i18n,
true);
list->addView(label);
this->list->addView(label);
}
list->registerAction((this->bid != "") ? "menus/cheats/cheatslips_dl_cheats"_i18n : "brls/hints/back"_i18n, brls::Key::B, [this] {
this->list->registerAction((this->bid != "") ? "menus/cheats/cheatslips_dl_cheats"_i18n : "brls/hints/back"_i18n, brls::Key::B, [this] {
std::vector<int> ids;
for (auto& e : toggles) {
if (e.first->getToggleState()) {
@ -298,7 +295,7 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const
}
return true;
});
this->AddCheatsfileListItem();
this->setContentView(list);
}
@ -307,7 +304,7 @@ std::string DownloadCheatsPage_CheatSlips::GetCheatsTitle(json cheat)
std::string res = "";
if (cheat.find("titles") != cheat.end()) {
for (auto& p : cheat.at("titles")) {
res += ".at(" + p.get<std::string>() + ")" + " - ";
res += "[" + p.get<std::string>() + "]" + " - ";
}
}
return res;
@ -317,13 +314,13 @@ void DownloadCheatsPage_CheatSlips::ShowCheatsContent(nlohmann::ordered_json tit
{
brls::AppletFrame* appView = new brls::AppletFrame(true, true);
brls::List* list = new brls::List();
brls::ListItem* listItem;
brls::ListItem* titlesItem;
for (auto& p : titles) {
listItem = new brls::ListItem(p.get<std::string>());
listItem->registerAction("", brls::Key::A, [this] {
titlesItem = new brls::ListItem(p.get<std::string>());
titlesItem->registerAction("", brls::Key::A, [this] {
return true;
});
list->addView(listItem);
list->addView(titlesItem);
}
appView->setContentView(list);
brls::PopupFrame::open("menus/cheats/sheet_content"_i18n, appView, "", "");
@ -331,11 +328,11 @@ void DownloadCheatsPage_CheatSlips::ShowCheatsContent(nlohmann::ordered_json tit
DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name)
{
label = new brls::Label(
this->label = new brls::Label(
brls::LabelStyle::DESCRIPTION,
fmt::format("menus/cheats/gbatemp_dl"_i18n, this->bid),
true);
list->addView(label);
this->list->addView(label);
if (this->bid != "") {
nlohmann::ordered_json cheatsJson;
@ -343,7 +340,7 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
if (cheatsJson.find(this->bid) != cheatsJson.end()) {
for (const auto& p : cheatsJson[this->bid].items()) {
json cheat = p.value();
listItem = new ::brls::ListItem(cheat.at("title"));
this->listItem = new brls::ListItem(cheat.at("title"));
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")));
@ -355,9 +352,9 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
dialog->open();
return true;
});
list->addView(listItem);
this->list->addView(listItem);
}
list->addView(new brls::ListItemGroupSpacing(true));
this->list->addView(new brls::ListItemGroupSpacing(true));
}
}
@ -368,6 +365,6 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
true);
list->addView(label);
}
this->setContentView(list);
this->AddCheatsfileListItem();
this->setContentView(this->list);
}

View file

@ -14,6 +14,7 @@
#include <vector>
#include "download.hpp"
#include "current_cfw.hpp"
#include "fs.hpp"
#include "main_frame.hpp"
#include "progress_event.hpp"
@ -79,7 +80,7 @@ namespace extract {
unzipper.extractEntry(entry.name);
if (entry.name.substr(0, 13) == "hekate_ctcaer") {
fs::copyFile("/" + entry.name, UPDATE_BIN_PATH);
if (util::showDialogBox(fmt::format("menus/utils/set_hekate_reboot_payload"_i18n, UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH), "menus/common/yes"_i18n, "menus/common/no"_i18n) == 0) {
if (CurrentCfw::running_cfw == CFW::ams && util::showDialogBox(fmt::format("menus/utils/set_hekate_reboot_payload"_i18n, UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH), "menus/common/yes"_i18n, "menus/common/no"_i18n) == 0) {
fs::copyFile(UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH);
}
}

View file

@ -148,7 +148,7 @@ void ListDownloadTab::setDescription(contentType type)
description->setText("menus/main/cheats_text"_i18n + this->currentCheatsVer);
break;
case contentType::payloads:
description->setText("menus/main/payloads_label"_i18n);
description->setText(fmt::format("menus/main/payloads_label"_i18n, BOOTLOADER_PL_PATH));
break;
default:
break;

View file

@ -9,7 +9,9 @@ using namespace i18n::literals;
PayloadPage::PayloadPage() : AppletFrame(true, true)
{
this->setTitle("menus/payloads/reboot_title"_i18n);
this->updateActionHint(brls::Key::B, "");
this->updateActionHint(brls::Key::PLUS, "");
list = new brls::List();
label = new brls::Label(
brls::LabelStyle::DESCRIPTION,

View file

@ -8,7 +8,6 @@
#include "changelog_page.hpp"
#include "cheats_page.hpp"
#include "confirm_page.hpp"
/* #include "download_payload_page.hpp" */
#include "extract.hpp"
#include "fs.hpp"
#include "hide_tabs_page.hpp"
@ -65,33 +64,12 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
});
PCcolor->setHeight(LISTITEM_HEIGHT);
/* downloadPayload = new brls::ListItem("menus/tools/dl_payloads"_i18n + std::string(BOOTLOADER_PL_PATH));
downloadPayload->getClickEvent()->subscribe([&, payloads](brls::View* view) {
brls::Application::pushView(new DownloadPayloadPage(payloads));
});
downloadPayload->setHeight(LISTITEM_HEIGHT); */
rebootPayload = new brls::ListItem("menus/tools/inject_payloads"_i18n);
rebootPayload->getClickEvent()->subscribe([](brls::View* view) {
brls::Application::pushView(new PayloadPage());
brls::PopupFrame::open("menus/tools/inject_payloads"_i18n, new PayloadPage(), "", "");
});
rebootPayload->setHeight(LISTITEM_HEIGHT);
/* ntcp = new brls::ListItem("menus/ntcp"_i18n);
ntcp->getClickEvent()->subscribe([](brls::View* view){
std::string res = syncTime();
brls::Dialog* dialog = new brls::Dialog(res);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
});
ntcp->setHeight(LISTITEM_HEIGHT);
this->addView(ntcp); */
netSettings = new brls::ListItem("menus/tools/internet_settings"_i18n);
netSettings->getClickEvent()->subscribe([](brls::View* view) {
brls::PopupFrame::open("menus/tools/internet_settings"_i18n, new NetPage(), "", "");
@ -232,7 +210,6 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
if (!util::getBoolValue(hideStatus, "cheats")) this->addView(cheats);
if (!util::getBoolValue(hideStatus, "jccolor")) this->addView(JCcolor);
if (!util::getBoolValue(hideStatus, "pccolor")) this->addView(PCcolor);
/* if (!util::getBoolValue(hideStatus, "downloadpayload")) this->addView(downloadPayload); */
if (erista && !util::getBoolValue(hideStatus, "rebootpayload")) this->addView(rebootPayload);
if (!util::getBoolValue(hideStatus, "netsettings")) this->addView(netSettings);
if (!util::getBoolValue(hideStatus, "browser")) this->addView(browser);