Wikia

Wikihack

W343-3

2,032pages on
this wiki
Talk2
W343-3 designates a bug that affects the Microsoft Windows version of NetHack 3.4.3. The DevTeam lists this bug as fixed in the next release. The bug is listed as:

Under the Polish version of Windows 2000 SP4, screen output with a raster font shows wrong characters for many dungeon features

Win32 locales fix
Author Ray Chason
Download link
Bilious PatchDB 313

Nature of the bug Edit

The bug has been reported on Polish and Russian editions of Windows 2000 and on a Czech version of Windows XP. It has been reproduced on an American Windows XP by changing a language setting. A screenshot is available.

Bug W343-3 really comprises two distinct and unrelated bugs. One is a simple character set issue: many non-USA PCs are configured with different character sets, and seven symbols may look different. This issue is more fully detailed in the IBMgraphics article.

The more serious bug is that some characters appear as strange symbols or blank squares. This is not actually a bug in NetHack, but in Windows. The rest of this article will deal with this bug.

Cause of the bug Edit

The bug is a flaw in the Windows WriteConsoleOutputCharacterA API. When its configured code page is other than 437 or 850, many non-ASCII characters can show up incorrectly.

The bug occurs when four conditions are met:

  • The version of Windows is Windows NT or one of its descendants. The bug is confirmed to exist on Windows 2000, Windows XP, and Windows Vista.
  • A bitmap font, rather than Lucida Console, is selected.
  • The command shell is running in a window, rather than full screen.
  • The language for non-Unicode programs is set to one whose OEM code page is anything other than 437 or 850. Basically this means any East European language, whether it uses Greek, Cyrillic or Latin writing.

No API other than WriteConsoleOutputCharacterA is known to be affected. In particular, the Unicode variant WriteConsoleOutputCharacterW works correctly.

Versions affected Edit

NetHack 3.4.3 is known to have this bug. Because NetHack 3.1.1 through 3.1.3 also use the flawed API, it is likely that they have it as well. NetHack 3.2.0 through 3.4.2 use different APIs, and do not have this bug.

Patch Edit

A patch is available to fix this bug; but no binaries or variants other than Spanish NetHack are known to incorporate it.

The patch fixes the API issue by detecting when it is running on an NT-based version of Windows, and using the Unicode API instead, avoiding the Windows bug. It fixes the character set issue as well (see IBMgraphics) by allowing less-extensive variants of IBMgraphics to be set, avoiding the characters that can vary among code pages.

The patch was posted to rec.games.roguelike.nethack as four articles:

  • Part 1 describes the API issue and provides detailed instructions to duplicate it, and a small test program to demonstrate the bug.
  • Part 2 describes the character set issue.
  • Part 3 contains the patch itself.
  • Part 4 is a description of each change the patch makes.

The Bilious Patch Database has a simpler form of this patch, that works around the faulty API but does not alter the IBMgraphics, here. This patch also fixes W343-4.

Around Wikia's network

Random Wiki