|
@@ -803,11 +803,47 @@ namespace LOTRO_DAT {
|
|
}
|
|
}
|
|
|
|
|
|
bool DatFile::CheckIfUpdatedByGame() {
|
|
bool DatFile::CheckIfUpdatedByGame() {
|
|
- return false;
|
|
|
|
|
|
+ if (!pending_patch_.empty())
|
|
|
|
+ return true;
|
|
|
|
+ if (current_locale_ == ORIGINAL)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ bool updated = false;
|
|
|
|
+
|
|
|
|
+ for (auto i : dictionary_) {
|
|
|
|
+ long long file_id = i.first;
|
|
|
|
+ Subfile* subfile = i.second;
|
|
|
|
+ if (inactive_categories.count(subfile->category) > 0)
|
|
|
|
+ continue;
|
|
|
|
+ if (patch_dict_.count(file_id) > 0
|
|
|
|
+ && (subfile->file_size() != patch_dict_[file_id]->file_size()
|
|
|
|
+ || subfile->file_offset() != patch_dict_[file_id]->file_offset()
|
|
|
|
+ || subfile->block_size() != patch_dict_[file_id]->block_size())) {
|
|
|
|
+ orig_dict_.erase(file_id);
|
|
|
|
+ patch_dict_.erase(file_id);
|
|
|
|
+ pending_patch_.insert(file_id);
|
|
|
|
+ updated = true;
|
|
|
|
+ dat_state_ = UPDATED;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ CommitChanges();
|
|
|
|
+ return updated;
|
|
}
|
|
}
|
|
|
|
|
|
void DatFile::RepairPatches(Database *db) {
|
|
void DatFile::RepairPatches(Database *db) {
|
|
|
|
+ SubfileData data;
|
|
|
|
+ data = db->GetNextFile();
|
|
|
|
+ while (!data.Empty()) {
|
|
|
|
+ if (pending_patch_.count(data.options["fid"].as<long long>()) > 0) {
|
|
|
|
+ PatchFile(data);
|
|
|
|
+ }
|
|
|
|
+ data = db->GetNextFile();
|
|
|
|
+ }
|
|
|
|
+ CommitChanges();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ void DatFile::FinishRepairingPatches() {
|
|
|
|
+ pending_patch_.clear();
|
|
}
|
|
}
|
|
|
|
|
|
LOCALE DatFile::current_locale() {
|
|
LOCALE DatFile::current_locale() {
|
|
@@ -887,16 +923,15 @@ namespace LOTRO_DAT {
|
|
}
|
|
}
|
|
|
|
|
|
void DatFile::EnableCategory(int category) {
|
|
void DatFile::EnableCategory(int category) {
|
|
- std::cout << "Disabling category " << category << std::endl;
|
|
|
|
|
|
+ std::cout << "Enabling category " << category << std::endl;
|
|
if (inactive_categories.count(category) == 0)
|
|
if (inactive_categories.count(category) == 0)
|
|
return;
|
|
return;
|
|
inactive_categories.erase(category);
|
|
inactive_categories.erase(category);
|
|
|
|
+ dat_state_ = UPDATED;
|
|
|
|
|
|
for (auto file : dictionary_) {
|
|
for (auto file : dictionary_) {
|
|
auto file_id = file.first;
|
|
auto file_id = file.first;
|
|
if (patch_dict_.count(file_id) > 0 && patch_dict_[file_id]->category == category) {
|
|
if (patch_dict_.count(file_id) > 0 && patch_dict_[file_id]->category == category) {
|
|
- dat_state_ = UPDATED;
|
|
|
|
-
|
|
|
|
file.second->file_offset_ = patch_dict_[file_id]->file_offset_;
|
|
file.second->file_offset_ = patch_dict_[file_id]->file_offset_;
|
|
file.second->file_size_ = patch_dict_[file_id]->file_size_;
|
|
file.second->file_size_ = patch_dict_[file_id]->file_size_;
|
|
file.second->block_size_ = patch_dict_[file_id]->block_size_;
|
|
file.second->block_size_ = patch_dict_[file_id]->block_size_;
|
|
@@ -912,13 +947,11 @@ namespace LOTRO_DAT {
|
|
if (inactive_categories.count(category) != 0)
|
|
if (inactive_categories.count(category) != 0)
|
|
return;
|
|
return;
|
|
inactive_categories.insert(category);
|
|
inactive_categories.insert(category);
|
|
|
|
+ dat_state_ = UPDATED;
|
|
|
|
|
|
for (auto file : dictionary_) {
|
|
for (auto file : dictionary_) {
|
|
auto file_id = file.first;
|
|
auto file_id = file.first;
|
|
-
|
|
|
|
if (orig_dict_.count(file_id) && orig_dict_[file_id]->category == category) {
|
|
if (orig_dict_.count(file_id) && orig_dict_[file_id]->category == category) {
|
|
- dat_state_ = UPDATED;
|
|
|
|
-
|
|
|
|
file.second->file_offset_ = orig_dict_[file_id]->file_offset_;
|
|
file.second->file_offset_ = orig_dict_[file_id]->file_offset_;
|
|
file.second->file_size_ = orig_dict_[file_id]->file_size_;
|
|
file.second->file_size_ = orig_dict_[file_id]->file_size_;
|
|
file.second->block_size_ = orig_dict_[file_id]->block_size_;
|
|
file.second->block_size_ = orig_dict_[file_id]->block_size_;
|
|
@@ -940,5 +973,6 @@ namespace LOTRO_DAT {
|
|
bool DatFile::CheckIfPatchedByOldLauncher() {
|
|
bool DatFile::CheckIfPatchedByOldLauncher() {
|
|
return dictionary_.count(620750000) > 0;
|
|
return dictionary_.count(620750000) > 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|