1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-08 19:41:49 +00:00
AIO-switch-updater/include/app_page.hpp

93 lines
1.9 KiB
C++
Raw Normal View History

2020-09-20 01:21:28 +01:00
#pragma once
#include <switch.h>
2021-09-11 14:48:13 +01:00
2020-09-20 01:21:28 +01:00
#include <algorithm>
2021-09-11 14:48:13 +01:00
#include <borealis.hpp>
#include <filesystem>
2022-05-16 14:39:50 +01:00
#include <json.hpp>
2021-02-10 16:28:47 +00:00
#include <set>
2020-09-20 01:21:28 +01:00
static constexpr uint32_t MaxTitleCount = 64000;
2020-09-20 01:21:28 +01:00
2021-09-11 14:48:13 +01:00
enum class appPageType
{
base,
cheatSlips,
gbatempCheats
};
2020-09-20 01:21:28 +01:00
class AppPage : public brls::AppletFrame
{
2021-09-11 14:48:13 +01:00
private:
brls::ListItem* download;
std::set<std::string> titles;
2021-09-11 14:48:13 +01:00
protected:
brls::List* list;
brls::Label* label;
brls::ListItem* listItem;
void CreateDownloadAllButton();
uint64_t GetCurrentApplicationId();
u32 InitControlData(NsApplicationControlData** controlData);
uint32_t GetControlData(u64 tid, NsApplicationControlData* controlData, u64& controlSize, std::string& name);
virtual void PopulatePage();
virtual void CreateLabel(){};
2022-05-16 14:39:50 +01:00
virtual void AddListItem(const std::string& name, uint64_t tid);
2021-09-11 14:48:13 +01:00
public:
AppPage();
};
class AppPage_Exclude : public AppPage
{
2021-09-11 14:48:13 +01:00
private:
std::set<std::pair<brls::ToggleListItem*, std::string>> items;
void PopulatePage() override;
void CreateLabel() override;
public:
AppPage_Exclude();
};
class AppPage_CheatSlips : public AppPage
{
2021-09-11 14:48:13 +01:00
private:
void CreateLabel() override;
2022-05-16 14:39:50 +01:00
void AddListItem(const std::string& name, uint64_t tid) override;
2021-09-11 14:48:13 +01:00
public:
AppPage_CheatSlips();
};
class AppPage_Gbatemp : public AppPage
{
2021-09-11 14:48:13 +01:00
private:
void CreateLabel() override;
2022-05-16 14:39:50 +01:00
void AddListItem(const std::string& name, uint64_t tid) override;
2020-09-20 01:21:28 +01:00
2021-09-11 14:48:13 +01:00
public:
AppPage_Gbatemp();
};
class AppPage_DownloadedCheats : public AppPage
{
2021-09-11 14:48:13 +01:00
private:
std::set<std::string> titles;
void CreateLabel() override;
2022-05-16 14:39:50 +01:00
void AddListItem(const std::string& name, uint64_t tid) override;
2021-09-11 14:48:13 +01:00
void GetExistingCheatsTids();
2021-09-11 14:48:13 +01:00
public:
AppPage_DownloadedCheats();
2022-05-16 14:39:50 +01:00
};
class AppPage_OutdatedTitles : public AppPage
{
private:
nlohmann::ordered_json versions;
void AddListItem(const std::string& name, uint64_t tid) override;
public:
AppPage_OutdatedTitles();
2020-09-20 01:21:28 +01:00
};