|
@@ -14,13 +14,11 @@
|
|
|
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
|
|
|
|
|
|
|
|
-LegacyApplication::LegacyApplication(int &argc, char **argv)
|
|
|
- : QApplication(argc, argv)
|
|
|
-{
|
|
|
+LegacyApplication::LegacyApplication() {
|
|
|
qInstallMessageHandler(logMessageHandler);
|
|
|
|
|
|
modules_init_timer_.setInterval(1 * 1000);
|
|
|
- connect(&modules_init_timer_, &QTimer::timeout, this, &LegacyApplication::HandleModulesInitTimer);
|
|
|
+ connect(&modules_init_timer_, &QTimer::timeout, this, &LegacyApplication::InitModules);
|
|
|
modules_init_timer_.stop();
|
|
|
}
|
|
|
|
|
@@ -81,83 +79,6 @@ bool LegacyApplication::init()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-LegacyApplication::ErrorStatus LegacyApplication::CheckErrorStatus()
|
|
|
-{
|
|
|
- size_t status = E_NO_ERRORS;
|
|
|
- QString game_folder_path = Settings::getValue("Lotro/game_path").toString();
|
|
|
- QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
-
|
|
|
-
|
|
|
- QFileInfo lotro_launcher_exe(game_folder_path + "/LotroLauncher.exe");
|
|
|
- if (!lotro_launcher_exe.exists()) {
|
|
|
- status |= E_WRONG_GAME_FOLDER;
|
|
|
- } else {
|
|
|
- if (!QFile::setPermissions(lotro_launcher_exe.absoluteFilePath(),
|
|
|
- QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ExeUser)) {
|
|
|
- status |= E_WRONG_FILE_PERMISSIONS;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (!patch_list->getManager()->Initialised() || !patch_list->getManager()->DatPathIsRelevant()) {
|
|
|
- QString client_local_filepath = game_folder_path + "/client_local_" + locale_prefix + ".dat";
|
|
|
- QString client_general_filepath = game_folder_path + "/client_general.dat";
|
|
|
-
|
|
|
- QFileInfo client_local_file(client_local_filepath);
|
|
|
- QFileInfo client_general_file(client_general_filepath);
|
|
|
-
|
|
|
- if (!client_general_file.exists() || !client_local_file.exists()) {
|
|
|
- status |= E_DAT_FILES_MISSING;
|
|
|
- } else {
|
|
|
- if (!QFile::setPermissions(client_general_filepath,
|
|
|
- QFileDevice::ReadUser |
|
|
|
- QFileDevice::WriteUser |
|
|
|
- QFileDevice::ExeUser)) {
|
|
|
- status |= E_WRONG_FILE_PERMISSIONS;
|
|
|
- status |= E_CANNOT_ACCESS_DAT_FILES;
|
|
|
- }
|
|
|
-
|
|
|
- if (!QFile::setPermissions(client_local_filepath,
|
|
|
- QFileDevice::ReadUser |
|
|
|
- QFileDevice::WriteUser |
|
|
|
- QFileDevice::ExeUser)) {
|
|
|
- status |= E_WRONG_FILE_PERMISSIONS;
|
|
|
- status |= E_CANNOT_ACCESS_DAT_FILES;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- LOTRO_DAT::DatFile test_file;
|
|
|
- auto result = test_file.Initialise(client_local_filepath.toStdString(), 0);
|
|
|
- if (!result.result) {
|
|
|
- if (result.msg == "DATINIT: Error, cannot initialize dat due to internal IO error") {
|
|
|
- status |= E_CANNOT_ACCESS_DAT_FILES;
|
|
|
- } else {
|
|
|
- status |= E_DAT_FILE_INCORRECT;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- result = test_file.Initialise(client_general_filepath.toStdString(), 0);
|
|
|
- if (!result.result) {
|
|
|
- if (result.msg == "DATINIT: Error, cannot initialize dat due to internal IO error") {
|
|
|
- status |= E_CANNOT_ACCESS_DAT_FILES;
|
|
|
- } else {
|
|
|
- status |= E_DAT_FILE_INCORRECT;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!checkInternetConnection(QUrl(Settings::getValue("Network/patch_updates_url").toString()))) {
|
|
|
- status |= E_NO_SERVER_CONNECTION;
|
|
|
- }
|
|
|
-
|
|
|
- qDebug() << "LegacyApplication: StatusCheck: " << ErrorStatus(status);
|
|
|
- return ErrorStatus(status);
|
|
|
-}
|
|
|
-
|
|
|
-void LegacyApplication::HandleModulesInitTimer()
|
|
|
-{
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
void LegacyApplication::InitModules()
|
|
|
{
|
|
@@ -169,7 +90,7 @@ void LegacyApplication::InitModules()
|
|
|
|
|
|
modules_init_timer_.stop();
|
|
|
seconds_after_previous_try_to_init_ = 0;
|
|
|
- ErrorStatus status = CheckErrorStatus();
|
|
|
+ AppErrorStatus status = CheckAppPrerequesities();
|
|
|
emit ErrorStatusChanged(status);
|
|
|
|
|
|
if (status == E_NO_ERRORS) {
|
|
@@ -180,24 +101,3 @@ void LegacyApplication::InitModules()
|
|
|
modules_init_timer_.start();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-QDebug operator<<(QDebug dbg, const LegacyApplication::ErrorStatus &status)
|
|
|
-{
|
|
|
- bool wrong_game_folder = (status & LegacyApplication::E_WRONG_GAME_FOLDER);
|
|
|
- bool dat_files_missing = (status & LegacyApplication::E_DAT_FILES_MISSING);
|
|
|
- bool wrong_file_permissions = (status & LegacyApplication::E_WRONG_FILE_PERMISSIONS);
|
|
|
- bool cannot_access_dat_files = (status & LegacyApplication::E_CANNOT_ACCESS_DAT_FILES);
|
|
|
- bool dat_file_incorrect = (status & LegacyApplication::E_DAT_FILE_INCORRECT);
|
|
|
- bool no_server_connection = (status & LegacyApplication::E_NO_SERVER_CONNECTION);
|
|
|
-
|
|
|
- dbg.nospace() << "ErrorStatus ( "
|
|
|
- << (wrong_game_folder ? "Wrong game folder! " : "")
|
|
|
- << (dat_files_missing ? "Dat files missing! " : "")
|
|
|
- << (wrong_file_permissions ? "Wrong file permissions! " : "")
|
|
|
- << (cannot_access_dat_files ? "Cannot access dat files! " : "")
|
|
|
- << (dat_file_incorrect ? "Incorrect dat file! " : "")
|
|
|
- << (no_server_connection ? "No server connection! " : "")
|
|
|
- << ")";
|
|
|
-
|
|
|
- return dbg;
|
|
|
-}
|