mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-08 11:31:43 +00:00
superate menus for regular cheat codes and gfx cheat codes
This commit is contained in:
parent
e6951c5378
commit
057252db92
16 changed files with 123 additions and 39 deletions
|
@ -70,6 +70,16 @@ public:
|
|||
AppPage_Gbatemp();
|
||||
};
|
||||
|
||||
class AppPage_Gfx : public AppPage
|
||||
{
|
||||
private:
|
||||
void CreateLabel() override;
|
||||
void AddListItem(const std::string& name, uint64_t tid) override;
|
||||
|
||||
public:
|
||||
AppPage_Gfx();
|
||||
};
|
||||
|
||||
class AppPage_DownloadedCheats : public AppPage
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -54,6 +54,8 @@ constexpr const char LOOKUP_TABLE_URL[] = "https://raw.githubusercontent.com/Ham
|
|||
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/";
|
||||
constexpr const char CHEATS_DIRECTORY[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/cheats/";
|
||||
constexpr const char CHEATS_DIRECTORY_GBATEMP[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/cheats_gbatemp/";
|
||||
constexpr const char CHEATS_DIRECTORY_GFX[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/cheats_gfx/";
|
||||
constexpr const char CHEATSLIPS_CHEATS_URL[] = "https://www.cheatslips.com/api/v1/cheats/";
|
||||
constexpr const char CHEATSLIPS_TOKEN_URL[] = "https://www.cheatslips.com/api/v1/token";
|
||||
constexpr const char TOKEN_PATH[] = "/config/aio-switch-updater/token.json";
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <filesystem>
|
||||
#include <json.hpp>
|
||||
|
||||
#include "constants.hpp"
|
||||
|
||||
namespace cheats_util {
|
||||
u32 GetVersion(uint64_t title_id);
|
||||
void ShowCheatFiles(uint64_t tid, const std::string& name);
|
||||
|
@ -64,11 +66,33 @@ public:
|
|||
DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name);
|
||||
};
|
||||
|
||||
class DownloadCheatsPage_GbaTemp : public DownloadCheatsPage
|
||||
class DownloadCheatsPage_Github : public DownloadCheatsPage
|
||||
{
|
||||
private:
|
||||
brls::ListItem* listItem;
|
||||
|
||||
public:
|
||||
DownloadCheatsPage_GbaTemp(uint64_t tid, const std::string& name);
|
||||
DownloadCheatsPage_Github(uint64_t tid, const std::string& name);
|
||||
void PopulateList(uint64_t tid, const std::string& name);
|
||||
|
||||
protected:
|
||||
virtual std::string get_url() { return CHEATS_DIRECTORY; }
|
||||
};
|
||||
|
||||
class DownloadCheatsPage_Gbatemp : public DownloadCheatsPage_Github
|
||||
{
|
||||
public:
|
||||
DownloadCheatsPage_Gbatemp(uint64_t tid, const std::string& name);
|
||||
|
||||
private:
|
||||
std::string get_url() override { return CHEATS_DIRECTORY_GBATEMP; }
|
||||
};
|
||||
|
||||
class DownloadCheatsPage_Gfx : public DownloadCheatsPage_Github
|
||||
{
|
||||
public:
|
||||
DownloadCheatsPage_Gfx(uint64_t tid, const std::string& name);
|
||||
|
||||
private:
|
||||
std::string get_url() override { return CHEATS_DIRECTORY_GFX; }
|
||||
};
|
|
@ -16,7 +16,8 @@ private:
|
|||
void createList();
|
||||
void createList(contentType type);
|
||||
void createCheatSlipItem();
|
||||
void creategbatempItem();
|
||||
void createGbatempItem();
|
||||
void createGfxItem();
|
||||
void setDescription();
|
||||
void setDescription(contentType type);
|
||||
void displayNotFound();
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
"dl_all": "Das gesamte GBAtemp.net Cheat-Archiv herunterladen und enptacken",
|
||||
"delete_orphaned": "Verwaiste Cheat-Codes löschen",
|
||||
"cheats_label": "\u25c6 Lade einzelne Cheat-Codes aus der GBAtemp.net-Datenbank oder Cheat-Sheets von Cheatlips herunter",
|
||||
"gbatemp_dl": "Lade von GBAtemp.net verwaltete Cheat-Codes herunter. Diese Cheats werden am Ende deiner bestehenden Cheat-Datei hinzugefügt.",
|
||||
"gbatemp_dl_cheatcode": "Cheat-Code herunterladen",
|
||||
"gbatemp_dl_successful_dl": "Folgender Cheat-Code wurde erfolgreich heruntergeladen:\\n{}",
|
||||
"bid_tid_info": "Diese Cheats werden am Ende deiner bestehenden Cheat-Datei hinzugefügt.",
|
||||
"dl_cheatcodes": "Cheat-Code herunterladen",
|
||||
"dl_successful": "Folgender Cheat-Code wurde erfolgreich heruntergeladen:\\n{}",
|
||||
"applet_mode_not_supported": "Aufgrund von Speicherbeschränkungen können im Applet-Modus nur Cheat-Codes für das Spiel abgerufen werden, das gerade gespielt wird. Bitte starte den AIO-Switch-Updater über die Title Override, um Cheat-Codes für alle verfügbaren Spiele herunterzuladen.",
|
||||
"cheatfile_label": "Hier sind die Cheat-Codes, die in der Datei {} aufgelistet sind",
|
||||
"not_found": "Es konnten keine geeigneten Cheat-Codes für dieses Spiel gefunden werden",
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
"exclude_all": "Exclude all",
|
||||
"exclude_none": "Exclude none",
|
||||
"dl_all": "Download and extract the entire GBAtemp.net cheats archive",
|
||||
"gbatemp_dl": "Download cheat codes curated from GBAtemp.net. Those cheats will be added to the end of your existing cheat file.",
|
||||
"gbatemp_dl_cheatcode": "Download cheat code",
|
||||
"gbatemp_dl_successful_dl": "Successfully downloaded the following cheat code:\n{}",
|
||||
"bid_tid_info": "Those cheats will be added to the end of your existing cheat file.",
|
||||
"dl_cheatcodes": "Download cheat code",
|
||||
"dl_successful": "Successfully downloaded the following cheat code:\n{}",
|
||||
"applet_mode_not_supported": "Due to memory constraints, in applet mode you may only fetch cheat codes for the game you're currently playing. Please launch AIO-Switch-Updater through title override to download cheat codes for any game you own.",
|
||||
"cheatfile_label": "Here are the cheat codes listed in file {}",
|
||||
"not_found": "No proper cheat codes could be found for this game",
|
||||
|
@ -52,7 +52,9 @@
|
|||
"show_cheat_files": "Show all cheat files",
|
||||
"cheats_not_found": "Couldn't find cheat codes matching this build ID.",
|
||||
"old_cheats_found": "Cheat codes matching BID(s) [ {}] exist.",
|
||||
"cheatslips_logout": "Log out"
|
||||
"cheatslips_logout": "Log out",
|
||||
"gfx_title": "Graphics enhancing cheats",
|
||||
"get_gfx": "Download individual graphics enhancing cheat codes"
|
||||
},
|
||||
"common": {
|
||||
"downloading": "Downloading…",
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
"exclude_titles_desc": "Puedes desactivar las actualizaciones de trucos con este menú",
|
||||
"exclude_titles_save": "Guardar elección y volver",
|
||||
"dl_all": "Descarga y extrae al completo los todos los trucos de GBAtemp.net",
|
||||
"gbatemp_dl": "Descarga los trucos desde GBAtemp.net. Estos trucos seran añadidos al final del archivo de trucos actual.",
|
||||
"gbatemp_dl_cheatcode": "Descargar trucos",
|
||||
"gbatemp_dl_successful_dl": "Se ha descargado exitosamente el siguiente truco:\n{}",
|
||||
"bid_tid_info": "Estos trucos seran añadidos al final del archivo de trucos actual.",
|
||||
"dl_cheatcodes": "Descargar trucos",
|
||||
"dl_successful": "Se ha descargado exitosamente el siguiente truco:\n{}",
|
||||
"applet_mode_not_supported": "Debido a limitaciones de memoria, en 'applet mode' solo puedes obtener trucos para el juego que estás jugando actualmente. Por favor ejecuta AIO-Switch-Updater a travez de un juego para descargar trucos para cualquier juego que tengas.",
|
||||
"cheatfile_label": "Aquí están los trucos listados en el archivo {}",
|
||||
"not_found": "No se pudieron encontrar trucos para este juego.",
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
"exclude_titles_desc": "Vous pouvez desactiver les mises à jour des codes de triche dans ce menu",
|
||||
"exclude_titles_save": "Enregistrer et retour",
|
||||
"dl_all": "Télécharger et extraire toute l'archive de triche de GBAtemp.net",
|
||||
"gbatemp_dl": "Télécharger les codes de triche archivés par GBAtemp.net. Ces codes seront ajoutés à la fin du fichier de triche existant.",
|
||||
"gbatemp_dl_cheatcode": "Télécharger un code de triche",
|
||||
"gbatemp_dl_successful_dl": "Téléchargement du code de triche réussi\u00a0:\n{}",
|
||||
"bid_tid_info": "Ces codes seront ajoutés à la fin du fichier de triche existant.",
|
||||
"dl_cheatcodes": "Télécharger un code de triche",
|
||||
"dl_successful": "Téléchargement du code de triche réussi\u00a0:\n{}",
|
||||
"applet_mode_not_supported": "À cause de contraintes de mémoire du mode applet, vous ne pouvez récupérer que les codes de triche pour le jeu auquel vous être en train de jouer. Pour télécharger les codes de triche de tout autre jeu installé, veuillez lancer AIO-Switch-Updater via la redirection d'application.",
|
||||
"cheatfile_label": "Voici les codes de triche listés dans le fichier {}",
|
||||
"not_found": "Aucun code de triche valide n'a été trouvé pour ce jeu",
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
"exclude_titles_desc": "Con questo menu puoi disattivare l'aggiornamento dei cheat per i singoli titoli",
|
||||
"exclude_titles_save": "Salva ed esci",
|
||||
"dl_all": "Salva ed estrai tutti i cheat esistenti su GBAtemp.net",
|
||||
"gbatemp_dl": "Scarica cheat curati da GBAtemp.net. Questi cheat verranno aggiunti al termine del file di cheat presente sul tuo sistema.\n\u25c6 ID della build: {}",
|
||||
"gbatemp_dl_cheatcode": "Scarica cheat",
|
||||
"gbatemp_dl_successful_dl": "Il seguente cheat è stato scaricato correttamente:\n{}",
|
||||
"bid_tid_info": "Questi cheat verranno aggiunti al termine del file di cheat presente sul tuo sistema.\n\u25c6 ID della build: {}",
|
||||
"dl_cheatcodes": "Scarica cheat",
|
||||
"dl_successful": "Il seguente cheat è stato scaricato correttamente:\n{}",
|
||||
"applet_mode_not_supported": "A causa di limitazioni di memoria, nella Modalità Applet puoi ottenere i cheat soltanto per il gioco che stai attualmente giocando. Lancia AIO-Switch-Updater come applicazione per ottenere i cheat per tutti i giochi che possiedi.",
|
||||
"cheatfile_label": "Questi sono i cheat presenti nel file {}",
|
||||
"not_found": "Non sono stati trovati cheat validi per questo gioco",
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
"exclude_titles_desc": "このメニューでチートのアップデートをオフにする事ができます",
|
||||
"exclude_titles_save": "選択を保存して戻る",
|
||||
"dl_all": "GBAtemp.netチートアーカイブ全体をダウンロードして抽出",
|
||||
"gbatemp_dl": "GBAtemp.netからキュレーションされたチートコードをダウンロードします。 これらのチートは、既存のチートファイルの最後に追加されます。",
|
||||
"gbatemp_dl_cheatcode": "チートコードをダウンロード",
|
||||
"gbatemp_dl_successful_dl": "次のチートコードを正常にダウンロードしました:\n{}",
|
||||
"bid_tid_info": "これらのチートは、既存のチートファイルの最後に追加されます。",
|
||||
"dl_cheatcodes": "チートコードをダウンロード",
|
||||
"dl_successful": "次のチートコードを正常にダウンロードしました:\n{}",
|
||||
"applet_mode_not_supported": "メモリの制約により、アプレットモードでは、現在プレイしているゲームのチートコードのみをフェッチできます。所有しているゲームのチートコードをダウンロードするには、タイトルリダイレクトを通じてAIO-Switch-Updaterを起動してください。",
|
||||
"cheatfile_label": "これがファイルにリストされているチートコードです {}",
|
||||
"not_found": "このゲームに適切なチートコードが見つかりませんでした",
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
"exclude_all": "모두 제외",
|
||||
"exclude_none": "제외 없음",
|
||||
"dl_all": "전체 GBAtemp.net 치트 아카이브 다운로드 및 추출",
|
||||
"gbatemp_dl": "GBAtemp.net에서 엄선된 치트 코드를 다운로드하세요. 해당 치트는 기존 치트 파일 끝에 추가됩니다.",
|
||||
"gbatemp_dl_cheatcode": "치트 코드 다운로드",
|
||||
"gbatemp_dl_successful_dl": "다음 치트 코드를 성공적으로 다운로드했습니다:\n{}",
|
||||
"bid_tid_info": "해당 치트는 기존 치트 파일 끝에 추가됩니다.",
|
||||
"dl_cheatcodes": "치트 코드 다운로드",
|
||||
"dl_successful": "다음 치트 코드를 성공적으로 다운로드했습니다:\n{}",
|
||||
"applet_mode_not_supported": "메모리 제약으로 인해 애플릿 모드에서는 현재 플레이 중인 게임의 치트 코드만 가져올 수 있습니다. 보유한 게임에 대한 치트 코드를 다운로드하려면 타이틀 리디렉션을 통해 일체형-스위치-업데이터를 실행하세요.",
|
||||
"cheatfile_label": "다음은 {} 파일에 나열된 치트 코드입니다.",
|
||||
"not_found": "이 게임에 대한 적절한 치트 코드를 찾을 수 없습니다.",
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
"exclude_titles_desc": "你可以用这个菜单关闭金手指更新",
|
||||
"exclude_titles_save": "保存选择并返回",
|
||||
"dl_all": "下载并解压整个GBAtemp.net金手指压缩包文件",
|
||||
"gbatemp_dl": "从GBAtemp.net下载精选金手指。 这些金手指代码将被添加到您现有的金手指文件的末尾。\n\u25c6 版本号: {}",
|
||||
"gbatemp_dl_cheatcode": "下载金手指",
|
||||
"gbatemp_dl_successful_dl": "已成功下载以下金手指:\n{}",
|
||||
"bid_tid_info": "这些金手指代码将被添加到您现有的金手指文件的末尾。\n\u25c6 版本号: {}",
|
||||
"dl_cheatcodes": "下载金手指",
|
||||
"dl_successful": "已成功下载以下金手指:\n{}",
|
||||
"applet_mode_not_supported": "由于内存的限制,在applet模式下,你只能获取当前游戏的金手指。请通过游戏重定向启动AIO-Switch-Updater,为你拥有的任何游戏下载金手指。",
|
||||
"cheatfile_label": "以下是文件中列出的金手指 {}",
|
||||
"not_found": "找不到此游戏合适的金手指",
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
"exclude_all": "排除所有項目",
|
||||
"exclude_none": "不進行排除",
|
||||
"dl_all": "下載GBAtemp.net目前全部的金手指並個別解壓縮後歸檔存放",
|
||||
"gbatemp_dl": "準備從GBAtemp.net下載金手指。下載的金手指將會放置排列在目前已有的金手指項目之後。",
|
||||
"gbatemp_dl_cheatcode": "下載金手指",
|
||||
"gbatemp_dl_successful_dl": "下列金手指已下載完成:\n{}",
|
||||
"bid_tid_info": "下載的金手指將會放置排列在目前已有的金手指項目之後。",
|
||||
"dl_cheatcodes": "下載金手指",
|
||||
"dl_successful": "下列金手指已下載完成:\n{}",
|
||||
"applet_mode_not_supported": "由於記憶體限制,在applet模式下,只能擷取目前正在玩的遊戲的金手指。請重新執行AIO-Switch-Updater並透過title重新導向來下載其他遊戲的金手指",
|
||||
"cheatfile_label": "列出檔案內的金手指{}",
|
||||
"not_found": "沒有此遊戲的金手指",
|
||||
|
|
|
@ -197,10 +197,29 @@ void AppPage_Gbatemp::CreateLabel()
|
|||
|
||||
void AppPage_Gbatemp::AddListItem(const std::string& name, u64 tid)
|
||||
{
|
||||
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)); });
|
||||
list->addView(listItem);
|
||||
}
|
||||
|
||||
AppPage_Gfx::AppPage_Gfx() : AppPage()
|
||||
{
|
||||
this->PopulatePage();
|
||||
}
|
||||
|
||||
void AppPage_Gfx::CreateLabel()
|
||||
{
|
||||
this->setTitle("menus/cheats/gfx_title"_i18n);
|
||||
label = new brls::Label(brls::LabelStyle::DESCRIPTION, "menus/cheats/cheatslips_select"_i18n, true);
|
||||
list->addView(label);
|
||||
}
|
||||
|
||||
void AppPage_Gfx::AddListItem(const std::string& name, u64 tid)
|
||||
{
|
||||
listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { brls::Application::pushView(new DownloadCheatsPage_Gfx(tid, name)); });
|
||||
list->addView(listItem);
|
||||
}
|
||||
|
||||
|
||||
AppPage_Exclude::AppPage_Exclude() : AppPage()
|
||||
{
|
||||
this->PopulatePage();
|
||||
|
|
|
@ -326,11 +326,15 @@ void DownloadCheatsPage_CheatSlips::ShowCheatsContent(nlohmann::ordered_json tit
|
|||
brls::PopupFrame::open("menus/cheats/sheet_content"_i18n, appView, "", "");
|
||||
}
|
||||
|
||||
DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name)
|
||||
DownloadCheatsPage_Github::DownloadCheatsPage_Github(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name)
|
||||
{
|
||||
}
|
||||
|
||||
void DownloadCheatsPage_Github::PopulateList(uint64_t tid, const std::string& name)
|
||||
{
|
||||
this->label = new brls::Label(
|
||||
brls::LabelStyle::DESCRIPTION,
|
||||
"menus/cheats/gbatemp_dl"_i18n +
|
||||
"menus/cheats/bid_tid_info"_i18n +
|
||||
"\n\uE016 Title ID: " + util::formatApplicationId(this->tid) +
|
||||
"\n\uE016 Build ID: " + this->bid,
|
||||
true);
|
||||
|
@ -338,15 +342,15 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
|
|||
|
||||
if (this->bid != "") {
|
||||
nlohmann::ordered_json cheatsJson;
|
||||
download::getRequest(CHEATS_DIRECTORY + util::formatApplicationId(this->tid) + ".json", cheatsJson);
|
||||
download::getRequest(this->get_url() + util::formatApplicationId(this->tid) + ".json", cheatsJson);
|
||||
if (cheatsJson.find(this->bid) != cheatsJson.end()) {
|
||||
for (auto& [key, val] : cheatsJson[this->bid].items()) {
|
||||
auto title = key;
|
||||
auto content = val;
|
||||
this->listItem = new brls::ListItem(title);
|
||||
listItem->registerAction("menus/cheats/gbatemp_dl_cheatcode"_i18n, brls::Key::A, [this, content, title] {
|
||||
listItem->registerAction("menus/cheats/dl_cheatcodes"_i18n, brls::Key::A, [this, content, title] {
|
||||
WriteCheats(content);
|
||||
util::showDialogBoxInfo(fmt::format("menus/cheats/gbatemp_dl_successful_dl"_i18n, title));
|
||||
util::showDialogBoxInfo(fmt::format("menus/cheats/dl_successful"_i18n, title));
|
||||
return true;
|
||||
});
|
||||
this->list->addView(listItem);
|
||||
|
@ -369,3 +373,13 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
|
|||
this->AddCheatsfileListItem();
|
||||
this->setContentView(this->list);
|
||||
}
|
||||
|
||||
DownloadCheatsPage_Gbatemp::DownloadCheatsPage_Gbatemp(uint64_t tid, const std::string& name) : DownloadCheatsPage_Github(tid, name)
|
||||
{
|
||||
this->PopulateList(tid, name);
|
||||
}
|
||||
|
||||
DownloadCheatsPage_Gfx::DownloadCheatsPage_Gfx(uint64_t tid, const std::string& name) : DownloadCheatsPage_Github(tid, name)
|
||||
{
|
||||
this->PopulateList(tid, name);
|
||||
}
|
|
@ -29,7 +29,8 @@ ListDownloadTab::ListDownloadTab(const contentType type, const nlohmann::ordered
|
|||
"menus/cheats/cheats_label"_i18n,
|
||||
true);
|
||||
this->addView(cheatsLabel);
|
||||
this->creategbatempItem();
|
||||
this->createGbatempItem();
|
||||
this->createGfxItem();
|
||||
this->createCheatSlipItem();
|
||||
}
|
||||
|
||||
|
@ -198,7 +199,7 @@ void ListDownloadTab::createCheatSlipItem()
|
|||
this->addView(cheatslipsItem);
|
||||
}
|
||||
|
||||
void ListDownloadTab::creategbatempItem()
|
||||
void ListDownloadTab::createGbatempItem()
|
||||
{
|
||||
brls::ListItem* gbatempItem = new brls::ListItem("menus/cheats/get_gbatemp"_i18n);
|
||||
gbatempItem->setHeight(LISTITEM_HEIGHT);
|
||||
|
@ -207,4 +208,15 @@ void ListDownloadTab::creategbatempItem()
|
|||
return true;
|
||||
});
|
||||
this->addView(gbatempItem);
|
||||
}
|
||||
|
||||
void ListDownloadTab::createGfxItem()
|
||||
{
|
||||
brls::ListItem* gfxItem = new brls::ListItem("menus/cheats/get_gfx"_i18n);
|
||||
gfxItem->setHeight(LISTITEM_HEIGHT);
|
||||
gfxItem->getClickEvent()->subscribe([](brls::View* view) {
|
||||
brls::Application::pushView(new AppPage_Gfx());
|
||||
return true;
|
||||
});
|
||||
this->addView(gfxItem);
|
||||
}
|
Loading…
Reference in a new issue