2022-01-21 20:22:13 +01:00
|
|
|
#include <server.h>
|
2020-09-19 12:48:34 +02:00
|
|
|
#include "imgui.h"
|
|
|
|
#include <stdio.h>
|
2020-09-20 00:19:39 +02:00
|
|
|
#include <gui/main_window.h>
|
|
|
|
#include <gui/style.h>
|
2020-11-30 21:17:36 +01:00
|
|
|
#include <gui/gui.h>
|
2020-09-20 00:19:39 +02:00
|
|
|
#include <gui/icons.h>
|
2020-09-19 12:48:34 +02:00
|
|
|
#include <version.h>
|
|
|
|
#include <spdlog/spdlog.h>
|
2020-12-05 22:42:12 +01:00
|
|
|
#include <gui/widgets/bandplan.h>
|
2020-09-19 12:48:34 +02:00
|
|
|
#include <stb_image.h>
|
|
|
|
#include <config.h>
|
2020-09-24 19:36:57 +02:00
|
|
|
#include <core.h>
|
2020-12-22 14:50:26 +01:00
|
|
|
#include <options.h>
|
2020-12-23 00:11:12 +01:00
|
|
|
#include <filesystem>
|
2021-06-23 21:45:38 +02:00
|
|
|
#include <gui/menus/theme.h>
|
2022-01-29 20:35:08 +01:00
|
|
|
#include <backend.h>
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
#define STB_IMAGE_RESIZE_IMPLEMENTATION
|
|
|
|
#include <stb_image_resize.h>
|
2020-10-07 22:44:54 +02:00
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <signal_path/signal_path.h>
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
|
|
|
#endif
|
|
|
|
|
2021-02-11 22:49:33 +01:00
|
|
|
#ifndef INSTALL_PREFIX
|
2021-12-19 22:11:44 +01:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#define INSTALL_PREFIX "/usr/local"
|
|
|
|
#else
|
|
|
|
#define INSTALL_PREFIX "/usr"
|
|
|
|
#endif
|
2021-02-11 22:49:33 +01:00
|
|
|
#endif
|
|
|
|
|
2020-09-24 19:36:57 +02:00
|
|
|
namespace core {
|
|
|
|
ConfigManager configManager;
|
2020-12-08 04:36:37 +01:00
|
|
|
ModuleManager moduleManager;
|
2021-04-22 04:15:23 +02:00
|
|
|
ModuleComManager modComManager;
|
2020-10-02 01:44:18 +02:00
|
|
|
|
|
|
|
void setInputSampleRate(double samplerate) {
|
2022-01-21 20:22:13 +01:00
|
|
|
// Forward this to the server
|
|
|
|
if (options::opts.serverMode) { server::setInputSampleRate(samplerate); return; }
|
|
|
|
|
2021-07-26 21:18:06 +02:00
|
|
|
sigpath::signalPath.sourceSampleRate = samplerate;
|
|
|
|
double effectiveSr = samplerate / ((double)(1 << sigpath::signalPath.decimation));
|
2020-10-02 01:44:18 +02:00
|
|
|
// NOTE: Zoom controls won't work
|
2021-07-26 21:18:06 +02:00
|
|
|
spdlog::info("New DSP samplerate: {0} (source samplerate is {1})", effectiveSr, samplerate);
|
|
|
|
gui::waterfall.setBandwidth(effectiveSr);
|
2020-12-14 18:14:04 +01:00
|
|
|
gui::waterfall.setViewOffset(0);
|
2021-07-26 21:18:06 +02:00
|
|
|
gui::waterfall.setViewBandwidth(effectiveSr);
|
|
|
|
sigpath::signalPath.setSampleRate(effectiveSr);
|
2021-08-30 19:22:00 +02:00
|
|
|
gui::mainWindow.setViewBandwidthSlider(1.0);
|
2020-10-02 01:44:18 +02:00
|
|
|
}
|
2020-09-24 19:36:57 +02:00
|
|
|
};
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
// main
|
2021-12-19 22:11:44 +01:00
|
|
|
int sdrpp_main(int argc, char* argv[]) {
|
2020-09-19 12:48:34 +02:00
|
|
|
spdlog::info("SDR++ v" VERSION_STR);
|
|
|
|
|
2021-11-17 15:37:21 -06:00
|
|
|
#ifdef IS_MACOS_BUNDLE
|
2021-11-15 20:33:09 -06:00
|
|
|
// If this is a MacOS .app, CD to the correct directory
|
|
|
|
auto execPath = std::filesystem::absolute(argv[0]);
|
|
|
|
chdir(execPath.parent_path().string().c_str());
|
|
|
|
#endif
|
|
|
|
|
2020-12-22 14:50:26 +01:00
|
|
|
// Load default options and parse command line
|
|
|
|
options::loadDefaults();
|
|
|
|
if (!options::parse(argc, argv)) { return -1; }
|
|
|
|
|
2021-02-06 21:28:27 +01:00
|
|
|
#ifdef _WIN32
|
2022-02-14 19:36:49 +01:00
|
|
|
if (!options::opts.showConsole && !options::opts.serverMode) { FreeConsole(); }
|
2021-02-06 21:28:27 +01:00
|
|
|
#endif
|
|
|
|
|
2020-12-23 00:11:12 +01:00
|
|
|
// Check root directory
|
|
|
|
if (!std::filesystem::exists(options::opts.root)) {
|
|
|
|
spdlog::warn("Root directory {0} does not exist, creating it", options::opts.root);
|
2021-11-28 03:17:08 +01:00
|
|
|
if (!std::filesystem::create_directories(options::opts.root)) {
|
2020-12-23 00:11:12 +01:00
|
|
|
spdlog::error("Could not create root directory {0}", options::opts.root);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!std::filesystem::is_directory(options::opts.root)) {
|
|
|
|
spdlog::error("{0} is not a directory", options::opts.root);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-12-10 05:18:40 +01:00
|
|
|
// ======== DEFAULT CONFIG ========
|
|
|
|
json defConfig;
|
|
|
|
defConfig["bandColors"]["amateur"] = "#FF0000FF";
|
|
|
|
defConfig["bandColors"]["aviation"] = "#00FF00FF";
|
|
|
|
defConfig["bandColors"]["broadcast"] = "#0000FFFF";
|
|
|
|
defConfig["bandColors"]["marine"] = "#00FFFFFF";
|
|
|
|
defConfig["bandColors"]["military"] = "#FFFF00FF";
|
|
|
|
defConfig["bandPlan"] = "General";
|
|
|
|
defConfig["bandPlanEnabled"] = true;
|
2021-04-14 01:45:21 +02:00
|
|
|
defConfig["bandPlanPos"] = 0;
|
2020-12-12 05:34:58 +01:00
|
|
|
defConfig["centerTuning"] = false;
|
2020-12-31 14:26:12 +01:00
|
|
|
defConfig["colorMap"] = "Classic";
|
2021-04-13 04:57:42 +02:00
|
|
|
defConfig["fastFFT"] = false;
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["fftHeight"] = 300;
|
2021-07-27 01:57:12 +02:00
|
|
|
defConfig["fftRate"] = 20;
|
2021-04-13 18:31:38 +02:00
|
|
|
defConfig["fftSize"] = 65536;
|
2021-07-05 05:26:49 +02:00
|
|
|
defConfig["fftWindow"] = 1;
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["frequency"] = 100000000.0;
|
2021-04-13 04:57:42 +02:00
|
|
|
defConfig["fullWaterfallUpdate"] = false;
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["max"] = 0.0;
|
|
|
|
defConfig["maximized"] = false;
|
2021-11-05 18:57:50 +01:00
|
|
|
defConfig["fullscreen"] = false;
|
2021-04-22 23:49:35 +02:00
|
|
|
|
|
|
|
// Menu
|
|
|
|
defConfig["menuElements"] = json::array();
|
|
|
|
|
|
|
|
defConfig["menuElements"][0]["name"] = "Source";
|
|
|
|
defConfig["menuElements"][0]["open"] = true;
|
|
|
|
|
|
|
|
defConfig["menuElements"][1]["name"] = "Radio";
|
|
|
|
defConfig["menuElements"][1]["open"] = true;
|
|
|
|
|
|
|
|
defConfig["menuElements"][2]["name"] = "Recorder";
|
|
|
|
defConfig["menuElements"][2]["open"] = true;
|
|
|
|
|
|
|
|
defConfig["menuElements"][3]["name"] = "Sinks";
|
|
|
|
defConfig["menuElements"][3]["open"] = true;
|
|
|
|
|
2021-07-03 19:46:21 +02:00
|
|
|
defConfig["menuElements"][3]["name"] = "Frequency Manager";
|
|
|
|
defConfig["menuElements"][3]["open"] = true;
|
|
|
|
|
2021-05-04 21:05:45 +02:00
|
|
|
defConfig["menuElements"][4]["name"] = "VFO Color";
|
|
|
|
defConfig["menuElements"][4]["open"] = true;
|
2021-04-22 23:49:35 +02:00
|
|
|
|
2021-05-04 21:05:45 +02:00
|
|
|
defConfig["menuElements"][5]["name"] = "Scripting";
|
|
|
|
defConfig["menuElements"][5]["open"] = false;
|
2021-04-22 23:49:35 +02:00
|
|
|
|
2021-05-04 21:05:45 +02:00
|
|
|
defConfig["menuElements"][6]["name"] = "Band Plan";
|
2021-04-22 23:49:35 +02:00
|
|
|
defConfig["menuElements"][6]["open"] = true;
|
|
|
|
|
2021-05-04 21:05:45 +02:00
|
|
|
defConfig["menuElements"][7]["name"] = "Display";
|
|
|
|
defConfig["menuElements"][7]["open"] = true;
|
|
|
|
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["menuWidth"] = 300;
|
2021-02-28 17:32:22 +01:00
|
|
|
defConfig["min"] = -120.0;
|
2020-12-23 00:11:12 +01:00
|
|
|
|
2021-04-23 03:58:10 +02:00
|
|
|
// Module instances
|
2021-07-10 00:28:56 +02:00
|
|
|
defConfig["moduleInstances"]["Airspy Source"]["module"] = "airspy_source";
|
|
|
|
defConfig["moduleInstances"]["Airspy Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["AirspyHF+ Source"]["module"] = "airspyhf_source";
|
|
|
|
defConfig["moduleInstances"]["AirspyHF+ Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["BladeRF Source"]["module"] = "bladerf_source";
|
|
|
|
defConfig["moduleInstances"]["BladeRF Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["File Source"]["module"] = "file_source";
|
|
|
|
defConfig["moduleInstances"]["File Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["HackRF Source"]["module"] = "hackrf_source";
|
|
|
|
defConfig["moduleInstances"]["HackRF Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["LimeSDR Source"]["module"] = "limesdr_source";
|
|
|
|
defConfig["moduleInstances"]["LimeSDR Source"]["enabled"] = true;
|
2022-01-02 18:34:06 +01:00
|
|
|
defConfig["moduleInstances"]["RFspace Source"]["module"] = "rfspace_source";
|
2022-01-02 19:02:12 +01:00
|
|
|
defConfig["moduleInstances"]["RFspace Source"]["enabled"] = true;
|
2021-07-10 00:28:56 +02:00
|
|
|
defConfig["moduleInstances"]["RTL-SDR Source"]["module"] = "rtl_sdr_source";
|
|
|
|
defConfig["moduleInstances"]["RTL-SDR Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["RTL-TCP Source"]["module"] = "rtl_tcp_source";
|
|
|
|
defConfig["moduleInstances"]["RTL-TCP Source"]["enabled"] = true;
|
|
|
|
defConfig["moduleInstances"]["SDRplay Source"]["module"] = "sdrplay_source";
|
|
|
|
defConfig["moduleInstances"]["SDRplay Source"]["enabled"] = true;
|
2022-01-21 20:41:39 +01:00
|
|
|
defConfig["moduleInstances"]["SDR++ Server Source"]["module"] = "sdrpp_server_source";
|
|
|
|
defConfig["moduleInstances"]["SDR++ Server Source"]["enabled"] = true;
|
2021-07-10 00:28:56 +02:00
|
|
|
defConfig["moduleInstances"]["SoapySDR Source"]["module"] = "soapy_source";
|
|
|
|
defConfig["moduleInstances"]["SoapySDR Source"]["enabled"] = true;
|
2021-07-19 04:52:13 +02:00
|
|
|
defConfig["moduleInstances"]["SpyServer Source"]["module"] = "spyserver_source";
|
|
|
|
defConfig["moduleInstances"]["SpyServer Source"]["enabled"] = true;
|
2021-07-10 00:28:56 +02:00
|
|
|
defConfig["moduleInstances"]["PlutoSDR Source"]["module"] = "plutosdr_source";
|
|
|
|
defConfig["moduleInstances"]["PlutoSDR Source"]["enabled"] = true;
|
2021-06-28 02:22:51 +02:00
|
|
|
|
2020-12-24 14:43:14 +01:00
|
|
|
defConfig["moduleInstances"]["Audio Sink"] = "audio_sink";
|
2021-09-23 20:37:34 +02:00
|
|
|
defConfig["moduleInstances"]["Network Sink"] = "network_sink";
|
2020-12-23 00:11:12 +01:00
|
|
|
|
2021-06-28 02:22:51 +02:00
|
|
|
defConfig["moduleInstances"]["Radio"] = "radio";
|
|
|
|
|
2021-07-03 19:46:21 +02:00
|
|
|
defConfig["moduleInstances"]["Frequency Manager"] = "frequency_manager";
|
2021-06-28 02:22:51 +02:00
|
|
|
defConfig["moduleInstances"]["Recorder"] = "recorder";
|
2021-07-18 04:30:55 +02:00
|
|
|
defConfig["moduleInstances"]["Rigctl Server"] = "rigctl_server";
|
2021-12-19 22:11:44 +01:00
|
|
|
|
2021-06-28 02:22:51 +02:00
|
|
|
|
2021-06-23 21:45:38 +02:00
|
|
|
// Themes
|
|
|
|
defConfig["theme"] = "Dark";
|
2022-02-18 19:21:02 +01:00
|
|
|
defConfig["uiScale"] = 1.0f;
|
2021-06-23 21:45:38 +02:00
|
|
|
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["modules"] = json::array();
|
2022-02-13 17:25:23 +01:00
|
|
|
|
2021-07-09 00:58:05 +02:00
|
|
|
defConfig["offsetMode"] = (int)0; // Off
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["offset"] = 0.0;
|
2021-04-23 03:58:10 +02:00
|
|
|
defConfig["showMenu"] = true;
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["showWaterfall"] = true;
|
|
|
|
defConfig["source"] = "";
|
2021-07-26 21:18:06 +02:00
|
|
|
defConfig["decimationPower"] = 0;
|
2021-07-27 23:50:48 +02:00
|
|
|
defConfig["iqCorrection"] = false;
|
2021-05-05 04:31:37 +02:00
|
|
|
|
|
|
|
defConfig["streams"]["Radio"]["muted"] = false;
|
|
|
|
defConfig["streams"]["Radio"]["sink"] = "Audio";
|
|
|
|
defConfig["streams"]["Radio"]["volume"] = 1.0f;
|
|
|
|
|
2020-12-10 05:18:40 +01:00
|
|
|
defConfig["windowSize"]["h"] = 720;
|
|
|
|
defConfig["windowSize"]["w"] = 1280;
|
|
|
|
|
2021-04-22 02:00:33 +02:00
|
|
|
defConfig["vfoOffsets"] = json::object();
|
|
|
|
|
2021-05-04 20:41:23 +02:00
|
|
|
defConfig["vfoColors"]["Radio"] = "#FFFFFF";
|
|
|
|
|
2021-11-15 20:33:09 -06:00
|
|
|
#if defined(_WIN32)
|
2020-12-22 22:39:24 +01:00
|
|
|
defConfig["modulesDirectory"] = "./modules";
|
|
|
|
defConfig["resourcesDirectory"] = "./res";
|
2021-11-17 15:37:21 -06:00
|
|
|
#elif defined(IS_MACOS_BUNDLE)
|
2021-11-15 20:33:09 -06:00
|
|
|
defConfig["modulesDirectory"] = "../Plugins";
|
|
|
|
defConfig["resourcesDirectory"] = "../Resources";
|
2022-02-13 17:25:23 +01:00
|
|
|
#elif defined(__ANDROID__)
|
|
|
|
defConfig["modulesDirectory"] = options::opts.root + "/modules";
|
|
|
|
defConfig["resourcesDirectory"] = options::opts.root + "/res";
|
2020-12-22 22:39:24 +01:00
|
|
|
#else
|
2021-02-11 23:10:01 +01:00
|
|
|
defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins";
|
|
|
|
defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp";
|
2020-12-22 22:39:24 +01:00
|
|
|
#endif
|
|
|
|
|
2020-09-19 12:48:34 +02:00
|
|
|
// Load config
|
2020-12-22 18:42:30 +01:00
|
|
|
spdlog::info("Loading config");
|
2020-12-22 14:50:26 +01:00
|
|
|
core::configManager.setPath(options::opts.root + "/config.json");
|
2020-12-10 05:18:40 +01:00
|
|
|
core::configManager.load(defConfig);
|
2020-09-24 19:36:57 +02:00
|
|
|
core::configManager.enableAutoSave();
|
2021-07-09 14:24:07 -04:00
|
|
|
core::configManager.acquire();
|
2022-02-13 17:25:23 +01:00
|
|
|
|
|
|
|
// Android can't load just any .so file. This means we have to hardcode the name of the modules
|
|
|
|
#ifdef __ANDROID__
|
|
|
|
int modCount = 0;
|
|
|
|
core::configManager.conf["modules"] = json::array();
|
|
|
|
|
|
|
|
core::configManager.conf["modules"][modCount++] = "airspy_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "airspyhf_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "hackrf_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "plutosdr_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "sdrpp_server_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "rfspace_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "rtl_sdr_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "rtl_tcp_source.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "spyserver_source.so";
|
|
|
|
|
|
|
|
core::configManager.conf["modules"][modCount++] = "network_sink.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "audio_sink.so";
|
|
|
|
|
|
|
|
core::configManager.conf["modules"][modCount++] = "radio.so";
|
|
|
|
|
|
|
|
core::configManager.conf["modules"][modCount++] = "frequency_manager.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "recorder.so";
|
|
|
|
core::configManager.conf["modules"][modCount++] = "rigctl_server.so";
|
|
|
|
#endif
|
|
|
|
|
2021-04-22 23:49:35 +02:00
|
|
|
// Fix missing elements in config
|
2020-12-31 14:26:12 +01:00
|
|
|
for (auto const& item : defConfig.items()) {
|
|
|
|
if (!core::configManager.conf.contains(item.key())) {
|
2021-05-04 20:41:23 +02:00
|
|
|
spdlog::info("Missing key in config {0}, repairing", item.key());
|
2020-12-31 14:26:12 +01:00
|
|
|
core::configManager.conf[item.key()] = defConfig[item.key()];
|
|
|
|
}
|
|
|
|
}
|
2021-04-22 23:49:35 +02:00
|
|
|
|
|
|
|
// Remove unused elements
|
|
|
|
auto items = core::configManager.conf.items();
|
|
|
|
for (auto const& item : items) {
|
|
|
|
if (!defConfig.contains(item.key())) {
|
2021-05-04 20:41:23 +02:00
|
|
|
spdlog::info("Unused key in config {0}, repairing", item.key());
|
2021-04-22 23:49:35 +02:00
|
|
|
core::configManager.conf.erase(item.key());
|
|
|
|
}
|
|
|
|
}
|
2021-04-23 03:58:10 +02:00
|
|
|
|
2021-07-10 00:28:56 +02:00
|
|
|
// Update to new module representation in config if needed
|
|
|
|
for (auto [_name, inst] : core::configManager.conf["moduleInstances"].items()) {
|
|
|
|
if (!inst.is_string()) { continue; }
|
|
|
|
std::string mod = inst;
|
|
|
|
json newMod;
|
|
|
|
newMod["module"] = mod;
|
|
|
|
newMod["enabled"] = true;
|
|
|
|
core::configManager.conf["moduleInstances"][_name] = newMod;
|
|
|
|
}
|
|
|
|
|
2022-02-18 19:21:02 +01:00
|
|
|
// Load UI scaling
|
|
|
|
style::uiScale = core::configManager.conf["uiScale"];
|
|
|
|
|
2020-12-31 14:26:12 +01:00
|
|
|
core::configManager.release(true);
|
|
|
|
|
2022-01-21 20:22:13 +01:00
|
|
|
if (options::opts.serverMode) { return server::main(); }
|
2021-07-23 06:29:16 +02:00
|
|
|
|
2021-08-21 17:45:21 +02:00
|
|
|
core::configManager.acquire();
|
|
|
|
std::string resDir = core::configManager.conf["resourcesDirectory"];
|
|
|
|
json bandColors = core::configManager.conf["bandColors"];
|
|
|
|
core::configManager.release();
|
|
|
|
|
2021-12-26 02:09:37 +01:00
|
|
|
// Assert that the resource directory is absolute and check existance
|
|
|
|
resDir = std::filesystem::absolute(resDir).string();
|
2021-08-21 17:45:21 +02:00
|
|
|
if (!std::filesystem::is_directory(resDir)) {
|
|
|
|
spdlog::error("Resource directory doesn't exist! Please make sure that you've configured it correctly in config.json (check readme for details)");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2022-01-29 20:35:08 +01:00
|
|
|
// Initialize backend
|
|
|
|
int biRes = backend::init(resDir);
|
|
|
|
if (biRes < 0) { return biRes; }
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2021-06-23 21:45:38 +02:00
|
|
|
if (!style::loadFonts(resDir)) { return -1; }
|
|
|
|
thememenu::init(resDir);
|
2022-02-13 17:25:23 +01:00
|
|
|
LoadingScreen::init();
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2020-11-30 21:17:36 +01:00
|
|
|
LoadingScreen::show("Loading icons");
|
2020-09-19 12:48:34 +02:00
|
|
|
spdlog::info("Loading icons");
|
2020-12-22 22:39:24 +01:00
|
|
|
if (!icons::load(resDir)) { return -1; }
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2020-11-30 21:17:36 +01:00
|
|
|
LoadingScreen::show("Loading band plans");
|
2020-09-19 12:48:34 +02:00
|
|
|
spdlog::info("Loading band plans");
|
2020-12-23 00:11:12 +01:00
|
|
|
bandplan::loadFromDir(resDir + "/bandplans");
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2020-11-30 21:17:36 +01:00
|
|
|
LoadingScreen::show("Loading band plan colors");
|
2020-09-19 12:48:34 +02:00
|
|
|
spdlog::info("Loading band plans color table");
|
2020-12-23 00:11:12 +01:00
|
|
|
bandplan::loadColorTable(bandColors);
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2021-06-20 21:17:11 +02:00
|
|
|
gui::mainWindow.init();
|
2020-09-19 12:48:34 +02:00
|
|
|
|
|
|
|
spdlog::info("Ready.");
|
|
|
|
|
2022-01-29 20:35:08 +01:00
|
|
|
// Run render loop (TODO: CHECK RETURN VALUE)
|
|
|
|
backend::renderLoop();
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2022-02-13 17:25:23 +01:00
|
|
|
// On android, none of this shutdown should happen due to the way the UI works
|
|
|
|
#ifndef __ANDROID__
|
2021-07-29 15:07:22 +02:00
|
|
|
// Shut down all modules
|
|
|
|
for (auto& [name, mod] : core::moduleManager.modules) {
|
|
|
|
mod.end();
|
|
|
|
}
|
|
|
|
|
2022-01-29 20:35:08 +01:00
|
|
|
// Terminate backend (TODO: CHECK RETURN VALUE)
|
|
|
|
backend::end();
|
2020-09-19 12:48:34 +02:00
|
|
|
|
2021-06-29 15:52:35 +02:00
|
|
|
sigpath::signalPath.stop();
|
|
|
|
|
2021-07-29 15:07:22 +02:00
|
|
|
core::configManager.disableAutoSave();
|
|
|
|
core::configManager.save();
|
2022-02-13 17:25:23 +01:00
|
|
|
#endif
|
2021-07-29 15:07:22 +02:00
|
|
|
|
2022-02-14 19:36:49 +01:00
|
|
|
spdlog::info("Exiting successfully");
|
2020-09-19 12:48:34 +02:00
|
|
|
return 0;
|
2020-10-22 23:55:49 +08:00
|
|
|
}
|