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