Ivan Arkhipov 7 سال پیش
والد
کامیت
cadbc08893
5فایلهای تغییر یافته به همراه20 افزوده شده و 8 حذف شده
  1. BIN
      bin/LotRO_dat_extractor.exe
  2. BIN
      bin/LotRO_dat_patcher.exe
  3. BIN
      lib/libLotroDat.dll.a
  4. BIN
      lib/libLotroDat_static.a
  5. 20 8
      src/DatFile.cpp

BIN
bin/LotRO_dat_extractor.exe


BIN
bin/LotRO_dat_patcher.exe


BIN
lib/libLotroDat.dll.a


BIN
lib/libLotroDat_static.a


+ 20 - 8
src/DatFile.cpp

@@ -264,15 +264,24 @@ namespace LOTRO_DAT {
 
         ReadData(dicts_data, 4, dict_offset + 4);
         long long dict_version = dicts_data.ToNumber<4>(0);
-        LOG(INFO) << "Dictionary size is " << dict_size << ". Version is " << dict_version;
 
-        if (dict_version != 100) {
+        ReadData(dicts_data, 4, dict_offset + 8);
+        file_size_ = dicts_data.ToNumber<4>(0);
+
+        LOG(INFO) << "Dictionary size is " << dict_size << ". Version is " << dict_version << ". Localed .dat size = " << file_size_;
+
+        if (dict_version != 101) {
             LOG(WARNING) << "DICTIONARY IS OLD!!!";
+            orig_dict_.clear();
+            patch_dict_.clear();
+            WriteData(BinaryData::FromNumber<4>(0), 4, 300);
+            dat_state_ = UPDATED;
+            dat_without_patches_ = true;
             return SUCCESS;
         }
 
         dicts_data = BinaryData((unsigned)dict_size);
-        ReadData(dicts_data, dict_size, dict_offset + 8);
+        ReadData(dicts_data, dict_size, dict_offset + 12);
 
         if (dicts_data.size() < 15) {
             LOG(ERROR) << "Incorrect dictionary. Passing without it.";
@@ -513,9 +522,11 @@ namespace LOTRO_DAT {
             WriteData(BinaryData::FromNumber<4>(file_size_), 4, 300);
 
             WriteData(BinaryData::FromNumber<4>(std::max(binary_data.size() + 4, 20u * 1024u * 1024u)), 4, file_size_);
-            WriteData(BinaryData::FromNumber<4>(100), 4, file_size_ + 4);
-            WriteData(binary_data, binary_data.size(), file_size_ + 8);
-            file_size_ += binary_data.size() + 8;
+            WriteData(BinaryData::FromNumber<4>(101), 4, file_size_ + 4);
+            WriteData(BinaryData::FromNumber<4>(file_size_ + binary_data.size() + 12 + 20 * 1024 * 1024), 4, file_size_ + 8); // Writing current file size;
+
+            WriteData(binary_data, binary_data.size(), file_size_ + 12);
+            file_size_ += binary_data.size() + 12;
 
             // Adding space for 25 megabytes locales file in total.
             BinaryData nulls(unsigned(20 * 1024 * 1024));
@@ -524,8 +535,9 @@ namespace LOTRO_DAT {
 
         } else {
             WriteData(BinaryData::FromNumber<4>(std::max(binary_data.size(), 20u * 1024u * 1024u)), 4, dict_offset);
-            WriteData(BinaryData::FromNumber<4>(100), 4, dict_offset + 4);
-            WriteData(binary_data, binary_data.size(), dict_offset + 8);
+            WriteData(BinaryData::FromNumber<4>(101), 4, dict_offset + 4);
+            WriteData(BinaryData::FromNumber<4>(file_size_), 4, dict_offset + 8); // Writing current file size;
+            WriteData(binary_data, binary_data.size(), dict_offset + 12);
         }
         LOG(INFO) << "Locales commited successfully";
         return SUCCESS;