Ivan Arkhipov il y a 6 ans
Parent
commit
7b1912a022

+ 3 - 0
CHANGELOG

@@ -20,4 +20,7 @@ Version 3.0.0
 Version 3.1.0
     * Fixed issue with incorrect applying patch to files with inactive category
     * Minor code improvement and fixes for capability to work with extractor
+----------------------------------------------------------------------
+Version 3.2.0
+    * Added checkers for situations when .dat file wasn't patched at all or was patched by old launcher
 ----------------------------------------------------------------------

+ 12 - 0
include/DatFile.h

@@ -51,6 +51,13 @@ namespace LOTRO_DAT {
         UNKNOWN
     };
 
+    enum DAT_RESULT : int {
+        UNKNOWN_ERROR = 0,
+        SUCCESS = 1,
+        NOFILE_ERROR = 2,
+
+    };
+
     enum DAT_STATE {
         CLOSED = 1,
         SUCCESS_OPENED = 2,
@@ -150,6 +157,11 @@ namespace LOTRO_DAT {
         void DisableCategory(int category);
 
         const std::unordered_set<long long>& GetInactiveCategoriesList();
+
+    public:
+        bool CheckIfNotPatched();
+        bool CheckIfPatchedByOldLauncher();
+
     private:
         std::unordered_map<long long, Subfile*>* GetLocaleDictReference(LOCALE locale);
 

BIN
lib/libLotroDat.dll.a


BIN
lib/libLotroDat_static.a


+ 7 - 0
src/DatFile.cpp

@@ -933,5 +933,12 @@ namespace LOTRO_DAT {
         return inactive_categories;
     }
 
+    bool DatFile::CheckIfNotPatched() {
+        return patch_dict_.empty();
+    }
+
+    bool DatFile::CheckIfPatchedByOldLauncher() {
+        return dictionary_.count(620750000) > 0;
+    }
 }
 }

+ 1 - 1
src/Examples/extractor_example.cpp

@@ -36,7 +36,7 @@ const bool exportUnknownToDb = false;
 // There is no need to change anything else
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat extractor ver. 3.1.0" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat extractor ver. 3.2.0" << std::endl;
     const clock_t begin_time = clock();
 
     mkdir("Extracted data", 744);

+ 9 - 2
src/Examples/patcher_example.cpp

@@ -16,7 +16,7 @@ using namespace LOTRO_DAT;
 using namespace std;
 
 int main() {
-    std::cout << "Gi1dor's LotRO .dat patcher ver. 3.1.0" << std::endl;
+    std::cout << "Gi1dor's LotRO .dat patcher ver. 3.2.0" << std::endl;
     freopen("errors.log", "w", stderr);
 
     setbuf(stdout, NULL);
@@ -25,7 +25,8 @@ int main() {
     setvbuf (stdout, NULL, _IONBF, BUFSIZ);
     setvbuf (stderr, NULL, _IONBF, BUFSIZ);
 
-    std::cout << "Hello! I'm a basic shell version of .dat file patcher.\n";
+    std::cout << "Hello! I'm a basic shell version of .dat file patcher. I can open .dat file directly, "
+            "if you write path to it (with name of file) in file \"dat_file_path.txt\"\n";
     DatFile file;
 
     ifstream in("dat_file_path.txt");
@@ -59,6 +60,12 @@ int main() {
     }
 
     std::cout << "Great! File initialised successfully!\n";
+    if (file.CheckIfNotPatched())
+        std::cout << "MESSAGE: Dat file is new and haven't been patched yet\n";
+
+    if (file.CheckIfPatchedByOldLauncher())
+        std::cout << "MESSAGE: Dat file was patched by old launcher. Capability isn't guaranteed! Some functions may not work properly!!!\n";
+
     std::cout << "Files number: " << file.files_number() << std::endl;
 
     while (true) {