// // Created by kikab on 04.06.2018. // #ifndef LOTRO_DAT_LIBRARY_DATLOCALEMANAGER_H #define LOTRO_DAT_LIBRARY_DATLOCALEMANAGER_H #include #include #include #include extern "C++" { namespace LOTRO_DAT { class DatFile; class SubFile; class DatLocaleManager { public: enum LOCALE : int { ORIGINAL = 0, PATCHED = 1 }; DatLocaleManager() = delete; DatLocaleManager(const DatLocaleManager &other) = delete; DatLocaleManager& operator=(const DatLocaleManager &other) = delete; ~DatLocaleManager() = default; explicit DatLocaleManager(DatFile *datFilePtr); DatOperationResult<> Init(); DatOperationResult<> SetLocale(LOCALE locale); DatOperationResult<> DeInit(); LOCALE GetCurrentLocale(); void UpdateLocaleFile(LOCALE locale, const SubFile& file); DatOperationResult GetLocaleFile(long long file_id, LOCALE locale); void PrintInformaion(FILE* file); private: std::map& GetLocaleDictReference(LOCALE locale); private: DatFile *dat; std::map orig_dict_; std::map patch_dict_; std::set inactive_categories; LOCALE current_locale_; }; } }; /* * ======== LOCALE DICT STRUCTURE ========= * 4 bytes for block size (in bytes) * 4 bytes for locale version * 4 bytes for .dat file size (with patches) * 15 bytes for "Hi from Gi1dor" * 4 bytes for LOCALE * 4 bytes for orig_dict.size() * (32 + 4) * orig_dict.size() bytes for orig_dict data * 4 bytes for patch_dict.size() * (32 + 4) * patch_dict.size() bytes for patch_dict data * 4 bytes for inactive_categories dict * 4 * inactive_categories.size() bytes for inactive_categories data */ #endif //LOTRO_DAT_LIBRARY_DATLOCALEMANAGER_H