Cleanup
This commit is contained in:
parent
d78fd19ab4
commit
ccbb5a2ebf
|
@ -36,8 +36,7 @@ void PatchDB::LoadPatches() {
|
||||||
const std::filesystem::path patches_directory = patches_root_ / "patches";
|
const std::filesystem::path patches_directory = patches_root_ / "patches";
|
||||||
const std::vector<xe::filesystem::FileInfo>& patch_files =
|
const std::vector<xe::filesystem::FileInfo>& patch_files =
|
||||||
filesystem::ListFiles(patches_directory);
|
filesystem::ListFiles(patches_directory);
|
||||||
const std::regex file_name_regex_match =
|
const std::regex file_name_regex_match = std::regex(patch_filename_regex);
|
||||||
std::regex("^[A-Fa-f0-9]{8}.*\\.patch\\.toml$");
|
|
||||||
|
|
||||||
for (const xe::filesystem::FileInfo& patch_file : patch_files) {
|
for (const xe::filesystem::FileInfo& patch_file : patch_files) {
|
||||||
// Skip files that doesn't have only title_id as name and .patch as
|
// Skip files that doesn't have only title_id as name and .patch as
|
||||||
|
@ -150,7 +149,6 @@ bool PatchDB::ReadPatchData(
|
||||||
|
|
||||||
bool success = string_util::hex_string_to_array(data, value);
|
bool success = string_util::hex_string_to_array(data, value);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
XELOGE("PatchDB: Cannot load patch due to invalid data!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,11 @@ class PatchDB {
|
||||||
std::vector<PatchFileEntry>& GetAllPatches() { return loaded_patches; }
|
std::vector<PatchFileEntry>& GetAllPatches() { return loaded_patches; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<PatchFileEntry> loaded_patches;
|
void ReadHash(PatchFileEntry& patchEntry,
|
||||||
std::filesystem::path patches_root_;
|
std::shared_ptr<cpptoml::table> patch_toml_fields);
|
||||||
|
|
||||||
|
inline static const std::string patch_filename_regex =
|
||||||
|
"^[A-Fa-f0-9]{8}.*\\.patch\\.toml$";
|
||||||
|
|
||||||
const std::map<std::string, PatchData> patch_data_types_size = {
|
const std::map<std::string, PatchData> patch_data_types_size = {
|
||||||
{"string", PatchData(0, PatchDataType::string)},
|
{"string", PatchData(0, PatchDataType::string)},
|
||||||
|
@ -124,8 +127,8 @@ class PatchDB {
|
||||||
{"be16", PatchData(sizeof(uint16_t), PatchDataType::be16)},
|
{"be16", PatchData(sizeof(uint16_t), PatchDataType::be16)},
|
||||||
{"be8", PatchData(sizeof(uint8_t), PatchDataType::be8)}};
|
{"be8", PatchData(sizeof(uint8_t), PatchDataType::be8)}};
|
||||||
|
|
||||||
void ReadHash(PatchFileEntry& patchEntry,
|
std::vector<PatchFileEntry> loaded_patches;
|
||||||
std::shared_ptr<cpptoml::table> patch_toml_fields);
|
std::filesystem::path patches_root_;
|
||||||
};
|
};
|
||||||
} // namespace patcher
|
} // namespace patcher
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
Loading…
Reference in New Issue