123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // Created by kikab on 04.06.2018.
- //
- #ifndef LOTRO_DAT_LIBRARY_DATLOCALEMANAGER_H
- #define LOTRO_DAT_LIBRARY_DATLOCALEMANAGER_H
- #include <memory>
- #include <map>
- #include <DatOperationResult.h>
- #include <set>
- extern "C++" {
- namespace LOTRO_DAT {
- class DatFile;
- class SubFile;
- class DatLocaleManager {
- public:
- enum LOCALE {
- PATCHED,
- ORIGINAL
- };
- 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<SubFile> GetLocaleFile(long long file_id, LOCALE locale);
- private:
- std::map<long long, SubFile>& GetLocaleDictReference(LOCALE locale);
- private:
- DatFile *dat;
- std::map<long long, SubFile> orig_dict_;
- std::map<long long, SubFile> patch_dict_;
- std::set<long long> 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
|