|
@@ -141,12 +141,53 @@ void PatchInstaller::installPatch(QString patch_name, LOTRO_DAT::Database* datab
|
|
|
_current_applied_patches_info.textures_patch_hashsum = hashsum;
|
|
|
} else if (patch_name == "font") {
|
|
|
_current_applied_patches_info.fonts_patch_hashsum = hashsum;
|
|
|
+ } else if (patch_name == "video") {
|
|
|
+ _current_applied_patches_info.videos_patch_hashsum = hashsum;
|
|
|
}
|
|
|
orig_files_db.closeDatabase();
|
|
|
insertPatchesInfoInDatFile(_current_applied_patches_info);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+void PatchInstaller::installOriginalPatch(QString patch_name)
|
|
|
+{
|
|
|
+ qDebug() << "Installing original version of patch " << patch_name;
|
|
|
+ DatOriginalFilesDatabase orig_db(QApplication::applicationDirPath() + "/data/" + patch_name + "_orig.db");
|
|
|
+
|
|
|
+ DatOriginalFilesDatabase::FileOperation operation = [this](int file_id, int dat_id, int version, int iteration, const LOTRO_DAT::SubfileData& data) {
|
|
|
+ if (dat_id == E_CLIENT_LOCAL) {
|
|
|
+ client_local_file_->PatchFile(data, version, iteration);
|
|
|
+ } else if (dat_id == E_CLIENT_GENERAL) {
|
|
|
+ client_general_file_->PatchFile(data, version, iteration);
|
|
|
+ }
|
|
|
+ current_status.finished_parts++;
|
|
|
+ if (current_status.finished_parts * 100 / current_status.total_parts !=
|
|
|
+ (current_status.finished_parts - 1) * 100 * 10 / current_status.total_parts) {
|
|
|
+
|
|
|
+ emit progressChanged(current_status);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ orig_db.performOperationOnAllFiles(operation);
|
|
|
+
|
|
|
+ if (patch_name == "text") {
|
|
|
+ _current_applied_patches_info.texts_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "image") {
|
|
|
+ _current_applied_patches_info.images_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "sound") {
|
|
|
+ _current_applied_patches_info.sounds_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "texture") {
|
|
|
+ _current_applied_patches_info.textures_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "font") {
|
|
|
+ _current_applied_patches_info.fonts_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "video") {
|
|
|
+ _current_applied_patches_info.videos_patch_hashsum = "";
|
|
|
+ } else if (patch_name == "loadscreen") {
|
|
|
+ _current_applied_patches_info.loadscreens_patch_hashsum = "";
|
|
|
+ }
|
|
|
+ insertPatchesInfoInDatFile(_current_applied_patches_info);
|
|
|
+}
|
|
|
+
|
|
|
void PatchInstaller::installLoadscreens(LOTRO_DAT::Database* database) {
|
|
|
QString locale_prefix = Settings::getValue("Lotro/original_locale").toString();
|
|
|
|
|
@@ -265,7 +306,7 @@ PatchInstaller::AppliedPatchesInfo PatchInstaller::getAppliedPatchesInfoFromDatF
|
|
|
} else if (str.startsWith("FONTS:")) {
|
|
|
result.fonts_patch_hashsum = QString(str).remove(0, 6);
|
|
|
} else if (str.startsWith("VIDEOS:")) {
|
|
|
- result.videos_patch_hashsum = QString(str).remove(0, 6);
|
|
|
+ result.videos_patch_hashsum = QString(str).remove(0, 7);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -392,23 +433,6 @@ void PatchInstaller::startPatchInstallationChain() {
|
|
|
|
|
|
for (const QString& patch: patches) {
|
|
|
if (!Settings::getValue("DatabaseDownload/" + patch).toBool()) {
|
|
|
- if (patch == "text") {
|
|
|
- _current_applied_patches_info.texts_patch_hashsum = "";
|
|
|
- } else if (patch == "image") {
|
|
|
- _current_applied_patches_info.images_patch_hashsum = "";
|
|
|
- } else if (patch == "sound") {
|
|
|
- _current_applied_patches_info.sounds_patch_hashsum = "";
|
|
|
- } else if (patch == "texture") {
|
|
|
- _current_applied_patches_info.textures_patch_hashsum = "";
|
|
|
- } else if (patch == "font") {
|
|
|
- _current_applied_patches_info.fonts_patch_hashsum = "";
|
|
|
- } else if (patch == "video") {
|
|
|
- _current_applied_patches_info.videos_patch_hashsum = "";
|
|
|
- } else if (patch == "loadscreen") {
|
|
|
- _current_applied_patches_info.loadscreens_patch_hashsum = "";
|
|
|
- }
|
|
|
-
|
|
|
- qDebug() << "Skipping patch " << patch << " because its disabled";
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -452,6 +476,39 @@ void PatchInstaller::startPatchInstallationChain() {
|
|
|
current_status.total_parts += db->CountRows();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ QStringList patches_to_be_installed_orig_versions;
|
|
|
+ for (const QString& patch: patches) {
|
|
|
+ if (Settings::getValue("DatabaseDownload/" + patch).toBool()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString hashsum_in_dat_file = "";
|
|
|
+ if (patch == "text") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.texts_patch_hashsum;
|
|
|
+ } else if (patch == "image") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.images_patch_hashsum;
|
|
|
+ } else if (patch == "sound") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.sounds_patch_hashsum;
|
|
|
+ } else if (patch == "texture") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.textures_patch_hashsum;
|
|
|
+ } else if (patch == "font") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.fonts_patch_hashsum;
|
|
|
+ } else if (patch == "video") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.videos_patch_hashsum;
|
|
|
+ } else if (patch == "loadscreen") {
|
|
|
+ hashsum_in_dat_file = _current_applied_patches_info.loadscreens_patch_hashsum;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hashsum_in_dat_file == "") {
|
|
|
+ qDebug() << "Skipping installing original version of patch " << patch << " because hashsum in dat file is already empty";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ patches_to_be_installed_orig_versions.append(patch);
|
|
|
+ DatOriginalFilesDatabase db(QApplication::applicationDirPath() + "/data/" + patch + "_orig.db");
|
|
|
+ current_status.total_parts += db.getRowsCount();
|
|
|
+ }
|
|
|
+
|
|
|
emit progressChanged(current_status);
|
|
|
for (const QString patch_name: patch_databases.keys()) {
|
|
|
qInfo() << "PatchInstaller: Installing patch " << patch_name;
|
|
@@ -460,6 +517,10 @@ void PatchInstaller::startPatchInstallationChain() {
|
|
|
delete patch_databases[patch_name];
|
|
|
}
|
|
|
|
|
|
+ for (const QString& patch_name : patches_to_be_installed_orig_versions) {
|
|
|
+ installOriginalPatch(patch_name);
|
|
|
+ }
|
|
|
+
|
|
|
insertPatchesInfoInDatFile(_current_applied_patches_info);
|
|
|
qInfo() << "PatchInstaller: Finished installation chain...";
|
|
|
emit finished();
|