diff --git a/src/xenia/patcher/patch_db.cc b/src/xenia/patcher/patch_db.cc index 0d886e3d1..2e351fc7b 100644 --- a/src/xenia/patcher/patch_db.cc +++ b/src/xenia/patcher/patch_db.cc @@ -65,7 +65,8 @@ PatchFileEntry PatchDB::ReadPatchFile( try { patch_toml_fields = ParseFile(file_path); } 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; return patch_file; }; @@ -74,6 +75,13 @@ PatchFileEntry PatchDB::ReadPatchFile( auto title_id = patch_toml_fields.get_as("title_id"); 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_name = title_name->get(); ReadHashes(patch_file, hashes_node); diff --git a/src/xenia/patcher/plugin_loader.cc b/src/xenia/patcher/plugin_loader.cc index 3af0b8938..2fcace6d2 100644 --- a/src/xenia/patcher/plugin_loader.cc +++ b/src/xenia/patcher/plugin_loader.cc @@ -116,13 +116,17 @@ void PluginLoader::LoadTitleConfig(const uint32_t title_id) { plugin_entry.as_table()->get_as("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, - path_to_utf8(title_plugins_config)); + path_to_utf8(file)); continue; } - entry.hashes = GetHashes(plugin_entry.as_table()->get("hash")); plugin_configs_.push_back(entry); } } @@ -136,8 +140,13 @@ std::vector PluginLoader::GetHashes( } if (toml_entry->is_value()) { - hashes.push_back(xe::string_util::from_string( - toml_entry->as_string()->get(), true)); + const std::string hash = toml_entry->as_string()->get(); + + if (hash.empty()) { + return hashes; + } + + hashes.push_back(xe::string_util::from_string(hash, true)); } if (toml_entry->is_array()) {