diff options
| author | Doffi4 <206447286+Doffi4@users.noreply.github.com> | 2026-11-22 22:02:32 +0200 |
|---|---|---|
| committer | Doffi4 <206447286+Doffi4@users.noreply.github.com> | 2026-11-22 22:02:32 +0200 |
| commit | 35afd618e5f58f13012432ad2fc15b1ba9ed7d40 (patch) | |
| tree | 0b225a552cf44fb21f42f49c21a10446dee8af6e /runtime/src/main.cpp | |
| parent | 162821017ea3c286c8bec860f3ff94f037912061 (diff) | |
Runtime: preserve Unicode in the console path diagnostic
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 06baae387..6229ad210 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -129,7 +129,22 @@ int wmain(int argc, wchar_t** argv) { | |||
| 129 | return 1; | 129 | return 1; |
| 130 | } | 130 | } |
| 131 | rt::process::set_command_line(image.filename().wstring(), game_args); | 131 | rt::process::set_command_line(image.filename().wstring(), game_args); |
| 132 | std::printf("console paths: GAME: -> %ls, writes -> %ls\n", game_dir.c_str(), overlay_dir.c_str()); | 132 | const std::wstring paths = L"console paths: GAME: -> " + game_dir.native() + L", writes -> " + overlay_dir.native(); |
| 133 | const HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); | ||
| 134 | DWORD mode; | ||
| 135 | bool printed = false; | ||
| 136 | if (GetConsoleMode(out, &mode)) { | ||
| 137 | std::fflush(stdout); | ||
| 138 | const std::wstring line = paths + L"\r\n"; | ||
| 139 | DWORD written; | ||
| 140 | printed = WriteConsoleW(out, line.data(), static_cast<DWORD>(line.size()), &written, nullptr) != FALSE; | ||
| 141 | } | ||
| 142 | if (!printed) { | ||
| 143 | const auto game = game_dir.u8string(); | ||
| 144 | const auto overlay = overlay_dir.u8string(); | ||
| 145 | std::printf("console paths: GAME: -> %s, writes -> %s\n", | ||
| 146 | reinterpret_cast<const char*>(game.c_str()), reinterpret_cast<const char*>(overlay.c_str())); | ||
| 147 | } | ||
| 133 | std::printf("running %s\n", main_module.name.c_str()); | 148 | std::printf("running %s\n", main_module.name.c_str()); |
| 134 | std::fflush(stdout); | 149 | std::fflush(stdout); |
| 135 | const int code = rt::process::run_entry(main_module.base + main_module.entry_rva); | 150 | const int code = rt::process::run_entry(main_module.base + main_module.entry_rva); |