#include "launchercore.h" #include #include #include #include "../launcher/tablet/include/tabletinterface.h" #include "cmdinterface.h" #include "config.h" #include "desktopinterface.h" #include "gameinstaller.h" #include "sapphirelauncher.h" #include "squareboot.h" int main(int argc, char* argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication app(argc, argv); #ifdef NDEBUG QCoreApplication::setApplicationName("astra"); #else QCoreApplication::setApplicationName("astra-debug"); #endif QCoreApplication::setApplicationVersion(version); // we want to decide which interface to use. this is decided by the // -cli, -desktop, or -tablet // the default is -desktop // cli is a special case where it's always "enabled" QCommandLineParser parser; parser.setApplicationDescription("Cross-platform FFXIV Launcher"); auto helpOption = parser.addHelpOption(); auto versionOption = parser.addVersionOption(); QCommandLineOption desktopOption("desktop", "Open a desktop interface."); #ifdef ENABLE_DESKTOP parser.addOption(desktopOption); #endif QCommandLineOption tabletOption("tablet", "Open a tablet interface."); #ifdef ENABLE_TABLET parser.addOption(tabletOption); #endif QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface."); #ifdef ENABLE_CLI parser.addOption(cliOption); #endif auto cmd = std::make_unique(parser); parser.process(app); if (parser.isSet(versionOption)) { parser.showVersion(); } if (parser.isSet(helpOption)) { parser.showHelp(); } for(auto& argument : QCoreApplication::arguments()) { if(argument.contains("iscriptevaluator")) { QFile testFile("/home/josh/testargs.txt"); testFile.open(QFile::Text | QFile::Append); testFile.write(QCoreApplication::arguments().join(',').toStdString().c_str()); //return 0; } } LauncherCore c; std::unique_ptr desktopInterface; std::unique_ptr tabletInterface; if (parser.isSet(tabletOption)) { #ifdef ENABLE_TABLET tabletInterface = std::make_unique(c); #endif } else if (parser.isSet(cliOption)) { #ifdef ENABLE_CLI if (!cmd->parse(parser, c)) return -1; #endif } else { #ifdef ENABLE_DESKTOP desktopInterface = std::make_unique(c); #endif } return app.exec(); }