Browse Source

Ver 7.2.1 RC

Ivan Arkhipov 5 years ago
parent
commit
9d1be3fd8d

+ 4 - 1
CHANGELOG

@@ -69,4 +69,7 @@ Version 7.1.0
 ----------------------------------------------------------------------
 Version 7.2.0
     * Minor security fixes
-    * Reimplemented categories support
+    * Reimplemented categories support
+----------------------------------------------------------------------
+Version 7.2.1
+    * Bug fixes (Text files used incorrect fragments during import, if there was no fragment in patch with specified id)

+ 1 - 1
CMakeLists.txt

@@ -3,7 +3,7 @@ project(LotroDat)
 
 set(CMAKE_CXX_STANDARD 14)
 set(PROJECT_BINARY_DIR bin)
-set(PROJECT_VERSION 7.1.0)
+set(PROJECT_VERSION 7.2.1)
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} -Wall -Wextra -O2")
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")

+ 2 - 0
include/LotroDat.h

@@ -2,6 +2,8 @@
 // Created by Иван_Архипов on 01.11.2017.
 //
 
+#define LOTRO_DAT_VERSION "7.2.1"
+
 #include "DatFile.h"
 #include "Database.h"
 #include "SubfileData.h"

+ 2 - 2
include/Subfiles/TextSubFile.h

@@ -18,8 +18,8 @@ namespace LOTRO_DAT {
         std::u16string text;
         std::string args;
 
-        bool operator < (const TextFragment &other) const {
-            return fragment_id < other.fragment_id;
+        friend bool operator < (const TextFragment &first, const TextFragment &second) {
+            return first.fragment_id < second.fragment_id;
         }
     };
 

+ 4 - 8
src/DatSubsystems/DatLocaleManager.cpp

@@ -237,7 +237,9 @@ namespace LOTRO_DAT {
         if (!dat)
             return DatOperationResult<>(ERROR, "LOCALEDEINIT: no connection with Dat (dat is nullptr)");
 
-        return CommitLocales();
+        auto result = CommitLocales();
+        ClearData();
+        return result;
     }
 
 
@@ -433,13 +435,10 @@ namespace LOTRO_DAT {
      */
 
     DatOperationResult<> DatLocaleManager::CommitLocales() {
-        if (!dat->Initialized()) {
-            ClearData();
+        if (!dat->Initialized())
             return DatOperationResult<>(SUCCESS);
-        }
 
         if (patch_dict_.empty()) {
-            ClearData();
             dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 296);
             dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
             return DatOperationResult<>(SUCCESS);
@@ -504,7 +503,6 @@ namespace LOTRO_DAT {
 
             auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), new_dict_offset);
             if (operation.result != SUCCESS) {
-                ClearData();
                 return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales");
             }
 
@@ -536,14 +534,12 @@ namespace LOTRO_DAT {
             auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), dict_offset);
 
             if (operation.result != SUCCESS) {
-                ClearData();
                 return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales. ERRMSG: " + operation.msg);
             }
         }
 
 
         LOG(INFO) << "Locales committed successfully";
-        ClearData();
         return DatOperationResult<>(SUCCESS);
     }
 

+ 1 - 1
src/Examples/extractor_example.cpp

@@ -32,7 +32,7 @@ bool exportUnknownToDb = false;
 // There is no need to change anything else
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat extractor ver. 7.2.0" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat extractor ver. " << LOTRO_DAT_VERSION << std::endl;
 
     std::cout << "Hello! I'm a basic shell version of .dat file extractor. I can open .dat file directly, "
             "if you write path to it (with name of file) in file \"dat_file_path.txt\"\n";

+ 1 - 1
src/Examples/info_gatherer.cpp

@@ -11,7 +11,7 @@ using namespace LOTRO_DAT;
 #include <ctime>
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat patcher ver. 7.2.0" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat patcher ver. " << LOTRO_DAT_VERSION << std::endl;
     freopen("patcher_errors.log", "w", stderr);
 
     setbuf(stdout, nullptr);

+ 1 - 1
src/Examples/patcher_example.cpp

@@ -15,7 +15,7 @@ using namespace LOTRO_DAT;
 using namespace std;
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat patcher ver. 7.2.0" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat patcher ver. " << LOTRO_DAT_VERSION << std::endl;
     freopen("patcher_errors.log", "w", stderr);
 
     setbuf(stdout, nullptr);

+ 4 - 3
src/Subfiles/TextSubFile.cpp

@@ -161,7 +161,7 @@ namespace LOTRO_DAT {
 
             auto fragment_iterator = std::lower_bound(patch_fragments_.begin(), patch_fragments_.end(), id_comp);
 
-            if (fragment_iterator == patch_fragments_.end()) {
+            if (fragment_iterator == patch_fragments_.end() || fragment_iterator->fragment_id != id_comp.fragment_id) {
                 // Retrieving old pieces
                 new_data = new_data + GetPieceData(old_data, offset);
                 // Retrieving old references
@@ -191,11 +191,12 @@ namespace LOTRO_DAT {
         LOG(DEBUG) << "Started parsing patch fragments";
 
         size_t pointer = 0;
+        patch_fragments_.clear();
         while (pointer < data.text_data.length()) {
             // Parsing fragment_id
             size_t pointer1 = data.text_data.find(u":::", pointer);
             if (pointer1 == std::u16string::npos) {
-                LOG(ERROR) << "Unable to parse fragment id! Cannot find '...' divider. File_id = " << file_id_;
+                LOG(ERROR) << "Unable to parse fragment id! Cannot find ':::' divider. File_id = " << file_id_;
                 return;
             }
             long long fragment_id = from_utf16(data.text_data.substr(pointer, pointer1 - pointer));
@@ -208,7 +209,7 @@ namespace LOTRO_DAT {
             // Parsing arguments
             pointer1 = data.text_data.find(u":::", pointer);
             if (pointer1 == std::u16string::npos) {
-                LOG(ERROR) << "Unable to parse arguments! Cannot find '...' divider. File_id = " << file_id_;
+                LOG(ERROR) << "Unable to parse arguments! Cannot find ':::' divider. File_id = " << file_id_;
                 return;
             }
             std::u16string arguments = data.text_data.substr(pointer, pointer1 - pointer);