#ifndef LEGACYAPP_H #define LEGACYAPP_H #include #include #include "models/downloader.h" #include #include class PatchInstaller : public QObject { Q_OBJECT public: struct Status { size_t total_parts = 0; size_t finished_parts = 0; }; struct AppliedPatchesInfo { bool patched_by_old_legacy = false; bool has_no_patch_mark = false; QString texts_patch_hashsum = ""; QString images_patch_hashsum = ""; QString sounds_patch_hashsum = ""; QString loadscreens_patch_hashsum = ""; QString textures_patch_hashsum = ""; QString fonts_patch_hashsum = ""; QString videos_patch_hashsum = ""; }; public: static PatchInstaller& instance() { static PatchInstaller instance_; return instance_; } bool initialised(); ~PatchInstaller(); AppliedPatchesInfo getPatchesInfo(); // TODO: Implement private: Q_DISABLE_COPY(PatchInstaller) enum RESOURCE_FILE_TYPE : int { E_CLIENT_LOCAL = 0, E_CLIENT_GENERAL = 1 }; explicit PatchInstaller(QObject *parent = nullptr); bool datPathIsRelevant(); void installPatch(QString patch_name, LOTRO_DAT::Database* database); void installOriginalPatch(QString patch_name); void installLoadscreens(LOTRO_DAT::Database* database); void installVideos(LOTRO_DAT::Database* database); AppliedPatchesInfo getAppliedPatchesInfoFromDatFile(); void insertPatchesInfoInDatFile(const AppliedPatchesInfo& info); public slots: void deinit(); void init(); void startGame(); void startPatchInstallationChain(); private slots: void onDownloaderProgressChanged(Downloader* context, Downloader::Status progress); signals: void started(); void progressChanged(PatchInstaller::Status status); void videosDownloadProgressChanged(int finished_videos, int total_videos, Downloader::Status status); void finished(); void successfullyInitialized(); void deinitialized(); private: LOTRO_DAT::DatFile* client_local_file_; LOTRO_DAT::DatFile* client_general_file_; AppliedPatchesInfo _current_applied_patches_info; Status current_status; const QString _patch_mark_header = "HI_FROM_ENDEVIR_V2.0"; const int _applied_patches_file_id = 0x23F4F0F0; const int _patch_files_versions = 6; int download_video_finished_videos = 0; int download_video_total_videos = 0; }; Q_DECLARE_METATYPE(PatchInstaller::Status) #endif // LEGACYAPP_H