diff options
| author | Duck912 <350528965+Duck912@users.noreply.github.com> | 2026-11-03 12:56:27 -0500 |
|---|---|---|
| committer | Duck912 <350528965+Duck912@users.noreply.github.com> | 2026-11-03 13:06:59 -0500 |
| commit | f4f076fe447b2ddc158fcc12ee81ed2af2aecad7 (patch) | |
| tree | 43f418e4a46e2b5ea6626e8e793116817ce36acd /src | |
| parent | b1179a44fbd1cf514c2bed56bf235fbe456c8c7b (diff) | |
video_core, yuzu: write NVIDIA DLSS file paths to logs as UTF-8
The Streamline start-up and DLSS download code formatted paths with std::filesystem::path::string(),
which on MSVC converts to the active code page and throws when a character has no mapping there,
for example a user name in another script under %APPDATA%. The start-up log runs inside the
renderer's constructor, which only catches vk::Exception, so such a user would crash at game start
with the setting on.
Use Common::FS::PathToUTF8String for every path in these logs and messages.
Found by CodeRabbit review.
Assisted-by: Claude Opus 5.5 (implementation)
Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/vulkan_common/streamline.cpp | 17 | ||||
| -rw-r--r-- | src/yuzu/configuration/nvidia_dlss_panel.cpp | 14 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/video_core/vulkan_common/streamline.cpp b/src/video_core/vulkan_common/streamline.cpp index 966de82cb5..4f8fd796c1 100644 --- a/src/video_core/vulkan_common/streamline.cpp +++ b/src/video_core/vulkan_common/streamline.cpp @@ -15,6 +15,7 @@ #include <fmt/format.h> +#include "common/fs/fs_util.h" #include "common/fs/path_util.h" #include "common/logging.h" #include "common/settings.h" @@ -168,7 +169,7 @@ std::filesystem::path UseAppModel(const DlssFiles& files) { if (!current) { if (!IsSignedByNvidia(files.app_model)) { LOG_WARNING(Render_Vulkan, "The NVIDIA app's DLSS {} is not signed by NVIDIA", - files.app_model.string()); + Common::FS::PathToUTF8String(files.app_model)); return {}; } std::filesystem::create_directories(dir, ec); @@ -176,7 +177,7 @@ std::filesystem::path UseAppModel(const DlssFiles& files) { std::filesystem::copy_options::overwrite_existing, ec); if (ec) { LOG_WARNING(Render_Vulkan, "Could not copy the NVIDIA app's DLSS to {}: {}", - target.string(), ec.message()); + Common::FS::PathToUTF8String(target), ec.message()); return {}; } } @@ -186,12 +187,13 @@ std::filesystem::path UseAppModel(const DlssFiles& files) { bool Load(State& state, const std::filesystem::path& path) { if (!IsStreamlineModule(path)) { LOG_ERROR(Render_Vulkan, "{} is not signed by NVIDIA; not loading it", - path.string()); + Common::FS::PathToUTF8String(path)); return false; } state.module = LoadLibraryW(path.c_str()); if (!state.module) { - LOG_ERROR(Render_Vulkan, "Could not load {} (error {})", path.string(), GetLastError()); + LOG_ERROR(Render_Vulkan, "Could not load {} (error {})", Common::FS::PathToUTF8String(path), + GetLastError()); return false; } Api& api = state.api; @@ -298,7 +300,7 @@ bool Start() { LOG_WARNING(Render_Vulkan, "NVIDIA DLSS is on, but sl.interposer.dll (NVIDIA Streamline) is not in " "{} (the Graphics settings can download it); using FSR 3.1", - files.folder.string()); + Common::FS::PathToUTF8String(files.folder)); return false; } if (!Load(state, files.interposer)) { @@ -313,7 +315,7 @@ bool Start() { } } else if (files.model.empty()) { LOG_WARNING(Render_Vulkan, "No nvngx_dlss.dll in {} and no DLSS from the NVIDIA app", - files.folder.string()); + Common::FS::PathToUTF8String(files.folder)); } } @@ -371,7 +373,8 @@ bool Start() { sl::FeatureVersion version{}; api.get_feature_version(sl::kFeatureDLSS, version); LOG_INFO(Render_Vulkan, "NVIDIA Streamline {} started from {} (DLSS {})", - version.versionSL.toStr(), std::filesystem::path{state.plugin_dir}.string(), + version.versionSL.toStr(), + Common::FS::PathToUTF8String(std::filesystem::path{state.plugin_dir}), version.versionNGX.toStr()); state.started = true; return true; diff --git a/src/yuzu/configuration/nvidia_dlss_panel.cpp b/src/yuzu/configuration/nvidia_dlss_panel.cpp index fa1af23c4a..2329693a03 100644 --- a/src/yuzu/configuration/nvidia_dlss_panel.cpp +++ b/src/yuzu/configuration/nvidia_dlss_panel.cpp @@ -33,6 +33,7 @@ #include <zlib.h> #include "common/common_types.h" +#include "common/fs/fs_util.h" #include "common/logging.h" #include "video_core/vulkan_common/streamline.h" #include "yuzu/configuration/nvidia_dlss_panel.h" @@ -441,7 +442,8 @@ void NvidiaDlssPanel::Download() { QStringList names; for (const std::string& entry : wanted) { - names << QString::fromStdString(std::filesystem::path{entry}.filename().string()); + names << QString::fromStdString( + Common::FS::PathToUTF8String(std::filesystem::path{entry}.filename())); } QDialog dialog(this); dialog.setWindowTitle(Tr("Download NVIDIA DLSS")); @@ -517,7 +519,7 @@ void NvidiaDlssPanel::Download() { file.write(contents->data(), static_cast<std::streamsize>(contents->size())); if (!file) { progress.close(); - fail("could not write " + partial.string()); + fail("could not write " + Common::FS::PathToUTF8String(partial)); return; } } @@ -526,18 +528,18 @@ void NvidiaDlssPanel::Download() { if (!signed_ok) { std::filesystem::remove(partial, ec); progress.close(); - fail(target.filename().string() + " is not signed by NVIDIA"); + fail(Common::FS::PathToUTF8String(target.filename()) + " is not signed by NVIDIA"); return; } std::filesystem::rename(partial, target, ec); if (ec) { std::filesystem::remove(partial, ec); progress.close(); - fail("could not save " + target.string()); + fail("could not save " + Common::FS::PathToUTF8String(target)); return; } - LOG_INFO(Frontend, "Downloaded {} from NVIDIA's Streamline {} release", target.string(), - RELEASE_VERSION); + LOG_INFO(Frontend, "Downloaded {} from NVIDIA's Streamline {} release", + Common::FS::PathToUTF8String(target), RELEASE_VERSION); } progress.setValue(1000); progress.close(); |
