2019-12-19 01:33:27 +00:00
|
|
|
#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"
|
2019-10-30 01:58:53 +00:00
|
|
|
#include "util/util.hpp"
|
2019-12-19 01:33:27 +00:00
|
|
|
#include "util/config.hpp"
|
2019-10-17 20:20:40 +00:00
|
|
|
|
|
|
|
using namespace pu::ui::render;
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2019-10-26 05:58:32 +00:00
|
|
|
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);
|
2019-12-19 01:33:27 +00:00
|
|
|
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();
|
2019-12-19 01:33:27 +00:00
|
|
|
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
|
|
|
}
|
2019-10-26 05:58:32 +00:00
|
|
|
inst::util::deinitApp();
|
2019-10-17 20:20:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|