mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-08 11:31:43 +00:00
add payload downloads to bootloader tab
This commit is contained in:
parent
1da56da064
commit
cf9ad1d51a
24 changed files with 161 additions and 144 deletions
|
@ -103,7 +103,7 @@ constexpr const char HIDDEN_AIO_FILE[] = "/config/aio-switch-updater/.aio-switch
|
||||||
|
|
||||||
constexpr const int LISTITEM_HEIGHT = 50;
|
constexpr const int LISTITEM_HEIGHT = 50;
|
||||||
|
|
||||||
enum class archiveType
|
enum class contentType
|
||||||
{
|
{
|
||||||
sigpatches,
|
sigpatches,
|
||||||
cheats,
|
cheats,
|
||||||
|
@ -111,8 +111,11 @@ enum class archiveType
|
||||||
app,
|
app,
|
||||||
bootloaders,
|
bootloaders,
|
||||||
ams_cfw,
|
ams_cfw,
|
||||||
|
payloads,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr std::string_view contentTypeNames[7]{"sigpatches", "cheats", "firmwares", "app", "bootloaders", "cfws", "payloads"};
|
||||||
|
|
||||||
enum class CFW
|
enum class CFW
|
||||||
{
|
{
|
||||||
rnx,
|
rnx,
|
||||||
|
|
|
@ -7,8 +7,8 @@ constexpr int OFF = 0;
|
||||||
|
|
||||||
namespace download {
|
namespace download {
|
||||||
|
|
||||||
long downloadFile(const std::string& url, std::vector<std::uint8_t>& res, const char* output = "", int api = OFF);
|
long downloadFile(const std::string& url, std::vector<std::uint8_t>& res, const std::string& output = "", int api = OFF);
|
||||||
long downloadFile(const std::string& url, const char* output = "", int api = OFF);
|
long downloadFile(const std::string& url, const std::string& output = "", int api = OFF);
|
||||||
std::vector<std::pair<std::string, std::string>> getLinks(const std::string& url);
|
std::vector<std::pair<std::string, std::string>> getLinks(const std::string& url);
|
||||||
std::vector<std::pair<std::string, std::string>> getLinksFromJson(const nlohmann::ordered_json& json_object);
|
std::vector<std::pair<std::string, std::string>> getLinksFromJson(const nlohmann::ordered_json& json_object);
|
||||||
std::string fetchTitle(const std::string& url);
|
std::string fetchTitle(const std::string& url);
|
||||||
|
|
|
@ -11,14 +11,18 @@ private:
|
||||||
brls::ListItem* listItem;
|
brls::ListItem* listItem;
|
||||||
brls::ListItem* cheatslipsItem;
|
brls::ListItem* cheatslipsItem;
|
||||||
brls::ListItem* gbatempItem;
|
brls::ListItem* gbatempItem;
|
||||||
brls::Label* notFound;
|
nlohmann::ordered_json nxlinks;
|
||||||
brls::Label* description;
|
std::string currentCheatsVer = "";
|
||||||
brls::Label* cheatsLabel;
|
std::string newCheatsVer = "";
|
||||||
|
contentType type;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
void createList(contentType type);
|
||||||
void createCheatSlipItem();
|
void createCheatSlipItem();
|
||||||
void creategbatempItem();
|
void creategbatempItem();
|
||||||
|
void setDescription();
|
||||||
|
void displayNotFound();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ListDownloadTab(const archiveType type, const nlohmann::ordered_json& nxlinks = nlohmann::ordered_json::object());
|
ListDownloadTab(const contentType type, const nlohmann::ordered_json& nxlinks = nlohmann::ordered_json::object());
|
||||||
brls::View* getDefaultFocus() override;
|
brls::View* getDefaultFocus() override;
|
||||||
};
|
};
|
|
@ -24,9 +24,9 @@ namespace util {
|
||||||
|
|
||||||
void clearConsole();
|
void clearConsole();
|
||||||
bool isArchive(const std::string& path);
|
bool isArchive(const std::string& path);
|
||||||
void downloadArchive(const std::string& url, archiveType type);
|
void downloadArchive(const std::string& url, contentType type);
|
||||||
void downloadArchive(const std::string& url, archiveType type, long& status_code);
|
void downloadArchive(const std::string& url, contentType type, long& status_code);
|
||||||
void extractArchive(archiveType type, const std::string& tag = "0");
|
void extractArchive(contentType type, const std::string& tag = "0");
|
||||||
std::string formatListItemTitle(const std::string& str, size_t maxScore = 140);
|
std::string formatListItemTitle(const std::string& str, size_t maxScore = 140);
|
||||||
std::string formatApplicationId(u64 ApplicationId);
|
std::string formatApplicationId(u64 ApplicationId);
|
||||||
std::vector<std::string> fetchPayloads();
|
std::vector<std::string> fetchPayloads();
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
"all_done": "Fertig! Du musst dn Pro Controler vielleicht trennen und anschließen um den Effekt zu sehen."
|
"all_done": "Fertig! Du musst dn Pro Controler vielleicht trennen und anschließen um den Effekt zu sehen."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Herunterladen: ",
|
"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: ",
|
"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: ",
|
"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 ",
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
"changing": "Changing color. Make sure the Pro-Con is set to player 1."
|
"changing": "Changing color. Make sure the Pro-Con is set to player 1."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Getting ",
|
"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: ",
|
"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: ",
|
"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 ",
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"all_done": "¡Finalizado! Puede que necesites desacoplar y acoplar tus Joy-Cons para que el cambio surta efecto."
|
"all_done": "¡Finalizado! Puede que necesites desacoplar y acoplar tus Joy-Cons para que el cambio surta efecto."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Obteniendo ",
|
"getting": "Obteniendo {}",
|
||||||
"firmware_text": "\ue016 Firmwares de 'https://darthsternie.net/switch-firmwares/'. Una vez descargado, será extraído en '/firmware'. Entonces podrás instalar la actualización a través de Daybreak.\n\ue016 FW actual: ",
|
"firmware_text": "\ue016 Firmwares de 'https://darthsternie.net/switch-firmwares/'. Una vez descargado, será extraído en '/firmware'. Entonces podrás instalar la actualización a través de Daybreak.\n\ue016 FW actual: ",
|
||||||
"cheats_text": "\ue016 Esto descargará un paquete actualizado diario de trucos de 'gbatemp.net'. Los trucos de juegos que no tienes instalados no se extraerán a tu tarjeta SD. Puedes desactivar los trucos actualizados en 'Herramientas->Menú de trucos'.\n\ue016 Versión de trucos actual: ",
|
"cheats_text": "\ue016 Esto descargará un paquete actualizado diario de trucos de 'gbatemp.net'. Los trucos de juegos que no tienes instalados no se extraerán a tu tarjeta SD. Puedes desactivar los trucos actualizados en 'Herramientas->Menú de trucos'.\n\ue016 Versión de trucos actual: ",
|
||||||
"sigpatches": "sigpatches",
|
"sigpatches": "sigpatches",
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"all_done": "Fini ! Vous devrez peut-être ancrer/détacher votre Joy-Cons pour que le changement prenne effet"
|
"all_done": "Fini ! Vous devrez peut-être ancrer/détacher votre Joy-Cons pour que le changement prenne effet"
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Téléchargement du ",
|
"getting": "Téléchargement de {}",
|
||||||
"firmware_text": "\ue016 Firmware depuis 'https://darthsternie.net/switch-firmwares/'. Une fois téléchargés, ils seront dans '/firmware'. Vous pouvez ensuite les installer avec Daybreak.\n\ue016 FW actuel : ",
|
"firmware_text": "\ue016 Firmware depuis 'https://darthsternie.net/switch-firmwares/'. Une fois téléchargés, ils seront dans '/firmware'. Vous pouvez ensuite les installer avec Daybreak.\n\ue016 FW actuel : ",
|
||||||
"cheats_text": "\ue016 Archive mise à jour quotidiennement des codes de triche de 'gbatemp.net'. Les codes de triche pour les jeux que vous ne possedez pas ne seront pas extraits sur votre carte SD. Vous pouvez désactiver les mises à jour pour pour une sélection de jeux dans le menu 'Outils->Menu de cheat'.\n\ue016 Version actuelle des cheats : ",
|
"cheats_text": "\ue016 Archive mise à jour quotidiennement des codes de triche de 'gbatemp.net'. Les codes de triche pour les jeux que vous ne possedez pas ne seront pas extraits sur votre carte SD. Vous pouvez désactiver les mises à jour pour pour une sélection de jeux dans le menu 'Outils->Menu de cheat'.\n\ue016 Version actuelle des cheats : ",
|
||||||
"sigpatches": "sigpatches",
|
"sigpatches": "sigpatches",
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"all_done": "Finito! Potrebbe essere necessario scollegare/collegare i Joy-Cons perchè i cambiamenti abbiano effetto."
|
"all_done": "Finito! Potrebbe essere necessario scollegare/collegare i Joy-Cons perchè i cambiamenti abbiano effetto."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Ottengo ",
|
"getting": "Ottengo {}",
|
||||||
"firmware_text": "\ue016 il dump del Firmware da 'https://darthsternie.net/switch-firmwares/'. Una volta scaricato, sarà estratto in '/firmware'. Puoi installare l'aggiornamento tramite Daybreak.\n\ue016 FW attuale: ",
|
"firmware_text": "\ue016 il dump del Firmware da 'https://darthsternie.net/switch-firmwares/'. Una volta scaricato, sarà estratto in '/firmware'. Puoi installare l'aggiornamento tramite Daybreak.\n\ue016 FW attuale: ",
|
||||||
"cheats_text": "\ue016 Questo scaricherà quotidianamente un archivio di cheat da 'gbatemp.net'. I cheat per i giochi non installati non saranno estratti sulla tua scheda SD. Puoi disabilitare l'aggiornamento dei cheat in 'Tools->Cheat menu'.\n\ue016 Current cheats version: ",
|
"cheats_text": "\ue016 Questo scaricherà quotidianamente un archivio di cheat da 'gbatemp.net'. I cheat per i giochi non installati non saranno estratti sulla tua scheda SD. Puoi disabilitare l'aggiornamento dei cheat in 'Tools->Cheat menu'.\n\ue016 Current cheats version: ",
|
||||||
"sigpatches": "sigpatches",
|
"sigpatches": "sigpatches",
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
"changing": "色を変える。 プロコントローラーがプレーヤー1に設定されていることを確認してください。"
|
"changing": "色を変える。 プロコントローラーがプレーヤー1に設定されていることを確認してください。"
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "取得中 ",
|
"getting": "取得中 {}",
|
||||||
"firmware_text": "\ue016 ファームウェアは'https://darthsternie.net/switch-firmwares/'からダンプされます。 ダウンロードすると、「/firmware」に抽出されます。その後、Daybreakを介してアップデートをインストールできます。\n\ue016 現在のファームウェア: ",
|
"firmware_text": "\ue016 ファームウェアは'https://darthsternie.net/switch-firmwares/'からダンプされます。 ダウンロードすると、「/firmware」に抽出されます。その後、Daybreakを介してアップデートをインストールできます。\n\ue016 現在のファームウェア: ",
|
||||||
"cheats_text": "Download GBAtemp.net チートアーカイブ (ver ",
|
"cheats_text": "Download GBAtemp.net チートアーカイブ (ver ",
|
||||||
"get_cheats": "GBAtemp.netチートアーカイブをダウンロード (ver ",
|
"get_cheats": "GBAtemp.netチートアーカイブをダウンロード (ver ",
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
"changing": "Zmieniam kolor. Upewnij się, że kontroler jest podłączony jako Player 1."
|
"changing": "Zmieniam kolor. Upewnij się, że kontroler jest podłączony jako Player 1."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Pobieranie ",
|
"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: ",
|
"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: ",
|
"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 ",
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
"all_done": "Finalizado! Pode ser necessário desencaixar e encaixar o Joy-Cons para que a alteração tenha efeito."
|
"all_done": "Finalizado! Pode ser necessário desencaixar e encaixar o Joy-Cons para que a alteração tenha efeito."
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "Baixando ",
|
"getting": "Baixando {}",
|
||||||
"firmware_text": "\ue016 Firmwares de 'https://darthsternie.net/switch-firmwares/'. Depois de baixado, ele será extraído para '/firmware'. Você pode então instalar a atualização por meio do Daybreak ou.\n\ue016 FW atual: ",
|
"firmware_text": "\ue016 Firmwares de 'https://darthsternie.net/switch-firmwares/'. Depois de baixado, ele será extraído para '/firmware'. Você pode então instalar a atualização por meio do Daybreak ou.\n\ue016 FW atual: ",
|
||||||
"cheats_text": "\ue016 Isso irá baixar um pacote de cheat atualizado diariamente do 'gbatemp.net'. Os cheats do jogo que você não instalou não serão extraídos para o seu cartão SD. Você pode desabilitar cheats atualizados em 'Ferramentas->Trapaças'.\n\ue016 Versão das trapaças atual: ",
|
"cheats_text": "\ue016 Isso irá baixar um pacote de cheat atualizado diariamente do 'gbatemp.net'. Os cheats do jogo que você não instalou não serão extraídos para o seu cartão SD. Você pode desabilitar cheats atualizados em 'Ferramentas->Trapaças'.\n\ue016 Versão das trapaças atual: ",
|
||||||
"sigpatches": "sigpatches",
|
"sigpatches": "sigpatches",
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
"all_done": "完成,你可能需要拔插手柄来启动刚才的颜色更新"
|
"all_done": "完成,你可能需要拔插手柄来启动刚才的颜色更新"
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "获取 ",
|
"getting": "获取 {}",
|
||||||
"firmware_text": "\ue016 固件从 'https://darthsternie.net/switch-firmwares/ 下载'. 下载之后,文件会被解压到 '/firmware'. 您可以使用 Daybreak 来安装它 .\n\ue016 当前FW版本: ",
|
"firmware_text": "\ue016 固件从 'https://darthsternie.net/switch-firmwares/ 下载'. 下载之后,文件会被解压到 '/firmware'. 您可以使用 Daybreak 来安装它 .\n\ue016 当前FW版本: ",
|
||||||
"cheats_text": "\ue016 这个金手指的下载和更新地址是 'gbatemp.net'. 你的机器中没有的游戏,这些金手指不会解压到你的SD卡中 你可以在'工具->金手指菜单' 关闭金手指更新.\n\ue016 当前金手指版本: ",
|
"cheats_text": "\ue016 这个金手指的下载和更新地址是 'gbatemp.net'. 你的机器中没有的游戏,这些金手指不会解压到你的SD卡中 你可以在'工具->金手指菜单' 关闭金手指更新.\n\ue016 当前金手指版本: ",
|
||||||
"sigpatches": "数字签名",
|
"sigpatches": "数字签名",
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
"changing": "正在變更控制器顏色,請確認Pro-Con的玩家指示燈顯示為第一位玩家"
|
"changing": "正在變更控制器顏色,請確認Pro-Con的玩家指示燈顯示為第一位玩家"
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"getting": "正在擷取 ",
|
"getting": "正在擷取 {}",
|
||||||
"firmware_text": "\ue016 韌體檔案從'https://darthsternie.net/switch-firmwares/'進行轉存。當下載完成後,檔案會放置於資料夾'/firmware'內。你可以透過Daybreak來安裝更新韌體。\n\ue016 目前FW: ",
|
"firmware_text": "\ue016 韌體檔案從'https://darthsternie.net/switch-firmwares/'進行轉存。當下載完成後,檔案會放置於資料夾'/firmware'內。你可以透過Daybreak來安裝更新韌體。\n\ue016 目前FW: ",
|
||||||
"cheats_text": "\uE016 下載'gbatemp.net'每日更新的金手指檔案到記憶卡時,並不會複製到主機未安裝的遊戲金手指檔案。你可以從設定的 '工具->金手指選單' 內停用金手指更新。\n\uE016 目前金手指資料庫版本: ",
|
"cheats_text": "\uE016 下載'gbatemp.net'每日更新的金手指檔案到記憶卡時,並不會複製到主機未安裝的遊戲金手指檔案。你可以從設定的 '工具->金手指選單' 內停用金手指更新。\n\uE016 目前金手指資料庫版本: ",
|
||||||
"get_cheats:": "下載GBAtemp.net金手指資料庫(版本 ",
|
"get_cheats:": "下載GBAtemp.net金手指資料庫(版本 ",
|
||||||
|
|
|
@ -100,16 +100,16 @@ void AmsTab::CreateStagedFrames(const std::string& text, const std::string& url,
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, text));
|
new ConfirmPage(stagedFrame, text));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, archiveType::ams_cfw); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, contentType::ams_cfw); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(archiveType::ams_cfw); }));
|
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(contentType::ams_cfw); }));
|
||||||
if (hekate) {
|
if (hekate) {
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new DialoguePage_ams(stagedFrame, text_hekate, erista));
|
new DialoguePage_ams(stagedFrame, text_hekate, erista));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [hekate_url]() { util::downloadArchive(hekate_url, archiveType::bootloaders); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [hekate_url]() { util::downloadArchive(hekate_url, contentType::bootloaders); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(archiveType::bootloaders); }));
|
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(contentType::bootloaders); }));
|
||||||
}
|
}
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n, false, true, erista));
|
new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n, false, true, erista));
|
||||||
|
|
|
@ -90,9 +90,9 @@ void AppPage::CreateDownloadAllButton()
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, text));
|
new ConfirmPage(stagedFrame, text));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, archiveType::cheats); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, contentType::cheats); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(archiveType::cheats); }));
|
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { util::extractArchive(contentType::cheats); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
||||||
brls::Application::pushView(stagedFrame);
|
brls::Application::pushView(stagedFrame);
|
||||||
|
|
|
@ -63,7 +63,7 @@ CheatsPage::CheatsPage() : AppletFrame(true, true)
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, text));
|
new ConfirmPage(stagedFrame, text));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, archiveType::cheats); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url]() { util::downloadArchive(url, contentType::cheats); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { extract::extractAllCheats(CHEATS_ZIP_PATH, CurrentCfw::running_cfw); }));
|
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, []() { extract::extractAllCheats(CHEATS_ZIP_PATH, CurrentCfw::running_cfw); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
|
|
|
@ -127,14 +127,15 @@ namespace download {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
long downloadFile(const std::string& url, const char* output, int api)
|
long downloadFile(const std::string& url, const std::string& output, int api)
|
||||||
{
|
{
|
||||||
std::vector<std::uint8_t> dummy;
|
std::vector<std::uint8_t> dummy;
|
||||||
return downloadFile(url, dummy, output, api);
|
return downloadFile(url, dummy, output, api);
|
||||||
}
|
}
|
||||||
|
|
||||||
long downloadFile(const std::string& url, std::vector<std::uint8_t>& res, const char* output, int api)
|
long downloadFile(const std::string& url, std::vector<std::uint8_t>& res, const std::string& output, int api)
|
||||||
{
|
{
|
||||||
|
const char* out = output.c_str();
|
||||||
CURL* curl = curl_easy_init();
|
CURL* curl = curl_easy_init();
|
||||||
ntwrk_struct_t chunk = {0};
|
ntwrk_struct_t chunk = {0};
|
||||||
long status_code;
|
long status_code;
|
||||||
|
@ -143,13 +144,13 @@ namespace download {
|
||||||
bool can_download = true;
|
bool can_download = true;
|
||||||
|
|
||||||
if (curl) {
|
if (curl) {
|
||||||
FILE* fp = fopen(output, "wb");
|
FILE* fp = fopen(out, "wb");
|
||||||
if (fp || *output == 0) {
|
if (fp || *out == 0) {
|
||||||
chunk.data = static_cast<u_int8_t*>(malloc(_1MiB));
|
chunk.data = static_cast<u_int8_t*>(malloc(_1MiB));
|
||||||
chunk.data_size = _1MiB;
|
chunk.data_size = _1MiB;
|
||||||
chunk.out = fp;
|
chunk.out = fp;
|
||||||
|
|
||||||
if (*output != 0) {
|
if (*out != 0) {
|
||||||
can_download = checkSize(curl, url);
|
can_download = checkSize(curl, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +188,7 @@ namespace download {
|
||||||
res = {};
|
res = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*output == 0) {
|
if (*out == 0) {
|
||||||
res.assign(chunk.data, chunk.data + chunk.offset);
|
res.assign(chunk.data, chunk.data + chunk.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ DownloadPayloadPage::DownloadPayloadPage(const nlohmann::ordered_json& payloads)
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, text));
|
new ConfirmPage(stagedFrame, text));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, path]() { download::downloadFile(url, path.c_str(), OFF); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, path]() { download::downloadFile(url, path, OFF); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
||||||
brls::Application::pushView(stagedFrame);
|
brls::Application::pushView(stagedFrame);
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace extract {
|
||||||
namespace {
|
namespace {
|
||||||
bool caselessCompare(const std::string& a, const std::string& b)
|
bool caselessCompare(const std::string& a, const std::string& b)
|
||||||
{
|
{
|
||||||
return strcasecmp(a.c_str(), b.c_str()) < 0;
|
return strcasecmp(a.c_str(), b.c_str()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void preWork(zipper::Unzipper& unzipper, const std::string& workingPath, std::vector<zipper::ZipEntry>& entries)
|
void preWork(zipper::Unzipper& unzipper, const std::string& workingPath, std::vector<zipper::ZipEntry>& entries)
|
||||||
|
@ -79,6 +79,7 @@ namespace extract {
|
||||||
unzipper.extractEntry(entry.name);
|
unzipper.extractEntry(entry.name);
|
||||||
if (entry.name.substr(0, 13) == "hekate_ctcaer") {
|
if (entry.name.substr(0, 13) == "hekate_ctcaer") {
|
||||||
fs::copyFile("/" + entry.name, UPDATE_BIN_PATH);
|
fs::copyFile("/" + entry.name, UPDATE_BIN_PATH);
|
||||||
|
fs::copyFile("/" + entry.name, REBOOT_PAYLOAD_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProgressEvent::instance().incrementStep(1);
|
ProgressEvent::instance().incrementStep(1);
|
||||||
|
@ -217,7 +218,7 @@ namespace extract {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto matches = entries | std::views::filter([&title, offset](zipper::ZipEntry entry) {
|
auto matches = entries | std::views::filter([&title, offset](zipper::ZipEntry entry) {
|
||||||
return strcasecmp((title.substr(0, 13)).c_str(), entry.name.substr(offset, 13).c_str()) == 0 && strcasecmp(entry.name.substr(offset + 16, 7).c_str(), "/cheats") == 0;
|
return caselessCompare((title.substr(0, 13)), entry.name.substr(offset, 13)) && caselessCompare(entry.name.substr(offset + 16, 7), "/cheats");
|
||||||
});
|
});
|
||||||
for (const auto& match : matches) {
|
for (const auto& match : matches) {
|
||||||
unzipper.extractEntry(match.name);
|
unzipper.extractEntry(match.name);
|
||||||
|
@ -275,7 +276,7 @@ namespace extract {
|
||||||
void removeCheats()
|
void removeCheats()
|
||||||
{
|
{
|
||||||
std::string path = util::getContentsPath();
|
std::string path = util::getContentsPath();
|
||||||
ProgressEvent::instance().setTotalSteps(std::distance(std::filesystem::directory_iterator(path), std::filesystem::directory_iterator()));
|
ProgressEvent::instance().setTotalSteps(std::distance(std::filesystem::directory_iterator(path), std::filesystem::directory_iterator()) + 1);
|
||||||
for (const auto& entry : std::filesystem::directory_iterator(path)) {
|
for (const auto& entry : std::filesystem::directory_iterator(path)) {
|
||||||
if (ProgressEvent::instance().getInterupt()) {
|
if (ProgressEvent::instance().getInterupt()) {
|
||||||
break;
|
break;
|
||||||
|
@ -291,14 +292,9 @@ namespace extract {
|
||||||
{
|
{
|
||||||
bool res = true;
|
bool res = true;
|
||||||
std::string cheatsPath = fmt::format("{}/cheats", entry);
|
std::string cheatsPath = fmt::format("{}/cheats", entry);
|
||||||
if (std::filesystem::exists(cheatsPath)) {
|
if (std::filesystem::exists(cheatsPath)) res &= fs::removeDir(cheatsPath);
|
||||||
res &= fs::removeDir(cheatsPath);
|
if (std::filesystem::is_empty(entry)) res &= fs::removeDir(entry);
|
||||||
if (std::filesystem::is_empty(entry)) {
|
return res;
|
||||||
res &= fs::removeDir(entry);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace extract
|
} // namespace extract
|
|
@ -17,84 +17,67 @@
|
||||||
namespace i18n = brls::i18n;
|
namespace i18n = brls::i18n;
|
||||||
using namespace i18n::literals;
|
using namespace i18n::literals;
|
||||||
|
|
||||||
ListDownloadTab::ListDownloadTab(const archiveType type, const nlohmann::ordered_json& nxlinks) : brls::List()
|
ListDownloadTab::ListDownloadTab(const contentType type, const nlohmann::ordered_json& nxlinks) : brls::List(), type(type), nxlinks(nxlinks)
|
||||||
{
|
{
|
||||||
//std::vector<std::pair<std::string, std::string>> links, sxoslinks;
|
this->setDescription();
|
||||||
std::vector<std::pair<std::string, std::string>> links = download::getLinksFromJson(nxlinks);
|
|
||||||
std::string operation("menus/main/getting"_i18n);
|
|
||||||
std::string firmwareText("menus/main/firmware_text"_i18n);
|
|
||||||
|
|
||||||
std::string currentCheatsVer = "";
|
this->createList(this->type);
|
||||||
std::string newCheatsVer = "";
|
|
||||||
|
|
||||||
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
if (this->type == contentType::cheats) {
|
||||||
switch (type) {
|
brls::Label* cheatsLabel = new brls::Label(
|
||||||
case archiveType::sigpatches:
|
brls::LabelStyle::DESCRIPTION,
|
||||||
operation += "menus/main/sigpatches"_i18n;
|
"menus/cheats/cheats_label"_i18n,
|
||||||
this->description->setText(
|
true);
|
||||||
"menus/main/sigpatches_text"_i18n);
|
this->addView(cheatsLabel);
|
||||||
break;
|
creategbatempItem();
|
||||||
case archiveType::fw:
|
createCheatSlipItem();
|
||||||
operation += "menus/main/firmware"_i18n;
|
|
||||||
SetSysFirmwareVersion ver;
|
|
||||||
if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver)))
|
|
||||||
firmwareText += ver.display_version;
|
|
||||||
else
|
|
||||||
firmwareText += "menus/main/not_found"_i18n;
|
|
||||||
this->description->setText(firmwareText);
|
|
||||||
break;
|
|
||||||
case archiveType::app:
|
|
||||||
links.push_back(std::make_pair("menus/main/latest_cheats"_i18n, APP_URL));
|
|
||||||
operation += "menus/main/app"_i18n;
|
|
||||||
break;
|
|
||||||
case archiveType::bootloaders:
|
|
||||||
operation += "menus/main/cfw"_i18n;
|
|
||||||
this->description->setText(
|
|
||||||
"menus/main/bootloaders_text"_i18n);
|
|
||||||
break;
|
|
||||||
case archiveType::cheats:
|
|
||||||
newCheatsVer = util::downloadFileToString(CHEATS_URL_VERSION);
|
|
||||||
if (newCheatsVer != "") {
|
|
||||||
switch (CurrentCfw::running_cfw) {
|
|
||||||
case CFW::sxos:
|
|
||||||
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_TITLES));
|
|
||||||
break;
|
|
||||||
case CFW::ams:
|
|
||||||
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_CONTENTS));
|
|
||||||
break;
|
|
||||||
case CFW::rnx:
|
|
||||||
links.push_back(std::make_pair("menus/main/get_cheats"_i18n + newCheatsVer + ")", CHEATS_URL_CONTENTS));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
operation += "menus/main/cheats"_i18n;
|
|
||||||
currentCheatsVer = util::readVersion(CHEATS_VERSION);
|
|
||||||
this->description->setText("menus/main/cheats_text"_i18n + currentCheatsVer);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addView(description);
|
if (this->type == contentType::bootloaders) {
|
||||||
|
brls::Label* payloadsLabel = new brls::Label(
|
||||||
|
brls::LabelStyle::DESCRIPTION,
|
||||||
|
"menus/cheats/cheats_label"_i18n,
|
||||||
|
true);
|
||||||
|
this->addView(payloadsLabel);
|
||||||
|
createList(contentType::payloads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListDownloadTab::createList(contentType type)
|
||||||
|
{
|
||||||
|
std::vector<std::pair<std::string, std::string>> links;
|
||||||
|
if (this->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));
|
||||||
|
else
|
||||||
|
links = download::getLinksFromJson(util::getValueFromKey(this->nxlinks, contentTypeNames[(int)type].data()));
|
||||||
|
|
||||||
this->size = links.size();
|
this->size = links.size();
|
||||||
if (this->size) {
|
if (this->size) {
|
||||||
for (const auto& link : links) {
|
for (const auto& link : links) {
|
||||||
|
std::string title = link.first;
|
||||||
std::string url = link.second;
|
std::string url = link.second;
|
||||||
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, newCheatsVer, currentCheatsVer](brls::View* view) {
|
listItem->getClickEvent()->subscribe([&, text, url, title, type](brls::View* view) {
|
||||||
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame();
|
||||||
stagedFrame->setTitle(operation);
|
stagedFrame->setTitle(fmt::format("menus/main/getting"_i18n, contentTypeNames[(int)type].data()));
|
||||||
stagedFrame->addStage(new ConfirmPage(stagedFrame, text));
|
stagedFrame->addStage(new ConfirmPage(stagedFrame, text));
|
||||||
if (type != archiveType::cheats || newCheatsVer != currentCheatsVer || !std::filesystem::exists(CHEATS_ZIP_PATH)) {
|
if (type != contentType::payloads || type != contentType::cheats || this->newCheatsVer != this->currentCheatsVer || !std::filesystem::exists(CHEATS_ZIP_PATH)) {
|
||||||
stagedFrame->addStage(new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, type]() { util::downloadArchive(url, type); }));
|
stagedFrame->addStage(new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [type, url]() { util::downloadArchive(url, type); }));
|
||||||
|
}
|
||||||
|
if (type == contentType::payloads) {
|
||||||
|
fs::createTree(BOOTLOADER_PL_PATH);
|
||||||
|
std::string path = std::string(BOOTLOADER_PL_PATH) + title;
|
||||||
|
// TODO figure out why this doesn't work lol
|
||||||
|
stagedFrame->addStage(new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, path]() { download::downloadFile(url, path, OFF); }));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stagedFrame->addStage(new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [type]() { util::extractArchive(type); }));
|
||||||
}
|
}
|
||||||
stagedFrame->addStage(new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [type]() { util::extractArchive(type); }));
|
|
||||||
std::string doneMsg = "menus/common/all_done"_i18n;
|
std::string doneMsg = "menus/common/all_done"_i18n;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case archiveType::fw: {
|
case contentType::fw: {
|
||||||
std::string contentsPath = util::getContentsPath();
|
std::string contentsPath = util::getContentsPath();
|
||||||
for (const auto& tid : {"0100000000001000", "0100000000001007", "0100000000001013"}) {
|
for (const auto& tid : {"0100000000001000", "0100000000001007", "0100000000001013"}) {
|
||||||
if (std::filesystem::exists(contentsPath + tid) && !std::filesystem::is_empty(contentsPath + tid)) {
|
if (std::filesystem::exists(contentsPath + tid) && !std::filesystem::is_empty(contentsPath + tid)) {
|
||||||
|
@ -110,7 +93,7 @@ ListDownloadTab::ListDownloadTab(const archiveType type, const nlohmann::ordered
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case archiveType::sigpatches:
|
case contentType::sigpatches:
|
||||||
doneMsg += "\n" + "menus/sigpatches/reboot"_i18n;
|
doneMsg += "\n" + "menus/sigpatches/reboot"_i18n;
|
||||||
stagedFrame->addStage(new ConfirmPage(stagedFrame, doneMsg, true));
|
stagedFrame->addStage(new ConfirmPage(stagedFrame, doneMsg, true));
|
||||||
break;
|
break;
|
||||||
|
@ -123,25 +106,50 @@ ListDownloadTab::ListDownloadTab(const archiveType type, const nlohmann::ordered
|
||||||
this->addView(listItem);
|
this->addView(listItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
notFound = new brls::Label(
|
this->displayNotFound();
|
||||||
brls::LabelStyle::SMALL,
|
}
|
||||||
"menus/main/links_not_found"_i18n,
|
}
|
||||||
true);
|
|
||||||
notFound->setHorizontalAlign(NVG_ALIGN_CENTER);
|
void ListDownloadTab::displayNotFound()
|
||||||
this->addView(notFound);
|
{
|
||||||
|
brls::Label* notFound = new brls::Label(
|
||||||
|
brls::LabelStyle::SMALL,
|
||||||
|
"menus/main/links_not_found"_i18n,
|
||||||
|
true);
|
||||||
|
notFound->setHorizontalAlign(NVG_ALIGN_CENTER);
|
||||||
|
this->addView(notFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListDownloadTab::setDescription()
|
||||||
|
{
|
||||||
|
brls::Label* description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
||||||
|
|
||||||
|
switch (this->type) {
|
||||||
|
case contentType::sigpatches:
|
||||||
|
description->setText(
|
||||||
|
"menus/main/sigpatches_text"_i18n);
|
||||||
|
break;
|
||||||
|
case contentType::fw: {
|
||||||
|
SetSysFirmwareVersion ver;
|
||||||
|
description->setText(fmt::format("{}{}", "menus/main/firmware_text"_i18n, R_SUCCEEDED(setsysGetFirmwareVersion(&ver)) ? ver.display_version : "menus/main/not_found"_i18n));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case contentType::bootloaders:
|
||||||
|
description->setText(
|
||||||
|
"menus/main/bootloaders_text"_i18n);
|
||||||
|
break;
|
||||||
|
case contentType::cheats:
|
||||||
|
|
||||||
|
this->newCheatsVer = util::downloadFileToString(CHEATS_URL_VERSION);
|
||||||
|
this->currentCheatsVer = util::readVersion(CHEATS_VERSION);
|
||||||
|
description->setText("menus/main/cheats_text"_i18n + this->currentCheatsVer);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == archiveType::cheats) {
|
this->addView(description);
|
||||||
cheatsLabel = new brls::Label(
|
|
||||||
brls::LabelStyle::DESCRIPTION,
|
|
||||||
"menus/cheats/cheats_label"_i18n,
|
|
||||||
true);
|
|
||||||
this->addView(cheatsLabel);
|
|
||||||
creategbatempItem();
|
|
||||||
createCheatSlipItem();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListDownloadTab::createCheatSlipItem()
|
void ListDownloadTab::createCheatSlipItem()
|
||||||
|
|
|
@ -44,16 +44,16 @@ MainFrame::MainFrame() : TabFrame()
|
||||||
this->addTab("menus/main/update_ams"_i18n, new AmsTab(nxlinks, erista, util::getBoolValue(hideStatus, "atmosphereentries")));
|
this->addTab("menus/main/update_ams"_i18n, new AmsTab(nxlinks, erista, util::getBoolValue(hideStatus, "atmosphereentries")));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "cfw"))
|
if (!util::getBoolValue(hideStatus, "cfw"))
|
||||||
this->addTab("menus/main/update_bootloaders"_i18n, new ListDownloadTab(archiveType::bootloaders, util::getValueFromKey(nxlinks, "bootloaders")));
|
this->addTab("menus/main/update_bootloaders"_i18n, new ListDownloadTab(contentType::bootloaders, nxlinks));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "sigpatches"))
|
if (!util::getBoolValue(hideStatus, "sigpatches"))
|
||||||
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(archiveType::sigpatches, util::getValueFromKey(nxlinks, "sigpatches")));
|
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(contentType::sigpatches, nxlinks));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "firmwares"))
|
if (!util::getBoolValue(hideStatus, "firmwares"))
|
||||||
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(archiveType::fw, util::getValueFromKey(nxlinks, "firmwares")));
|
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(contentType::fw, nxlinks));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "cheats"))
|
if (!util::getBoolValue(hideStatus, "cheats"))
|
||||||
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(archiveType::cheats));
|
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(contentType::cheats));
|
||||||
|
|
||||||
if (!util::getBoolValue(hideStatus, "tools"))
|
if (!util::getBoolValue(hideStatus, "tools"))
|
||||||
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, util::getValueFromKey(nxlinks, "payloads"), erista, hideStatus));
|
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, util::getValueFromKey(nxlinks, "payloads"), erista, hideStatus));
|
||||||
|
|
|
@ -36,9 +36,9 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, text));
|
new ConfirmPage(stagedFrame, text));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, []() { util::downloadArchive(APP_URL, archiveType::app); }));
|
new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, []() { util::downloadArchive(APP_URL, contentType::app); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [tag]() { util::extractArchive(archiveType::app, tag); }));
|
new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [tag]() { util::extractArchive(contentType::app, tag); }));
|
||||||
stagedFrame->addStage(
|
stagedFrame->addStage(
|
||||||
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true));
|
||||||
brls::Application::pushView(stagedFrame);
|
brls::Application::pushView(stagedFrame);
|
||||||
|
|
|
@ -30,33 +30,36 @@ namespace util {
|
||||||
return fileContent.find("DOCTYPE") == std::string::npos;
|
return fileContent.find("DOCTYPE") == std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadArchive(const std::string& url, archiveType type)
|
void downloadArchive(const std::string& url, contentType type)
|
||||||
{
|
{
|
||||||
long status_code;
|
long status_code;
|
||||||
downloadArchive(url, type, status_code);
|
downloadArchive(url, type, status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadArchive(const std::string& url, archiveType type, long& status_code)
|
void downloadArchive(const std::string& url, contentType type, long& status_code)
|
||||||
{
|
{
|
||||||
fs::createTree(DOWNLOAD_PATH);
|
fs::createTree(DOWNLOAD_PATH);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case archiveType::sigpatches:
|
case contentType::sigpatches:
|
||||||
status_code = download::downloadFile(url, SIGPATCHES_FILENAME, OFF);
|
status_code = download::downloadFile(url, SIGPATCHES_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case archiveType::cheats:
|
case contentType::cheats:
|
||||||
status_code = download::downloadFile(url, CHEATS_FILENAME, OFF);
|
status_code = download::downloadFile(url, CHEATS_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case archiveType::fw:
|
case contentType::fw:
|
||||||
status_code = download::downloadFile(url, FIRMWARE_FILENAME, OFF);
|
status_code = download::downloadFile(url, FIRMWARE_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case archiveType::app:
|
case contentType::app:
|
||||||
status_code = download::downloadFile(url, APP_FILENAME, OFF);
|
status_code = download::downloadFile(url, APP_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case archiveType::bootloaders:
|
case contentType::bootloaders:
|
||||||
status_code = download::downloadFile(url, CFW_FILENAME, OFF);
|
status_code = download::downloadFile(url, CFW_FILENAME, OFF);
|
||||||
break;
|
break;
|
||||||
case archiveType::ams_cfw:
|
case contentType::ams_cfw:
|
||||||
status_code = download::downloadFile(url, AMS_FILENAME, OFF);
|
status_code = download::downloadFile(url, AMS_FILENAME, OFF);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ProgressEvent::instance().setStatusCode(status_code);
|
ProgressEvent::instance().setStatusCode(status_code);
|
||||||
}
|
}
|
||||||
|
@ -104,12 +107,12 @@ namespace util {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void extractArchive(archiveType type, const std::string& tag)
|
void extractArchive(contentType type, const std::string& tag)
|
||||||
{
|
{
|
||||||
int overwriteInis = 0;
|
int overwriteInis = 0;
|
||||||
chdir(ROOT_PATH);
|
chdir(ROOT_PATH);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case archiveType::sigpatches:
|
case contentType::sigpatches:
|
||||||
if (isArchive(SIGPATCHES_FILENAME)) {
|
if (isArchive(SIGPATCHES_FILENAME)) {
|
||||||
/* if(std::filesystem::exists(HEKATE_IPL_PATH)){
|
/* if(std::filesystem::exists(HEKATE_IPL_PATH)){
|
||||||
overwriteInis = showDialogBox("menus/utils/overwrite"_i18n + std::string(HEKATE_IPL_PATH) +"?", "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
overwriteInis = showDialogBox("menus/utils/overwrite"_i18n + std::string(HEKATE_IPL_PATH) +"?", "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
||||||
|
@ -128,13 +131,13 @@ namespace util {
|
||||||
brls::Application::crash("menus/utils/wrong_type_sigpatches"_i18n);
|
brls::Application::crash("menus/utils/wrong_type_sigpatches"_i18n);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case archiveType::cheats: {
|
case contentType::cheats: {
|
||||||
std::vector<std::string> titles = extract::getInstalledTitlesNs();
|
std::vector<std::string> titles = extract::getInstalledTitlesNs();
|
||||||
titles = extract::excludeTitles(CHEATS_EXCLUDE, titles);
|
titles = extract::excludeTitles(CHEATS_EXCLUDE, titles);
|
||||||
extract::extractCheats(CHEATS_FILENAME, titles, CurrentCfw::running_cfw);
|
extract::extractCheats(CHEATS_FILENAME, titles, CurrentCfw::running_cfw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case archiveType::fw:
|
case contentType::fw:
|
||||||
if (std::filesystem::file_size(FIRMWARE_FILENAME) < 200000) {
|
if (std::filesystem::file_size(FIRMWARE_FILENAME) < 200000) {
|
||||||
brls::Application::crash("menus/utils/wrong_type_sigpatches_downloaded"_i18n);
|
brls::Application::crash("menus/utils/wrong_type_sigpatches_downloaded"_i18n);
|
||||||
}
|
}
|
||||||
|
@ -144,14 +147,14 @@ namespace util {
|
||||||
extract::extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
extract::extract(FIRMWARE_FILENAME, FIRMWARE_PATH);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case archiveType::app:
|
case contentType::app:
|
||||||
extract::extract(APP_FILENAME, CONFIG_PATH);
|
extract::extract(APP_FILENAME, CONFIG_PATH);
|
||||||
fs::copyFile(ROMFS_FORWARDER, FORWARDER_PATH);
|
fs::copyFile(ROMFS_FORWARDER, FORWARDER_PATH);
|
||||||
envSetNextLoad(FORWARDER_PATH, fmt::format("\"{}\"", FORWARDER_PATH).c_str());
|
envSetNextLoad(FORWARDER_PATH, fmt::format("\"{}\"", FORWARDER_PATH).c_str());
|
||||||
romfsExit();
|
romfsExit();
|
||||||
brls::Application::quit();
|
brls::Application::quit();
|
||||||
break;
|
break;
|
||||||
case archiveType::bootloaders:
|
case contentType::bootloaders:
|
||||||
if (isArchive(CFW_FILENAME)) {
|
if (isArchive(CFW_FILENAME)) {
|
||||||
overwriteInis = showDialogBox("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
overwriteInis = showDialogBox("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
||||||
extract::extract(CFW_FILENAME, ROOT_PATH, overwriteInis);
|
extract::extract(CFW_FILENAME, ROOT_PATH, overwriteInis);
|
||||||
|
@ -160,7 +163,7 @@ namespace util {
|
||||||
brls::Application::crash("menus/utils/wrong_type_cfw"_i18n);
|
brls::Application::crash("menus/utils/wrong_type_cfw"_i18n);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case archiveType::ams_cfw:
|
case contentType::ams_cfw:
|
||||||
if (isArchive(AMS_FILENAME)) {
|
if (isArchive(AMS_FILENAME)) {
|
||||||
overwriteInis = showDialogBox("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
overwriteInis = showDialogBox("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
|
||||||
usleep(800000);
|
usleep(800000);
|
||||||
|
@ -170,8 +173,10 @@ namespace util {
|
||||||
extract::extract(AMS_FILENAME, ROOT_PATH, overwriteInis);
|
extract::extract(AMS_FILENAME, ROOT_PATH, overwriteInis);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (type == archiveType::ams_cfw || type == archiveType::bootloaders)
|
if (type == contentType::ams_cfw || type == contentType::bootloaders)
|
||||||
fs::copyFiles(COPY_FILES_TXT);
|
fs::copyFiles(COPY_FILES_TXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue