2021-11-23 15:34:23 -05:00
|
|
|
#include "launchercore.h"
|
|
|
|
#include "launcherwindow.h"
|
|
|
|
|
2021-11-01 09:54:58 -04:00
|
|
|
#include <QApplication>
|
2021-11-23 15:34:23 -05:00
|
|
|
#include <QCommandLineParser>
|
2022-03-16 18:39:13 -04:00
|
|
|
#include <QDir>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <keychain.h>
|
2022-07-21 20:53:19 -04:00
|
|
|
#include <physis.hpp>
|
2021-11-23 16:02:02 -05:00
|
|
|
|
2022-07-21 20:53:19 -04:00
|
|
|
#include "../launcher/tablet/include/tabletinterface.h"
|
|
|
|
#include "cmdinterface.h"
|
2022-04-09 17:44:00 -04:00
|
|
|
#include "config.h"
|
2022-06-08 11:52:07 -04:00
|
|
|
#include "desktopinterface.h"
|
2022-07-21 20:53:19 -04:00
|
|
|
#include "gameinstaller.h"
|
|
|
|
#include "sapphirelauncher.h"
|
|
|
|
#include "squareboot.h"
|
2021-11-01 09:54:58 -04:00
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
2022-04-09 17:02:25 -04:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
|
|
|
2021-11-01 09:54:58 -04:00
|
|
|
QApplication app(argc, argv);
|
2021-11-01 14:52:34 -04:00
|
|
|
|
|
|
|
#ifdef NDEBUG
|
2022-02-23 19:00:17 -05:00
|
|
|
QCoreApplication::setApplicationName("astra");
|
2021-11-01 14:52:34 -04:00
|
|
|
#else
|
2022-02-23 19:00:17 -05:00
|
|
|
QCoreApplication::setApplicationName("astra-debug");
|
2021-11-01 14:52:34 -04:00
|
|
|
#endif
|
|
|
|
|
2022-04-09 17:44:00 -04:00
|
|
|
QCoreApplication::setApplicationVersion(version);
|
2021-11-23 15:34:23 -05:00
|
|
|
|
2022-06-08 11:52:07 -04:00
|
|
|
// 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"
|
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.setApplicationDescription("Cross-platform FFXIV Launcher");
|
2022-04-09 17:44:00 -04:00
|
|
|
|
|
|
|
auto helpOption = parser.addHelpOption();
|
|
|
|
auto versionOption = parser.addVersionOption();
|
2021-11-23 15:37:02 -05:00
|
|
|
|
2022-06-08 12:06:44 -04:00
|
|
|
QCommandLineOption desktopOption("desktop", "Open a desktop interface.");
|
|
|
|
parser.addOption(desktopOption);
|
|
|
|
|
|
|
|
QCommandLineOption tabletOption("tablet", "Open a tablet interface.");
|
|
|
|
parser.addOption(tabletOption);
|
|
|
|
|
|
|
|
QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface.");
|
|
|
|
parser.addOption(cliOption);
|
2021-11-23 15:37:02 -05:00
|
|
|
|
2022-07-21 21:38:26 -04:00
|
|
|
auto cmd = std::make_unique<CMDInterface>(parser);
|
2021-11-23 16:02:02 -05:00
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
parser.process(app);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (parser.isSet(versionOption)) {
|
2022-04-09 17:44:00 -04:00
|
|
|
parser.showVersion();
|
|
|
|
}
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (parser.isSet(helpOption)) {
|
2022-04-09 17:44:00 -04:00
|
|
|
parser.showHelp();
|
|
|
|
}
|
|
|
|
|
|
|
|
LauncherCore c;
|
2022-08-15 11:14:37 -04:00
|
|
|
if (parser.isSet(tabletOption)) {
|
2022-07-21 21:38:26 -04:00
|
|
|
std::make_unique<TabletInterface>(c);
|
2022-08-15 11:14:37 -04:00
|
|
|
} else if (parser.isSet(cliOption)) {
|
|
|
|
if (!cmd->parse(parser, c))
|
2022-06-08 11:52:07 -04:00
|
|
|
return -1;
|
2022-06-08 12:06:44 -04:00
|
|
|
} else {
|
2022-07-21 21:38:26 -04:00
|
|
|
std::make_unique<DesktopInterface>(c);
|
2021-11-23 15:37:02 -05:00
|
|
|
}
|
2021-11-01 09:54:58 -04:00
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|