Awoo-Installer/source/main.cpp

27 lines
946 B
C++
Raw Normal View History

#include <thread>
2019-10-17 20:20:40 +00:00
#include "switch.h"
2019-11-30 17:12:59 +00:00
#include "util/error.hpp"
2019-10-17 20:20:40 +00:00
#include "ui/MainApplication.hpp"
#include "util/util.hpp"
#include "util/config.hpp"
2019-10-17 20:20:40 +00:00
using namespace pu::ui::render;
int main(int argc, char* argv[])
{
inst::util::initApp();
2019-10-17 20:20:40 +00:00
try {
auto renderer = Renderer::New(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER,
RendererInitOptions::RendererNoSound, RendererHardwareFlags);
auto main = inst::ui::MainApplication::New(renderer);
std::thread updateThread;
if (inst::config::autoUpdate && inst::util::getIPAddress() != "1.0.0.127") updateThread = std::thread(inst::util::checkForAppUpdate);
2019-10-17 20:20:40 +00:00
main->Prepare();
2019-12-05 18:16:36 +00:00
main->ShowWithFadeIn();
updateThread.join();
2019-10-17 20:20:40 +00:00
} catch (std::exception& e) {
2019-11-30 17:12:59 +00:00
LOG_DEBUG("An error occurred:\n%s", e.what());
2019-10-17 20:20:40 +00:00
}
inst::util::deinitApp();
2019-10-17 20:20:40 +00:00
return 0;
}