1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-28 12:22:02 +00:00
AIO-switch-updater/source/main.cpp
2021-09-11 15:48:13 +02:00

77 lines
1.8 KiB
C++

#include <switch.h>
#include <borealis.hpp>
#include <filesystem>
#include <json.hpp>
#include "constants.hpp"
#include "current_cfw.hpp"
#include "fs.hpp"
#include "main_frame.hpp"
#include "warning_page.hpp"
namespace i18n = brls::i18n;
using namespace i18n::literals;
//TimeServiceType __nx_time_service_type = TimeServiceType_System;
CFW CurrentCfw::running_cfw;
int main(int argc, char* argv[])
{
// Init the app
if (!brls::Application::init(APP_TITLE)) {
brls::Logger::error("Unable to init Borealis application");
return EXIT_FAILURE;
}
nlohmann::json languageFile = fs::parseJsonFile(LANGUAGE_JSON);
if (languageFile.find("language") != languageFile.end())
i18n::loadTranslations(languageFile["language"]);
else
i18n::loadTranslations();
//appletInitializeGamePlayRecording();
// Setup verbose logging on PC
#ifndef __SWITCH__
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);
#endif
setsysInitialize();
plInitialize(PlServiceType_User);
nsInitialize();
socketInitializeDefault();
nxlinkStdio();
pmdmntInitialize();
pminfoInitialize();
splInitialize();
romfsInit();
CurrentCfw::running_cfw = CurrentCfw::getCFW();
fs::createTree(CONFIG_PATH);
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);
brls::Logger::debug("Start");
if (std::filesystem::exists(HIDDEN_AIO_FILE)) {
brls::Application::pushView(new MainFrame());
}
else {
brls::Application::pushView(new WarningPage("menus/main/launch_warning"_i18n));
}
while (brls::Application::mainLoop())
;
romfsExit();
splExit();
pminfoExit();
pmdmntExit();
socketExit();
nsExit();
setsysExit();
plExit();
return EXIT_SUCCESS;
}