1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-24 18:42:05 +00:00

use more f-strings for localization, small code refactor

This commit is contained in:
flb 2021-10-27 17:56:29 +02:00
parent fa35245bb1
commit d6aa6716a0
20 changed files with 69 additions and 102 deletions

View file

@ -22,7 +22,7 @@ DATA := data
INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.16.0
APP_VERSION := 2.16.1
TARGET := $(notdir $(CURDIR))
ROMFS := resources

View file

@ -42,10 +42,9 @@ constexpr const char DEEPSEA_PACKAGE_PATH[] = "/config/deepsea/customPackage.jso
constexpr const char CUSTOM_PACKS_PATH[] = "/config/aio-switch-updater/customPacks.json";
constexpr const char CHEATS_RELEASE_URL[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/tag/v1.0";
constexpr const char CHEATS_URL_TITLES[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/titles.zip";
constexpr const char CHEATS_URL_CONTENTS[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/contents.zip";
constexpr const char CHEATS_URL_VERSION[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/VERSION";
constexpr const char CHEATS_URL_TITLES[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/latest/download/titles.zip";
constexpr const char CHEATS_URL_CONTENTS[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/latest/download/contents.zip";
constexpr const char CHEATS_URL_VERSION[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/latest/download/VERSION";
constexpr const char LOOKUP_TABLE_URL[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/versions.json";
constexpr const char LOOKUP_TABLE_CBOR[] = "https://github.com/HamletDuFromage/switch-cheats-db/raw/master/versions.cbor";
constexpr const char VERSIONS_DIRECTORY[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/versions/";
@ -68,6 +67,7 @@ constexpr const char REINX_PATH[] = "/ReiNX/";
constexpr const char CONTENTS_PATH[] = "contents/";
constexpr const char TITLES_PATH[] = "titles/";
constexpr const char COLOR_PICKER_URL[] = "https://git.io/jcpicker";
constexpr const char COLOR_PROFILES_PATH[] = "/config/aio-switch-updater/jc_profiles.json";
constexpr const char PC_COLOR_PATH[] = "/config/aio-switch-updater/pc_profiles.json";
@ -94,6 +94,7 @@ constexpr const char COPY_FILES_TXT[] = "/config/aio-switch-updater/copy_files.t
constexpr const char LANGUAGE_JSON[] = "/config/aio-switch-updater/language.json";
constexpr const char HOMEBREW[] = "/config/aio-switch-updater/language.json";
constexpr const char ROMFS_PATH[] = "romfs:/";
constexpr const char ROMFS_FORWARDER[] = "romfs:/aiosu-forwarder.nro";
constexpr const char FORWARDER_PATH[] = "/config/aio-switch-updater/aiosu-forwarder.nro";

View file

@ -10,6 +10,7 @@ private:
brls::ListItem* listItem;
brls::ListItem* reboot;
brls::ListItem* shutDown;
void RegisterCopyAction(brls::Key key, const std::string& payload_path, const std::string& payload_dest, const std::string& action_name);
public:
PayloadPage();

View file

@ -88,9 +88,6 @@
},
"joy_con": {
"title": "Joy-Con Farbwechseler",
"desc_1": "Du kannst die Farbe deiner Joy-Cons ändern. Stell sicher, dass die Joy-Cons angeschlossen sind.\nFarbprofile werden gespeichert in: '",
"desc_2": "'. Gehe auf 'https://git.io/jcpicker' ",
"desc_3": "um deine eigenen benutzerdefinierten Profile zu erstellen.",
"backup": "Derzeitiges Profil sichern",
"label": "Joy-Con Farbwechseler",
"backing_up": "Sichern des momentanen Farbprofils. Stell sicher, dass die Joy-Cons angeschlossen sind. Wenn der Prozess hängt, versuche die JC's ab- und anzuschließen.",
@ -110,7 +107,7 @@
"getting": "Herunterladen: {}",
"firmware_text": "\ue016 firmware von: 'https://darthsternie.net/switch-firmwares/'. Sobald runtergeladen, wird sie in '/firmware' entpackt . Danach kannst du das Update mit Daybreak installieren.\n\ue016 Mometnane FW: ",
"cheats_text": "\ue016 Lade ein täglich geupdatetes Archiv von 'gbatemp.net' runter. Cheats von Spielen die du nicht besitzt, werden nicht entpackt. Du kannst updates für ausgewählte Spiele unter 'Tools->Cheat menu' deaktivieren.\n\ue016 Momentane Cheatversion: ",
"get_cheats": "Lade GBAtemp.net Cheatarchiv herunter (ver ",
"get_cheats": "Lade GBAtemp.net Cheatarchiv herunter (ver {})",
"sigpatches": "Sigpatches",
"sigpatches_text": "\ue016 Sigpatches erlauben dir inoffizielle NSPs zu installieren und starten. Stell sicher, dass du die korrekten patches für dein Setup auswählst(reines Atmosphère or Hekate+Atmosphère). Starte die Konsole neu um die Patches zu aktivieren.",
"firmware": "Firmware",
@ -150,7 +147,7 @@
"pro_cons": "Ändere die farbe deines Pro Controlers",
"dl_payloads": "Lade Payloads hierhin runter: ",
"inject_payloads": "Injiziere Payload",
"update_app": "Update die App (v",
"update_app": "Update die App (v{})",
"dl_app": "Lade herunter:\nAIO-switch-updater\n\nVon:\n",
"changelog": "Changelog",
"clean_up": "Lösche übrig gebliebende Dateien",
@ -222,4 +219,4 @@
"zh-Hant": "Traditionelles Chinesisch (zh-Hant)",
"zh-Hans": "Vereinfachtes Chinesisch (zh-Hans)"
}
}
}

View file

@ -81,14 +81,11 @@
"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.",
"set_reboot_payload": "Set as reboot_payload.bin",
"set_update_bin": "Set as /bootloader/update.bin",
"copy_success": "Successfully copied '",
"to": "' to '"
"copy_success": "Successfully copied `{}` to `{}`."
},
"joy_con": {
"title": "Joy-Con color swapper",
"desc_1": "You can change the internal color of your Joy-Cons. Make sure they're docked.\nColor profiles are stored in '",
"desc_2": "'. Go to 'https://git.io/jcpicker' ",
"desc_3": "to generate your own custom profiles.",
"description": "You can change the internal color of your Joy-Cons. Make sure they're docked.\nColor profiles are stored in `{}`. Go to '{}' to generate your own custom profiles.",
"backup": "Backup current color profile",
"label": "Joy-Con color swapper",
"backing_up": "Backing up the current color profile. Make sure the Joy-Con are docked. If the process hangs, try docking/undocking the JCs.",
@ -108,7 +105,7 @@
"getting": "Getting {}",
"firmware_text": "\ue016 Firmware dumps from 'https://darthsternie.net/switch-firmwares/'. Once downloaded, it will be extracted in '/firmware'. You can then install the update through Daybreak.\n\ue016 Current FW: ",
"cheats_text": "\uE016 This will download a daily updated archive of cheat codes from 'gbatemp.net'. Cheat codes for games you don't have installed won't be extracted to your SD card. You can turn off cheat updates for specific games in 'Tools->Cheat menu'.\n\uE016 Current cheats version: ",
"get_cheats": "Download GBAtemp.net cheat archive (ver ",
"get_cheats": "Download GBAtemp.net cheat archive (ver {})",
"get_all_cheats:": "Download GBAtemp.net cheat archive",
"sigpatches": "sigpatches",
"sigpatches_text": "\ue016 Sigpatches allow your Switch to install and run unofficial NSP files. Make sure you pick the correct sigpatches for your setup (pure Atmosph\u00e8re or Hekate+Atmosph\u00e8re). Reboot the console to apply patches.",
@ -149,7 +146,7 @@
"dl_payloads": "Download payloads to ",
"inject_payloads": "Inject payload",
"getting_payload": "Getting payload",
"update_app": "Update the app (v",
"update_app": "Update the app (v{})",
"dl_app": "Downloading:\nAIO-switch-updater\n\nFrom:\n",
"changelog": "Changelog",
"clean_up": "Clean up downloaded files",
@ -166,7 +163,7 @@
"overwrite": " Do you want to overwrite existing ",
"not_an_archive": "The downloaded file is not a zip archive. This is most likely due to a broken link. If the problem persists after more than 30 minutes, please open an issue on Github.",
"overwrite_inis": "Do you want to overwrite existing .ini config files?",
"set_hekate_reboot_payload": "Do you want to copy the Hekate payload `{}` to `{}`?"
"set_hekate_reboot_payload": "Do you want to copy the Hekate payload `{}` to `{}`?"
},
"ams_update": {
"reboot_rcm": "The Switch will now reboot to a special payload in order to finalise the install.",

View file

@ -49,9 +49,6 @@
},
"joy_con": {
"title": "Cambiar color de Joy-Con",
"desc_1": "Puedes cambiar el color interno de tus Joy-Cons. Asegúrate de que están acoplados a la consola.\nLos perfiles de colores se almacenan en '",
"desc_2": "'. Ve a 'https://git.io/jcpicker' ",
"desc_3": "para generar tus propios perfiles.",
"backup": "Copia de seguridad del perfil de color actual",
"label": "Cambiar color de Joy-Con",
"backing_up": "Haciendo copia de seguridad del perfil de color actual. Asegúrate de que los Joy-Con están acoplados a la consola. Si el proceso se cuelga, prueba desacoplar y acoplar los Joy-Cons.",
@ -85,7 +82,7 @@
"joy_cons": "Cambiar color de los Joy-Cons",
"dl_payloads": "Descargar payloads a ",
"inject_payloads": "Inyectar payload",
"update_app": "Actualizar la aplicación (v",
"update_app": "Actualizar la aplicación (v{})",
"dl_app": "Descargando:\nAIO-switch-updater\n\nDesde:\n",
"changelog": "Cambios"
},

View file

@ -50,9 +50,6 @@
},
"joy_con": {
"title": "Changement de couleur des Joy-Cons",
"desc_1": "Vous pouvez changer la couleur interne de vos Joy-Cons. Assurez vous qu'ils soient bien ancrés à la Switch.\nLes profils de couleur se trouvent dans '",
"desc_2": "'. Visitez 'https://git.io/jcpicker' ",
"desc_3": "pour générer des profils personalisés.",
"backup": "Sauvegarde du profil actuel",
"label": "Échangeur de couleurs des Joy-Con",
"backing_up": "Sauvegarde du profil actuel, assurez vous que les Joy-Cons soient bien ancrés à la Switch.",
@ -86,7 +83,7 @@
"joy_cons": "Changer la couleur des Joy-Cons",
"dl_payloads": "Télécharger des payloads dans ",
"inject_payloads": "Injecter un payload",
"update_app": "Mettre à jour l'app (v",
"update_app": "Mettre à jour l'app (v{})",
"dl_app": "Mise à jour de :\nAIO-switch-updater\n\nDepuis :\n",
"changelog": "Liste des modifications"
},

View file

@ -49,9 +49,6 @@
},
"joy_con": {
"title": "Cambia il colore dei Joy-Con",
"desc_1": "You can change the internal color of your Joy-Cons. Make sure they're docked.\nColor profiles are stored in '",
"desc_2": "'. Visita 'https://git.io/jcpicker' ",
"desc_3": "per generare i tuoi profili personalizzati.",
"backup": "Salva il profilo corrente",
"label": "Cambia il colore dei Joy-Con",
"backing_up": "Backing up the current color profile. Accertati che i Joy-Con siano collegati. Se il processo si blocca, prova a scollegarli/ricollegarli.",
@ -85,7 +82,7 @@
"joy_cons": "Cambia il colore dei Joy-Cons",
"dl_payloads": "Scarica payloads in ",
"inject_payloads": "Inietta payload",
"update_app": "Aggiorna l'app (v",
"update_app": "Aggiorna l'app (v{})",
"dl_app": "Scarico:\nAIO-switch-updater\n\nDa:\n",
"changelog": "Changelog"
},

View file

@ -46,7 +46,7 @@
"show_existing": "既存のものを表示",
"delete_cheats": "このゲームのチートを削除する",
"deletion_error": "IDのゲームのチートファイルを削除できませんでした:\n{}",
"show_cheat_files": "すべてのチートファイルを表示する"
"show_cheat_files": "すべてのチートファイルを表示する"
},
"common": {
"downloading": "ダウンロード中...",
@ -86,9 +86,6 @@
},
"joy_con": {
"title": "ジョイコンの色を変更",
"desc_1": "ジョイコンの内部の色を変更できます。それらがドッキングされていることを確認してください。\nカラープロファイルは保存されます '",
"desc_2": "'. 'https://git.io/jcpicker'に移動 ",
"desc_3": "独自のカスタムプロファイルを生成します。",
"backup": "現在のカラープロファイルをバックアップする",
"label": "ジョイコンの色を変更",
"backing_up": "現在のカラープロファイルをバックアップします。 ジョイコンがドッキングされていることを確認してください。プロセスがハングする場合は、ジョイコンをドッキング/ドッキング解除してみてください",
@ -108,7 +105,7 @@
"getting": "取得中 {}",
"firmware_text": "\ue016 ファームウェアは'https://darthsternie.net/switch-firmwares/'からダンプされます。 ダウンロードすると、「/firmware」に抽出されます。その後、Daybreakを介してアップデートをインストールできます。\n\ue016 現在のファームウェア: ",
"cheats_text": "\ue016 GBAtemp.net チートアーカイブをダウンロード",
"get_cheats": "GBAtemp.net チートアーカイブをダウンロード (ver ",
"get_cheats": "GBAtemp.net チートアーカイブをダウンロード (ver {})",
"get_all_cheats:": "GBAtemp.net チートアーカイブをダウンロードする",
"sigpatches": "sigpatch",
"sigpatches_text": "\ue016 Sigpatchを使用すると、スイッチで非公式のNSPファイルをインストールして実行できます。セットアップに適したsigpatchを選択してくださいAtmosphèreまたはHekate + Atmosphère。",
@ -149,7 +146,7 @@
"dl_payloads": "ペイロードをダウンロード ",
"inject_payloads": "ペイロード送信",
"getting_payload": "ペイロードの取得",
"update_app": "アプリを更新 (v",
"update_app": "アプリを更新 (v{})",
"dl_app": "ダウンロード中:\nAIO-switch-updater\n\nから:\n",
"changelog": "更新履歴",
"clean_up": "ダウンロードしたファイルをクリーンアップする",

View file

@ -71,9 +71,6 @@
},
"joy_con": {
"title": "Zmień kolor Joy-Conów",
"desc_1": "Możesz zmienić kolor fabrycznie przypisany do twoich Joy-Conów. Upewnij się, że są zadokowane do konsoli.\nProfile kolorów zapisywane są w '",
"desc_2": "'. Wejdź na 'https://git.io/jcpicker' ",
"desc_3": "żeby utworzyć swój własny profil kolorów.",
"backup": "Zrób kopię zapasową bieżącego profilu kolorów",
"label": "Zmień kolor Joy-Conów",
"backing_up": "Tworzę kopię zapasową bieżącego profilu kolorów. Upewnij się, że Joy-Cony są zadokowane do konsoli. Jeśli operacja zawiesi się, spróbuj wypiąć i wpiąć Joy-Cony spowrotem.",
@ -92,7 +89,7 @@
"getting": "Pobieranie {}",
"firmware_text": "\ue016 Oprogramowanie z 'https://darthsternie.net/switch-firmwares/'. Po pobraniu zostanie rozpakowane do '/firmware'. Możesz je później zainstalować korzystając z Daybreak.\n\ue016 Bieżący FW: ",
"cheats_text": "\uE016 Pobierze aktualizowaną codziennie paczkę cheatów z 'gbatemp.net'. Cheaty dla gier których nie masz zainstalowanych nie zostaną wypakowane na twoją kartę SD. Możesz wyłączyć aktualizację cheatów dla poszczególnych gier w 'Narzędzia->Menu cheatów'.\n\uE016 Bieżąca wersja cheatów: ",
"get_cheats": "Pobierz archiwum cheatów GBAtemp.net (wersja ",
"get_cheats": "Pobierz archiwum cheatów GBAtemp.net (wersja {})",
"sigpatches": "sigpatche",
"sigpatches_text": "\ue016 Sigpatche umożliwiają twojemu Switchowi instalowanie i uruchamianie nieoficjalnych plików NSP. Upewnij się, że wybierasz sigpatche zgodne z twoim setupem (czysty Atmosph\u00e8re lub Hekate+Atmosph\u00e8re). Uruchom konsolę ponownie aby zastosować zmiany.",
"firmware": "firmware",
@ -126,7 +123,7 @@
"pro_cons": "Zmień kolor Pro Controllera",
"dl_payloads": "Pobierz payloady do ",
"inject_payloads": "Wstrzyknij payload",
"update_app": "Zaktualizuj aplikację (v",
"update_app": "Zaktualizuj aplikację (v{})",
"dl_app": "Pobieranie:\nAIO-switch-updater\n\nZ:\n",
"changelog": "Dziennik zmian",
"clean_up": "Wyczyść pobrane pliki",

View file

@ -49,9 +49,6 @@
},
"joy_con": {
"title": "Mudar a cor dos Joy-Cons",
"desc_1": "Você pode alterar a cor interna dos Joy-Cons. Certifique-se de que eles estejam encaixados no console.\nPerfis de cores são armazenados em '",
"desc_2": "'. Vamos a 'https://git.io/jcpicker' ",
"desc_3": "para gerar seus próprios perfis.",
"backup": "Fazer backup do perfil de cor atual",
"label": "Mudar a cor dos Joy-Cons",
"backing_up": "Fazendo backup do perfil de cor atual. Certifique-se de que o Joy-Con esteja encaixado no console. Se o processo travar, tente desencaixar e encaixar o Joy-Cons.",
@ -85,7 +82,7 @@
"joy_cons": "Mudar a cor do Joy-Cons",
"dl_payloads": "Baixar payloads em a ",
"inject_payloads": "Injetar payload",
"update_app": "Atualizar o aplicativo (v",
"update_app": "Atualizar o aplicativo (v{})",
"dl_app": "Baixando:\nAIO-switch-updater\n\nDesde:\n",
"changelog": "Alterações"
},

View file

@ -51,9 +51,6 @@
},
"joy_con": {
"title": "Joy-Con 颜色更换器",
"desc_1": "你可以改变游戏机里的手柄颜色确保手柄已经插入switch.\n颜色风格文件存储在 ' ",
"desc_2": "'. 去这里 'https://git.io/jcpicker' ",
"desc_3": "去制作你自己的颜色主题文件",
"backup": "备份当前主题文件",
"label": "手柄颜色修改器",
"backing_up": "备份当前的颜色配置文件,确定手柄已经插入switch如果进程卡住请拔插手柄反复试一下.",
@ -87,7 +84,7 @@
"joy_cons": "改变手柄颜色",
"dl_payloads": "下载注入文件存储到 ",
"inject_payloads": "启用注入文件",
"update_app": "更新软件版本 (v",
"update_app": "更新软件版本 (v{})",
"dl_app": "下载中:\nAIO-switch-updater\n\n从:\n",
"changelog": "更新日志"
},

View file

@ -85,9 +85,6 @@
},
"joy_con": {
"title": "Joy-Con 更換顏色工具",
"desc_1": "你可以透過置換Joy-Cons內的代碼設定來自訂控制器在系統內被辨識的顏色外觀。請確認Joy-Con已確實安裝到主機。\n顏色代碼檔案才能正確覆蓋取代。'",
"desc_2": "'. 前往控制器顏色代碼檔案產生網頁:'https://git.io/jcpicker' ",
"desc_3": "製作你專屬的控制器顏色外觀",
"backup": "備份目前的控制器顏色代碼設定檔案",
"label": "Joy-Con 更換顏色工具",
"backing_up": "正在備份目前的控制器顏色代碼設定檔案請確認Joy-Con已確實安裝到主機。 如果程序無法繼續進行時請嘗試將Joy-Con從主機上取下再重新安裝到主機。",
@ -148,7 +145,7 @@
"dl_payloads": "下載注入檔案的儲存位置",
"inject_payloads": "載入注入檔案",
"getting_payload": "下載注入檔案",
"update_app": "更新app (v",
"update_app": "更新app (v{})",
"dl_app": "正在下載:\nAIO-switch-updater\n\n來源:\n",
"changelog": "更新履歷",
"clean_up": "清空下載清單",
@ -217,4 +214,4 @@
"zh-Hant": "繁體中文 (zh-Hant)",
"zh-Hans": "簡體中文 (zh-Hans)"
}
}
}

View file

@ -11,9 +11,7 @@ JCPage::JCPage() : AppletFrame(true, true)
{
this->setTitle("menus/joy_con/title"_i18n);
list = new brls::List();
std::string labelText = "menus/joy_con/desc_1"_i18n + std::string(COLOR_PROFILES_PATH) + "menus/joy_con/desc_2"_i18n +
"menus/joy_con/desc_3"_i18n;
label = new brls::Label(brls::LabelStyle::DESCRIPTION, labelText, true);
label = new brls::Label(brls::LabelStyle::DESCRIPTION, fmt::format("menus/joy_con/description"_i18n, COLOR_PROFILES_PATH, COLOR_PICKER_URL), true);
list->addView(label);
backup = new brls::ListItem("menus/joy_con/backup"_i18n);

View file

@ -212,7 +212,10 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
changes.push_back("\uE016 Implement cheat codes support for multi-content games.\n\uE016 Move payload downloads to bootloader tab.");
verTitles.push_back("v2.16.0");
changes.push_back("\uE016 Ask user about replacing reboot_payload.bin with hekate with updating hekate.\n\uE016 Added option to deleted orphaned cheats.\n\uE016 UX tweaks.");
changes.push_back("\uE016 Ask user about replacing reboot_payload.bin with hekate when updating hekate.\n\uE016 Added option to deleted orphaned cheats.\n\uE016 UX tweaks.");
verTitles.push_back("v2.16.1");
changes.push_back("\uE016 Updated Japanese localisation (https://github.com/yyoossk).\n\uE016 Updated German localisation (https://github.com/MSco).\n\uE016 Added ability to manually launch aiosu_rcm.bin.");
for (int i = verTitles.size() - 1; i >= 0; i--) {
listItem = new brls::ListItem(verTitles[i]);

View file

@ -69,7 +69,7 @@ CheatsPage::CheatsPage() : AppletFrame(true, true)
url = CHEATS_URL_CONTENTS;
break;
}
std::string text("menus/main/get_cheats"_i18n + cheatsVer + ")" + "menus/common/from"_i18n + url);
std::string text(fmt::format("menus/main/get_cheats"_i18n, cheatsVer) + "menus/common/from"_i18n + url);
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
stagedFrame->setTitle("menus/cheats/dl_all"_i18n);
stagedFrame->addStage(

View file

@ -47,7 +47,7 @@ void ListDownloadTab::createList(contentType type)
{
std::vector<std::pair<std::string, std::string>> links;
if (type == contentType::cheats && this->newCheatsVer != "")
links.push_back(std::make_pair(fmt::format("{}{})", "menus/main/get_cheats"_i18n, this->newCheatsVer), CurrentCfw::running_cfw == CFW::sxos ? CHEATS_URL_TITLES : CHEATS_URL_CONTENTS));
links.push_back(std::make_pair(fmt::format("menus/main/get_cheats"_i18n, this->newCheatsVer), CurrentCfw::running_cfw == CFW::sxos ? CHEATS_URL_TITLES : CHEATS_URL_CONTENTS));
else
links = download::getLinksFromJson(util::getValueFromKey(this->nxlinks, contentTypeNames[(int)type].data()));

View file

@ -12,65 +12,58 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
this->updateActionHint(brls::Key::B, "");
this->updateActionHint(brls::Key::PLUS, "");
list = new brls::List();
label = new brls::Label(
this->list = new brls::List();
this->label = new brls::Label(
brls::LabelStyle::DESCRIPTION,
"menus/payloads/select"_i18n,
true);
list->addView(label);
this->list->addView(this->label);
std::vector<std::string> payloads = util::fetchPayloads();
for (const auto& payload : payloads) {
std::string payload_path = payload;
listItem = new brls::ListItem(payload_path);
listItem->getClickEvent()->subscribe([payload](brls::View* view) {
util::rebootToPayload(payload);
this->listItem = new brls::ListItem(payload_path);
this->listItem->getClickEvent()->subscribe([payload_path](brls::View* view) {
util::rebootToPayload(payload_path);
brls::Application::popView();
});
if (CurrentCfw::running_cfw == CFW::ams) {
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();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
this->RegisterCopyAction(brls::Key::X, payload_path, REBOOT_PAYLOAD_PATH, "menus/payloads/set_reboot_payload"_i18n);
}
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();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
list->addView(listItem);
this->RegisterCopyAction(brls::Key::Y, payload_path, UPDATE_BIN_PATH, "menus/payloads/set_update_bin"_i18n);
this->list->addView(this->listItem);
}
list->addView(new brls::ListItemGroupSpacing(true));
this->list->addView(new brls::ListItemGroupSpacing(true));
shutDown = new brls::ListItem("menus/common/shut_down"_i18n);
shutDown->getClickEvent()->subscribe([](brls::View* view) {
this->listItem = new brls::ListItem("menus/common/shut_down"_i18n);
this->listItem->getClickEvent()->subscribe([](brls::View* view) {
util::shutDown(false);
brls::Application::popView();
});
list->addView(shutDown);
this->list->addView(this->listItem);
reboot = new brls::ListItem("menus/common/reboot"_i18n);
reboot->getClickEvent()->subscribe([](brls::View* view) {
this->listItem = new brls::ListItem("menus/common/reboot"_i18n);
this->listItem->getClickEvent()->subscribe([](brls::View* view) {
util::shutDown(true);
brls::Application::popView();
});
list->addView(reboot);
list->addView(this->listItem);
this->setContentView(list);
}
void PayloadPage::RegisterCopyAction(brls::Key key, const std::string& payload_path, const std::string& payload_dest, const std::string& action_name)
{
this->listItem->registerAction(action_name, key, [payload_path, payload_dest] {
std::string res = fs::copyFile(payload_path, payload_dest)
? fmt::format("menus/payloads/copy_success"_i18n, payload_path, payload_dest)
: "Failed.";
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();
return true;
});
}

View file

@ -27,7 +27,7 @@ namespace {
ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payloads, bool erista, const nlohmann::json& hideStatus) : brls::List()
{
if (!tag.empty() && tag != AppVersion) {
updateApp = new brls::ListItem("menus/tools/update_app"_i18n + tag + ")");
updateApp = new brls::ListItem(fmt::format("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) {
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();

View file

@ -214,6 +214,7 @@ namespace util {
if (std::filesystem::exists(BOOTLOADER_PATH)) payloadPaths.push_back(BOOTLOADER_PATH);
if (std::filesystem::exists(BOOTLOADER_PL_PATH)) payloadPaths.push_back(BOOTLOADER_PL_PATH);
if (std::filesystem::exists(SXOS_PATH)) payloadPaths.push_back(SXOS_PATH);
if (std::filesystem::exists(ROMFS_PATH)) payloadPaths.push_back(ROMFS_PATH);
std::vector<std::string> res;
for (const auto& path : payloadPaths) {
for (const auto& entry : std::filesystem::directory_iterator(path)) {