|
@@ -70,21 +70,25 @@ void logMessageHandler(QtMsgType type, const QMessageLogContext &context, const
|
|
|
.arg(function);
|
|
|
|
|
|
#ifndef QT_DEBUG
|
|
|
- QFile log_file("legacy_log.txt");
|
|
|
- QFileInfo log_file_info(log_file);
|
|
|
- if (log_file_info.size() >= 10 * 1024 * 1024) {
|
|
|
- QFile::remove("legacy_log.old.txt");
|
|
|
- QFile::copy("legacy_log.txt", "legacy_log.old.txt");
|
|
|
- QFile::remove("legacy_log.txt");
|
|
|
+ if (type != QtDebugMsg) {
|
|
|
+ QFile log_file("legacy_log.txt");
|
|
|
+ QFileInfo log_file_info(log_file);
|
|
|
+ if (log_file_info.size() >= 10 * 1024 * 1024) {
|
|
|
+ QFile::remove("legacy_log.old.txt");
|
|
|
+ QFile::copy("legacy_log.txt", "legacy_log.old.txt");
|
|
|
+ QFile::remove("legacy_log.txt");
|
|
|
+ }
|
|
|
+ log_file.open(QIODevice::ReadWrite | QIODevice::Append);
|
|
|
+ QTextStream stream(&log_file);
|
|
|
+ stream << s;
|
|
|
+ log_file.close();
|
|
|
}
|
|
|
- log_file.open(QIODevice::ReadWrite | QIODevice::Append);
|
|
|
- QTextStream stream(&log_file);
|
|
|
- stream << s;
|
|
|
- log_file.close();
|
|
|
#endif
|
|
|
|
|
|
+#if defined(QT_DEBUG) || defined(DEBUG)
|
|
|
fprintf(stderr, "%s", qUtf8Printable(s));
|
|
|
fflush(stderr);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
bool isRunning(const QString &process) {
|
|
@@ -101,20 +105,27 @@ bool isRunning(const QString &process) {
|
|
|
|
|
|
|
|
|
AppErrorStatus CheckAppPrerequesities() {
|
|
|
+ qInfo() << "Starting CheckAppPrerequisities...";
|
|
|
if (isRunning("LotroLauncher.exe") || isRunning("lotroclient.exe") || isRunning("lotroclient64.exe")) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisites: found running LOTRO client!";
|
|
|
return E_LOTRO_RUNNING;
|
|
|
}
|
|
|
|
|
|
QString game_folder_path = Settings::getValue("Lotro/game_path").toString();
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
|
|
|
+ qInfo() << "CheckAppPrerequisities: game folder path=" << game_folder_path;
|
|
|
+ qInfo() << "CheckAppPrerequisities: locale prefix =" << locale_prefix;
|
|
|
+
|
|
|
// Checking LotroLauncher.exe availability
|
|
|
QFileInfo lotro_launcher_exe(game_folder_path + "/LotroLauncher.exe");
|
|
|
if (!lotro_launcher_exe.exists()) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: cannot find file LotroLauncher.exe";
|
|
|
return E_WRONG_GAME_FOLDER;
|
|
|
} else {
|
|
|
if (!QFile::setPermissions(lotro_launcher_exe.absoluteFilePath(),
|
|
|
QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ExeUser)) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: cannot check executable permissions for LotroLauncher.exe";
|
|
|
return E_WRONG_FILE_PERMISSIONS;
|
|
|
}
|
|
|
}
|
|
@@ -123,16 +134,23 @@ AppErrorStatus CheckAppPrerequesities() {
|
|
|
QString client_local_filepath = game_folder_path + "/client_local_" + locale_prefix + ".dat";
|
|
|
QString client_general_filepath = game_folder_path + "/client_general.dat";
|
|
|
|
|
|
+ qInfo() << "CheckAppPrerequisities: client_local_filepath = " << client_local_filepath;
|
|
|
+ qInfo() << "CheckAppPrerequisities: client_general_filepath = " << client_general_filepath;
|
|
|
+
|
|
|
+
|
|
|
QFileInfo client_local_file(client_local_filepath);
|
|
|
QFileInfo client_general_file(client_general_filepath);
|
|
|
|
|
|
if (!client_general_file.exists() || !client_local_file.exists()) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: dat files do not exist!";
|
|
|
return E_DAT_FILES_MISSING;
|
|
|
} else {
|
|
|
if (!QFile::setPermissions(client_general_filepath,
|
|
|
QFileDevice::ReadUser |
|
|
|
QFileDevice::WriteUser |
|
|
|
QFileDevice::ExeUser)) {
|
|
|
+
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: incorrect client general permissions!";
|
|
|
return E_WRONG_FILE_PERMISSIONS;
|
|
|
}
|
|
|
|
|
@@ -140,23 +158,29 @@ AppErrorStatus CheckAppPrerequesities() {
|
|
|
QFileDevice::ReadUser |
|
|
|
QFileDevice::WriteUser |
|
|
|
QFileDevice::ExeUser)) {
|
|
|
+
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: incorrect client local permissions!";
|
|
|
return E_WRONG_FILE_PERMISSIONS;
|
|
|
}
|
|
|
|
|
|
if (LOTRO_DAT::DatFile::checkIfPatchedByLegacyV1(client_local_file.absoluteFilePath().toStdString())) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: found Legacy v1 patch mark in client local!";
|
|
|
return E_PATCHED_BY_OLD_LEGACY;
|
|
|
}
|
|
|
if (LOTRO_DAT::DatFile::checkIfPatchedByLegacyV1(client_general_file.absoluteFilePath().toStdString())) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: found Legacy v1 patch mark in client general!";
|
|
|
return E_PATCHED_BY_OLD_LEGACY;
|
|
|
}
|
|
|
|
|
|
LOTRO_DAT::DatFile file(0);
|
|
|
if (!file.Init(client_local_file.absoluteFilePath().toStdString())) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: initialization of client local dat file failed!";
|
|
|
return E_DAT_FILE_INCORRECT;
|
|
|
} else {
|
|
|
file.Deinit();
|
|
|
}
|
|
|
if (!file.Init(client_general_file.absoluteFilePath().toStdString())) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: initialization of client general dat file failed!";
|
|
|
return E_DAT_FILE_INCORRECT;
|
|
|
} else {
|
|
|
file.Deinit();
|
|
@@ -164,9 +188,11 @@ AppErrorStatus CheckAppPrerequesities() {
|
|
|
}
|
|
|
|
|
|
if (!checkInternetConnection(QUrl(Settings::getValue("Network/patch_updates_url").toString()))) {
|
|
|
+ qCritical() << "Failed CheckAppPrerequisities: no server connection!";
|
|
|
return E_NO_SERVER_CONNECTION;
|
|
|
}
|
|
|
|
|
|
+ qInfo() << "CheckAppPrerequisities: successful, no errors found!";
|
|
|
return E_NO_ERRORS;
|
|
|
}
|
|
|
|