Ivan Arkhipov преди 6 години
родител
ревизия
46949c4b9f
променени са 79 файла, в които са добавени 56 реда и са изтрити 47 реда
  1. 5 2
      CHANGELOG
  2. 5 5
      CMakeLists.txt
  3. 2 0
      src/BinaryData.cpp
  4. 0 0
      src/BinaryData.h
  5. 0 0
      src/Common/CommonFunctions.h
  6. 0 0
      src/Common/DatException.h
  7. 0 0
      src/Common/SQLite/shell.c
  8. 0 0
      src/Common/SQLite/sqlite3.c
  9. 0 0
      src/Common/SQLite/sqlite3.h
  10. 0 0
      src/Common/Yaml/libyaml-cpp.a
  11. 0 0
      src/Common/Yaml/libyaml-cppmt.lib
  12. 0 0
      src/Common/Yaml/libyaml-cppmtd.lib
  13. 0 0
      src/Common/Yaml/yaml-cpp/anchor.h
  14. 0 0
      src/Common/Yaml/yaml-cpp/binary.h
  15. 0 0
      src/Common/Yaml/yaml-cpp/contrib/anchordict.h
  16. 0 0
      src/Common/Yaml/yaml-cpp/contrib/graphbuilder.h
  17. 0 0
      src/Common/Yaml/yaml-cpp/dll.h
  18. 0 0
      src/Common/Yaml/yaml-cpp/emitfromevents.h
  19. 0 0
      src/Common/Yaml/yaml-cpp/emitter.h
  20. 0 0
      src/Common/Yaml/yaml-cpp/emitterdef.h
  21. 0 0
      src/Common/Yaml/yaml-cpp/emittermanip.h
  22. 0 0
      src/Common/Yaml/yaml-cpp/emitterstyle.h
  23. 0 0
      src/Common/Yaml/yaml-cpp/eventhandler.h
  24. 0 0
      src/Common/Yaml/yaml-cpp/exceptions.h
  25. 0 0
      src/Common/Yaml/yaml-cpp/mark.h
  26. 0 0
      src/Common/Yaml/yaml-cpp/node/convert.h
  27. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/bool_type.h
  28. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/impl.h
  29. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/iterator.h
  30. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/iterator_fwd.h
  31. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/memory.h
  32. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/node.h
  33. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/node_data.h
  34. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/node_iterator.h
  35. 0 0
      src/Common/Yaml/yaml-cpp/node/detail/node_ref.h
  36. 0 0
      src/Common/Yaml/yaml-cpp/node/emit.h
  37. 0 0
      src/Common/Yaml/yaml-cpp/node/impl.h
  38. 0 0
      src/Common/Yaml/yaml-cpp/node/iterator.h
  39. 0 0
      src/Common/Yaml/yaml-cpp/node/node.h
  40. 0 0
      src/Common/Yaml/yaml-cpp/node/parse.h
  41. 0 0
      src/Common/Yaml/yaml-cpp/node/ptr.h
  42. 0 0
      src/Common/Yaml/yaml-cpp/node/type.h
  43. 0 0
      src/Common/Yaml/yaml-cpp/noncopyable.h
  44. 0 0
      src/Common/Yaml/yaml-cpp/null.h
  45. 0 0
      src/Common/Yaml/yaml-cpp/ostream_wrapper.h
  46. 0 0
      src/Common/Yaml/yaml-cpp/parser.h
  47. 0 0
      src/Common/Yaml/yaml-cpp/stlemitter.h
  48. 0 0
      src/Common/Yaml/yaml-cpp/traits.h
  49. 0 0
      src/Common/Yaml/yaml-cpp/yaml.h
  50. 0 0
      src/Common/ZLib/libzlibstatic.a
  51. 0 0
      src/Common/ZLib/zconf.h
  52. 0 0
      src/Common/ZLib/zlib.h
  53. 0 0
      src/Common/ZLib/zlibstatic.lib
  54. 19 14
      src/DatFile.cpp
  55. 0 0
      src/DatFile.h
  56. 0 0
      src/Database.cpp
  57. 0 0
      src/Database.h
  58. 16 11
      src/Examples/extractor_example.cpp
  59. 8 10
      src/Examples/patcher_example.cpp
  60. 0 0
      src/LotroDatPatcher.h
  61. 1 1
      src/SubDirectory.cpp
  62. 0 0
      src/SubDirectory.h
  63. 0 0
      src/Subfile.cpp
  64. 0 0
      src/Subfile.h
  65. 0 0
      src/SubfileData.h
  66. 0 0
      src/Subfiles/DdsSubfile.cpp
  67. 0 0
      src/Subfiles/DdsSubfile.h
  68. 0 0
      src/Subfiles/FontSubfile.cpp
  69. 0 0
      src/Subfiles/FontSubfile.h
  70. 0 0
      src/Subfiles/JpgSubfile.cpp
  71. 0 0
      src/Subfiles/JpgSubfile.h
  72. 0 0
      src/Subfiles/OggSubfile.cpp
  73. 0 0
      src/Subfiles/OggSubfile.h
  74. 0 4
      src/Subfiles/TextSubfile.cpp
  75. 0 0
      src/Subfiles/TextSubfile.h
  76. 0 0
      src/Subfiles/UnknownSubfile.cpp
  77. 0 0
      src/Subfiles/UnknownSubfile.h
  78. 0 0
      src/Subfiles/WavSubfile.cpp
  79. 0 0
      src/Subfiles/WavSubfile.h

+ 5 - 2
CHANGELOG

@@ -1,5 +1,8 @@
 ----------------------------------------------------------------------
-Version 0.0.1
-    * First version, development state
+Version 1.0.0
+	* First beta version of library, with most functions for extracting/patching already implemented
+----------------------------------------------------------------------	
+Version 1.0.2
+    * Fixed issue when some text files were patched but didn't appear in game ("<string error DID.." error due to incomplete dictionary update)
 ----------------------------------------------------------------------
     

+ 5 - 5
CMakeLists.txt

@@ -13,7 +13,7 @@ if (MSVS)
 endif(MSVS)
 
 set(CMAKE_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/bin)
-set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source)
+set(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
 
 include_directories(${CMAKE_SOURCE_DIR}/Common/Yaml)
 
@@ -63,7 +63,7 @@ set(SOURCE_FILES
 
         ${CMAKE_SOURCE_DIR}/Subfiles/UnknownSubfile.cpp
         ${CMAKE_SOURCE_DIR}/Subfiles/UnknownSubfile.h
-        Source/SubfileData.h)
+        src/SubfileData.h)
 
 set(CompilerFlags
         CMAKE_CXX_FLAGS
@@ -87,9 +87,9 @@ add_library(LotroDat_static STATIC ${SOURCE_FILES})
 # SHARED LIBRARY
 add_library(LotroDat SHARED ${SOURCE_FILES})
 # CONSOLE EXTRACTOR TOOL
-add_executable(LotRO_dat_extract_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Tests/extract_test.cpp)
+add_executable(LotRO_dat_extract_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Examples/extractor_example.cpp)
 # CONSOLE PATCHER TOOL
-add_executable(LotRO_dat_pat_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Tests/patch_test.cpp)
+add_executable(LotRO_dat_pat_tester ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Examples/patcher_example.cpp)
 
 foreach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_tester)
     if(MSVC)
@@ -101,4 +101,4 @@ foreach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_t
         target_link_libraries(${TARGET} ${CMAKE_SOURCE_DIR}/Common/Yaml/libyaml-cpp.a)
         target_link_libraries(${TARGET} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic)
     endif(MSVC)
-endforeach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_tester)
+endforeach(TARGET LotroDat_static LotroDat LotRO_dat_extract_tester LotRO_dat_pat_tester)

+ 2 - 0
Source/BinaryData.cpp → src/BinaryData.cpp

@@ -30,6 +30,8 @@ namespace LOTRO_DAT {
 
     BinaryData::BinaryData(unsigned int size) {
         data_ = new unsigned char[size];
+        for (int i = 0; i < size; i++)
+            data_[i] = 0;
         size_ = size;
     }
 

+ 0 - 0
Source/BinaryData.h → src/BinaryData.h


+ 0 - 0
Source/Common/CommonFunctions.h → src/Common/CommonFunctions.h


+ 0 - 0
Source/Common/DatException.h → src/Common/DatException.h


+ 0 - 0
Source/Common/SQLite/shell.c → src/Common/SQLite/shell.c


+ 0 - 0
Source/Common/SQLite/sqlite3.c → src/Common/SQLite/sqlite3.c


+ 0 - 0
Source/Common/SQLite/sqlite3.h → src/Common/SQLite/sqlite3.h


+ 0 - 0
Source/Common/Yaml/libyaml-cpp.a → src/Common/Yaml/libyaml-cpp.a


+ 0 - 0
Source/Common/Yaml/libyaml-cppmt.lib → src/Common/Yaml/libyaml-cppmt.lib


+ 0 - 0
Source/Common/Yaml/libyaml-cppmtd.lib → src/Common/Yaml/libyaml-cppmtd.lib


+ 0 - 0
Source/Common/Yaml/yaml-cpp/anchor.h → src/Common/Yaml/yaml-cpp/anchor.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/binary.h → src/Common/Yaml/yaml-cpp/binary.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/contrib/anchordict.h → src/Common/Yaml/yaml-cpp/contrib/anchordict.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/contrib/graphbuilder.h → src/Common/Yaml/yaml-cpp/contrib/graphbuilder.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/dll.h → src/Common/Yaml/yaml-cpp/dll.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/emitfromevents.h → src/Common/Yaml/yaml-cpp/emitfromevents.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/emitter.h → src/Common/Yaml/yaml-cpp/emitter.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/emitterdef.h → src/Common/Yaml/yaml-cpp/emitterdef.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/emittermanip.h → src/Common/Yaml/yaml-cpp/emittermanip.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/emitterstyle.h → src/Common/Yaml/yaml-cpp/emitterstyle.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/eventhandler.h → src/Common/Yaml/yaml-cpp/eventhandler.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/exceptions.h → src/Common/Yaml/yaml-cpp/exceptions.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/mark.h → src/Common/Yaml/yaml-cpp/mark.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/convert.h → src/Common/Yaml/yaml-cpp/node/convert.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/bool_type.h → src/Common/Yaml/yaml-cpp/node/detail/bool_type.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/impl.h → src/Common/Yaml/yaml-cpp/node/detail/impl.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/iterator.h → src/Common/Yaml/yaml-cpp/node/detail/iterator.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/iterator_fwd.h → src/Common/Yaml/yaml-cpp/node/detail/iterator_fwd.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/memory.h → src/Common/Yaml/yaml-cpp/node/detail/memory.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/node.h → src/Common/Yaml/yaml-cpp/node/detail/node.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/node_data.h → src/Common/Yaml/yaml-cpp/node/detail/node_data.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/node_iterator.h → src/Common/Yaml/yaml-cpp/node/detail/node_iterator.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/detail/node_ref.h → src/Common/Yaml/yaml-cpp/node/detail/node_ref.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/emit.h → src/Common/Yaml/yaml-cpp/node/emit.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/impl.h → src/Common/Yaml/yaml-cpp/node/impl.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/iterator.h → src/Common/Yaml/yaml-cpp/node/iterator.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/node.h → src/Common/Yaml/yaml-cpp/node/node.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/parse.h → src/Common/Yaml/yaml-cpp/node/parse.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/ptr.h → src/Common/Yaml/yaml-cpp/node/ptr.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/node/type.h → src/Common/Yaml/yaml-cpp/node/type.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/noncopyable.h → src/Common/Yaml/yaml-cpp/noncopyable.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/null.h → src/Common/Yaml/yaml-cpp/null.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/ostream_wrapper.h → src/Common/Yaml/yaml-cpp/ostream_wrapper.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/parser.h → src/Common/Yaml/yaml-cpp/parser.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/stlemitter.h → src/Common/Yaml/yaml-cpp/stlemitter.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/traits.h → src/Common/Yaml/yaml-cpp/traits.h


+ 0 - 0
Source/Common/Yaml/yaml-cpp/yaml.h → src/Common/Yaml/yaml-cpp/yaml.h


+ 0 - 0
Source/Common/ZLib/libzlibstatic.a → src/Common/ZLib/libzlibstatic.a


+ 0 - 0
Source/Common/ZLib/zconf.h → src/Common/ZLib/zconf.h


+ 0 - 0
Source/Common/ZLib/zlib.h → src/Common/ZLib/zlib.h


+ 0 - 0
Source/Common/ZLib/zlibstatic.lib → src/Common/ZLib/zlibstatic.lib


+ 19 - 14
Source/DatFile.cpp → src/DatFile.cpp

@@ -11,19 +11,17 @@
 #include "SubfileData.h"
 
 #include <locale>
+#include <algorithm>
 
 extern "C++"
 {
 namespace LOTRO_DAT {
-    DatFile::DatFile() {
-        dat_state_ = CLOSED;
-        patched_ = false;
-    }
+    DatFile::DatFile() : dat_state_(CLOSED), patched_(false) {}
 
-    DatFile::DatFile(const char *filename, int dat_id) {
-        dat_id_ = dat_id;
-        dat_state_ = CLOSED;
-        patched_ = false;
+    DatFile::DatFile(const char *filename, int dat_id)
+            : dat_id_(dat_id)
+            , dat_state_(CLOSED)
+            , patched_(false) {
         OpenDatFile(filename);
         ReadSuperBlock();
         MakeDirectories();
@@ -135,7 +133,7 @@ namespace LOTRO_DAT {
         }
 
         if (export_data == SubfileData()) {
-            fprintf(stderr, "WARNING: file with id %lld is too small. Passing it\n", dictionary_[file_id]->file_id());
+            fprintf(stderr, "WARNING: file with id %lld is empty. Passing it\n", dictionary_[file_id]->file_id());
             return true;
         }
 
@@ -225,6 +223,12 @@ namespace LOTRO_DAT {
     bool DatFile::PatchFile(const SubfileData &data) {
         auto file_id = data.options["fid"].as<long long>();
         Subfile *file = dictionary_[file_id];
+
+        if (file == nullptr) {
+            fprintf(stderr, "ERROR DatFile::PatchFile() - Cannot patch file - there is no file in dictionary with file_id = %lld.\n", file_id);
+            return false;
+        }
+
         BinaryData old_data = GetFileData(file);
         BinaryData patch_data = file->MakeForImport(old_data, data);
         ApplyFilePatch(file, patch_data);
@@ -461,18 +465,16 @@ namespace LOTRO_DAT {
             fprintf(stderr, "Warning: DatFile::ApplyFilePatch - found 2 files in patch with the same file_id. Passing last...\n");
             return;
         }
-
         patched_list[file->file_id()] = new BinaryData(file->MakeHeaderData());
         patched_ = true;
 
         auto journal = GetFragmentationJournal();
 
         file->file_size_ = data.size() - 8;
-        //file->fragments_count_ = 0;
 
-        if (data.size() > file->block_size()) {
+        //if (data.size() > file->block_size()) {
             file->file_offset_ = journal[0].second;
-            file->block_size_ = data.size();
+            file->block_size_ = std::max(data.size(), 256u);
 
             journal[0].second += data.size();
 
@@ -480,7 +482,7 @@ namespace LOTRO_DAT {
             WriteData(nulls, nulls.size(), file_size_);
 
             this->file_size_ += data.size();
-        }
+        //}
 
         BinaryData fragments_count(4);
         fragments_count.FromNumber<4>(0);
@@ -492,6 +494,9 @@ namespace LOTRO_DAT {
                                        "Patch wasn't written to .dat file");
 
         WriteData(file_data, file_data.size(), file->file_offset());
+
+        nulls = BinaryData(unsigned(file->block_size_ - file_data.size()));
+        WriteData(nulls, nulls.size(), file->file_offset() + file_data.size());
         UpdateFragmentationJournal(journal);
     }
 

+ 0 - 0
Source/DatFile.h → src/DatFile.h


+ 0 - 0
Source/Database.cpp → src/Database.cpp


+ 0 - 0
Source/Database.h → src/Database.h


+ 16 - 11
Source/Tests/extract_test.cpp → src/Examples/extractor_example.cpp

@@ -60,40 +60,45 @@ int main() {
         std::cout << "Starting search...\n" << std::flush;
         DatFile a((path + filename).c_str(), 0);
         std::cout << "Total files found: " << a.files_number() << std::endl << std::flush;
-
+        a.WriteUnorderedDictionary(output_dir);
         std::cout << "Beginning unpacking... Please, wait for some minutes."
         "\nMaybe it's a good idea to have a cup of tea, while unpacker is working...\n" << std::flush;
 
         Database *out = new Database("out.db");
         if (exportImagesToDb) {
-            Database *images = out;//new Database(output_dir + std::string("Images.db"));
+            //Database *images = out;//new Database(output_dir + std::string("Images.db"));
+            Database *images = new Database(output_dir + std::string("Images.db"));
             std::cout << "Extracted " << a.ExtractAllFilesByType(JPG, images) << " .jpg files to Images.db" << std::endl << std::flush;
-//            delete images;
+            delete images;
         }
 
         if (exportSoundsToDb) {
-            Database *sounds = out;//new Database(output_dir + std::string("Sounds.db"));
+//            Database *sounds = out;//new Database(output_dir + std::string("Sounds.db"));
+            Database *sounds = new Database(output_dir + std::string("Sounds.db"));
             std::cout << "Extracted " << a.ExtractAllFilesByType(WAV, sounds) << " .wav files to Sounds.db" << std::endl << std::flush;
             std::cout << "Extracted " << a.ExtractAllFilesByType(OGG, sounds) << " .ogg files to Sounds.db" << std::endl << std::flush;
-//            delete sounds;
+            delete sounds;
         }
 
         if (exportTextsToDb) {
-            Database *texts = out;//new Database(output_dir + std::string("Texts.db"));
+//            Database *texts = out;//new Database(output_dir + std::string("Texts.db"));
+            Database *texts = new Database(output_dir + std::string("Texts.db"));
             std::cout << "Extracted " << a.ExtractAllFilesByType(TEXT, texts) << " text files to Texts.db" << std::endl << std::flush;
-//            delete texts;
+            delete texts;
         }
 
         if (exportFontsToDb) {
-            Database *fonts = out;//new Database(output_dir + std::string("Fonts.db"));
+//            Database *fonts = out;//new Database(output_dir + std::string("Fonts.db"));
+            Database *fonts = new Database(output_dir + std::string("Fonts.db"));
             std::cout << "Extracted " << a.ExtractAllFilesByType(FONT, fonts) << " font files to Fonts.db" << std::endl << std::flush;
-//            delete fonts;
+            delete fonts;
         }
 
         if (exportTexturesToDb) {
-            Database *textures = out;//new Database(output_dir + std::string("Textures.db"));
+//            Database *textures = out;//new Database(output_dir + std::string("Textures.db"));
+            Database *textures = new Database(output_dir + std::string("Textures.db"));
             std::cout << "Extracted " << a.ExtractAllFilesByType(DDS, textures) << " .dds files to Textures.db" << std::endl << std::flush;
-//            delete textures;
+            delete textures;
         }
         delete out;
 

+ 8 - 10
Source/Tests/patch_test.cpp → src/Examples/patcher_example.cpp

@@ -21,35 +21,33 @@ const std::string filename = "client_local_English.dat";
 
 int main() {
     const clock_t begin_time = clock();
-
+    std::cout << "Gi1dor's LotRO .dat patcher ver. 1.0.3" << std::endl;
     freopen("errors.log", "w", stderr);
-    //freopen("stdout.log", "w", stdout);
+
     setbuf(stdout, NULL);
     setbuf(stderr, NULL);
 
     setvbuf (stdout, NULL, _IONBF, BUFSIZ);
     setvbuf (stderr, NULL, _IONBF, BUFSIZ);
-    Database db;
-    db.InitDatabase("out.db");
 
-    DatFile *a;
+    Database db;
+    db.InitDatabase("patch.db");
 
     try {
-        a = new DatFile((path + filename).c_str(), 0);
+        DatFile *a = new DatFile((path + filename).c_str(), 0);
         std::cout << "Starting magic...\n";
         std::cout << "Files number: " << a->files_number() << std::endl;
-        a->WriteUnorderedDictionary("");
         a->PatchAllDatabase(&db);
+        delete a;
     } catch (std::exception &e) {
         fprintf(stderr, "Caught %s exception.", e.what());
         printf("Caught %s exception.", e.what());
         fflush(stdout);
 
-        printf("Some critical errors occured. Need to stop execution. See information in errors.log file");
-        fprintf(stderr, "Some critical errors occured. Need to stop execution now...");
+        printf("Some critical errors occured. Need to stop execution. See information in errors.log file\n");
+        fprintf(stderr, "Some critical errors occured. Need to stop execution now...\n");
     }
 
-    delete a;
     fprintf(stdout, "Spent %f seconds on performing magic! Thank you for your patience!\n",
             float(clock() - begin_time) / CLOCKS_PER_SEC);
     system("pause");

+ 0 - 0
Source/LotroDatPatcher.h → src/LotroDatPatcher.h


+ 1 - 1
Source/SubDirectory.cpp → src/SubDirectory.cpp

@@ -127,7 +127,7 @@ namespace LOTRO_DAT {
             if (patched_files.count(file_id) != 0) {
                 BinaryData data(32);
                 dat_->ReadData(data, 32, subfiles_[i]->dictionary_offset());
-                if (data != *patched_files[file_id])
+                if (data.CutData(8, 16) != patched_files[file_id]->CutData(8, 16))
                     continue;
 
                 BinaryData header = dict[subfiles_[i]->file_id()]->MakeHeaderData();

+ 0 - 0
Source/SubDirectory.h → src/SubDirectory.h


+ 0 - 0
Source/Subfile.cpp → src/Subfile.cpp


+ 0 - 0
Source/Subfile.h → src/Subfile.h


+ 0 - 0
Source/SubfileData.h → src/SubfileData.h


+ 0 - 0
Source/Subfiles/DdsSubfile.cpp → src/Subfiles/DdsSubfile.cpp


+ 0 - 0
Source/Subfiles/DdsSubfile.h → src/Subfiles/DdsSubfile.h


+ 0 - 0
Source/Subfiles/FontSubfile.cpp → src/Subfiles/FontSubfile.cpp


+ 0 - 0
Source/Subfiles/FontSubfile.h → src/Subfiles/FontSubfile.h


+ 0 - 0
Source/Subfiles/JpgSubfile.cpp → src/Subfiles/JpgSubfile.cpp


+ 0 - 0
Source/Subfiles/JpgSubfile.h → src/Subfiles/JpgSubfile.h


+ 0 - 0
Source/Subfiles/OggSubfile.cpp → src/Subfiles/OggSubfile.cpp


+ 0 - 0
Source/Subfiles/OggSubfile.h → src/Subfiles/OggSubfile.h


+ 0 - 4
Source/Subfiles/TextSubfile.cpp → src/Subfiles/TextSubfile.cpp

@@ -66,9 +66,6 @@ namespace LOTRO_DAT {
 
     SubfileData TextSubfile::PrepareForExport(const BinaryData &file_data) {
         SubfileData result;
-        if (file_size() <= 10) // File is empty, nothing to do;
-            return result;
-
         long long offset = 9; // first 4 bytes - file_id, then 4 bytes - unknown, then 1 byte - unknown
 
         long long text_fragment_num = file_data.ToNumber<1>(offset);
@@ -136,7 +133,6 @@ namespace LOTRO_DAT {
             new_data = new_data + old_data.CutData(offset - 8, offset);
 
             if (patch_fragments.count(fragment_id) == 0) {
-                std::cerr << "Omg, what..? " << file_id() << " " << fragment_id << " is not in patch? " << std::endl;
                 try {
                     // Retrieving old pieces
                     new_data = new_data + GetPieceData(old_data, offset);

+ 0 - 0
Source/Subfiles/TextSubfile.h → src/Subfiles/TextSubfile.h


+ 0 - 0
Source/Subfiles/UnknownSubfile.cpp → src/Subfiles/UnknownSubfile.cpp


+ 0 - 0
Source/Subfiles/UnknownSubfile.h → src/Subfiles/UnknownSubfile.h


+ 0 - 0
Source/Subfiles/WavSubfile.cpp → src/Subfiles/WavSubfile.cpp


+ 0 - 0
Source/Subfiles/WavSubfile.h → src/Subfiles/WavSubfile.h