Description:
|
When something goes wrong during Crawl's initialization, typically the error is handled gracefully with Crawl printing an error message and prompting for input before exit. However, under Windows, no text is output to the console. On my Windows test machine (Vista x64) this error message and prompt is not displayed, although pressing enter will cause crawl to exit. Even after setting the console's current codepage to UTF-8, no output appears.
C:\%CRAWL%>chcp
Active code page: 437
C:\%CRAWL%>chcp 65001
Active code page: 65001
For example, moving the contents of %CRAWL%\data\des causes the following error to be printed to the console after starting Crawl:
C:\%CRAWL%>crawl.exe
Cannot find data file 'des/sprint/meat.des' anywhere, aborting
Hit Enter to continue...
This is a big issue, as Windows users cannot report many startup issues they encounter. Instead, the best report a Windows user can give is, "Well, after I start Crawl the window leaves a blinking cursor until I hit enter".
Commenting out lines 273-274 from source/main.cc (or removing the whole block from 262-275) allows these stdout/stderr messages to appear.
262 #ifdef TARGET_OS_WINDOWS
263 // No documentation about resetting this, nor about which versions of
264 // Windows is required. Previous ones can't handle writing to the console
265 // outside ancient locales AT ALL via standard means.
266 // Even with _O_U8TEXT, output tends to fail unless the user manually
267 // switches the terminal to a truetype font. And even that fails for
268 // anything not directly in the font, above U+FFFF, or within Arabic or
269 // any complex scripts.
270 # ifndef _O_U8TEXT
271 # define _O_U8TEXT 0x40000
272 # endif
273 _setmode(_fileno(stdout), _O_U8TEXT);
274 _setmode(_fileno(stderr), _O_U8TEXT);
275 #endif
This issue affects the current windows trunk builds posted on CDO, as well as my personal builds using the i686-w64-mingw32 toolchain. I have not tested a build compiled with MSVC. Removing these stdout/stderr mode sets does not seem to affect the crawl console gameplay, although I've only tested against Vista x64. Unicode console mode still works fine, for example, as Crawl's console mode implementation in source/libwin32c.cc uses the Windows Console API.
For more reading: http://alfps.wordpress.com/2011/11/22/unicode-part-1-windows-console-io-approaches/ [^]
|