diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 71e5028c..429bd899 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -906,3 +906,6 @@ ConsoleWindow=0 ;Console window position and size data. Do not modify ConsoleWindowData= + +;Set the code page for the console window (Default is your system code page) +ConsoleCodePage=0 diff --git a/sfall/Logging.cpp b/sfall/Logging.cpp index 8ee69fd2..af029916 100644 --- a/sfall/Logging.cpp +++ b/sfall/Logging.cpp @@ -46,6 +46,7 @@ public: static constexpr char* IniSection = "Debugging"; static constexpr char* IniModeKey = "ConsoleWindow"; static constexpr char* IniPositionKey = "ConsoleWindowData"; + static constexpr char* IniCodePageKey = "ConsoleCodePage"; static ConsoleWindow& instance() { return _instance; } @@ -137,6 +138,9 @@ void ConsoleWindow::init() { dlog_f("Failed to allocate console: 0x%x\n", DL_MAIN, GetLastError()); return; } + int cp = IniReader::GetIntDefaultConfig(IniSection, IniCodePageKey, 0); + if (cp > 0) SetConsoleOutputCP(cp); + freopen("CONOUT$", "w", stdout); // this allows to print to console via std::cout if (_mode & ConsoleSource::GAME) {