|
@@ -76,6 +76,29 @@ void DatFile::Deinit() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+bool DatFile::checkIfPatchedByLegacyV1(const std::string& filename) {
|
|
|
+ FILE* file_handler = fopen(filename.c_str(), "r+b");
|
|
|
+ if (file_handler == nullptr) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ BinaryData data(1024);
|
|
|
+ fread(data.data(), 1024, 1, file_handler);
|
|
|
+ fclose(file_handler);
|
|
|
+ return (data.ToNumber<4>(0x128) != 0 || data.ToNumber<4>(0x12C) != 0);
|
|
|
+}
|
|
|
+
|
|
|
+int DatFile::GetDatFileMaxIteration() const {
|
|
|
+ int subfiles_num = api_.GetNumSubfiles(file_handle_);
|
|
|
+ int max_iteration = -1;
|
|
|
+ for (int i = 0; i < subfiles_num; ++i) {
|
|
|
+ SubfileInfo file_info;
|
|
|
+ api_.GetSubfileSizes(file_handle_, &file_info.file_id, &file_info.size, &file_info.iteration, i, 1);
|
|
|
+ max_iteration = std::max(max_iteration, file_info.iteration);
|
|
|
+ }
|
|
|
+
|
|
|
+ return max_iteration;
|
|
|
+}
|
|
|
+
|
|
|
bool DatFile::Initialized() const{
|
|
|
return initialized_;
|
|
|
}
|