Browse Source

ver 2.0.0. Stable locale controlling and patching all files in client_local_English.dat

Ivan Arkhipov 7 years ago
parent
commit
1eb9056df5
2 changed files with 14 additions and 2 deletions
  1. 13 1
      src/DatFile.cpp
  2. 1 1
      src/Examples/patcher_example.cpp

+ 13 - 1
src/DatFile.cpp

@@ -466,12 +466,15 @@ namespace LOTRO_DAT {
             return;
         }
         if (current_locale() != PATCHED) {
-            std::cout << "Changing locale to RU in order to patch file";
+            std::cout << "Changing locale to RU in order to patch file" << std::endl;
             SetLocale(PATCHED);
         }
         dat_state_ = UPDATED;
 
         auto journal = GetFragmentationJournal();
+        if (journal[0].second != file_size_) {
+            journal[0].second = file_size_;
+        }
 
         file->file_size_ = data.size() - 8;
 
@@ -562,6 +565,15 @@ namespace LOTRO_DAT {
         if (dat_state_ != UPDATED)
             return;
         std::cout << "There are some updated files. Rewriting dictionary..." << std::endl << std::flush;
+
+        auto journal = GetFragmentationJournal();
+        journal[0].second = file_size_;
+        BinaryData nulls(size_t(journal[0].first));
+        WriteData(nulls, nulls.size(), file_size_);
+        file_size_ += journal[0].first;
+        UpdateFragmentationJournal(journal);
+        std::cout << "Updated fragmentation journal..." << std::endl << std::flush;
+
         UpdateHeader();
         std::cout << "Updated header..." << std::endl << std::flush;
         UpdateSubdirectories();

+ 1 - 1
src/Examples/patcher_example.cpp

@@ -19,7 +19,7 @@ const std::string rulocale_filename = "rulocale.dbgm";
 const std::string enlocale_filename = "enlocale.dbgm";
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat patcher ver. 1.0.6" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat patcher ver. 2.0.0" << std::endl;
     freopen("errors.log", "w", stderr);
 
    // setbuf(stdout, NULL);