From fd78ab4dfcd3e0c8340f59a9237720c1bb0505c8 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 18 Jul 2022 08:46:04 +0200 Subject: [PATCH] [Patcher] Allow loading patches from non-utf8 paths --- src/xenia/config.cc | 1 - src/xenia/config.h | 4 ++++ src/xenia/patcher/patch_db.cc | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xenia/config.cc b/src/xenia/config.cc index 365602493..801f7ac8a 100644 --- a/src/xenia/config.cc +++ b/src/xenia/config.cc @@ -9,7 +9,6 @@ #include "config.h" -#include "third_party/cpptoml/include/cpptoml.h" #include "third_party/fmt/include/fmt/format.h" #include "xenia/base/assert.h" #include "xenia/base/cvar.h" diff --git a/src/xenia/config.h b/src/xenia/config.h index 2271cea6c..8d7b6269b 100644 --- a/src/xenia/config.h +++ b/src/xenia/config.h @@ -11,6 +11,10 @@ #define XENIA_CONFIG_H_ #include +#include "third_party/cpptoml/include/cpptoml.h" + +std::shared_ptr ParseFile( + const std::filesystem::path& filename); namespace config { void SetupConfig(const std::filesystem::path& config_folder); diff --git a/src/xenia/patcher/patch_db.cc b/src/xenia/patcher/patch_db.cc index 8a7eb3d5c..e3acb573d 100644 --- a/src/xenia/patcher/patch_db.cc +++ b/src/xenia/patcher/patch_db.cc @@ -8,6 +8,7 @@ */ #include +#include "xenia/config.h" #include "xenia/base/cvar.h" #include "xenia/base/filesystem.h" #include "xenia/base/logging.h" @@ -61,7 +62,7 @@ PatchFileEntry PatchDB::ReadPatchFile(const std::filesystem::path& file_path) { std::shared_ptr patch_toml_fields; try { - patch_toml_fields = cpptoml::parse_file(path_to_utf8(file_path)); + patch_toml_fields = ParseFile(file_path); } catch (...) { XELOGE("PatchDB: Cannot load patch file: {}", path_to_utf8(file_path)); patch_file.title_id = -1;