2021-09-11 14:48:13 +01:00
|
|
|
#pragma once
|
2021-02-06 17:24:47 +00:00
|
|
|
|
|
|
|
#include <switch.h>
|
2021-09-11 14:48:13 +01:00
|
|
|
|
|
|
|
#include <borealis.hpp>
|
2021-07-16 16:33:57 +01:00
|
|
|
#include <filesystem>
|
2021-09-11 14:48:13 +01:00
|
|
|
#include <json.hpp>
|
2021-07-16 16:33:57 +01:00
|
|
|
|
2022-05-16 14:39:50 +01:00
|
|
|
namespace cheats_util {
|
|
|
|
u32 GetVersion(uint64_t title_id);
|
2021-07-16 16:33:57 +01:00
|
|
|
void ShowCheatFiles(uint64_t tid, const std::string& name);
|
2021-10-01 18:22:52 +01:00
|
|
|
void ShowCheatSheet(u64 tid, const std::string& bid, const std::string& name);
|
|
|
|
bool CreateCheatList(const std::filesystem::path& path, brls::List** cheatsList);
|
2021-10-08 20:53:38 +01:00
|
|
|
void DeleteCheats(u64 tid, const std::string& bid);
|
2022-05-16 14:39:50 +01:00
|
|
|
} // namespace cheats_util
|
2021-02-06 17:24:47 +00:00
|
|
|
|
|
|
|
class DownloadCheatsPage : public brls::AppletFrame
|
|
|
|
{
|
2021-09-11 14:48:13 +01:00
|
|
|
protected:
|
|
|
|
brls::List* list;
|
|
|
|
brls::Label* label;
|
|
|
|
brls::ListItem* del;
|
|
|
|
uint64_t tid = 0;
|
|
|
|
std::string bid = "";
|
2021-10-26 14:48:24 +01:00
|
|
|
std::string name;
|
2021-09-11 14:48:13 +01:00
|
|
|
u32 version = 0;
|
2021-02-06 17:24:47 +00:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
DownloadCheatsPage(uint64_t tid, const std::string& name);
|
|
|
|
void GetBuildID();
|
|
|
|
void GetBuildIDFromDmnt();
|
|
|
|
void GetBuildIDFromFile();
|
|
|
|
void WriteCheats(const std::string& cheatContent);
|
2021-10-26 14:48:24 +01:00
|
|
|
void AddCheatsfileListItem();
|
2022-02-20 15:33:54 +00:00
|
|
|
void ShowBidNotFound();
|
2022-03-10 13:11:20 +00:00
|
|
|
void ShowCheatsNotFound(const std::string& versionsWithCheats = "");
|
2021-02-10 17:41:13 +00:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u64 base;
|
|
|
|
u64 size;
|
|
|
|
} DmntMemoryRegionExtents;
|
2021-02-10 17:41:13 +00:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u64 process_id;
|
|
|
|
u64 title_id;
|
|
|
|
DmntMemoryRegionExtents main_nso_extents;
|
|
|
|
DmntMemoryRegionExtents heap_extents;
|
|
|
|
DmntMemoryRegionExtents alias_extents;
|
|
|
|
DmntMemoryRegionExtents address_space_extents;
|
|
|
|
u8 main_nso_build_id[0x20];
|
|
|
|
} DmntCheatProcessMetadata;
|
2021-06-05 18:10:51 +01:00
|
|
|
};
|
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
class DownloadCheatsPage_CheatSlips : public DownloadCheatsPage
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
brls::ToggleListItem* listItem;
|
|
|
|
std::vector<std::pair<brls::ToggleListItem*, int>> toggles;
|
2022-10-31 18:59:48 +00:00
|
|
|
std::string GetCheatsTitle(nlohmann::ordered_json cheat);
|
2021-09-11 14:48:13 +01:00
|
|
|
void ShowCheatsContent(nlohmann::ordered_json titles);
|
2021-06-05 18:10:51 +01:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
public:
|
|
|
|
DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name);
|
2021-06-05 18:10:51 +01:00
|
|
|
};
|
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
class DownloadCheatsPage_GbaTemp : public DownloadCheatsPage
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
brls::ListItem* listItem;
|
2021-06-05 18:10:51 +01:00
|
|
|
|
2021-09-11 14:48:13 +01:00
|
|
|
public:
|
|
|
|
DownloadCheatsPage_GbaTemp(uint64_t tid, const std::string& name);
|
2021-02-06 17:24:47 +00:00
|
|
|
};
|