diff --git a/Engine/Resource/cas_codec.cpp b/Engine/Resource/cas_codec.cpp index 8249df8..9149e1f 100644 --- a/Engine/Resource/cas_codec.cpp +++ b/Engine/Resource/cas_codec.cpp @@ -1,4 +1,5 @@ #include "cas_codec.h" +#include "Engine/Core/Platform/path_text.h" #ifdef _WIN32 #include @@ -68,7 +69,7 @@ HMODULE oodle(const std::filesystem::path& gameRoot) { std::ranges::sort(matches); handle = LoadLibraryExW(matches.back().c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); - if (!handle) throw std::runtime_error("Cannot load " + matches.back().string() + + if (!handle) throw std::runtime_error("Cannot load " + path_utf8(matches.back()) + " (Windows error " + std::to_string(GetLastError()) + ")"); return handle; } diff --git a/Extension/Assets/live_mods.cpp b/Extension/Assets/live_mods.cpp index 33accd7..f58dfcd 100644 --- a/Extension/Assets/live_mods.cpp +++ b/Extension/Assets/live_mods.cpp @@ -5,6 +5,7 @@ #include "Engine/Game/Build/20260929/engine.h" #include "Engine/Game/World/custom_level_manifest.h" #include "Engine/Core/Platform/memory.h" +#include "Engine/Core/Platform/path_text.h" #include "Engine/Game/Build/20260929/live_mods.h" #include "Engine/Game/Build/addresses.h" #include "Engine/Vfs/mod_catalog.h" @@ -211,7 +212,7 @@ bool refresh_toc(const std::string &superbundle, const std::filesystem::path &fi std::ifstream in(file, std::ios::binary); std::vector bytes((std::istreambuf_iterator(in)), std::istreambuf_iterator()); if (bytes.size() <= native::toc_header + 4) { - problem = file.filename().string() + " could not be read"; + problem = path_utf8(file.filename()) + " could not be read"; return false; } const auto base = reinterpret_cast(GetModuleHandleW(nullptr)); diff --git a/Extension/Objects/ParkEditor/park_mods.cpp b/Extension/Objects/ParkEditor/park_mods.cpp index caa5adb..a8207dc 100644 --- a/Extension/Objects/ParkEditor/park_mods.cpp +++ b/Extension/Objects/ParkEditor/park_mods.cpp @@ -2,6 +2,7 @@ #include "Engine/Vfs/mod_list.h" #include "Engine/Core/Json/json.h" +#include "Engine/Core/Platform/path_text.h" #include @@ -46,23 +47,23 @@ void write_atomically(const fs::path &path, const std::string &text) { stream.write(text.data(), static_cast(text.size())); stream.flush(); if (!stream) - throw std::runtime_error("Could not write " + path.filename().string() + ". The previous copy was kept."); + throw std::runtime_error("Could not write " + path_utf8(path.filename()) + ". The previous copy was kept."); } if (!MoveFileExW(temporary.c_str(), path.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) - throw std::runtime_error("Could not replace " + path.filename().string() + ". The previous copy was kept."); + throw std::runtime_error("Could not replace " + path_utf8(path.filename()) + ". The previous copy was kept."); } std::string read_file(const fs::path &path, std::size_t limit) { std::error_code error; const auto size = fs::file_size(path, error); if (error) - throw std::runtime_error("Could not open " + path.filename().string() + "."); + throw std::runtime_error("Could not open " + path_utf8(path.filename()) + "."); if (size > limit) - throw std::runtime_error(path.filename().string() + " is too large."); + throw std::runtime_error(path_utf8(path.filename()) + " is too large."); std::ifstream stream(path, std::ios::binary); std::string text(static_cast(size), '\0'); if (!stream.read(text.data(), static_cast(text.size()))) - throw std::runtime_error("Could not read " + path.filename().string() + "."); + throw std::runtime_error("Could not read " + path_utf8(path.filename()) + "."); return text; } diff --git a/Extension/Trainer/trainer.cpp b/Extension/Trainer/trainer.cpp index 26c2487..c67aabd 100644 --- a/Extension/Trainer/trainer.cpp +++ b/Extension/Trainer/trainer.cpp @@ -5,6 +5,7 @@ #include "trainer_session.h" #include "Engine/Core/Json/json.h" #include "Engine/Core/Log/logging.h" +#include "Engine/Core/Platform/path_text.h" #include "Engine/Game/Build/addresses.h" #include "Engine/Game/Build/20260929/no_bail.h" #include "Engine/Game/Build/20260929/physics_tuning.h" @@ -1706,7 +1707,7 @@ std::string run(std::string_view verb, const std::vector &a) { file << std::format("{}\t0x{:x}\t{}\t{:.6g}\t{:.6g}\n", e.id, e.offset, e.kind == Kind::real ? "real" : e.kind == Kind::flag ? "flag" : e.kind == Kind::curve ? "curve" : e.kind == Kind::graph ? "graph" : "int", e.stock, e.value); - return std::format("Wrote {} values to {}.", s.entries.size(), (directory / L"tuning-values.txt").string()); + return std::format("Wrote {} values to {}.", s.entries.size(), path_utf8(directory / L"tuning-values.txt")); } if (v == "selftest") { if (s.test.step) return "The self test is already running."; diff --git a/Extension/UI/NativeMenu/native_menu_dump.cpp b/Extension/UI/NativeMenu/native_menu_dump.cpp index 18d5945..de3d0b9 100644 --- a/Extension/UI/NativeMenu/native_menu_dump.cpp +++ b/Extension/UI/NativeMenu/native_menu_dump.cpp @@ -1,6 +1,7 @@ #include "native_menu_dump.h" #include "native_menu_data.h" #include "Engine/Core/Log/logging.h" +#include "Engine/Core/Platform/path_text.h" #include "Engine/Game/Abi/native_data.h" #include "Engine/Game/Build/addresses.h" #include "Engine/Game/Build/20260929/engine.h" @@ -225,7 +226,7 @@ void run_pending_ui_dump(std::uintptr_t base) noexcept { if (text.empty()) text = "asset " + name + " is not loaded in any domain\n"; const auto path = dump_path("asset", GetTickCount64()); std::ofstream(path, std::ios::trunc) << text; - logging::log(logging::Level::info, logging::Channel::ui, "UI dump: asset {} written to {}.", name, path.string()); + logging::log(logging::Level::info, logging::Channel::ui, "UI dump: asset {} written to {}.", name, path_utf8(path)); return; } std::uint32_t only_schema{}; @@ -255,7 +256,7 @@ void run_pending_ui_dump(std::uintptr_t base) noexcept { out << "roots " << roots << ", written " << written << ", filter " << (what.empty() ? "all" : what) << "\n" << text; logging::log(logging::Level::info, logging::Channel::ui, - "UI dump: {} of {} roots written to {}.", written, roots, path.string()); + "UI dump: {} of {} roots written to {}.", written, roots, path_utf8(path)); } catch (const std::exception& error) { logging::log(logging::Level::warning, logging::Channel::ui, "UI dump failed: {}.", error.what()); } diff --git a/Extension/UI/Overlay/perf_overlay.cpp b/Extension/UI/Overlay/perf_overlay.cpp index 6ff2934..57ca680 100644 --- a/Extension/UI/Overlay/perf_overlay.cpp +++ b/Extension/UI/Overlay/perf_overlay.cpp @@ -1,6 +1,7 @@ #include "overlay_internal.h" #include "skate_style.h" #include "Engine/Core/Profiling/profiler.h" +#include "Engine/Core/Platform/path_text.h" #include #include @@ -251,7 +252,7 @@ void draw_perf_window() { for (const auto& thread : report->threads) ImGui::TextDisabled(" %5.1f%% thread %u %s", thread.cpu_percent, thread.id, thread.label.c_str()); if (!report->error.empty()) ImGui::TextColored(ImColor(skate::danger), "%s", report->error.c_str()); - const auto report_path = report->report.string(), folded_path = report->folded.string(); + const auto report_path = path_utf8(report->report), folded_path = path_utf8(report->folded); ImGui::TextDisabled("Report: %s", report_path.c_str()); ImGui::SameLine(); if (ImGui::SmallButton("Copy##report")) ImGui::SetClipboardText(report_path.c_str());