2020-09-20 02:21:28 +02:00
|
|
|
#include "main_frame.hpp"
|
2021-02-10 17:28:47 +01:00
|
|
|
#include "about_tab.hpp"
|
|
|
|
#include "list_download_tab.hpp"
|
|
|
|
#include "ams_tab.hpp"
|
|
|
|
#include "tools_tab.hpp"
|
|
|
|
#include "utils.hpp"
|
2021-03-16 15:56:46 +01:00
|
|
|
#include "fs.hpp"
|
2021-05-28 15:51:30 +02:00
|
|
|
#include <json.hpp>
|
|
|
|
#include <fstream>
|
2021-03-10 21:43:00 +01:00
|
|
|
|
2020-10-06 00:53:12 +02:00
|
|
|
namespace i18n = brls::i18n;
|
|
|
|
using namespace i18n::literals;
|
2021-02-06 18:24:47 +01:00
|
|
|
using json = nlohmann::json;
|
2020-10-06 00:53:12 +02:00
|
|
|
|
2021-06-03 22:51:00 +02:00
|
|
|
namespace {
|
|
|
|
constexpr const char AppTitle[] = APP_TITLE;
|
|
|
|
constexpr const char AppVersion[] = APP_VERSION;
|
|
|
|
}
|
|
|
|
|
2020-09-20 02:21:28 +02:00
|
|
|
MainFrame::MainFrame() : TabFrame()
|
|
|
|
{
|
2021-02-01 17:01:49 +01:00
|
|
|
this->setIcon("romfs:/gui_icon.png");
|
2021-06-03 22:51:00 +02:00
|
|
|
this->setTitle(AppTitle);
|
2021-02-01 17:01:49 +01:00
|
|
|
|
2021-06-03 22:51:00 +02:00
|
|
|
s64 freeStorage;
|
2021-03-16 03:04:21 +01:00
|
|
|
std::string tag = util::getLatestTag(TAGS_INFO);
|
2021-06-03 22:55:01 +02:00
|
|
|
this->setFooterText(fmt::format("menus/main/footer_text"_i18n,
|
2021-06-03 22:51:00 +02:00
|
|
|
(!tag.empty() && tag != AppVersion) ? AppVersion + "menus/main/new_update"_i18n : AppVersion,
|
2021-06-03 22:55:01 +02:00
|
|
|
R_SUCCEEDED(fs::getFreeStorageSD(freeStorage)) ? (float)freeStorage/0x40000000 : -1)
|
2021-06-03 22:51:00 +02:00
|
|
|
);
|
|
|
|
|
2021-03-16 15:56:46 +01:00
|
|
|
json hideStatus = fs::parseJsonFile(HIDE_TABS_JSON);
|
2021-02-06 18:24:47 +01:00
|
|
|
|
2021-05-21 18:14:26 +02:00
|
|
|
bool erista = util::isErista();
|
2021-02-17 19:00:12 +01:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "about"))
|
2021-03-01 19:19:17 +01:00
|
|
|
this->addTab("menus/main/about"_i18n, new AboutTab());
|
2021-02-06 18:24:47 +01:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "atmosphere"))
|
|
|
|
this->addTab("menus/main/update_ams"_i18n, new AmsTab(erista, util::getBoolValue(hideStatus, "atmosphereentries")));
|
|
|
|
|
|
|
|
if(!util::getBoolValue(hideStatus, "cfw"))
|
2021-06-28 00:46:00 +02:00
|
|
|
this->addTab("menus/main/update_bootloaders"_i18n, new ListDownloadTab(archiveType::cfw));
|
2020-09-20 02:21:28 +02:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "sigpatches"))
|
2021-03-16 03:04:21 +01:00
|
|
|
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(archiveType::sigpatches));
|
2020-09-20 02:21:28 +02:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "firmwares"))
|
2021-03-16 03:04:21 +01:00
|
|
|
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(archiveType::fw));
|
2020-09-20 02:21:28 +02:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "cheats"))
|
2021-03-16 03:04:21 +01:00
|
|
|
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(archiveType::cheats));
|
2020-10-06 00:53:12 +02:00
|
|
|
|
2021-07-21 15:38:43 +02:00
|
|
|
if(!util::getBoolValue(hideStatus, "tools"))
|
|
|
|
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, erista, hideStatus));
|
2020-10-06 00:53:12 +02:00
|
|
|
|
2021-02-15 19:31:06 +01:00
|
|
|
this->registerAction("" , brls::Key::B, [this] { return true; });
|
2020-09-20 02:21:28 +02:00
|
|
|
}
|