|
@@ -118,7 +118,7 @@ void PatchInstaller::installPatch(QString patch_name, LOTRO_DAT::Database* datab
|
|
|
qWarning() << "Unknown dat id parameter for file " << file.options["fid"].as<long long>() << " (dat id value = " << dat_id << "), SKIPPING!";
|
|
|
}
|
|
|
|
|
|
- if (file_version != 721359) {
|
|
|
+ if (file_version != _patch_files_versions) {
|
|
|
const QString query = "INSERT INTO `patch_data` (`file_id`, `options`) VALUES ('"
|
|
|
+ QString::number(file_id) + "', '" + QString::number(file_version)
|
|
|
+ "') ON CONFLICT(`file_id`) DO UPDATE SET `options`='" + QString::number(file_version) + "';";
|
|
@@ -256,9 +256,29 @@ PatchInstaller::AppliedPatchesInfo PatchInstaller::getAppliedPatchesInfoFromDatF
|
|
|
if (patch_versions_file.Empty()) {
|
|
|
result.has_no_patch_mark = true;
|
|
|
} else {
|
|
|
+ const QString text_data = QString::fromUtf8(reinterpret_cast<const char*>(patch_versions_file.binary_data.data() + 4), patch_versions_file.binary_data.size() - 4);
|
|
|
+ const QStringList text_data_splitted = text_data.split("\n");
|
|
|
+ if (text_data_splitted.length() < 0 || text_data_splitted[0] != _patch_mark_header) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
result.has_no_patch_mark = false;
|
|
|
-// const QString text_data = QString::fromUtf16(reinterpret_cast<const ushort*>(patch_versions_file.binary_data.data()), patch_versions_file.binary_data.size() / sizeof(ushort));
|
|
|
-// qDebug() << "AAAAAAAAA PATCH INFO TEXT DATA " << text_data;
|
|
|
+ for (const QString& str: text_data_splitted) {
|
|
|
+ if (str.startsWith("TEXTS:")) {
|
|
|
+ result.texts_patch_hashsum = QString(str).remove(0, 6);
|
|
|
+ } else if (str.startsWith("IMAGES:")) {
|
|
|
+ result.images_patch_hashsum = QString(str).remove(0, 7);
|
|
|
+ } else if (str.startsWith("SOUNDS:")) {
|
|
|
+ result.sounds_patch_hashsum = QString(str).remove(0, 7);
|
|
|
+ } else if (str.startsWith("LOADSCREENS:")) {
|
|
|
+ result.loadscreens_patch_hashsum = QString(str).remove(0, 12);
|
|
|
+ } else if (str.startsWith("TEXTURES:")) {
|
|
|
+ result.textures_patch_hashsum = QString(str).remove(0, 9);
|
|
|
+ } 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// TODO: PATCHED BY OLD LEGACY CHECK
|
|
|
return result;
|
|
@@ -269,7 +289,7 @@ void PatchInstaller::insertPatchesInfoInDatFile(const PatchInstaller::AppliedPat
|
|
|
file_data.options["fid"] = _applied_patches_file_id;
|
|
|
file_data.options["ext"] = LOTRO_DAT::StringFromFileType(LOTRO_DAT::TEXT);
|
|
|
|
|
|
- QString patches_info_data = "1::::::[HI_FROM_ENDEVIR_V2.0\n";
|
|
|
+ QString patches_info_data = _patch_mark_header + "\n";
|
|
|
patches_info_data += "TEXTS:" + info.texts_patch_hashsum + "\n";
|
|
|
patches_info_data += "IMAGES:" + info.images_patch_hashsum + "\n";
|
|
|
patches_info_data += "SOUNDS:" + info.sounds_patch_hashsum + "\n";
|
|
@@ -277,10 +297,10 @@ void PatchInstaller::insertPatchesInfoInDatFile(const PatchInstaller::AppliedPat
|
|
|
patches_info_data += "TEXTURES:" + info.textures_patch_hashsum + "\n";
|
|
|
patches_info_data += "FONTS:" + info.fonts_patch_hashsum + "\n";
|
|
|
patches_info_data += "VIDEOS:" + info.videos_patch_hashsum + "\n";
|
|
|
- patches_info_data += "]";
|
|
|
|
|
|
- file_data.text_data = patches_info_data.toStdU16String();
|
|
|
- client_local_file_->PatchFile(file_data);
|
|
|
+ QByteArray data = QByteArray((char*)&_applied_patches_file_id, 4) + patches_info_data.toUtf8();
|
|
|
+ file_data.binary_data = LOTRO_DAT::BinaryData(data.data(), data.size());
|
|
|
+ client_local_file_->PatchFile(file_data, _patch_files_versions, 1, true);
|
|
|
}
|
|
|
|
|
|
|