Browse Source

Added LegacyLauncher subproject, improved lotro secure launcher logic

Ivan Arkhipov 5 years ago
parent
commit
2fd88b7dc6

+ 4 - 4
src/Launcher/main.cpp

@@ -12,9 +12,9 @@ int main(int argc, char *argv[]) {
 
     if (args.contains("gamelaunch")) {
         QProcess process;
-        process.setProgram("lotro_ru.exe");
+        process.setProgram(QApplication::applicationDirPath() + "/lotro_ru.exe");
 
-        QFileInfo check_file("lotro_ru.exe");
+        QFileInfo check_file(QApplication::applicationDirPath() + "/lotro_ru.exe");
         if (!(check_file.exists() && check_file.isFile())) {
             QMessageBox::critical(nullptr, "Ошибка запуска!", "Не удалось запустить русифицированную версию игры! Ошибка 0x0!");
         } else {
@@ -26,13 +26,13 @@ int main(int argc, char *argv[]) {
             QMessageBox::critical(nullptr, "Ошибка запуска!", "Не удалось запустить русифицированную версию игры! Ошибка 0x2!");
         }
     } else {
-        QFile file("legacy_path.txt");
+        QFile file(QApplication::applicationDirPath() + "/legacy_path.txt");
         file.open(QIODevice::ReadOnly);
         QString legacy_path = file.readLine();
         file.close();
 
         if (legacy_path.isEmpty())
-            legacy_path = "Legacy.exe";
+            legacy_path = QApplication::applicationDirPath() + "/Legacy.exe";
 
         QProcess process;
         process.setProgram(legacy_path);

+ 28 - 0
src/LegacyLauncher/LegacyLauncher.pro

@@ -0,0 +1,28 @@
+include( ../../common.pri )
+include( ../../app.pri )
+
+QT = core widgets
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+        main.cpp
+
+RESOURCES +=
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+win32:RC_ICONS = $${PROJECT_ROOT_PATH}/resources/icon.ico

+ 13 - 0
src/LegacyLauncher/legacylauncher_plugin_import.cpp

@@ -0,0 +1,13 @@
+// This file is autogenerated by qmake. It imports static plugin classes for
+// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
+Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+Q_IMPORT_PLUGIN(QGifPlugin)
+Q_IMPORT_PLUGIN(QICNSPlugin)
+Q_IMPORT_PLUGIN(QICOPlugin)
+Q_IMPORT_PLUGIN(QJpegPlugin)
+Q_IMPORT_PLUGIN(QTgaPlugin)
+Q_IMPORT_PLUGIN(QTiffPlugin)
+Q_IMPORT_PLUGIN(QWbmpPlugin)
+Q_IMPORT_PLUGIN(QWebpPlugin)

+ 12 - 0
src/LegacyLauncher/main.cpp

@@ -0,0 +1,12 @@
+#include <QFile>
+#include <QProcess>
+#include <QCoreApplication>
+#include <QDebug>
+#include <QMessageBox>
+#include <QApplication>
+
+int main(int argc, char *argv[]) {
+    QApplication app(argc, argv);
+    QMessageBox::information(nullptr, "Привет, мир!", "Я прелаунчер! Должен устанавливать обновления и запускать основной лаунчер! Но пока я этого не умею :)");
+    return 0;
+}