1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-09 20:11:48 +00:00
AIO-switch-updater/source/main.cpp

78 lines
1.8 KiB
C++
Raw Normal View History

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