// // Created by Иван_Архипов on 31.10.2017. // #ifndef LOTRO_DAT_PATCHER_DATFILE_H #define LOTRO_DAT_PATCHER_DATFILE_H #ifdef LOTRO_DAT_EXPORTS #define LOTRO_DAT_API __declspec(dllexport) #else #define LOTRO_DAT_API __declspec(dllimport) #endif #include #include #include #include // Dat file names definitions #define CLIENT_LOCAL_ENGLISH 0 #define CLIENT_GENERAL 1 #define CLIENT_SOUND 2 #define CLIENT_SURFACE 3 #define CLIENT_HIGHRES 4 extern "C++" { namespace LOTRO_DAT { class BinaryData; class DatException; class SubDirectory; class Subfile; enum STATE { CLOSED, SUCCESS_OPENED, SUCCESS_SUPERBLOCK, SUCCESS_DIRECTORIES, SUCCESS_DICTIONARY, READY }; class DatFile { public: DatFile(); explicit DatFile(const char* filename, int dat_id); explicit DatFile(const std::string &filename, int dat_id); ~DatFile(); void ReadData(BinaryData &data, long long size, long long offset = 0, long long data_offset = 0); void WriteData(const BinaryData &data, long long size, long long offset = 0, long long data_offset = 0); long long constant1() const; long long constant2() const; long long file_size() const; long long version1() const; long long version2() const; const std::unordered_map &dictionary(); private: FILE *file_handler_; SubDirectory *root_directory_; std::unordered_map dictionary_; void OpenDatFile(const char* dat_name); void ReadSuperBlock(); void MakeDirectories(); void MakeDictionary(); long long constant1_; long long constant2_; long long file_size_; long long version1_; long long version2_; long long root_directory_offset_; STATE dat_state_; int dat_id_; }; } } #endif //LOTRO_DAT_PATCHER_DATFILE_H