[Patcher] Check for missing entries and use relative paths
This commit is contained in:
parent
2fcf8c1163
commit
7003e54e51
|
@ -65,7 +65,8 @@ PatchFileEntry PatchDB::ReadPatchFile(
|
||||||
try {
|
try {
|
||||||
patch_toml_fields = ParseFile(file_path);
|
patch_toml_fields = ParseFile(file_path);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
XELOGE("PatchDB: Cannot load patch file: {}", path_to_utf8(file_path));
|
XELOGE("PatchDB: Cannot load patch file: {}",
|
||||||
|
path_to_utf8(file_path.filename()));
|
||||||
patch_file.title_id = -1;
|
patch_file.title_id = -1;
|
||||||
return patch_file;
|
return patch_file;
|
||||||
};
|
};
|
||||||
|
@ -74,6 +75,13 @@ PatchFileEntry PatchDB::ReadPatchFile(
|
||||||
auto title_id = patch_toml_fields.get_as<std::string>("title_id");
|
auto title_id = patch_toml_fields.get_as<std::string>("title_id");
|
||||||
auto hashes_node = patch_toml_fields.get("hash");
|
auto hashes_node = patch_toml_fields.get("hash");
|
||||||
|
|
||||||
|
if (!title_name || !title_id || !hashes_node) {
|
||||||
|
XELOGE("PatchDB: Cannot load patch file: {}",
|
||||||
|
path_to_utf8(file_path.filename()));
|
||||||
|
patch_file.title_id = -1;
|
||||||
|
return patch_file;
|
||||||
|
}
|
||||||
|
|
||||||
patch_file.title_id = strtoul(title_id->get().c_str(), NULL, 16);
|
patch_file.title_id = strtoul(title_id->get().c_str(), NULL, 16);
|
||||||
patch_file.title_name = title_name->get();
|
patch_file.title_name = title_name->get();
|
||||||
ReadHashes(patch_file, hashes_node);
|
ReadHashes(patch_file, hashes_node);
|
||||||
|
|
|
@ -116,13 +116,17 @@ void PluginLoader::LoadTitleConfig(const uint32_t title_id) {
|
||||||
plugin_entry.as_table()->get_as<bool>("is_enabled")->get();
|
plugin_entry.as_table()->get_as<bool>("is_enabled")->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin_entry.as_table()->contains("hash")) {
|
entry.hashes = GetHashes(plugin_entry.as_table()->get("hash"));
|
||||||
|
|
||||||
|
if (!plugin_entry.as_table()->contains("hash") || entry.hashes.empty()) {
|
||||||
|
const std::string file =
|
||||||
|
fmt::format("plugins\\{:08X}\\plugins.toml", title_id);
|
||||||
|
|
||||||
XELOGE("Hash error! skipping plugin {} in: {}", entry.name,
|
XELOGE("Hash error! skipping plugin {} in: {}", entry.name,
|
||||||
path_to_utf8(title_plugins_config));
|
path_to_utf8(file));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.hashes = GetHashes(plugin_entry.as_table()->get("hash"));
|
|
||||||
plugin_configs_.push_back(entry);
|
plugin_configs_.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,8 +140,13 @@ std::vector<uint64_t> PluginLoader::GetHashes(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toml_entry->is_value()) {
|
if (toml_entry->is_value()) {
|
||||||
hashes.push_back(xe::string_util::from_string<uint64_t>(
|
const std::string hash = toml_entry->as_string()->get();
|
||||||
toml_entry->as_string()->get(), true));
|
|
||||||
|
if (hash.empty()) {
|
||||||
|
return hashes;
|
||||||
|
}
|
||||||
|
|
||||||
|
hashes.push_back(xe::string_util::from_string<uint64_t>(hash, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toml_entry->is_array()) {
|
if (toml_entry->is_array()) {
|
||||||
|
|
Loading…
Reference in New Issue