|
@@ -49,22 +49,22 @@ namespace LOTRO_DAT {
|
|
|
|
|
|
LOG(INFO) << "Initialising locales...";
|
|
|
BinaryData locale_offset_data(4);
|
|
|
- dat->getIO().ReadData(locale_offset_data, 4, 300);
|
|
|
+ dat->GetIO().ReadData(locale_offset_data, 4, 300);
|
|
|
long long locale_offset = locale_offset_data.ToNumber<4>(0);
|
|
|
|
|
|
- if (locale_offset == 0 || locale_offset + 8 >= dat->getIO().GetActualDatSize().value) {
|
|
|
+ if (locale_offset == 0 || locale_offset + 8 >= dat->GetIO().GetActualDatSize().value) {
|
|
|
LOG(INFO) << "Dictionary offset is empty or incorrect. Passing.";
|
|
|
return DatOperationResult<>();
|
|
|
}
|
|
|
|
|
|
BinaryData locale_info(12);
|
|
|
- dat->getIO().ReadData(locale_info, 12, locale_offset);
|
|
|
+ dat->GetIO().ReadData(locale_info, 12, locale_offset);
|
|
|
|
|
|
long long dict_size = locale_info.ToNumber<4>(0);
|
|
|
long long dict_version = locale_info.ToNumber<4>(4);
|
|
|
|
|
|
if (dict_version != 101) {
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
if (CheckLocaleCorrect())
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
else
|
|
@@ -72,10 +72,10 @@ namespace LOTRO_DAT {
|
|
|
}
|
|
|
|
|
|
BinaryData dicts_data = BinaryData((unsigned)dict_size);
|
|
|
- dat->getIO().ReadData(dicts_data, dict_size - 12, locale_offset + 12);
|
|
|
+ dat->GetIO().ReadData(dicts_data, dict_size - 12, locale_offset + 12);
|
|
|
|
|
|
if (dicts_data.size() < 15) {
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
return DatOperationResult<>(ERROR, "INITLOCALE: Data in locales' dictionary is incorrect.");
|
|
|
}
|
|
|
|
|
@@ -118,8 +118,8 @@ namespace LOTRO_DAT {
|
|
|
LOG(INFO) << "Finished initialising locales";
|
|
|
|
|
|
if (CheckLocaleCorrect()) {
|
|
|
- dat->getIO().file_size = locale_info.ToNumber<4>(8);
|
|
|
- LOG(INFO) << "Locales initialisation success. Dictionary size is " << dict_size << ". Version is " << dict_version << ". Localed .dat size = " << dat->getIO().file_size;
|
|
|
+ dat->GetIO().file_size = locale_info.ToNumber<4>(8);
|
|
|
+ LOG(INFO) << "Locales initialisation success. Dictionary size is " << dict_size << ". Version is " << dict_version << ". Localed .dat size = " << dat->GetIO().file_size;
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
} else
|
|
|
return DatOperationResult<>(ERROR, "Locale dict is incorrect, through patched mark is standing. Dat file may be corrupted");
|
|
@@ -148,7 +148,7 @@ namespace LOTRO_DAT {
|
|
|
for (const auto &file : dict) {
|
|
|
long long file_id = file.first;
|
|
|
|
|
|
- auto dict_file_result = dat->getFileSystem().GetFile(file_id);
|
|
|
+ auto dict_file_result = dat->GetFileSystem().GetFile(file_id);
|
|
|
if (dict_file_result.result != SUCCESS) {
|
|
|
LOG(WARNING) << "Unable to get file with id = " << file_id << "from datFileSystem!";
|
|
|
dict.erase(file_id);
|
|
@@ -160,7 +160,7 @@ namespace LOTRO_DAT {
|
|
|
if (dict_file->MakeHeaderData().CutData(8, 16) == file.second.MakeHeaderData().CutData(8, 16))
|
|
|
continue;
|
|
|
|
|
|
- dat->getFileSystem().UpdateFileInfo(file.second);
|
|
|
+ dat->GetFileSystem().UpdateFileInfo(file.second);
|
|
|
}
|
|
|
current_locale_ = locale;
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
@@ -212,7 +212,7 @@ namespace LOTRO_DAT {
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: no connection with Dat (dat is nullptr)");
|
|
|
|
|
|
if (patch_dict_.empty()) {
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(0), 4, 300);
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
}
|
|
|
|
|
@@ -259,40 +259,40 @@ namespace LOTRO_DAT {
|
|
|
|
|
|
|
|
|
BinaryData dicts_data(4);
|
|
|
- dat->getIO().ReadData(dicts_data, 4, 300);
|
|
|
+ dat->GetIO().ReadData(dicts_data, 4, 300);
|
|
|
long long dict_offset = dicts_data.ToNumber<4>(0);
|
|
|
- dat->getIO().ReadData(dicts_data, 4, dict_offset);
|
|
|
+ dat->GetIO().ReadData(dicts_data, 4, dict_offset);
|
|
|
long long dict_size = dicts_data.ToNumber<4>(0);
|
|
|
|
|
|
if (binary_data.size() > dict_size || dict_offset == 0) {
|
|
|
- long long new_dict_offset = dat->getIO().file_size + 12;
|
|
|
+ long long new_dict_offset = dat->GetIO().file_size + 12;
|
|
|
|
|
|
|
|
|
binary_data.Append(BinaryData::FromNumber<4>(std::max(binary_data.size() + 4, 20u * 1024u * 1024u)), 0);
|
|
|
binary_data.Append(BinaryData::FromNumber<4>(101), 4);
|
|
|
- binary_data.Append(BinaryData::FromNumber<4>(dat->getIO().file_size + binary_data.size() + 20 * 1024 * 1024), 8);
|
|
|
+ binary_data.Append(BinaryData::FromNumber<4>(dat->GetIO().file_size + binary_data.size() + 20 * 1024 * 1024), 8);
|
|
|
|
|
|
- auto operation = dat->getIO().WriteData(binary_data, binary_data.size(), new_dict_offset);
|
|
|
+ auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), new_dict_offset);
|
|
|
if (operation.result != SUCCESS)
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales");
|
|
|
|
|
|
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(new_dict_offset), 4, 300);
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(current_locale_), 4, 296);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(new_dict_offset), 4, 300);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(current_locale_), 4, 296);
|
|
|
|
|
|
- dat->getIO().file_size += binary_data.size();
|
|
|
+ dat->GetIO().file_size += binary_data.size();
|
|
|
|
|
|
|
|
|
BinaryData nulls(unsigned(20 * 1024 * 1024));
|
|
|
- dat->getIO().WriteData(nulls, nulls.size(), dat->getIO().file_size);
|
|
|
- dat->getIO().file_size += nulls.size();
|
|
|
+ dat->GetIO().WriteData(nulls, nulls.size(), dat->GetIO().file_size);
|
|
|
+ dat->GetIO().file_size += nulls.size();
|
|
|
} else {
|
|
|
binary_data.Append(BinaryData::FromNumber<4>(std::max(binary_data.size() + 4, 20u * 1024u * 1024u)), 0);
|
|
|
binary_data.Append(BinaryData::FromNumber<4>(101), 4);
|
|
|
- binary_data.Append(BinaryData::FromNumber<4>(dat->getIO().file_size), 8);
|
|
|
+ binary_data.Append(BinaryData::FromNumber<4>(dat->GetIO().file_size), 8);
|
|
|
|
|
|
- dat->getIO().WriteData(BinaryData::FromNumber<4>(current_locale_), 4, 296, 0);
|
|
|
- auto operation = dat->getIO().WriteData(binary_data, binary_data.size(), dict_offset);
|
|
|
+ dat->GetIO().WriteData(BinaryData::FromNumber<4>(current_locale_), 4, 296, 0);
|
|
|
+ auto operation = dat->GetIO().WriteData(binary_data, binary_data.size(), dict_offset);
|
|
|
if (operation.result != SUCCESS)
|
|
|
return DatOperationResult<>(ERROR, "LOCALEDEINIT: Cannot write locales. ERRMSG: " + operation.msg);
|
|
|
}
|
|
@@ -354,27 +354,27 @@ namespace LOTRO_DAT {
|
|
|
void DatLocaleManager::PrintInformaion(FILE *file) {
|
|
|
fprintf(file, "========= Locales info ========\n");
|
|
|
BinaryData locale_offset_data(4);
|
|
|
- dat->getIO().ReadData(locale_offset_data, 4, 300);
|
|
|
+ dat->GetIO().ReadData(locale_offset_data, 4, 300);
|
|
|
long long locale_offset = locale_offset_data.ToNumber<4>(0);
|
|
|
|
|
|
fprintf(file, "Locales' dictionary offset = %lld\n", locale_offset);
|
|
|
|
|
|
BinaryData locale_status_data(4);
|
|
|
- dat->getIO().ReadData(locale_status_data, 4, 296);
|
|
|
+ dat->GetIO().ReadData(locale_status_data, 4, 296);
|
|
|
long long locale_status = locale_offset_data.ToNumber<4>(0);
|
|
|
|
|
|
fprintf(file, "Locale status = %lld\n", locale_status);
|
|
|
|
|
|
if (locale_offset != 0) {
|
|
|
BinaryData locale_info(12);
|
|
|
- dat->getIO().ReadData(locale_info, 12, locale_offset);
|
|
|
+ dat->GetIO().ReadData(locale_info, 12, locale_offset);
|
|
|
|
|
|
long long dict_size = locale_info.ToNumber<4>(0);
|
|
|
long long dict_version = locale_info.ToNumber<4>(4);
|
|
|
|
|
|
fprintf(file, "Locales' dictionary size = %lld, version = %lld\n", dict_size, dict_version);
|
|
|
|
|
|
- dat->getIO().file_size = locale_info.ToNumber<4>(8);
|
|
|
+ dat->GetIO().file_size = locale_info.ToNumber<4>(8);
|
|
|
}
|
|
|
|
|
|
fprintf(file, "Current locale id = %d\n", current_locale_);
|
|
@@ -393,21 +393,21 @@ namespace LOTRO_DAT {
|
|
|
|
|
|
bool DatLocaleManager::CheckLocaleCorrect() {
|
|
|
BinaryData locale_info(4);
|
|
|
- dat->getIO().ReadData(locale_info, 4, 296);
|
|
|
+ dat->GetIO().ReadData(locale_info, 4, 296);
|
|
|
long long locale_status = locale_info.ToNumber<4>(0);
|
|
|
|
|
|
if (locale_status == ORIGINAL)
|
|
|
return true;
|
|
|
|
|
|
BinaryData locale_offset_data(4);
|
|
|
- dat->getIO().ReadData(locale_offset_data, 4, 300);
|
|
|
+ dat->GetIO().ReadData(locale_offset_data, 4, 300);
|
|
|
long long locale_offset = locale_offset_data.ToNumber<4>(0);
|
|
|
|
|
|
- if (locale_offset == 0 || locale_offset + 8 >= dat->getIO().GetActualDatSize().value)
|
|
|
+ if (locale_offset == 0 || locale_offset + 8 >= dat->GetIO().GetActualDatSize().value)
|
|
|
return locale_status == ORIGINAL;
|
|
|
|
|
|
BinaryData dicts_data = BinaryData(4);
|
|
|
- auto operation = dat->getIO().ReadData(dicts_data, 4, locale_offset + 12 + 15);
|
|
|
+ auto operation = dat->GetIO().ReadData(dicts_data, 4, locale_offset + 12 + 15);
|
|
|
if (operation.result == ERROR)
|
|
|
return locale_status == ORIGINAL;
|
|
|
|